#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 atoi(char *);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char *argv[]) {
  int rep;
  if (argc >= 2) {
    rep = atoi(argv[1]);
  } else {
    rep = 1000;
  }
  int i, j;
  double a, b, t;
  for (i = 0; i < rep; i++) {
    a = 1;
    b = 1;
    for (j = 0; j < 1000; j++) {
      t = a;
      a = b;
      b = b + t;
    }
  }
  printf("%f\n", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1155 <main+0x35>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    115c <main+0x3c>
movl   $0x3e8,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e1 <main+0xc1>
movsd  0xe89(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe7c(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    11ce <main+0xae>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1190 <main+0x70>
jmp    11d3 <main+0xb3>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1163 <main+0x43>
movsd  -0x30(%rbp),%xmm0
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3e8,%eax
cmp    $0x2,%edi
jl     1134 <main+0x14>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
xor    %ecx,%ecx
movsd  0xec2(%rip),%xmm1
xchg   %ax,%ax
mov    $0x3e8,%edx
movapd %xmm1,%xmm0
movapd %xmm1,%xmm2
nopl   (%rax)
addsd  %xmm0,%xmm2
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm2
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm2
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm2
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm2
addsd  %xmm2,%xmm0
add    $0xfffffff6,%edx
jne    1150 <main+0x30>
add    $0x1,%ecx
cmp    %eax,%ecx
jne    1140 <main+0x20>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%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 i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp sge i32 %12, 2
br i1 %13, label %14, label %19
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
br label %20
19: ; preds = %2
store i32 1000, i32* %6
br label %20
20: ; preds = %19, %14
store i32 0, i32* %7
br label %21
21: ; preds = %39, %20
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %42
25: ; preds = %21
store double 1.000000e+00, double* %9
store double 1.000000e+00, double* %10
store i32 0, i32* %8
br label %26
26: ; preds = %35, %25
%27 = load i32, i32* %8
%28 = icmp slt i32 %27, 1000
br i1 %28, label %29, label %38
29: ; preds = %26
%30 = load double, double* %9
store double %30, double* %11
%31 = load double, double* %10
store double %31, double* %9
%32 = load double, double* %10
%33 = load double, double* %11
%34 = fadd double %32, %33
store double %34, double* %10
br label %35
35: ; preds = %29
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %26
38: ; preds = %26
br label %39
39: ; preds = %38
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %21
42: ; preds = %21
%43 = load double, double* %10
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %43)
ret i32 0
}

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