#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 EXIT_SUCCESS;
int /*<<< orphan*/ checkInput(int *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int n, first = 0, second = 1, next, ctr;
  printf("Enter the number of terms: ");
  checkInput(&n);
  for (ctr = 0; ctr < n; ctr++) {
    if (ctr <= 1)
      next = ctr;
    else {
      next = first + second;
      first = second;
      second = next;
    }
    printf("%d ", next);
  }
  return (EXIT_SUCCESS);
}


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)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1040 <checkInput@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b0 <main+0x90>
cmpl   $0x1,-0x18(%rbp)
jg     117c <main+0x5c>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1191 <main+0x71>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115b <main+0x3b>
mov    0x2e29(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
call   1040 <checkInput@plt>
cmpl   $0x0,0x4(%rsp)
jle    1184 <main+0x64>
mov    $0x1,%ebx
lea    0xeca(%rip),%r14
xor    %ebp,%ebp
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
lea    (%rbx,%r15,1),%esi
cmp    $0x2,%ebp
cmovae %ebx,%r15d
cmovae %esi,%ebx
cmovb  %ebp,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     1160 <main+0x40>
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Enter the number of terms: \00"
@.str.1 = [4 x i8] c"%d \00"
@EXIT_SUCCESS = global i32 0
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
store i32 0, i32* %3
store i32 1, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @checkInput(i32* %2)
store i32 0, i32* %6
br label %9
9: ; preds = %27, %0
%10 = load i32, i32* %6
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %30
13: ; preds = %9
%14 = load i32, i32* %6
%15 = icmp sle i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = load i32, i32* %6
store i32 %17, i32* %5
br label %24
18: ; preds = %13
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = add nsw i32 %19, %20
store i32 %21, i32* %5
%22 = load i32, i32* %4
store i32 %22, i32* %3
%23 = load i32, i32* %5
store i32 %23, i32* %4
br label %24
24: ; preds = %18, %16
%25 = load i32, i32* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %24
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %9
30: ; preds = %9
%31 = load i32, i32* @EXIT_SUCCESS
ret i32 %31
}

LLVM IR (-O2):
@.str = [28 x i8] c"Enter the number of terms: \00"
@.str.1 = [4 x i8] c"%d \00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @checkInput(i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %0, %7
%8 = phi i32 [ %17, %7 ], [ 0, %0 ]
%9 = phi i32 [ %14, %7 ], [ 1, %0 ]
%10 = phi i32 [ %13, %7 ], [ 0, %0 ]
%11 = icmp ult i32 %8, 2
%12 = add nsw i32 %9, %10
%13 = select i1 %11, i32 %10, i32 %9
%14 = select i1 %11, i32 %9, i32 %12
%15 = select i1 %11, i32 %8, i32 %12
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = add nuw nsw i32 %8, 1
%18 = load i32, i32* %1
%19 = icmp slt i32 %17, %18
br i1 %19, label %7, label %20
20: ; preds = %7, %0
%21 = load i32, i32* @EXIT_SUCCESS
ret i32 %21
}