#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 fibonacci(int);
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  int i, n;
  int sum = 0;
  for (i = 0; i < 11; i++) {
    n = fibonacci(i + 1);
    printf("%d ", n);
    sum += n;
  }
  printf("\nThe Sum of %d fibonacci numbers is %d\n", 11, sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xb,-0x8(%rbp)
jge    117d <main+0x5d>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1040 <fibonacci@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x10(%rbp),%edx
lea    0xe7d(%rip),%rdi
mov    $0xb,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%edi
call   1040 <fibonacci@plt>
mov    %eax,%ebx
lea    0xec9(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <fibonacci@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%ebp
mov    $0x3,%edi
call   1040 <fibonacci@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%ebp
mov    $0x4,%edi
call   1040 <fibonacci@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%ebp
mov    $0x5,%edi
call   1040 <fibonacci@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%ebp
mov    $0x6,%edi
call   1040 <fibonacci@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%ebp
mov    $0x7,%edi
call   1040 <fibonacci@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%ebp
mov    $0x8,%edi
call   1040 <fibonacci@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%ebp
mov    $0x9,%edi
call   1040 <fibonacci@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%ebp
mov    $0xa,%edi
call   1040 <fibonacci@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%ebp
mov    $0xb,%edi
call   1040 <fibonacci@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%ebp
lea    0xdb6(%rip),%rdi
mov    $0xb,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [40 x i8] c"\0AThe Sum of %d fibonacci numbers is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %2
br label %5
5: ; preds = %17, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 11
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
%11 = call i32 @fibonacci(i32 %10)
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = add nsw i32 %15, %14
store i32 %16, i32* %4
br label %17
17: ; preds = %8
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %5
20: ; preds = %5
%21 = load i32, i32* %4
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 11, i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@.str.1 = [40 x i8] c"\0AThe Sum of %d fibonacci numbers is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @fibonacci(i32 1)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @fibonacci(i32 2)
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = add nsw i32 %3, %1
%6 = tail call i32 @fibonacci(i32 3)
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = add nsw i32 %6, %5
%9 = tail call i32 @fibonacci(i32 4)
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nsw i32 %9, %8
%12 = tail call i32 @fibonacci(i32 5)
%13 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = add nsw i32 %12, %11
%15 = tail call i32 @fibonacci(i32 6)
%16 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = add nsw i32 %15, %14
%18 = tail call i32 @fibonacci(i32 7)
%19 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = add nsw i32 %18, %17
%21 = tail call i32 @fibonacci(i32 8)
%22 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = add nsw i32 %21, %20
%24 = tail call i32 @fibonacci(i32 9)
%25 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = add nsw i32 %24, %23
%27 = tail call i32 @fibonacci(i32 10)
%28 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = add nsw i32 %27, %26
%30 = tail call i32 @fibonacci(i32 11)
%31 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = add nsw i32 %30, %29
%33 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 11, i32 %32)
ret i32 0
}