#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*/ flushall();
int /*<<< orphan*/ getchar();
int next_five_terms(int);
int /*<<< orphan*/ output(int);
main() {
  int fibonacci[10] = {0, 1, 1, 2, 3};
  int i;
  int n = 0;
  for (i = 4; i < 10; i++) {
    fibonacci[i] = next_five_terms(n);
  }
  for (i = 0; i < 10; i++) {
    output(fibonacci[i]);
  }
  flushall();
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x1,-0x2c(%rbp)
movl   $0x1,-0x28(%rbp)
movl   $0x2,-0x24(%rbp)
movl   $0x3,-0x20(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x4,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11c3 <main+0x73>
mov    -0x38(%rbp),%edi
call   1070 <next_five_terms@plt>
mov    %eax,%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1199 <main+0x49>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11ef <main+0x9f>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   1030 <output@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ca <main+0x7a>
mov    $0x0,%al
call   1050 <flushall@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <next_five_terms@plt>
mov    %eax,%r14d
xor    %edi,%edi
call   1060 <next_five_terms@plt>
mov    %eax,%r15d
xor    %edi,%edi
call   1060 <next_five_terms@plt>
mov    %eax,%r12d
xor    %edi,%edi
call   1060 <next_five_terms@plt>
mov    %eax,%r13d
xor    %edi,%edi
call   1060 <next_five_terms@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1060 <next_five_terms@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   1030 <output@plt>
mov    $0x1,%edi
call   1030 <output@plt>
mov    $0x1,%edi
call   1030 <output@plt>
mov    $0x2,%edi
call   1030 <output@plt>
mov    %r14d,%edi
call   1030 <output@plt>
mov    %r15d,%edi
call   1030 <output@plt>
mov    %r12d,%edi
call   1030 <output@plt>
mov    %r13d,%edi
call   1030 <output@plt>
mov    %ebx,%edi
call   1030 <output@plt>
mov    %ebp,%edi
call   1030 <output@plt>
xor    %eax,%eax
call   1040 <flushall@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @next_five_terms(i32 0)
%2 = tail call i32 @next_five_terms(i32 0)
%3 = tail call i32 @next_five_terms(i32 0)
%4 = tail call i32 @next_five_terms(i32 0)
%5 = tail call i32 @next_five_terms(i32 0)
%6 = tail call i32 @next_five_terms(i32 0)
%7 = tail call i32 @output(i32 0)
%8 = tail call i32 @output(i32 1)
%9 = tail call i32 @output(i32 1)
%10 = tail call i32 @output(i32 2)
%11 = tail call i32 @output(i32 %1)
%12 = tail call i32 @output(i32 %2)
%13 = tail call i32 @output(i32 %3)
%14 = tail call i32 @output(i32 %4)
%15 = tail call i32 @output(i32 %5)
%16 = tail call i32 @output(i32 %6)
%17 = tail call i32 (...) @flushall()
%18 = tail call i32 (...) @getchar()
ret i32 0
}