#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 *, long, ...);
int main() {
  long i = 2;
  long i2 = 1;
  long i3;
  int n;
  int b = 0;
  int n_max = 100;
  printf("%ld\n%ld\n", i, i2);
  for (n = 2; n < n_max; n++) {
    i3 = i + i2;
    if (b == 0) {
      b = 1;
      i = i3;
    } else {
      b = 0;
      i2 = i3;
    }
    printf("%ld\n", i3);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x2,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x64,-0x2c(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11bf <main+0xaf>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x28(%rbp)
jne    1190 <main+0x80>
movl   $0x1,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    119f <main+0x8f>
movl   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115a <main+0x4a>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xee1(%rip),%rdi
mov    $0x2,%r15d
mov    $0x1,%ebx
mov    $0x2,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x62,%r12d
lea    0xebc(%rip),%r14
xor    %eax,%eax
xor    %ebp,%ebp
nopl   0x0(%rax)
lea    (%r15,%rbx,1),%rsi
xor    $0x1,%ebp
test   %eax,%eax
cmovne %rsi,%rbx
cmove  %rsi,%r15
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%eax
add    $0xffffffff,%r12d
jne    1150 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%ld\0A%ld\0A\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 2, i64 1)
br label %2
2: ; preds = %0, %2
%3 = phi i64 [ 2, %0 ], [ %11, %2 ]
%4 = phi i32 [ 0, %0 ], [ %10, %2 ]
%5 = phi i32 [ 2, %0 ], [ %13, %2 ]
%6 = phi i64 [ 1, %0 ], [ %9, %2 ]
%7 = add nsw i64 %3, %6
%8 = icmp eq i32 %4, 0
%9 = select i1 %8, i64 %6, i64 %7
%10 = xor i32 %4, 1
%11 = select i1 %8, i64 %7, i64 %3
%12 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %7)
%13 = add nuw nsw i32 %5, 1
%14 = icmp eq i32 %13, 100
br i1 %14, label %15, label %2
15: ; preds = %2
ret i32 0
}