#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 main(void) {
  long c, f, l, i;
  c = 0;
  f = 3;
  i = 1;
  l = 2;
  printf("1, 2, ");
  while (c < 47) {
    printf("%ld, ", f);
    i = l;
    l = f;
    f = i + l;
    c++;
  }
  printf("%ld\n", f);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x3,-0x18(%rbp)
movq   $0x1,-0x28(%rbp)
movq   $0x2,-0x20(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x2f,-0x10(%rbp)
jge    1197 <main+0x87>
mov    -0x18(%rbp),%rsi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    114d <main+0x3d>
mov    -0x18(%rbp),%rsi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xee1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x3,%r15d
mov    $0x2,%r12d
mov    $0x2f,%ebx
lea    0xec9(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rax
add    %r15,%rax
mov    %r15,%r12
mov    %rax,%r15
add    $0xffffffffffffffff,%rbx
jne    1140 <main+0x30>
lea    0xea7(%rip),%rdi
movabs $0x4bdd96882,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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