#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*/ preencherFibonacci(double *, int);
int /*<<< orphan*/ printf(char *, int, double);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  double sequencia[61];
  int casos, indice;
  preencherFibonacci(sequencia, 61);
  scanf("%d", &casos);
  while (casos-- > 0) {
    scanf("%d", &indice);
    printf("Fib(%d) = %.0f\n", indice, sequencia[indice]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1f0(%rbp),%rdi
mov    $0x3d,%esi
call   1050 <preencherFibonacci@plt>
lea    0xea6(%rip),%rdi
lea    -0x1f4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x1f4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1f4(%rbp)
cmp    $0x0,%eax
jle    11ba <main+0x8a>
lea    0xe79(%rip),%rdi
lea    -0x1f8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x1f8(%rbp),%esi
movslq -0x1f8(%rbp),%rax
movsd  -0x1f0(%rbp,%rax,8),%xmm0
ff ff
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
jmp    1166 <main+0x36>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
lea    0x10(%rsp),%rdi
mov    $0x3d,%esi
call   1050 <preencherFibonacci@plt>
lea    0xeae(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x8(%rsp)
test   %eax,%eax
jle    11ad <main+0x7d>
lea    0xe8e(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xe85(%rip),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq 0xc(%rsp),%rsi
movsd  0x10(%rsp,%rsi,8),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x8(%rsp)
test   %eax,%eax
jg     1180 <main+0x50>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"Fib(%d) = %.0f\0A\00"
define i32 @main() {
%1 = alloca [61 x double]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [61 x double]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = getelementptr inbounds [61 x double], [61 x double]* %1, i64 0, i64 0
%8 = call i32 @preencherFibonacci(double* %7, i32 61)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
%12 = icmp sgt i32 %10, 0
br i1 %12, label %13, label %23
13: ; preds = %0, %13
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [61 x double], [61 x double]* %1, i64 0, i64 %16
%18 = load double, double* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %15, double %18)
%20 = load i32, i32* %2
%21 = add nsw i32 %20, -1
store i32 %21, i32* %2
%22 = icmp sgt i32 %20, 0
br i1 %22, label %13, label %23
23: ; preds = %13, %0
ret i32 0
}