int main() {
  short int array[] = {2, 3, 5, 7, 9};
  int *pa;
  int x;
  for (x = 0; x < 5; x++) {
    pa = &array[x];
    printf("array[%d] at %p = %d\n", x, pa, array[x]);
  }
  putchar('\n');
  pa = &array;
  for (x = 0; x < 5; x++) {
    printf("array[%d] at %p\n", x, pa);
    pa++;
  }
  exit(1527);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xeb7(%rip),%ax
mov    %ax,-0x6(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    11a5 <main+0x75>
movslq -0x1c(%rbp),%rcx
lea    -0xe(%rbp),%rax
shl    $0x1,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
movslq -0x1c(%rbp),%rax
movswl -0xe(%rbp,%rax,2),%ecx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115c <main+0x2c>
mov    $0xa,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
lea    -0xe(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    11f9 <main+0xc9>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c0 <main+0x90>
mov    $0x5f7,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movzwl 0xec6(%rip),%eax
mov    %ax,0x10(%rsp)
mov    0xeb2(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%r14
lea    0xeab(%rip),%rbx
lea    0x8(%rsp),%r15
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r15,%rdx
mov    $0x2,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xa(%rsp),%rdx
movswl 0xa(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%r12
movswl 0xc(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe(%rsp),%rdx
movswl 0xe(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movswl 0x10(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
lea    0xe30(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x5f7,%edi
call   1050 <exit@plt>

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 i32*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [5 x i16]* %2 to i8*
store i32 0, i32* %4
br label %6
6: ; preds = %22, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 5
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [5 x i16], [5 x i16]* %2, i64 0, i64 %11
%13 = bitcast i16* %12 to i32*
store i32* %13, i32** %3
%14 = load i32, i32* %4
%15 = load i32*, i32** %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x i16], [5 x i16]* %2, i64 0, i64 %17
%19 = load i16, i16* %18
%20 = sext i16 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %14, i32* %15, i32 %20)
br label %22
22: ; preds = %9
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %6
25: ; preds = %6
%26 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%27 = bitcast [5 x i16]* %2 to i32*
store i32* %27, i32** %3
store i32 0, i32* %4
br label %28
28: ; preds = %37, %25
%29 = load i32, i32* %4
%30 = icmp slt i32 %29, 5
br i1 %30, label %31, label %40
31: ; preds = %28
%32 = load i32, i32* %4
%33 = load i32*, i32** %3
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %32, i32* %33)
%35 = load i32*, i32** %3
%36 = getelementptr inbounds i32, i32* %35, i32 1
store i32* %36, i32** %3
br label %37
37: ; preds = %31
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %28
40: ; preds = %28
unreachable
}

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*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 0, i16* %3, i32 2)
%5 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 1
%6 = load i16, i16* %5
%7 = sext i16 %6 to i32
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 1, i16* %5, i32 %7)
%9 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 2
%10 = load i16, i16* %9
%11 = sext i16 %10 to i32
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 2, i16* %9, i32 %11)
%13 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 3
%14 = load i16, i16* %13
%15 = sext i16 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 3, i16* %13, i32 %15)
%17 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 4
%18 = load i16, i16* %17
%19 = sext i16 %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 4, i16* %17, i32 %19)
%21 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 0, [5 x i16]* %1)
%23 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 2
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 1, i16* %23)
%25 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 4
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 2, i16* %25)
%27 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 6
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 3, i16* %27)
%29 = getelementptr inbounds [5 x i16], [5 x i16]* %1, i64 0, i64 8
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 4, i16* %29)
unreachable
}