#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(void) {
  int Fibonacci[40], i;
  Fibonacci[0] = 0;
  Fibonacci[1] = 1;
  for (i = 2; i < 40; ++i)
    Fibonacci[i] = Fibonacci[i - 2] + Fibonacci[i - 1];
  for (i = 0; i < 40; ++i)
    printf("%i ", Fibonacci[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xb0(%rbp)
movl   $0x1,-0xac(%rbp)
movl   $0x2,-0xb4(%rbp)
cmpl   $0x28,-0xb4(%rbp)
jge    1193 <main+0x83>
mov    -0xb4(%rbp),%eax
sub    $0x2,%eax
cltq
mov    -0xb0(%rbp,%rax,4),%ecx
mov    -0xb4(%rbp),%eax
sub    $0x1,%eax
cltq
add    -0xb0(%rbp,%rax,4),%ecx
movslq -0xb4(%rbp),%rax
mov    %ecx,-0xb0(%rbp,%rax,4)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1140 <main+0x30>
movl   $0x0,-0xb4(%rbp)
cmpl   $0x28,-0xb4(%rbp)
jge    11d8 <main+0xc8>
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,4),%esi
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    119d <main+0x8d>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xa8,%rsp
movabs $0x100000000,%rax
mov    %rax,(%rsp)
xor    %eax,%eax
mov    $0x1,%ecx
mov    $0x3,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %ecx,%eax
mov    %eax,-0x4(%rsp,%rdx,4)
add    %eax,%ecx
mov    %ecx,(%rsp,%rdx,4)
add    $0x2,%rdx
cmp    $0x29,%rdx
jne    1140 <main+0x30>
lea    0xea4(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x28,%rbx
jne    1170 <main+0x60>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i \00"
define i32 @main() {
%1 = alloca [40 x i32]
%2 = bitcast [40 x i32]* %1 to i8*
%3 = getelementptr inbounds [40 x i32], [40 x i32]* %1, i64 0, i64 0
store i32 0, i32* %3
%4 = getelementptr inbounds [40 x i32], [40 x i32]* %1, i64 0, i64 1
store i32 1, i32* %4
br label %5
5: ; preds = %5, %0
%6 = phi i32 [ 1, %0 ], [ %12, %5 ]
%7 = phi i32 [ 0, %0 ], [ %9, %5 ]
%8 = phi i64 [ 2, %0 ], [ %14, %5 ]
%9 = add nsw i32 %6, %7
%10 = getelementptr inbounds [40 x i32], [40 x i32]* %1, i64 0, i64 %8
store i32 %9, i32* %10
%11 = or i64 %8, 1
%12 = add nsw i32 %9, %6
%13 = getelementptr inbounds [40 x i32], [40 x i32]* %1, i64 0, i64 %11
store i32 %12, i32* %13
%14 = add nuw nsw i64 %8, 2
%15 = icmp eq i64 %14, 40
br i1 %15, label %16, label %5
16: ; preds = %5
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
br label %18
18: ; preds = %16, %18
%19 = phi i64 [ 1, %16 ], [ %23, %18 ]
%20 = getelementptr inbounds [40 x i32], [40 x i32]* %1, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = add nuw nsw i64 %19, 1
%24 = icmp eq i64 %23, 40
br i1 %24, label %25, label %18
25: ; preds = %18
ret i32 0
}