main() {
  int n, first = 0, second = 1, next, c;
  n = 10;
  for (c = 0; c < n; c++) {
    if (c <= 1)
      next = c;
    else {
      next = first + second;
      first = second;
      second = next;
    }
    printf(next);
  }
}


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)
movl   $0xa,-0x8(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118a <main+0x7a>
cmpl   $0x1,-0x18(%rbp)
jg     115c <main+0x4c>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1171 <main+0x61>
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)
movslq -0x14(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113b <main+0x2b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x2,%edi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x3,%edi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x5,%edi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x8,%edi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xd,%edi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x15,%edi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x22,%edi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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
store i32 10, i32* %2
store i32 0, i32* %6
br label %7
7: ; preds = %27, %0
%8 = load i32, i32* %6
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %30
11: ; preds = %7
%12 = load i32, i32* %6
%13 = icmp sle i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = load i32, i32* %6
store i32 %15, i32* %5
br label %22
16: ; preds = %11
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = add nsw i32 %17, %18
store i32 %19, i32* %5
%20 = load i32, i32* %4
store i32 %20, i32* %3
%21 = load i32, i32* %5
store i32 %21, i32* %4
br label %22
22: ; preds = %16, %14
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i8*
%26 = call i32 (i8*, ...) @printf(i8* %25)
br label %27
27: ; preds = %22
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %7
30: ; preds = %7
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) null)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) inttoptr (i64 1 to i8*))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) inttoptr (i64 1 to i8*))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) inttoptr (i64 2 to i8*))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) inttoptr (i64 3 to i8*))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) inttoptr (i64 5 to i8*))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) inttoptr (i64 8 to i8*))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) inttoptr (i64 13 to i8*))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) inttoptr (i64 21 to i8*))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) inttoptr (i64 34 to i8*))
ret i32 0
}