#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 *);
double fib(int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int i;
  double result;
  int n = 35;
  if (argc > 1)
    n = atoi(argv[1]);
  for (i = 0; i < 2; i++)
    result = fib(n);
  if (result != 9227465.)
    printf("*** wrong result ***\n");
  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   $0x23,-0x24(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1167 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    1193 <main+0x63>
mov    -0x24(%rbp),%edi
call   1040 <fib@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116e <main+0x3e>
movsd  -0x20(%rbp),%xmm0
movsd  0xe60(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11b5 <main+0x85>
jp     11b5 <main+0x85>
jmp    11c1 <main+0x91>
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x23,%ebx
cmp    $0x2,%edi
jl     1146 <main+0x16>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    %ebx,%edi
call   1040 <fib@plt>
mov    %ebx,%edi
call   1040 <fib@plt>
ucomisd 0xea4(%rip),%xmm0
jne    1160 <main+0x30>
jnp    116c <main+0x3c>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"*** wrong result ***\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 35, i32* %8
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %8
br label %16
16: ; preds = %11, %2
store i32 0, i32* %6
br label %17
17: ; preds = %23, %16
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 2
br i1 %19, label %20, label %26
20: ; preds = %17
%21 = load i32, i32* %8
%22 = call double @fib(i32 %21)
store double %22, double* %7
br label %23
23: ; preds = %20
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %17
26: ; preds = %17
%27 = load double, double* %7
%28 = fcmp une double %27, 0x4161999920000000
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
ret i32 0
}

LLVM IR (-O2):
@str = [21 x i8] c"*** wrong result ***\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 = %4, %2
%9 = phi i32 [ %7, %4 ], [ 35, %2 ]
%10 = tail call double @fib(i32 %9)
%11 = tail call double @fib(i32 %9)
%12 = fcmp une double %11, 0x4161999920000000
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %13, %8
ret i32 0
}