#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 */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fibonacci_dynamic(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, int /*<<< orphan*/);
int main() {
  int seq[10] = {1, 2, 3, 4, 5, 10, 25, 50, 75, 90};
  int c;
  for (c = 0; c < 10; c++) {
    uint64_t *fib = (uint64_t *)calloc(seq[c] + 1, sizeof(uint64_t));
    printf("fibonnaci number %d: %ld\n", seq[c],
           fibonacci_dynamic(seq[c], fib));
    free(fib);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe96(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11e2 <main+0x92>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
add    $0x1,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x44(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
mov    -0x40(%rbp),%rsi
call   1070 <fibonacci_dynamic@plt>
mov    -0x44(%rbp),%esi
mov    %eax,%edx
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    117b <main+0x2b>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
xor    %ebx,%ebx
lea    0xeae(%rip),%r13
lea    0xecf(%rip),%r14
nopl   0x0(%rax)
mov    (%rbx,%r13,1),%r12d
lea    0x1(%r12),%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r15
mov    %r12d,%edi
mov    %rax,%rsi
call   1060 <fibonacci_dynamic@plt>
mov    %r14,%rdi
mov    %r12d,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x4,%rbx
cmp    $0x28,%rbx
jne    1160 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.seq = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 10, i32 25, i32 50, i32 75, i32 90]
@.str = [26 x i8] c"fibonnaci number %d: %ld\0A\00"
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*
store i32 0, i32* %3
br label %6
6: ; preds = %30, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %33
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
%15 = call i64 @calloc(i32 %14, i32 4)
%16 = inttoptr i64 %15 to i32*
store i32* %16, i32** %4
%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
%20 = load i32, i32* %19
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = load i32*, i32** %4
%26 = call i32 @fibonacci_dynamic(i32 %24, i32* %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %26)
%28 = load i32*, i32** %4
%29 = call i32 @free(i32* %28)
br label %30
30: ; preds = %9
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %6
33: ; preds = %6
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@__const.main.seq = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 10, i32 25, i32 50, i32 75, i32 90]
@.str = [26 x i8] c"fibonnaci number %d: %ld\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i64 [ 0, %0 ], [ %11, %1 ]
%3 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.seq, i64 0, i64 %2
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
%6 = tail call i64 @calloc(i32 %5, i32 4)
%7 = inttoptr i64 %6 to i32*
%8 = tail call i32 @fibonacci_dynamic(i32 %4, i32* %7)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %8)
%10 = tail call i32 @free(i32* %7)
%11 = add nuw nsw i64 %2, 1
%12 = icmp eq i64 %11, 10
br i1 %12, label %13, label %1
13: ; preds = %1
ret i32 0
}