#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*/ indirect(int);
int /*<<< orphan*/ indirect2(int *);
int /*<<< orphan*/ print_int(int);
int /*<<< orphan*/ print_string(char *);
void main(void) {
  int myInt;
  int intArr[3];
  intArr[0] = 999;
  intArr[1] = 100;
  intArr[2] = 200;
  myInt = intArr[1];
  print_string("should get 100\ngot: ");
  print_int(myInt);
  print_string("\n\n");
  indirect(intArr[1]);
  indirect2(intArr);
  print_string("should get 100\ngot: ");
  print_int(intArr[1]);
  print_string("\n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3e7,-0x10(%rbp)
movl   $0x64,-0xc(%rbp)
movl   $0xc8,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
lea    0xe96(%rip),%rdi
call   1030 <print_string@plt>
mov    -0x4(%rbp),%edi
call   1050 <print_int@plt>
lea    0xe97(%rip),%rdi
call   1030 <print_string@plt>
mov    -0xc(%rbp),%edi
call   1060 <indirect@plt>
lea    -0x10(%rbp),%rdi
call   1040 <indirect2@plt>
lea    0xe65(%rip),%rdi
call   1030 <print_string@plt>
mov    -0xc(%rbp),%edi
call   1050 <print_int@plt>
lea    0xe66(%rip),%rdi
call   1030 <print_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x64000003e7,%rax
mov    %rax,0xc(%rsp)
movl   $0xc8,0x14(%rsp)
lea    0xe9b(%rip),%r14
mov    %r14,%rdi
call   1030 <print_string@plt>
mov    $0x64,%edi
call   1050 <print_int@plt>
lea    0xe97(%rip),%rbx
mov    %rbx,%rdi
call   1030 <print_string@plt>
mov    $0x64,%edi
call   1060 <indirect@plt>
lea    0xc(%rsp),%rdi
call   1040 <indirect2@plt>
mov    %r14,%rdi
call   1030 <print_string@plt>
mov    0x10(%rsp),%edi
call   1050 <print_int@plt>
mov    %rbx,%rdi
call   1030 <print_string@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [21 x i8] c"should get 100\0Agot: \00"
@.str.1 = [3 x i8] c"\0A\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32 999, i32* %3
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
store i32 100, i32* %4
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
store i32 200, i32* %5
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%7 = load i32, i32* %6
store i32 %7, i32* %1
%8 = call i32 @print_string(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %1
%10 = call i32 @print_int(i32 %9)
%11 = call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%13 = load i32, i32* %12
%14 = call i32 @indirect(i32 %13)
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%16 = call i32 @indirect2(i32* %15)
%17 = call i32 @print_string(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
%19 = load i32, i32* %18
%20 = call i32 @print_int(i32 %19)
%21 = call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"should get 100\0Agot: \00"
@.str.1 = [3 x i8] c"\0A\0A\00"
define void @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
store i32 999, i32* %3
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
store i32 100, i32* %4
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
store i32 200, i32* %5
%6 = tail call i32 @print_string(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @print_int(i32 100)
%8 = tail call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @indirect(i32 100)
%10 = call i32 @indirect2(i32* %3)
%11 = call i32 @print_string(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %4
%13 = call i32 @print_int(i32 %12)
%14 = call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}