#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_r();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int count = 20;
  if (argv[1])
    count = atoi(argv[1]);
  while (count--)
    printf("%d\n", fibo_r());
}


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)
movl   $0x14,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     116c <main+0x3c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    1171 <main+0x41>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     119f <main+0x6f>
mov    $0x0,%al
call   1040 <fibo_r@plt>
mov    %eax,%esi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
jmp    1171 <main+0x41>
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
test   %rdi,%rdi
je     114a <main+0x1a>
call   1050 <atoi@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    114f <main+0x1f>
jmp    1176 <main+0x46>
mov    $0x14,%ebx
lea    0xeaa(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <fibo_r@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebx
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\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
store i32 20, i32* %6
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
br label %16
16: ; preds = %11, %2
br label %17
17: ; preds = %21, %16
%18 = load i32, i32* %6
%19 = add nsw i32 %18, -1
store i32 %19, i32* %6
%20 = icmp ne i32 %18, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = call i32 (...) @fibo_r()
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %17
24: ; preds = %17
%25 = load i32, i32* %3
ret i32 %25
}

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