#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*/ printf(char *, ...);
long recursiveFibonacci(long);
int /*<<< orphan*/ scanf(char *, long *);
int main() {
  long nthNumber;
  printf("nth Fibonacci : \n");
  printf("\n");
  printf("nth Number = ");
  scanf("%d", &nthNumber);
  printf("\n");
  long nthFibonacci = recursiveFibonacci(nthNumber);
  if (nthFibonacci == -1) {
    printf("Invalid Input \n");
    printf("\n");
  } else {
    printf("fibonacci(%d) = %d \n", nthNumber, nthFibonacci);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <recursiveFibonacci@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    11c0 <main+0x90>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e4 <main+0xb4>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe92(%rip),%rdi
mov    %rsp,%rsi
call   1070 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rsp),%rdi
call   1060 <recursiveFibonacci@plt>
cmp    $0xffffffffffffffff,%rax
je     11b4 <main+0x64>
mov    (%rsp),%rsi
lea    0xe69(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11c0 <main+0x70>
lea    0xe7c(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"nth Fibonacci : \0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [14 x i8] c"nth Number = \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [16 x i8] c"Invalid Input \0A\00"
@.str.5 = [21 x i8] c"fibonacci(%d) = %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = load i64, i64* %2
%10 = call i64 @recursiveFibonacci(i64 %9)
store i64 %10, i64* %3
%11 = load i64, i64* %3
%12 = icmp eq i64 %11, -1
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %21
16: ; preds = %0
%17 = load i64, i64* %2
%18 = load i64, i64* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 %17, i64 %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %16, %13
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [14 x i8] c"nth Number = \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.5 = [21 x i8] c"fibonacci(%d) = %d \0A\00"
@str = [17 x i8] c"nth Fibonacci : \00"
@str.6 = [15 x i8] c"Invalid Input \00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64* %1)
%7 = call i32 @putchar(i32 10)
%8 = load i64, i64* %1
%9 = call i64 @recursiveFibonacci(i64 %8)
%10 = icmp eq i64 %9, -1
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.6, i64 0, i64 0))
br label %16
13: ; preds = %0
%14 = load i64, i64* %1
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 %14, i64 %9)
br label %16
16: ; preds = %13, %11
%17 = call i32 @putchar(i32 10)
ret i32 0
}