#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 */
long atoi(char *);
long calc_fib(long);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ stdin;
int main() {
  long n = 0;
  long fib;
  char buffer[100];
  fgets(buffer, 100, stdin);
  n = atoi(buffer);
  if (n > 90) {
    return -1;
  }
  fib = calc_fib(n);
  printf("%ld\n", fib);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1050 <fgets@plt>
lea    -0x80(%rbp),%rdi
call   1060 <atoi@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x5a,-0x10(%rbp)
jle    1195 <main+0x55>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b9 <main+0x79>
mov    -0x10(%rbp),%rdi
call   1030 <calc_fib@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    0x2e9c(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1060 <atoi@plt>
mov    $0xffffffff,%ecx
cmp    $0x5a,%rax
jg     118a <main+0x4a>
mov    %rax,%rdi
call   1030 <calc_fib@plt>
lea    0xe80(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca [100 x i8]
store i32 0, i32* %1
store i64 0, i64* %2
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i32 100, i32 %6)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%9 = call i64 @atoi(i8* %8)
store i64 %9, i64* %2
%10 = load i64, i64* %2
%11 = icmp sgt i64 %10, 90
br i1 %11, label %12, label %13
12: ; preds = %0
store i32 -1, i32* %1
br label %18
13: ; preds = %0
%14 = load i64, i64* %2
%15 = call i64 @calc_fib(i64 %14)
store i64 %15, i64* %3
%16 = load i64, i64* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %16)
store i32 0, i32* %1
br label %18
18: ; preds = %13, %12
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 100, i32 %3)
%5 = call i64 @atoi(i8* %2)
%6 = icmp sgt i64 %5, 90
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = call i64 @calc_fib(i64 %5)
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %8)
br label %10
10: ; preds = %0, %7
%11 = phi i32 [ 0, %7 ], [ -1, %0 ]
ret i32 %11
}