#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 /*<<< orphan*/ free(double *);
double *malloc(int);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char **argv) {
  int size = 100;
  double *fibo = malloc(sizeof(double) * size);
  fibo[0] = 1;
  fibo[1] = 1;
  int i;
  for (i = 1; i < size; i++) {
    fibo[i] = fibo[i - 1] + fibo[i - 2];
  }
  printf(" fibo = %f\n", fibo[size]);
  free(fibo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x64,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsd  0xe94(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0xe84(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d3 <main+0xa3>
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1188 <main+0x58>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x320,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
movaps 0xebb(%rip),%xmm0
movups %xmm0,(%rax)
movsd  0xec0(%rip),%xmm0
mov    $0x3,%eax
cs nopw 0x0(%rax,%rax,1)
nop
addsd  -0x20(%rbx,%rax,8),%xmm0
movsd  %xmm0,-0x10(%rbx,%rax,8)
movsd  -0x18(%rbx,%rax,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,-0x8(%rbx,%rax,8)
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx,%rax,8)
add    $0x3,%rax
cmp    $0x66,%rax
jne    1160 <main+0x30>
movsd  0x320(%rbx),%xmm0
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c" fibo = %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 100, i32* %6
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = mul i64 8, %10
%12 = trunc i64 %11 to i32
%13 = call double* @malloc(i32 %12)
store double* %13, double** %7
%14 = load double*, double** %7
%15 = getelementptr inbounds double, double* %14, i64 0
store double 1.000000e+00, double* %15
%16 = load double*, double** %7
%17 = getelementptr inbounds double, double* %16, i64 1
store double 1.000000e+00, double* %17
store i32 1, i32* %8
br label %18
18: ; preds = %40, %2
%19 = load i32, i32* %8
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %43
22: ; preds = %18
%23 = load double*, double** %7
%24 = load i32, i32* %8
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %23, i64 %26
%28 = load double, double* %27
%29 = load double*, double** %7
%30 = load i32, i32* %8
%31 = sub nsw i32 %30, 2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %29, i64 %32
%34 = load double, double* %33
%35 = fadd double %28, %34
%36 = load double*, double** %7
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
store double %35, double* %39
br label %40
40: ; preds = %22
%41 = load i32, i32* %8
%42 = add nsw i32 %41, 1
store i32 %42, i32* %8
br label %18
43: ; preds = %18
%44 = load double*, double** %7
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
%48 = load double, double* %47
%49 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %48)
%50 = load double*, double** %7
%51 = call i32 @free(double* %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c" fibo = %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double* @malloc(i32 800)
%4 = bitcast double* %3 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %4
br label %5
5: ; preds = %5, %2
%6 = phi double [ 1.000000e+00, %2 ], [ %22, %5 ]
%7 = phi i64 [ 1, %2 ], [ %24, %5 ]
%8 = add nsw i64 %7, -2
%9 = getelementptr inbounds double, double* %3, i64 %8
%10 = load double, double* %9
%11 = fadd double %6, %10
%12 = getelementptr inbounds double, double* %3, i64 %7
store double %11, double* %12
%13 = add nuw nsw i64 %7, 1
%14 = add nsw i64 %7, -1
%15 = getelementptr inbounds double, double* %3, i64 %14
%16 = load double, double* %15
%17 = fadd double %11, %16
%18 = getelementptr inbounds double, double* %3, i64 %13
store double %17, double* %18
%19 = add nuw nsw i64 %7, 2
%20 = getelementptr inbounds double, double* %3, i64 %7
%21 = load double, double* %20
%22 = fadd double %17, %21
%23 = getelementptr inbounds double, double* %3, i64 %19
store double %22, double* %23
%24 = add nuw nsw i64 %7, 3
%25 = icmp eq i64 %24, 100
br i1 %25, label %26, label %5
26: ; preds = %5
%27 = getelementptr inbounds double, double* %3, i64 100
%28 = load double, double* %27
%29 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %28)
%30 = tail call i32 @free(double* %3)
ret i32 0
}