#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*/ time_t;
typedef double clock_t;

/* Variables and functions */
float CLOCKS_PER_SEC;
double clock();
long long fib(int);
int /*<<< orphan*/ printf(char *, long long, ...);
int main() {
  time_t timer;
  long long int x = 0;
  double seconds = 0;
  clock_t t;
  t = clock();
  x = fib(40 - 1);
  printf("%f time \n", t, ((float)t) / CLOCKS_PER_SEC);
  printf("%lli\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
movsd  %xmm0,-0x20(%rbp)
mov    $0x27,%edi
call   1050 <fib@plt>
mov    %rax,-0x10(%rbp)
cvttsd2si -0x20(%rbp),%rsi
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0x2e69(%rip),%rax
divss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe72(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <clock@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x27,%edi
call   1050 <fib@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%rsi
cvtsd2ss %xmm0,%xmm0
mov    0x2e83(%rip),%rax
divss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%f time \0A\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str.1 = [6 x i8] c"%lli\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store i64 0, i64* %3
store double 0.000000e+00, double* %4
%6 = call double (...) @clock()
store double %6, double* %5
%7 = call i64 @fib(i32 39)
store i64 %7, i64* %3
%8 = load double, double* %5
%9 = fptosi double %8 to i64
%10 = load double, double* %5
%11 = fptrunc double %10 to float
%12 = load float, float* @CLOCKS_PER_SEC
%13 = fdiv float %11, %12
%14 = fpext float %13 to double
%15 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %9, double %14)
%16 = load i64, i64* %3
%17 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%f time \0A\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str.1 = [6 x i8] c"%lli\0A\00"
define i32 @main() {
%1 = tail call double (...) @clock()
%2 = tail call i64 @fib(i32 39)
%3 = fptosi double %1 to i64
%4 = fptrunc double %1 to float
%5 = load float, float* @CLOCKS_PER_SEC
%6 = fdiv float %4, %5
%7 = fpext float %6 to double
%8 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %3, double %7)
%9 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %2)
ret i32 0
}