#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 /*<<< orphan*/ scanf(char *, long *, long *);
int main() {
  long fib_number[40] = {};
  printf("Please enter two number:");
  scanf("%ld %ld", &fib_number[0], &fib_number[1]);
  for (int i = 2; i < 40; i++) {
    fib_number[i] = fib_number[i - 1] + fib_number[i - 2];
  }
  for (int i = 0; i < 40; i++) {
    printf("%ld\n", fib_number[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x150(%rbp),%rdi
xor    %esi,%esi
mov    $0x140,%edx
call   1040 <memset@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x150(%rbp),%rsi
lea    -0x150(%rbp),%rdx
add    $0x8,%rdx
lea    0xe9d(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x2,-0x154(%rbp)
cmpl   $0x28,-0x154(%rbp)
jge    11e1 <main+0xb1>
mov    -0x154(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x150(%rbp,%rax,8),%rcx
ff
mov    -0x154(%rbp),%eax
sub    $0x2,%eax
cltq
add    -0x150(%rbp,%rax,8),%rcx
ff
movslq -0x154(%rbp),%rax
mov    %rcx,-0x150(%rbp,%rax,8)
ff
mov    -0x154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x154(%rbp)
jmp    118b <main+0x5b>
movl   $0x0,-0x158(%rbp)
cmpl   $0x28,-0x158(%rbp)
jge    1229 <main+0xf9>
movslq -0x158(%rbp),%rax
mov    -0x150(%rbp,%rax,8),%rsi
ff
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
jmp    11eb <main+0xbb>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x148,%rsp
mov    %rsp,%rbx
mov    $0x140,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rdx
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    $0x3,%eax
mov    0x8(%rsp),%rcx
nopl   0x0(%rax,%rax,1)
add    -0x18(%rsp,%rax,8),%rcx
mov    %rcx,-0x8(%rsp,%rax,8)
add    -0x10(%rsp,%rax,8),%rcx
mov    %rcx,(%rsp,%rax,8)
add    $0x2,%rax
cmp    $0x29,%rax
jne    1180 <main+0x50>
lea    0xe7d(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x28,%rbx
jne    11b0 <main+0x80>
xor    %eax,%eax
add    $0x148,%rsp
pop    %rbx
pop    %r14
ret

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

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