#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, num1, num2, fibo, i;
  printf("Enter the number of fibonacci numbers to display: ");
  scanf("%d", &n);
  num1 = num2 = 1;
  for (i = 0; i < n; i++) {
    fibo = num1 + num2;
    if (i == 0 || i == 1)
      fibo = 1;
    printf("%d\n", fibo);
    num1 = num2;
    num2 = fibo;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11bd <main+0x9d>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     118b <main+0x6b>
cmpl   $0x1,-0x18(%rbp)
jne    1192 <main+0x72>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1162 <main+0x42>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1197 <main+0x77>
mov    $0x1,%r14d
lea    0xed7(%rip),%r15
xor    %ebx,%ebx
mov    $0x1,%eax
mov    $0x1,%r12d
nopl   0x0(%rax)
add    %r12d,%eax
cmp    $0x2,%ebx
mov    %eax,%ebp
cmovb  %r14d,%ebp
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    %r12d,%eax
mov    %ebp,%r12d
cmp    0xc(%rsp),%ebx
jl     1170 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [51 x i8] c"Enter the number of fibonacci numbers to display: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 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 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %0, %7
%8 = phi i32 [ %15, %7 ], [ 0, %0 ]
%9 = phi i32 [ %10, %7 ], [ 1, %0 ]
%10 = phi i32 [ %13, %7 ], [ 1, %0 ]
%11 = add nsw i32 %9, %10
%12 = icmp ugt i32 %8, 1
%13 = select i1 %12, i32 %11, i32 1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i32 %8, 1
%16 = load i32, i32* %1
%17 = icmp slt i32 %15, %16
br i1 %17, label %7, label %18
18: ; preds = %7, %0
ret i32 0
}