#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 CLOCKS_PER_SEC;
double clock();
double fibonacci(unsigned int);
int /*<<< orphan*/ printf(char *, unsigned int, double, double);
int main() {
  unsigned n;
  double f;
  double start;
  double stop;
  double ticks;
  for (n = 1; n < 50; ++n) {
    start = clock();
    f = fibonacci(n);
    stop = clock();
    ticks = (stop - start) / CLOCKS_PER_SEC * 1000;
    printf("f(%u) = %g,  Zeit = %g\n", n, f, ticks);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x32,-0x8(%rbp)
jae    11c2 <main+0x92>
mov    $0x0,%al
call   1030 <clock@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <fibonacci@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
mov    0x2e62(%rip),%rax
divsd  (%rax),%xmm0
movsd  0xe6e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0x1,%ebx
mov    0x2ea3(%rip),%r15
lea    0xebc(%rip),%r14
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <clock@plt>
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   1050 <fibonacci@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <clock@plt>
movapd %xmm0,%xmm1
subsd  (%rsp),%xmm1
divsd  (%r15),%xmm1
mulsd  0xe7a(%rip),%xmm1
mov    %r14,%rdi
mov    %ebx,%esi
movsd  0x8(%rsp),%xmm0
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x32,%ebx
jne    1150 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str = [24 x i8] c"f(%u) = %g, Zeit = %g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store i32 1, i32* %2
br label %7
7: ; preds = %25, %0
%8 = load i32, i32* %2
%9 = icmp ult i32 %8, 50
br i1 %9, label %10, label %28
10: ; preds = %7
%11 = call double (...) @clock()
store double %11, double* %4
%12 = load i32, i32* %2
%13 = call double @fibonacci(i32 %12)
store double %13, double* %3
%14 = call double (...) @clock()
store double %14, double* %5
%15 = load double, double* %5
%16 = load double, double* %4
%17 = fsub double %15, %16
%18 = load double, double* @CLOCKS_PER_SEC
%19 = fdiv double %17, %18
%20 = fmul double %19, 1.000000e+03
store double %20, double* %6
%21 = load i32, i32* %2
%22 = load double, double* %3
%23 = load double, double* %6
%24 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %21, double %22, double %23)
br label %25
25: ; preds = %10
%26 = load i32, i32* %2
%27 = add i32 %26, 1
store i32 %27, i32* %2
br label %7
28: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global double 0.000000e+00
@.str = [24 x i8] c"f(%u) = %g, Zeit = %g\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %11, %1 ]
%3 = tail call double (...) @clock()
%4 = tail call double @fibonacci(i32 %2)
%5 = tail call double (...) @clock()
%6 = fsub double %5, %3
%7 = load double, double* @CLOCKS_PER_SEC
%8 = fdiv double %6, %7
%9 = fmul double %8, 1.000000e+03
%10 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %2, double %4, double %9)
%11 = add nuw nsw i32 %2, 1
%12 = icmp eq i32 %11, 50
br i1 %12, label %13, label %1
13: ; preds = %1
ret i32 0
}