#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 const *);
int fibo(int);
int /*<<< orphan*/ printf(char *, int, int);
int Fibonacci(size_t argc, const char **argv) {
  if (argc <= (1)) {
    printf("Insufficient arguments. %d expected, %zd given.\n", (1), argc - 1);
    return -1;
  };
  int n = atoi(argv[1]);
  printf("Fibonacci(%d)=%d\n", n, fibo(n));
  return 0;
}


x86 assembly (clang, -O0):
<Fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x1,-0x10(%rbp)
ja     1172 <Fibonacci+0x42>
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
mov    %eax,%edx
lea    0xea4(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a8 <Fibonacci+0x78>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
call   1040 <fibo@plt>
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fibonacci>:
push   %rbx
cmp    $0x1,%rdi
ja     1155 <Fibonacci+0x25>
mov    %rdi,%rdx
add    $0xffffffff,%edx
lea    0xebc(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1040 <fibo@plt>
lea    0xec3(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Insufficient arguments. %d expected, %zd given.\0A\00"
@.str.1 = [18 x i8] c"Fibonacci(%d)=%d\0A\00"
define i32 @Fibonacci(i64 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i8**
%6 = alloca i32
store i64 %0, i64* %4
store i8** %1, i8*** %5
%7 = load i64, i64* %4
%8 = icmp ule i64 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i64, i64* %4
%11 = sub i64 %10, 1
%12 = trunc i64 %11 to i32
%13 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 1, i32 %12)
store i32 -1, i32* %3
br label %23
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
%19 = load i32, i32* %6
%20 = load i32, i32* %6
%21 = call i32 @fibo(i32 %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %21)
store i32 0, i32* %3
br label %23
23: ; preds = %14, %9
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [49 x i8] c"Insufficient arguments. %d expected, %zd given.\0A\00"
@.str.1 = [18 x i8] c"Fibonacci(%d)=%d\0A\00"
define i32 @Fibonacci(i64 %0, i8** nocapture %1) {
%3 = icmp ult i64 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = trunc i64 %0 to i32
%6 = add nsw i32 %5, -1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 1, i32 %6)
br label %14
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = tail call i32 @fibo(i32 %11)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %12)
br label %14
14: ; preds = %8, %4
%15 = phi i32 [ -1, %4 ], [ 0, %8 ]
ret i32 %15
}