#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 */
typedef int /*<<< orphan*/ clock_t;

/* Variables and functions */
int atoi(char *);
int fib_recursion(int);
int fib_repeated(int);
int /*<<< orphan*/ getClock();
float getTime(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int number, ret;
  float gap;
  clock_t startTime;
  if (argc != 2) {
    printf("USAGE: TEST ${NUMBER}\n");
    return 0;
  }
  number = atoi(argv[1]);
  startTime = getClock();
  ret = fib_recursion(number);
  gap = getTime(startTime);
  printf("Get fibonacci %d as recursion is %d, T : %f\n", number, ret, gap);
  startTime = getClock();
  ret = fib_repeated(number);
  gap = getTime(startTime);
  printf("Get fibonacci %d as repeated is %d, T : %f\n", number, ret, gap);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     119a <main+0x3a>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    122f <main+0xcf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1060 <getClock@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <fib_recursion@plt>
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <getTime@plt>
movss  %xmm0,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe35(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getClock@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <fib_repeated@plt>
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <getTime@plt>
movss  %xmm0,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe23(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jne    11e8 <main+0x78>
mov    0x8(%rsi),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1070 <getClock@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1080 <fib_recursion@plt>
mov    %eax,%r14d
mov    %ebp,%edi
call   1040 <getTime@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe57(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <getClock@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1060 <fib_repeated@plt>
mov    %eax,%r14d
mov    %ebp,%edi
call   1040 <getTime@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe53(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    $0x1,%al
call   1050 <printf@plt>
jmp    11f4 <main+0x84>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"USAGE: TEST ${NUMBER}\0A\00"
@.str.1 = [45 x i8] c"Get fibonacci %d as recursion is %d, T : %f\0A\00"
@.str.2 = [44 x i8] c"Get fibonacci %d as repeated is %d, T : %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %39
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %6
%19 = call i32 (...) @getClock()
store i32 %19, i32* %9
%20 = load i32, i32* %6
%21 = call i32 @fib_recursion(i32 %20)
store i32 %21, i32* %7
%22 = load i32, i32* %9
%23 = call float @getTime(i32 %22)
store float %23, float* %8
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = load float, float* %8
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 %25, double %27)
%29 = call i32 (...) @getClock()
store i32 %29, i32* %9
%30 = load i32, i32* %6
%31 = call i32 @fib_repeated(i32 %30)
store i32 %31, i32* %7
%32 = load i32, i32* %9
%33 = call float @getTime(i32 %32)
store float %33, float* %8
%34 = load i32, i32* %6
%35 = load i32, i32* %7
%36 = load float, float* %8
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %34, i32 %35, double %37)
store i32 0, i32* %3
br label %39
39: ; preds = %14, %12
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str.1 = [45 x i8] c"Get fibonacci %d as recursion is %d, T : %f\0A\00"
@.str.2 = [44 x i8] c"Get fibonacci %d as repeated is %d, T : %f\0A\00"
@str = [22 x i8] c"USAGE: TEST ${NUMBER}\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %20
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = tail call i32 (...) @getClock()
%11 = tail call i32 @fib_recursion(i32 %9)
%12 = tail call float @getTime(i32 %10)
%13 = fpext float %12 to double
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %11, double %13)
%15 = tail call i32 (...) @getClock()
%16 = tail call i32 @fib_repeated(i32 %9)
%17 = tail call float @getTime(i32 %15)
%18 = fpext float %17 to double
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %16, double %18)
br label %20
20: ; preds = %6, %4
ret i32 0
}