#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 fnFibonacci(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int iTerm, i, iNum;
  printf("Enter the no of terms\n");
  scanf("%d", &iNum);
  printf("\nThe terms in the Fibonacci Sequence:\n%d\t%d\t", 0, 1);
  for (i = 2; i < iNum; ++i) {
    iTerm = fnFibonacci(i);
    printf("%d\t", iTerm);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb6(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11af <main+0x7f>
mov    -0xc(%rbp),%edi
call   1050 <fnFibonacci@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1179 <main+0x49>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
lea    0xea9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xe9b(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x3,0x4(%rsp)
jl     11ac <main+0x6c>
mov    $0x2,%ebx
lea    0xea3(%rip),%r14
nopl   0x0(%rax)
mov    %ebx,%edi
call   1060 <fnFibonacci@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jl     1190 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter the no of terms\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [45 x i8] c"\0AThe terms in the Fibonacci Sequence:\0A%d\09%d\09\00"
@.str.3 = [4 x i8] c"%d\09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 1)
store i32 2, i32* %3
br label %8
8: ; preds = %17, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = load i32, i32* %3
%14 = call i32 @fnFibonacci(i32 %13)
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %12
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %8
20: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [45 x i8] c"\0AThe terms in the Fibonacci Sequence:\0A%d\09%d\09\00"
@.str.3 = [4 x i8] c"%d\09\00"
@str = [22 x i8] c"Enter the no of terms\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 2
br i1 %7, label %8, label %15
8: ; preds = %0, %8
%9 = phi i32 [ %12, %8 ], [ 2, %0 ]
%10 = call i32 @fnFibonacci(i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i32 %9, 1
%13 = load i32, i32* %1
%14 = icmp slt i32 %12, %13
br i1 %14, label %8, label %15
15: ; preds = %8, %0
ret i32 0
}