#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 */
unsigned int atoi(char *);
int fibonacci();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  unsigned int limit = atoi(argv[1]);
  for (unsigned int n = 0; n < limit; n++)
    printf("%d ", fibonacci());
  printf("\n");
}


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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    118e <main+0x5e>
mov    $0x0,%al
call   1040 <fibonacci@plt>
mov    %eax,%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115d <main+0x2d>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
test   %eax,%eax
je     1178 <main+0x38>
mov    %eax,%ebx
lea    0xea6(%rip),%r14
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <fibonacci@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    1160 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %9, %2
%8 = tail call i32 @putchar(i32 10)
ret i32 0
9: ; preds = %2, %9
%10 = phi i32 [ %13, %9 ], [ 0, %2 ]
%11 = tail call i32 (...) @fibonacci()
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = add nuw i32 %10, 1
%14 = icmp eq i32 %13, %5
br i1 %14, label %7, label %9
}