#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 fib(int);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int j, x;
  for (j = 0; j < 15; j++) {
    x = j * 3 + 3;
    printf("fib(%d) = %d\n", x, fib(x));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jge    1177 <main+0x57>
imul   $0x3,-0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <fib@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x3,%edi
call   1040 <fib@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x6,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x9,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xc,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xf,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x12,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x15,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x15,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x18,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x18,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x1b,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x1b,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x1e,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x21,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x21,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x24,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x24,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x27,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x27,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x2a,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x2d,%edi
call   1040 <fib@plt>
mov    %rbx,%rdi
mov    $0x2d,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"fib(%d) = %d\0A\00"
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 = %15, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 15
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = load i32, i32* %2
%9 = mul nsw i32 %8, 3
%10 = add nsw i32 %9, 3
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = load i32, i32* %3
%13 = call i32 @fib(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %13)
br label %15
15: ; preds = %7
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %4
18: ; preds = %4
ret i32 0
}

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