#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 multiply(int *, int, int);
int /*<<< orphan*/ print_int(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int result[200], m, i, n, t;
  scanf("%d", &t);
  while (t > 0) {
    t--;
    scanf("%d", &n);
    m = 1;
    result[0] = 1;
    for (i = 2; i <= n; i++)
      m = multiply(result, i, m);
    print_int(result, m);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x340(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0x340(%rbp)
jle    1219 <main+0xd9>
mov    -0x340(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x340(%rbp)
lea    0xe78(%rip),%rdi
lea    -0x33c(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x1,-0x334(%rbp)
movl   $0x1,-0x330(%rbp)
movl   $0x2,-0x338(%rbp)
mov    -0x338(%rbp),%eax
cmp    -0x33c(%rbp),%eax
jg     11f6 <main+0xb6>
lea    -0x330(%rbp),%rdi
mov    -0x338(%rbp),%esi
mov    -0x334(%rbp),%edx
call   1030 <multiply@plt>
mov    %eax,-0x334(%rbp)
mov    -0x338(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x338(%rbp)
jmp    11b2 <main+0x72>
lea    -0x330(%rbp),%rdi
mov    -0x334(%rbp),%esi
call   1050 <print_int@plt>
lea    0xdf4(%rip),%rdi
call   1040 <printf@plt>
jmp    1165 <main+0x25>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x338,%rsp
lea    0xeac(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    11e7 <main+0xa7>
lea    0xe8f(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%rbx
jmp    119c <main+0x5c>
nopl   (%rax)
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <print_int@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    11e7 <main+0xa7>
add    $0xffffffff,%eax
mov    %eax,0x8(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
movl   $0x1,0x10(%rsp)
mov    $0x1,%eax
cmpl   $0x2,0xc(%rsp)
jl     1180 <main+0x40>
mov    $0x1,%ebp
mov    $0x1,%eax
nopl   0x0(%rax)
add    $0x1,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1040 <multiply@plt>
cmp    0xc(%rsp),%ebp
jl     11d0 <main+0x90>
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0x338,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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