#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 */
double fibonacciDubs(int);
int fibonacciNR(int);
int /*<<< orphan*/ printf(char *, int, double);
int main() {
  int i;
  for (i = 1; i < 49; i++) {
    printf("fibonacciNR(%d) = %d\n", i, fibonacciNR(i));
  }
  for (i = 1; i < 1479; i++) {
    printf("fibonacciDubs(%d) = %.0f\n", i, fibonacciDubs(i));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x31,-0x8(%rbp)
jge    117f <main+0x4f>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fibonacciNR@plt>
mov    -0xc(%rbp),%esi
cvtsi2sd %eax,%xmm0
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
movl   $0x1,-0x8(%rbp)
cmpl   $0x5c7,-0x8(%rbp)
jge    11be <main+0x8e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <fibonacciDubs@plt>
mov    -0x10(%rbp),%esi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1186 <main+0x56>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xec0(%rip),%r14
mov    %ebx,%edi
call   1040 <fibonacciNR@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x31,%ebx
jne    1140 <main+0x10>
mov    $0x1,%ebx
lea    0xeaa(%rip),%r14
nopl   0x0(%rax)
mov    %ebx,%edi
call   1050 <fibonacciDubs@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x5c7,%ebx
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [22 x i8] c"fibonacciNR(%d) = %d\0A\00"
@.str.1 = [26 x i8] c"fibonacciDubs(%d) = %.0f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %3
3: ; preds = %12, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 49
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @fibonacciNR(i32 %8)
%10 = sitofp i32 %9 to double
%11 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7, double %10)
br label %12
12: ; preds = %6
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %3
15: ; preds = %3
store i32 1, i32* %2
br label %16
16: ; preds = %24, %15
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 1479
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i32, i32* %2
%21 = load i32, i32* %2
%22 = call double @fibonacciDubs(i32 %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %20, double %22)
br label %24
24: ; preds = %19
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %16
27: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"fibonacciNR(%d) = %d\0A\00"
@.str.1 = [26 x i8] c"fibonacciDubs(%d) = %.0f\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %6, %1 ]
%3 = tail call i32 @fibonacciNR(i32 %2)
%4 = sitofp i32 %3 to double
%5 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %2, double %4)
%6 = add nuw nsw i32 %2, 1
%7 = icmp eq i32 %6, 49
br i1 %7, label %8, label %1
8: ; preds = %1, %8
%9 = phi i32 [ %12, %8 ], [ 1, %1 ]
%10 = tail call double @fibonacciDubs(i32 %9)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %9, double %10)
%12 = add nuw nsw i32 %9, 1
%13 = icmp eq i32 %12, 1479
br i1 %13, label %14, label %8
14: ; preds = %8
ret i32 0
}