#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 fibo(int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    puts("usage: ./fibo [NUMBER]");
    return 0;
  }
  for (int i = 1; i <= atoi(argv[1]); i++)
    printf("%d%c", fibo(i), 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1178 <main+0x38>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11cf <main+0x8f>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jg     11c8 <main+0x88>
mov    -0x14(%rbp),%edi
call   1050 <fibo@plt>
mov    %eax,%esi
lea    0xe67(%rip),%rdi
mov    $0xa,%edx
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117f <main+0x3f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jge    1157 <main+0x17>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
jmp    1196 <main+0x56>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
test   %eax,%eax
jle    1196 <main+0x56>
xor    %ebp,%ebp
lea    0xea7(%rip),%r14
add    $0x1,%ebp
mov    %ebp,%edi
call   1050 <fibo@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <printf@plt>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
cmp    %eax,%ebp
jl     1170 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"usage: ./fibo [NUMBER]\00"
@.str.1 = [5 x i8] c"%d%c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %27
11: ; preds = %2
store i32 1, i32* %6
br label %12
12: ; preds = %23, %11
%13 = load i32, i32* %6
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
%18 = icmp sle i32 %13, %17
br i1 %18, label %19, label %26
19: ; preds = %12
%20 = load i32, i32* %6
%21 = call i32 @fibo(i32 %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 10)
br label %23
23: ; preds = %19
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %12
26: ; preds = %12
store i32 0, i32* %3
br label %27
27: ; preds = %26, %9
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [23 x i8] c"usage: ./fibo [NUMBER]\00"
@.str.1 = [5 x i8] c"%d%c\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = icmp slt i32 %7, 1
br i1 %8, label %19, label %11
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %19
11: ; preds = %4, %11
%12 = phi i32 [ %15, %11 ], [ 1, %4 ]
%13 = tail call i32 @fibo(i32 %12)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 10)
%15 = add nuw nsw i32 %12, 1
%16 = load i8*, i8** %5
%17 = tail call i32 @atoi(i8* %16)
%18 = icmp slt i32 %12, %17
br i1 %18, label %11, label %19
19: ; preds = %11, %4, %9
ret i32 0
}