#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 /*<<< orphan*/);
int main() {
  int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, *p;
  for (p = a; p < a + 10; printf("%3d", *p++))
    ;
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
lea    -0x30(%rbp),%rcx
add    $0x28,%rcx
cmp    %rcx,%rax
jae    1198 <main+0x68>
jmp    1176 <main+0x46>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x38(%rbp)
mov    (%rax),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
jmp    115c <main+0x2c>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    0xef0(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x28(%rsp),%r14
lea    0x4(%rsp),%rbx
lea    0xecb(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%esi
add    $0x4,%rbx
mov    %r15,%rdi
call   1030 <printf@plt>
cmp    %r14,%rbx
jb     1170 <main+0x50>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@.str = [4 x i8] c"%3d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32*
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %2 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32* %5, i32** %3
br label %6
6: ; preds = %12, %0
%7 = load i32*, i32** %3
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = getelementptr inbounds i32, i32* %8, i64 10
%10 = icmp ult i32* %7, %9
br i1 %10, label %11, label %17
11: ; preds = %6
br label %12
12: ; preds = %11
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %3
%15 = load i32, i32* %13
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %6
17: ; preds = %6
%18 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@.str = [4 x i8] c"%3d\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 10
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
br label %6
6: ; preds = %0, %6
%7 = phi i32* [ %4, %0 ], [ %9, %6 ]
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %7, i64 1
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%11 = icmp ult i32* %9, %3
br i1 %11, label %6, label %12
12: ; preds = %6
%13 = call i32 (...) @getchar()
ret i32 0
}