#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, T;
  int i;
  int a, b, c;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    a = 0, b = 1;
    for (i = 1; i <= n; i++) {
      if (i == n)
        printf("%d\n", a);
      c = a + b;
      a = b;
      b = c;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     11c7 <main+0xa7>
lea    0xea6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11c2 <main+0xa2>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    119f <main+0x7f>
mov    -0x14(%rbp),%esi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1178 <main+0x58>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
subl   $0x1,(%rsp)
jae    1151 <main+0x31>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea8(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xe9f(%rip),%r12
jmp    1176 <main+0x56>
cs nopw 0x0(%rax,%rax,1)
subl   $0x1,(%rsp)
jb     1140 <main+0x20>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1170 <main+0x50>
mov    $0x1,%ecx
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    11ac <main+0x8c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %r13d,%ebp
mov    %ebp,%ecx
mov    %r13d,%ebp
cmp    %eax,%ebx
jge    1170 <main+0x50>
mov    %ecx,%r13d
add    $0x1,%ebx
cmp    %eax,%ebx
jne    11a0 <main+0x80>
mov    %r12,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
jmp    11a0 <main+0x80>

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

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