#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 foo1();
int foo2();
int foo3();
int foo4();
int foo5();
int foo6();
int foo7();
int foo8();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n",
         foo1() + foo2() + foo3() + foo4() + foo5() + foo6() + foo7() + foo8());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   10a0 <foo1@plt>
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1060 <foo2@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1080 <foo3@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <foo4@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1090 <foo5@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <foo6@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   10b0 <foo7@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1070 <foo8@plt>
mov    -0x8(%rbp),%esi
add    %eax,%esi
lea    0xdde(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   10a0 <foo1@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <foo2@plt>
add    %eax,%ebx
xor    %eax,%eax
call   1080 <foo3@plt>
add    %eax,%ebx
xor    %eax,%eax
call   1040 <foo4@plt>
add    %eax,%ebx
xor    %eax,%eax
call   1090 <foo5@plt>
add    %eax,%ebx
xor    %eax,%eax
call   1050 <foo6@plt>
add    %eax,%ebx
xor    %eax,%eax
call   10b0 <foo7@plt>
add    %eax,%ebx
xor    %eax,%eax
call   1070 <foo8@plt>
add    %eax,%ebx
lea    0xe20(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @foo1()
%3 = call i32 (...) @foo2()
%4 = add nsw i32 %2, %3
%5 = call i32 (...) @foo3()
%6 = add nsw i32 %4, %5
%7 = call i32 (...) @foo4()
%8 = add nsw i32 %6, %7
%9 = call i32 (...) @foo5()
%10 = add nsw i32 %8, %9
%11 = call i32 (...) @foo6()
%12 = add nsw i32 %10, %11
%13 = call i32 (...) @foo7()
%14 = add nsw i32 %12, %13
%15 = call i32 (...) @foo8()
%16 = add nsw i32 %14, %15
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @foo1()
%2 = tail call i32 (...) @foo2()
%3 = add nsw i32 %2, %1
%4 = tail call i32 (...) @foo3()
%5 = add nsw i32 %3, %4
%6 = tail call i32 (...) @foo4()
%7 = add nsw i32 %5, %6
%8 = tail call i32 (...) @foo5()
%9 = add nsw i32 %7, %8
%10 = tail call i32 (...) @foo6()
%11 = add nsw i32 %9, %10
%12 = tail call i32 (...) @foo7()
%13 = add nsw i32 %11, %12
%14 = tail call i32 (...) @foo8()
%15 = add nsw i32 %13, %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}