#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, int, short *, ...);
int main(void) {
  short int array[] = {2, 3, 5, 7, 9};
  short int *pa;
  int x;
  pa = array;
  for (x = 0; x < 5; x++) {
    printf("array[%d] at %p = %d\n", x, pa, *pa);
    printf("array[%d] at %p\n", x, pa);
    pa++;
  }
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xec7(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xe(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    11a9 <main+0x89>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%rax
movswl (%rax),%ecx
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1154 <main+0x34>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movzwl 0xed6(%rip),%eax
mov    %ax,0x10(%rsp)
mov    0xec2(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%r14
lea    0xebb(%rip),%r15
lea    0x8(%rsp),%rbx
mov    %r15,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
mov    $0x2,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb1(%rip),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xa(%rsp),%rbx
movswl 0xa(%rsp),%ecx
mov    %r15,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rbx
movswl 0xc(%rsp),%ecx
mov    %r15,%rdi
mov    $0x2,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x2,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe(%rsp),%rbx
movswl 0xe(%rsp),%ecx
mov    %r15,%rdi
mov    $0x3,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x3,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
movswl 0x10(%rsp),%ecx
mov    %r15,%rdi
mov    $0x4,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    $0x4,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.array = [5 x i16] [i16 2, i16 3, i16 5, i16 7, i16 9]
@.str = [22 x i8] c"array[%d] at %p = %d\0A\00"
@.str.1 = [17 x i8] c"array[%d] at %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i16]
%3 = alloca i16*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [5 x i16]* %2 to i8*
%6 = getelementptr inbounds [5 x i16], [5 x i16]* %2, i64 0, i64 0
store i16* %6, i16** %3
store i32 0, i32* %4
br label %7
7: ; preds = %22, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %25
10: ; preds = %7
%11 = load i32, i32* %4
%12 = load i16*, i16** %3
%13 = load i16*, i16** %3
%14 = load i16, i16* %13
%15 = sext i16 %14 to i32
%16 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %11, i16* %12, i32 %15)
%17 = load i32, i32* %4
%18 = load i16*, i16** %3
%19 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %17, i16* %18)
%20 = load i16*, i16** %3
%21 = getelementptr inbounds i16, i16* %20, i32 1
store i16* %21, i16** %3
br label %22
22: ; preds = %10
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %7
25: ; preds = %7
%26 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [5 x i16] [i16 2, i16 3, i16 5, i16 7, i16 9]
@.str = [22 x i8] c"array[%d] at %p = %d\0A\00"
@.str.1 = [17 x i8] c"array[%d] at %p\0A\00"
define i32 @main() {
%1 = alloca [5 x i16]
%2 = bitcast [5 x i16]* %1 to i8*
%3 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 0
%4 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 0, i16* %3, i32 2)
%5 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 0, i16* %3)
%6 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 1
%7 = load i16, i16* %6
%8 = sext i16 %7 to i32
%9 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 1, i16* %6, i32 %8)
%10 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 1, i16* %6)
%11 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 2
%12 = load i16, i16* %11
%13 = sext i16 %12 to i32
%14 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 2, i16* %11, i32 %13)
%15 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 2, i16* %11)
%16 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 3
%17 = load i16, i16* %16
%18 = sext i16 %17 to i32
%19 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 3, i16* %16, i32 %18)
%20 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 3, i16* %16)
%21 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 4
%22 = load i16, i16* %21
%23 = sext i16 %22 to i32
%24 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 4, i16* %21, i32 %23)
%25 = call i32 (i8*, i32, i16*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 4, i16* %21)
%26 = call i32 (...) @getchar()
ret i32 0
}