#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 */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int arr[2] = {0, 1};
  int i = 10;
  arr[2] = 20;
  printf("element 0:%d\t\n", arr[0]);
  printf("element 1:%d\t\n", arr[1]);
  printf("element 2:%d\t\n", arr[2]);
  printf("i:%d\t\t\n", i);
  printf("array size:%d\t\n", sizeof(arr) / sizeof(int));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
movl   $0x14,0x0(%rbp)
mov    -0x8(%rbp),%esi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    0x0(%rbp),%esi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.arr = [2 x i32] [i32 0, i32 1]
@.str = [15 x i8] c"element 0:%d\09\0A\00"
@.str.1 = [15 x i8] c"element 1:%d\09\0A\00"
@.str.2 = [15 x i8] c"element 2:%d\09\0A\00"
@.str.3 = [8 x i8] c"i:%d\09\09\0A\00"
@.str.4 = [16 x i8] c"array size:%d\09\0A\00"
define i32 @main() {
%1 = alloca [2 x i32]
%2 = alloca i32
%3 = bitcast [2 x i32]* %1 to i8*
store i32 10, i32* %2
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 2
store i32 20, i32* %4
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%6 = load i32, i32* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 2
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 2)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"element 0:%d\09\0A\00"
@.str.1 = [15 x i8] c"element 1:%d\09\0A\00"
@.str.2 = [15 x i8] c"element 2:%d\09\0A\00"
@.str.3 = [8 x i8] c"i:%d\09\09\0A\00"
@.str.4 = [16 x i8] c"array size:%d\09\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 poison)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 10)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 2)
ret i32 0
}