#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 fabonacci(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
int main(void) {
  int num, i;
  scanf("%d", &num);
  printf("fabonacci(%d)=%d\n", num, fabonacci(num));
  for (i = 1; i <= num; i++) {
    printf("%10d", fabonacci(i));
    fflush(stdout);
    sleep(1);
    if (i % 5 == 0)
      printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fabonacci@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1208 <main+0xb8>
mov    -0xc(%rbp),%edi
call   1040 <fabonacci@plt>
mov    %eax,%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11f5 <main+0xa5>
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fa <main+0xaa>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1197 <main+0x47>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe8e(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%ebx
mov    %ebx,%edi
call   1050 <fabonacci@plt>
lea    0xe75(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    121e <main+0xbe>
mov    $0x1,%ebx
lea    0xe69(%rip),%r14
mov    0x2e2d(%rip),%r12
xor    %ebp,%ebp
jmp    11c9 <main+0x69>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    0x4(%rsp),%ebp
jge    121e <main+0xbe>
mov    %ebp,%r13d
lea    0x1(%r13),%ebp
mov    %ebx,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%r15d
add    $0xffffffff,%r15d
mov    %ebp,%edi
call   1050 <fabonacci@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r12),%edi
call   1060 <fflush@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
cmp    %r13d,%r15d
jne    11c0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11c0 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [18 x i8] c"fabonacci(%d)=%d\0A\00"
@.str.2 = [5 x i8] c"%10d\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @fabonacci(i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %5)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %24, label %9
9: ; preds = %0, %20
%10 = phi i32 [ %21, %20 ], [ 1, %0 ]
%11 = call i32 @fabonacci(i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = load i32, i32* @stdout
%14 = call i32 @fflush(i32 %13)
%15 = call i32 @sleep(i32 1)
%16 = urem i32 %10, 5
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %9
%19 = call i32 @putchar(i32 10)
br label %20
20: ; preds = %9, %18
%21 = add nuw nsw i32 %10, 1
%22 = load i32, i32* %1
%23 = icmp slt i32 %10, %22
br i1 %23, label %9, label %24
24: ; preds = %20, %0
ret i32 0
}