#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 count = 1;
  int first = 0;
  int next = 0;
  int second = 1;
  int userInput = 0;
  int userInput2 = 0;
  printf("This Program does Fibonacci Series Problem");
  printf("\nEnter number to be starting element: ");
  scanf("%d", &userInput);
  printf("Enter number of how many elemnt you want to print out: ");
  scanf("%d", &userInput2);
  while (count != userInput + userInput2) {
    if (count >= userInput) {
      printf("%d ", next);
    }
    first = first + second;
    second = next;
    next = first;
    count++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    -0x1c(%rbp),%ecx
cmp    %ecx,%eax
je     11f4 <main+0xd4>
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     11d1 <main+0xb1>
mov    -0x10(%rbp),%esi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a3 <main+0x83>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef9(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%ecx
lea    (%rcx,%rax,1),%edx
cmp    $0x1,%edx
jne    119b <main+0x7b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r15d
lea    0xee5(%rip),%r14
xor    %ebp,%ebp
mov    $0x1,%ebx
jmp    11d4 <main+0xb4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edx
add    %ebp,%edx
add    $0x1,%ebx
lea    (%rcx,%rax,1),%esi
mov    %ebp,%r15d
mov    %edx,%ebp
cmp    %esi,%ebx
je     118e <main+0x6e>
cmp    %eax,%ebx
jl     11c0 <main+0xa0>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%ecx
jmp    11c0 <main+0xa0>

LLVM IR (-O0):
@.str = [43 x i8] c"This Program does Fibonacci Series Problem\00"
@.str.1 = [39 x i8] c"\0AEnter number to be starting element: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [56 x i8] c"Enter number of how many elemnt you want to print out: \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
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 1, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
br label %13
13: ; preds = %26, %0
%14 = load i32, i32* %2
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = add nsw i32 %15, %16
%18 = icmp ne i32 %14, %17
br i1 %18, label %19, label %34
19: ; preds = %13
%20 = load i32, i32* %2
%21 = load i32, i32* %6
%22 = icmp sge i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %4
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23, %19
%27 = load i32, i32* %3
%28 = load i32, i32* %5
%29 = add nsw i32 %27, %28
store i32 %29, i32* %3
%30 = load i32, i32* %4
store i32 %30, i32* %5
%31 = load i32, i32* %3
store i32 %31, i32* %4
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %13
34: ; preds = %13
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [43 x i8] c"This Program does Fibonacci Series Problem\00"
@.str.1 = [39 x i8] c"\0AEnter number to be starting element: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [56 x i8] c"Enter number of how many elemnt you want to print out: \00"
@.str.4 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = add nsw i32 %11, %10
%13 = icmp eq i32 %12, 1
br i1 %13, label %32, label %14
14: ; preds = %0, %25
%15 = phi i32 [ %26, %25 ], [ %11, %0 ]
%16 = phi i32 [ %27, %25 ], [ %10, %0 ]
%17 = phi i32 [ %18, %25 ], [ 1, %0 ]
%18 = phi i32 [ %28, %25 ], [ 0, %0 ]
%19 = phi i32 [ %29, %25 ], [ 1, %0 ]
%20 = icmp slt i32 %19, %16
br i1 %20, label %25, label %21
21: ; preds = %14
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
br label %25
25: ; preds = %21, %14
%26 = phi i32 [ %24, %21 ], [ %15, %14 ]
%27 = phi i32 [ %23, %21 ], [ %16, %14 ]
%28 = add nsw i32 %17, %18
%29 = add nuw nsw i32 %19, 1
%30 = add nsw i32 %26, %27
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %14
32: ; preds = %25, %0
ret i32 0
}