#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*/ f1(int **);
int /*<<< orphan*/ f2(int **);
int /*<<< orphan*/ printf(char *, int, int);
void main() {
  int *p = 0;
  int val = 5;
  int i = 0;
  int array_1[10];
  for (i = 0; i < 10; i++) {
    array_1[i] = 0;
    printf("array_1 [ %d ] = %d;\n", i, array_1[i]);
  };
  p = array_1;
  f1(&array_1);
  for (i = 0; i < 10; i++) {
    printf("stack [ %d ] = %d;\n", i, array_1[i]);
  };
  f2(&array_1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movq   $0x0,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    1190 <main+0x60>
movslq -0x10(%rbp),%rax
movl   $0x0,-0x40(%rbp,%rax,4)
mov    -0x10(%rbp),%esi
movslq -0x10(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1155 <main+0x25>
lea    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
call   1050 <f1@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    11d7 <main+0xa7>
mov    -0x10(%rbp),%esi
movslq -0x10(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xe52(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11a8 <main+0x78>
lea    -0x40(%rbp),%rdi
call   1030 <f2@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xed2(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %edx,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %edx,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %edx,%edx
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %edx,%edx
call   1040 <printf@plt>
movl   $0x0,0x20(%rsp)
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %edx,%edx
call   1040 <printf@plt>
movl   $0x0,0x24(%rsp)
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %edx,%edx
call   1040 <printf@plt>
mov    %rsp,%r14
mov    %r14,%rdi
call   1050 <f1@plt>
mov    (%rsp),%edx
lea    0xe21(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <printf@plt>
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <printf@plt>
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <f2@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"array_1 [ %d ] = %d;\0A\00"
@.str.1 = [20 x i8] c"stack [ %d ] = %d;\0A\00"
define void @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 0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 1, i32 0)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%8 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 2, i32 0)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%10 = bitcast [10 x i32]* %1 to <4 x i32>*
store <4 x i32> zeroinitializer, <4 x i32>* %10
%11 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 3, i32 0)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%13 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 4, i32 0)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%15 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 5, i32 0)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%17 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 6, i32 0)
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%19 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> zeroinitializer, <4 x i32>* %19
%20 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 7, i32 0)
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
store i32 0, i32* %21
%22 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 8, i32 0)
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
store i32 0, i32* %23
%24 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 9, i32 0)
%25 = bitcast [10 x i32]* %1 to i32**
%26 = call i32 @f1(i32** %25)
%27 = load i32, i32* %3
%28 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %27)
%29 = load i32, i32* %5
%30 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %29)
%31 = load i32, i32* %7
%32 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %31)
%33 = load i32, i32* %9
%34 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %33)
%35 = load i32, i32* %12
%36 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %35)
%37 = load i32, i32* %14
%38 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 %37)
%39 = load i32, i32* %16
%40 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %39)
%41 = load i32, i32* %18
%42 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %41)
%43 = load i32, i32* %21
%44 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 %43)
%45 = load i32, i32* %23
%46 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 9, i32 %45)
%47 = call i32 @f2(i32** %25)
ret void
}