#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 f(int);
int /*<<< orphan*/ foo(int, int, int, int, int);
int g(int);
int main(void) {
  int x;
  foo(0, 1, 2, 3, 4);
  x = 5;
  foo(x + 0, x + 1, x + 2, x + x - 2, x * 2 - 1);
  foo(0, f(0), f(f(0)), f(f(f(0))), g(2));
  foo(g(2) + g(0), g(2) + g(1), g(0) + g(1) + g(2), g(3), g(4) - 7);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
call   1040 <foo@plt>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x0,%edi
mov    -0x4(%rbp),%esi
add    $0x1,%esi
mov    -0x4(%rbp),%edx
add    $0x2,%edx
mov    -0x4(%rbp),%ecx
add    -0x4(%rbp),%ecx
sub    $0x2,%ecx
mov    -0x4(%rbp),%r8d
shl    $0x1,%r8d
sub    $0x1,%r8d
call   1040 <foo@plt>
xor    %edi,%edi
call   1030 <f@plt>
mov    %eax,-0x30(%rbp)
xor    %edi,%edi
call   1030 <f@plt>
mov    %eax,%edi
call   1030 <f@plt>
mov    %eax,-0x2c(%rbp)
xor    %edi,%edi
call   1030 <f@plt>
mov    %eax,%edi
call   1030 <f@plt>
mov    %eax,%edi
call   1030 <f@plt>
mov    %eax,-0x28(%rbp)
mov    $0x2,%edi
call   1050 <g@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    %eax,%r8d
xor    %edi,%edi
call   1040 <foo@plt>
mov    $0x2,%edi
call   1050 <g@plt>
mov    %eax,-0x24(%rbp)
xor    %edi,%edi
call   1050 <g@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    $0x2,%edi
call   1050 <g@plt>
mov    %eax,-0x20(%rbp)
mov    $0x1,%edi
call   1050 <g@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
xor    %edi,%edi
call   1050 <g@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x1,%edi
call   1050 <g@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    $0x2,%edi
call   1050 <g@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x3,%edi
call   1050 <g@plt>
mov    %eax,-0x8(%rbp)
mov    $0x4,%edi
call   1050 <g@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    %eax,%r8d
sub    $0x7,%r8d
call   1040 <foo@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
call   1040 <foo@plt>
mov    $0x5,%edi
mov    $0x6,%esi
mov    $0x7,%edx
mov    $0x8,%ecx
mov    $0x9,%r8d
call   1040 <foo@plt>
xor    %edi,%edi
call   1030 <f@plt>
mov    %eax,%r14d
xor    %edi,%edi
call   1030 <f@plt>
mov    %eax,%edi
call   1030 <f@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   1030 <f@plt>
mov    %eax,%edi
call   1030 <f@plt>
mov    %eax,%edi
call   1030 <f@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   1050 <g@plt>
xor    %edi,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
call   1040 <foo@plt>
mov    $0x2,%edi
call   1050 <g@plt>
mov    %eax,%r14d
xor    %edi,%edi
call   1050 <g@plt>
add    %eax,%r14d
mov    $0x2,%edi
call   1050 <g@plt>
mov    %eax,%ebp
mov    $0x1,%edi
call   1050 <g@plt>
add    %eax,%ebp
xor    %edi,%edi
call   1050 <g@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1050 <g@plt>
add    %eax,%ebx
mov    $0x2,%edi
call   1050 <g@plt>
add    %eax,%ebx
mov    $0x3,%edi
call   1050 <g@plt>
mov    %eax,%r15d
mov    $0x4,%edi
call   1050 <g@plt>
lea    -0x7(%rax),%r8d
mov    %r14d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
call   1040 <foo@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = call i32 @foo(i32 0, i32 1, i32 2, i32 3, i32 4)
store i32 5, i32* %1
%3 = load i32, i32* %1
%4 = add nsw i32 %3, 0
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 2
%9 = load i32, i32* %1
%10 = load i32, i32* %1
%11 = add nsw i32 %9, %10
%12 = sub nsw i32 %11, 2
%13 = load i32, i32* %1
%14 = mul nsw i32 %13, 2
%15 = sub nsw i32 %14, 1
%16 = call i32 @foo(i32 %4, i32 %6, i32 %8, i32 %12, i32 %15)
%17 = call i32 @f(i32 0)
%18 = call i32 @f(i32 0)
%19 = call i32 @f(i32 %18)
%20 = call i32 @f(i32 0)
%21 = call i32 @f(i32 %20)
%22 = call i32 @f(i32 %21)
%23 = call i32 @g(i32 2)
%24 = call i32 @foo(i32 0, i32 %17, i32 %19, i32 %22, i32 %23)
%25 = call i32 @g(i32 2)
%26 = call i32 @g(i32 0)
%27 = add nsw i32 %25, %26
%28 = call i32 @g(i32 2)
%29 = call i32 @g(i32 1)
%30 = add nsw i32 %28, %29
%31 = call i32 @g(i32 0)
%32 = call i32 @g(i32 1)
%33 = add nsw i32 %31, %32
%34 = call i32 @g(i32 2)
%35 = add nsw i32 %33, %34
%36 = call i32 @g(i32 3)
%37 = call i32 @g(i32 4)
%38 = sub nsw i32 %37, 7
%39 = call i32 @foo(i32 %27, i32 %30, i32 %35, i32 %36, i32 %38)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 0, i32 1, i32 2, i32 3, i32 4)
%2 = tail call i32 @foo(i32 5, i32 6, i32 7, i32 8, i32 9)
%3 = tail call i32 @f(i32 0)
%4 = tail call i32 @f(i32 0)
%5 = tail call i32 @f(i32 %4)
%6 = tail call i32 @f(i32 0)
%7 = tail call i32 @f(i32 %6)
%8 = tail call i32 @f(i32 %7)
%9 = tail call i32 @g(i32 2)
%10 = tail call i32 @foo(i32 0, i32 %3, i32 %5, i32 %8, i32 %9)
%11 = tail call i32 @g(i32 2)
%12 = tail call i32 @g(i32 0)
%13 = add nsw i32 %12, %11
%14 = tail call i32 @g(i32 2)
%15 = tail call i32 @g(i32 1)
%16 = add nsw i32 %15, %14
%17 = tail call i32 @g(i32 0)
%18 = tail call i32 @g(i32 1)
%19 = add nsw i32 %18, %17
%20 = tail call i32 @g(i32 2)
%21 = add nsw i32 %19, %20
%22 = tail call i32 @g(i32 3)
%23 = tail call i32 @g(i32 4)
%24 = add nsw i32 %23, -7
%25 = tail call i32 @foo(i32 %13, i32 %16, i32 %21, i32 %22, i32 %24)
ret i32 0
}