#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, i = 0, fib_i = 1, fib_f = 1;
  scanf(" %d", &N);
  while (i < N) {
    if (i < 1) {
      printf("0 ");
    } else if (i < 2) {
      printf("1 ");
    } else {
      if (i == N - 1)
        printf("%d\n", fib_f);
      else {
        printf("%d ", fib_f);
        fib_f = fib_f + fib_i;
        fib_i = fib_f - fib_i;
      }
    }
    i++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fc <main+0xdc>
cmpl   $0x1,-0xc(%rbp)
jge    117d <main+0x5d>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <main+0xce>
cmpl   $0x2,-0xc(%rbp)
jge    119a <main+0x7a>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e9 <main+0xc9>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11c1 <main+0xa1>
mov    -0x14(%rbp),%esi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e4 <main+0xc4>
mov    -0x14(%rbp),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11e9 <main+0xc9>
jmp    11ee <main+0xce>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <main+0x34>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11d1 <main+0xb1>
mov    $0x1,%ebx
lea    0xeb3(%rip),%r14
lea    0xea9(%rip),%r15
lea    0xeac(%rip),%r13
mov    $0x1,%r12d
xor    %ebp,%ebp
jmp    1185 <main+0x65>
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebp
mov    0x4(%rsp),%eax
cmp    %eax,%ebp
jge    11d1 <main+0xb1>
cmp    $0x1,%ebp
je     1170 <main+0x50>
test   %ebp,%ebp
jne    11a0 <main+0x80>
mov    %r15,%rdi
jmp    1173 <main+0x53>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%eax
cmp    %eax,%ebp
jne    11b9 <main+0x99>
lea    0xe5c(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    117a <main+0x5a>
mov    %r13,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12d,%eax
add    %ebx,%eax
mov    %ebx,%r12d
mov    %eax,%ebx
jmp    117a <main+0x5a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %d\00"
@.str.1 = [3 x i8] c"0 \00"
@.str.2 = [3 x i8] c"1 \00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 1, i32* %4
store i32 1, i32* %5
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %40, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %43
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %40
16: ; preds = %11
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 2
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %39
21: ; preds = %16
%22 = load i32, i32* %3
%23 = load i32, i32* %2
%24 = sub nsw i32 %23, 1
%25 = icmp eq i32 %22, %24
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = load i32, i32* %5
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %27)
br label %38
29: ; preds = %21
%30 = load i32, i32* %5
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %5
%33 = load i32, i32* %4
%34 = add nsw i32 %32, %33
store i32 %34, i32* %5
%35 = load i32, i32* %5
%36 = load i32, i32* %4
%37 = sub nsw i32 %35, %36
store i32 %37, i32* %4
br label %38
38: ; preds = %29, %26
br label %39
39: ; preds = %38, %19
br label %40
40: ; preds = %39, %14
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %7
43: ; preds = %7
%44 = load i32, i32* %1
ret i32 %44
}

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