#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 foo(int);
int func1(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
int sum(int);
int test_div(int);
int test_for(int);
int test_if(int);
int test_log_and(int);
int test_mul(int);
int main(int argc, char *argv[]) {
  for (int i = 0; i < 10; ++i) {
    printf("func1(%d) = %d\n", i, func1(i, 0));
  }
  for (int i = -4; i < 5; ++i) {
    printf("test_if(%d) = %d\n", i, test_if(i));
  }
  printf("test_for(%d) = %d\n", 10, test_for(10));
  printf("sum(%d) = %d\n", 10, sum(10));
  printf("test_mul(%d) = %d\n", 10, test_mul(10));
  printf("test_div(%d) = %d\n", 1, test_div(1));
  printf("test_log_and(%d) = %d\n", 1, test_log_and(1));
  printf("foo(%d) = %d\n", 2, foo(2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11e6 <main+0x56>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1040 <func1@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe2d(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ad <main+0x1d>
movl   $0xfffffffc,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jge    1224 <main+0x94>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
call   1080 <test_if@plt>
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xdff(%rip),%rdi
call   1060 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ed <main+0x5d>
mov    $0xa,%edi
call   1070 <test_for@plt>
mov    %eax,%edx
lea    0xdeb(%rip),%rdi
mov    $0xa,%esi
call   1060 <printf@plt>
mov    $0xa,%edi
call   1090 <sum@plt>
mov    %eax,%edx
lea    0xde1(%rip),%rdi
mov    $0xa,%esi
call   1060 <printf@plt>
mov    $0xa,%edi
call   1050 <test_mul@plt>
mov    %eax,%edx
lea    0xdd2(%rip),%rdi
mov    $0xa,%esi
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <test_div@plt>
mov    %eax,%edx
lea    0xdc8(%rip),%rdi
mov    $0x1,%esi
call   1060 <printf@plt>
mov    $0x1,%edi
call   1030 <test_log_and@plt>
mov    %eax,%edx
lea    0xdbe(%rip),%rdi
mov    $0x1,%esi
call   1060 <printf@plt>
mov    $0x2,%edi
call   10a0 <foo@plt>
mov    %eax,%edx
lea    0xdb8(%rip),%rdi
mov    $0x2,%esi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <func1@plt>
lea    0xe5f(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <func1@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1040 <func1@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   1040 <func1@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <func1@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1040 <func1@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x6,%edi
xor    %esi,%esi
call   1040 <func1@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x7,%edi
xor    %esi,%esi
call   1040 <func1@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x8,%edi
xor    %esi,%esi
call   1040 <func1@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x9,%edi
xor    %esi,%esi
call   1040 <func1@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0xfffffffc,%edi
call   1080 <test_if@plt>
lea    0xd5f(%rip),%rbx
mov    %rbx,%rdi
mov    $0xfffffffc,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0xfffffffd,%edi
call   1080 <test_if@plt>
mov    %rbx,%rdi
mov    $0xfffffffd,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0xfffffffe,%edi
call   1080 <test_if@plt>
mov    %rbx,%rdi
mov    $0xfffffffe,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <test_if@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    %eax,%edx
call   1060 <printf@plt>
xor    %edi,%edi
call   1080 <test_if@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x1,%edi
call   1080 <test_if@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x2,%edi
call   1080 <test_if@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x3,%edi
call   1080 <test_if@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x4,%edi
call   1080 <test_if@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0xa,%edi
call   1070 <test_for@plt>
lea    0xc8f(%rip),%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0xa,%edi
call   1090 <sum@plt>
lea    0xc85(%rip),%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0xa,%edi
call   1050 <test_mul@plt>
lea    0xc76(%rip),%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x1,%edi
call   10b0 <test_div@plt>
lea    0xc6c(%rip),%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x1,%edi
call   1030 <test_log_and@plt>
lea    0xc62(%rip),%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1060 <printf@plt>
mov    $0x2,%edi
call   10a0 <foo@plt>
lea    0xc5c(%rip),%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"func1(%d) = %d\0A\00"
@.str.1 = [18 x i8] c"test_if(%d) = %d\0A\00"
@.str.2 = [19 x i8] c"test_for(%d) = %d\0A\00"
@.str.3 = [14 x i8] c"sum(%d) = %d\0A\00"
@.str.4 = [19 x i8] c"test_mul(%d) = %d\0A\00"
@.str.5 = [19 x i8] c"test_div(%d) = %d\0A\00"
@.str.6 = [23 x i8] c"test_log_and(%d) = %d\0A\00"
@.str.7 = [14 x i8] c"foo(%d) = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @func1(i32 0, i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0, i32 %3)
%5 = tail call i32 @func1(i32 1, i32 0)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1, i32 %5)
%7 = tail call i32 @func1(i32 2, i32 0)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 2, i32 %7)
%9 = tail call i32 @func1(i32 3, i32 0)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 3, i32 %9)
%11 = tail call i32 @func1(i32 4, i32 0)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4, i32 %11)
%13 = tail call i32 @func1(i32 5, i32 0)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 5, i32 %13)
%15 = tail call i32 @func1(i32 6, i32 0)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 6, i32 %15)
%17 = tail call i32 @func1(i32 7, i32 0)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 7, i32 %17)
%19 = tail call i32 @func1(i32 8, i32 0)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 8, i32 %19)
%21 = tail call i32 @func1(i32 9, i32 0)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 9, i32 %21)
%23 = tail call i32 @test_if(i32 -4)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 -4, i32 %23)
%25 = tail call i32 @test_if(i32 -3)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 -3, i32 %25)
%27 = tail call i32 @test_if(i32 -2)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 -2, i32 %27)
%29 = tail call i32 @test_if(i32 -1)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32 %29)
%31 = tail call i32 @test_if(i32 0)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %31)
%33 = tail call i32 @test_if(i32 1)
%34 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %33)
%35 = tail call i32 @test_if(i32 2)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %35)
%37 = tail call i32 @test_if(i32 3)
%38 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %37)
%39 = tail call i32 @test_if(i32 4)
%40 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %39)
%41 = tail call i32 @test_for(i32 10)
%42 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 10, i32 %41)
%43 = tail call i32 @sum(i32 10)
%44 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 10, i32 %43)
%45 = tail call i32 @test_mul(i32 10)
%46 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 10, i32 %45)
%47 = tail call i32 @test_div(i32 1)
%48 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 1, i32 %47)
%49 = tail call i32 @test_log_and(i32 1)
%50 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 1, i32 %49)
%51 = tail call i32 @foo(i32 2)
%52 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 2, i32 %51)
ret i32 0
}