#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 *);
int main() {
  int start = 0, terms = 0, i = 0, num1 = 1, num2 = 0;
  int done = 0;
  do {
    printf("Enter two positive integers n1 and n2: ");
    scanf("%d %d", &start, &terms);
    if (terms > start && start > 0 && terms > 0)
      done = !done;
  } while (!done);
  start--;
  if (terms < 0 || terms > 47)
    printf("ERROR: Out of bounds");
  else {
    for (i = 0; i < terms; i++) {
      if (i % 2) {
        if (i >= start)
          printf("%d ", num1);
        num2 += num1;
      } else {
        if (i >= start)
          printf("%d ", num2);
        num1 += num2;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-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    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11ac <main+0x8c>
cmpl   $0x0,-0x8(%rbp)
jle    11ac <main+0x8c>
cmpl   $0x0,-0xc(%rbp)
jle    11ac <main+0x8c>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b1 <main+0x91>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1159 <main+0x39>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11df <main+0xbf>
cmpl   $0x2f,-0xc(%rbp)
jle    11f2 <main+0xd2>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1282 <main+0x162>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    127d <main+0x15d>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1244 <main+0x124>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1236 <main+0x116>
mov    -0x14(%rbp),%esi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    126a <main+0x14a>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1261 <main+0x141>
mov    -0x18(%rbp),%esi
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    126f <main+0x14f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f9 <main+0xd9>
jmp    1282 <main+0x162>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xec3(%rip),%r14
lea    0xee4(%rip),%r15
mov    %rsp,%rbx
lea    0x4(%rsp),%rbp
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1150 <main+0x30>
mov    (%rsp),%ecx
cmp    %ecx,%eax
jle    1150 <main+0x30>
test   %ecx,%ecx
jle    1150 <main+0x30>
add    $0xffffffff,%ecx
mov    %ecx,(%rsp)
cmp    $0x2f,%eax
jbe    11a1 <main+0x81>
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r15d
lea    0xe95(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11cc <main+0xac>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %ebp,%r15d
add    $0x1,%ebx
cmp    0x4(%rsp),%ebx
jge    1194 <main+0x74>
mov    (%rsp),%eax
test   $0x1,%bl
jne    11f0 <main+0xd0>
cmp    %eax,%ebx
jl     11c0 <main+0xa0>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11c0 <main+0xa0>
cs nopw 0x0(%rax,%rax,1)
cmp    %eax,%ebx
jl     1201 <main+0xe1>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    %r15d,%ebp
jmp    11c3 <main+0xa3>

LLVM IR (-O0):
@.str = [40 x i8] c"Enter two positive integers n1 and n2: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [21 x i8] c"ERROR: Out of bounds\00"
@.str.3 = [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 0, 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
br label %8
8: ; preds = %26, %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp sgt i32 %11, %12
br i1 %13, label %14, label %25
14: ; preds = %8
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i32, i32* %7
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
store i32 %24, i32* %7
br label %25
25: ; preds = %20, %17, %14, %8
br label %26
26: ; preds = %25
%27 = load i32, i32* %7
%28 = icmp ne i32 %27, 0
%29 = xor i1 %28, true
br i1 %29, label %8, label %30
30: ; preds = %26
%31 = load i32, i32* %2
%32 = add nsw i32 %31, -1
store i32 %32, i32* %2
%33 = load i32, i32* %3
%34 = icmp slt i32 %33, 0
br i1 %34, label %38, label %35
35: ; preds = %30
%36 = load i32, i32* %3
%37 = icmp sgt i32 %36, 47
br i1 %37, label %38, label %40
38: ; preds = %35, %30
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %76
40: ; preds = %35
store i32 0, i32* %4
br label %41
41: ; preds = %72, %40
%42 = load i32, i32* %4
%43 = load i32, i32* %3
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %75
45: ; preds = %41
%46 = load i32, i32* %4
%47 = srem i32 %46, 2
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %60
49: ; preds = %45
%50 = load i32, i32* %4
%51 = load i32, i32* %2
%52 = icmp sge i32 %50, %51
br i1 %52, label %53, label %56
53: ; preds = %49
%54 = load i32, i32* %5
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %53, %49
%57 = load i32, i32* %5
%58 = load i32, i32* %6
%59 = add nsw i32 %58, %57
store i32 %59, i32* %6
br label %71
60: ; preds = %45
%61 = load i32, i32* %4
%62 = load i32, i32* %2
%63 = icmp sge i32 %61, %62
br i1 %63, label %64, label %67
64: ; preds = %60
%65 = load i32, i32* %6
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %65)
br label %67
67: ; preds = %64, %60
%68 = load i32, i32* %6
%69 = load i32, i32* %5
%70 = add nsw i32 %69, %68
store i32 %70, i32* %5
br label %71
71: ; preds = %67, %56
br label %72
72: ; preds = %71
%73 = load i32, i32* %4
%74 = add nsw i32 %73, 1
store i32 %74, i32* %4
br label %41
75: ; preds = %41
br label %76
76: ; preds = %75, %38
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"Enter two positive integers n1 and n2: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [21 x i8] c"ERROR: Out of bounds\00"
@.str.3 = [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
br label %5
5: ; preds = %5, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = icmp sgt i32 %8, %9
%11 = icmp sgt i32 %9, 0
%12 = and i1 %10, %11
%13 = icmp sgt i32 %8, 0
%14 = and i1 %13, %12
br i1 %14, label %15, label %5
15: ; preds = %5
%16 = add nsw i32 %9, -1
store i32 %16, i32* %1
%17 = icmp ugt i32 %8, 47
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %44
20: ; preds = %15, %38
%21 = phi i32 [ %40, %38 ], [ 0, %15 ]
%22 = phi i32 [ %39, %38 ], [ 1, %15 ]
%23 = phi i32 [ %41, %38 ], [ 0, %15 ]
%24 = and i32 %23, 1
%25 = icmp eq i32 %24, 0
%26 = load i32, i32* %1
%27 = icmp slt i32 %23, %26
br i1 %25, label %33, label %28
28: ; preds = %20
br i1 %27, label %31, label %29
29: ; preds = %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %22)
br label %31
31: ; preds = %29, %28
%32 = add nsw i32 %21, %22
br label %38
33: ; preds = %20
br i1 %27, label %36, label %34
34: ; preds = %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %21)
br label %36
36: ; preds = %34, %33
%37 = add nsw i32 %21, %22
br label %38
38: ; preds = %31, %36
%39 = phi i32 [ %22, %31 ], [ %37, %36 ]
%40 = phi i32 [ %32, %31 ], [ %21, %36 ]
%41 = add nuw nsw i32 %23, 1
%42 = load i32, i32* %2
%43 = icmp slt i32 %41, %42
br i1 %43, label %20, label %44
44: ; preds = %38, %18
ret i32 0
}