#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 *, long long);
int /*<<< orphan*/ scanf(char *, long long *);
int main() {
  long long fact(long long);
  long long t;
  long long a[10000];
  long long i;
  scanf("%Ld", &t);
  for (i = 0; i < t; i++) {
    scanf("%Ld", &a[i]);
  }
  for (i = 0; i < t; i++) {
    printf("%Ld\n", fact(a[i]));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x138a0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movq   $0x0,-0x13898(%rbp)
mov    -0x13898(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    11a6 <main+0x76>
mov    -0x13898(%rbp),%rax
lea    -0x13890(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe76(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x13898(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x13898(%rbp)
jmp    115d <main+0x2d>
movq   $0x0,-0x13898(%rbp)
mov    -0x13898(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    11fc <main+0xcc>
mov    -0x13898(%rbp),%rax
mov    -0x13890(%rbp,%rax,8),%rdi
ff
call   1040 <fact@plt>
mov    %rax,%rsi
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
mov    -0x13898(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x13898(%rbp)
jmp    11b1 <main+0x81>
xor    %eax,%eax
add    $0x138a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x13890,%rsp
lea    0xebd(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
cmpq   $0x0,0x8(%rsp)
jle    11c0 <main+0x90>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe9d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
mov    0x8(%rsp),%rax
add    $0x8,%r15
cmp    %rax,%rbx
jl     1170 <main+0x40>
test   %rax,%rax
jle    11c0 <main+0x90>
xor    %ebx,%ebx
lea    0xe69(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp,%rbx,8),%rdi
call   1040 <fact@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    0x8(%rsp),%rbx
jl     11a0 <main+0x70>
xor    %eax,%eax
add    $0x13890,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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