#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 */
scalar_t__ fib(int);
scalar_t__ inc(int);
int main(void) {
  int i, j;
  for (i = 0; i < 10; i++)
    j += inc(i);
  j += fib(3);
  return j;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1163 <main+0x43>
mov    -0x8(%rbp),%edi
call   1040 <inc@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    $0x3,%edi
call   1030 <fib@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %edi,%edi
call   1040 <inc@plt>
mov    %rax,%r14
mov    $0x1,%edi
call   1040 <inc@plt>
mov    %rax,%r15
add    %r14d,%r15d
mov    $0x2,%edi
call   1040 <inc@plt>
mov    %rax,%rbx
add    %r15d,%ebx
mov    $0x3,%edi
call   1040 <inc@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x4,%edi
call   1040 <inc@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x5,%edi
call   1040 <inc@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x6,%edi
call   1040 <inc@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x7,%edi
call   1040 <inc@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x8,%edi
call   1040 <inc@plt>
mov    %rax,%r15
add    %r14d,%r15d
mov    $0x9,%edi
call   1040 <inc@plt>
mov    %rax,%rbx
add    %r15d,%ebx
mov    $0x3,%edi
call   1030 <fib@plt>
add    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i64 @inc(i32 %8)
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = add nsw i64 %11, %9
%13 = trunc i64 %12 to i32
store i32 %13, i32* %3
br label %14
14: ; preds = %7
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
%18 = call i64 @fib(i32 3)
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = add nsw i64 %20, %18
%22 = trunc i64 %21 to i32
store i32 %22, i32* %3
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @inc(i32 0)
%2 = tail call i64 @inc(i32 1)
%3 = add i64 %2, %1
%4 = tail call i64 @inc(i32 2)
%5 = add i64 %4, %3
%6 = tail call i64 @inc(i32 3)
%7 = add i64 %6, %5
%8 = tail call i64 @inc(i32 4)
%9 = add i64 %8, %7
%10 = tail call i64 @inc(i32 5)
%11 = add i64 %10, %9
%12 = tail call i64 @inc(i32 6)
%13 = add i64 %12, %11
%14 = tail call i64 @inc(i32 7)
%15 = add i64 %14, %13
%16 = tail call i64 @inc(i32 8)
%17 = add i64 %16, %15
%18 = tail call i64 @inc(i32 9)
%19 = add i64 %18, %17
%20 = tail call i64 @fib(i32 3)
%21 = add i64 %20, %19
%22 = trunc i64 %21 to i32
ret i32 %22
}