#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, ...);
int main() {
  int a = 1;
  int b = 1;
  while (a < 10000) {
    printf("%i\n%i\n", a, b);
    a = a + b;
    b = a + b;
  }
  int x = 1;
  int y = 1;
  int z = 0;
  while (z < 10000) {
    x = y;
    y = z;
    z = x + y;
    printf("%i\n", z);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    1165 <main+0x55>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x2710,-0x18(%rbp)
jge    11b2 <main+0xa2>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117a <main+0x6a>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%ebx
lea    0xee0(%rip),%r14
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
add    %ebx,%ebp
add    %ebp,%ebx
cmp    $0x2710,%ebp
jl     1130 <main+0x20>
mov    $0x1,%ebx
lea    0xead(%rip),%r14
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
mov    %eax,%ebp
add    %eax,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%eax
cmp    $0x2710,%ebx
mov    %ebp,%ebx
jl     1160 <main+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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