#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*/ printf(char *, int, int);
int main() {
  int a[5];
  a[0] = 42;
  a[1] = 10;
  a[2] = 10 - (5 + 6);
  a[3] = a[0] + a[1];
  a[4] = 999;
  for (int i = 0; i < 5; ++i) {
    a[i] = i * i;
  }
  for (int i = 0; i < 5; ++i) {
    printf("a[%d] = %d\n", i, a[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2a,-0x20(%rbp)
movl   $0xa,-0x1c(%rbp)
movl   $0xffffffff,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x3e7,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1172 <main+0x62>
mov    -0x24(%rbp),%ecx
imul   -0x24(%rbp),%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114b <main+0x3b>
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    11a8 <main+0x98>
mov    -0x28(%rbp),%esi
movslq -0x28(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1179 <main+0x69>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x4,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x9,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x10,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"a[%d] = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
store i32 42, i32* %5
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 1
store i32 10, i32* %6
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
store i32 -1, i32* %7
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %8
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 1
%11 = load i32, i32* %10
%12 = add nsw i32 %9, %11
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 3
store i32 %12, i32* %13
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 4
store i32 999, i32* %14
store i32 0, i32* %3
br label %15
15: ; preds = %25, %0
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 5
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = load i32, i32* %3
%20 = load i32, i32* %3
%21 = mul nsw i32 %19, %20
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %23
store i32 %21, i32* %24
br label %25
25: ; preds = %18
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %15
28: ; preds = %15
store i32 0, i32* %4
br label %29
29: ; preds = %39, %28
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 5
br i1 %31, label %32, label %42
32: ; preds = %29
%33 = load i32, i32* %4
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %33, i32 %37)
br label %39
39: ; preds = %32
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %29
42: ; preds = %29
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"a[%d] = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1, i32 1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2, i32 4)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 3, i32 9)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 4, i32 16)
ret i32 0
}