#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 fibo(int);
char *int_to_string(int);
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ readStr();
int str_to_int(int /*<<< orphan*/);
void fibonaci() {
  print("\nHow many Elements: ");
  int n = str_to_int(readStr());
  print("\n");
  int i = 0;
  for (i = 0; i < n; i++) {
    print("Fibo ");
    print(int_to_string(i));
    print(" : ");
    print(int_to_string(fibo(i)));
    print("\n");
  }
}


x86 assembly (clang, -O0):
<fibonaci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1040 <print@plt>
mov    $0x0,%al
call   1060 <readStr@plt>
mov    %eax,%edi
call   1030 <str_to_int@plt>
mov    %eax,-0x4(%rbp)
lea    0xe99(%rip),%rdi
call   1040 <print@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f4 <fibonaci+0xa4>
lea    0xe75(%rip),%rdi
call   1040 <print@plt>
mov    -0x8(%rbp),%edi
call   1070 <int_to_string@plt>
mov    %rax,%rdi
call   1040 <print@plt>
lea    0xe5f(%rip),%rdi
call   1040 <print@plt>
mov    -0x8(%rbp),%edi
call   1050 <fibo@plt>
mov    %eax,%edi
call   1070 <int_to_string@plt>
mov    %rax,%rdi
call   1040 <print@plt>
lea    0xe34(%rip),%rdi
call   1040 <print@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118f <fibonaci+0x3f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibonaci>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xea1(%rip),%rdi
call   1040 <print@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <readStr@plt>
mov    %eax,%edi
call   1030 <str_to_int@plt>
mov    %eax,%ebp
lea    0xe98(%rip),%rdi
call   1040 <print@plt>
test   %ebp,%ebp
jle    11e4 <fibonaci+0x94>
lea    0xe8a(%rip),%r14
lea    0xe89(%rip),%r15
lea    0xe7a(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <print@plt>
mov    %ebx,%edi
call   1070 <int_to_string@plt>
mov    %rax,%rdi
call   1040 <print@plt>
mov    %r15,%rdi
call   1040 <print@plt>
mov    %ebx,%edi
call   1050 <fibo@plt>
mov    %eax,%edi
call   1070 <int_to_string@plt>
mov    %rax,%rdi
call   1040 <print@plt>
mov    %r12,%rdi
call   1040 <print@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    11a0 <fibonaci+0x50>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0AHow many Elements: \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [6 x i8] c"Fibo \00"
@.str.3 = [4 x i8] c" : \00"
define void @fibonaci() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @readStr()
%5 = call i32 @str_to_int(i32 %4)
store i32 %5, i32* %1
%6 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
store i32 0, i32* %2
br label %7
7: ; preds = %22, %0
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %25
11: ; preds = %7
%12 = call i32 @print(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %2
%14 = call i8* @int_to_string(i32 %13)
%15 = call i32 @print(i8* %14)
%16 = call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%17 = load i32, i32* %2
%18 = call i32 @fibo(i32 %17)
%19 = call i8* @int_to_string(i32 %18)
%20 = call i32 @print(i8* %19)
%21 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %11
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %7
25: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0AHow many Elements: \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [6 x i8] c"Fibo \00"
@.str.3 = [4 x i8] c" : \00"
define void @fibonaci() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @readStr()
%3 = tail call i32 @str_to_int(i32 %2)
%4 = tail call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %18
6: ; preds = %0, %6
%7 = phi i32 [ %16, %6 ], [ 0, %0 ]
%8 = tail call i32 @print(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i8* @int_to_string(i32 %7)
%10 = tail call i32 @print(i8* %9)
%11 = tail call i32 @print(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @fibo(i32 %7)
%13 = tail call i8* @int_to_string(i32 %12)
%14 = tail call i32 @print(i8* %13)
%15 = tail call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = add nuw nsw i32 %7, 1
%17 = icmp eq i32 %16, %3
br i1 %17, label %18, label %6
18: ; preds = %6, %0
ret void
}