#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 *, unsigned long long);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int N, Cont;
  unsigned long long int Result, Num;
  scanf("%d", &N);
  for (Cont = 0; Cont < N; Cont++) {
    scanf("%lld", &Num);
    if (Num % 4 == 0 || Num == 0)
      printf("1\n", Result);
    else if (Num % 4 == 3)
      printf("3\n", Result);
    else if (Num % 4 == 2)
      printf("9\n", Result);
    else if (Num % 4 == 1)
      printf("7\n", Result);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    122a <main+0x10a>
lea    0xea8(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x20(%rbp),%rax
and    $0x3,%rax
cmp    $0x0,%rax
je     1183 <main+0x63>
cmpq   $0x0,-0x20(%rbp)
jne    1198 <main+0x78>
mov    -0x18(%rbp),%rsi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
jmp    1217 <main+0xf7>
mov    -0x20(%rbp),%rax
and    $0x3,%rax
cmp    $0x3,%rax
jne    11bf <main+0x9f>
mov    -0x18(%rbp),%rsi
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
jmp    1212 <main+0xf2>
mov    -0x20(%rbp),%rax
and    $0x3,%rax
cmp    $0x2,%rax
jne    11e6 <main+0xc6>
mov    -0x18(%rbp),%rsi
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
jmp    120d <main+0xed>
mov    -0x20(%rbp),%rax
and    $0x3,%rax
cmp    $0x1,%rax
jne    1208 <main+0xe8>
mov    -0x18(%rbp),%rsi
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
jmp    120d <main+0xed>
jmp    1212 <main+0xf2>
jmp    1217 <main+0xf7>
jmp    121c <main+0xfc>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xecf(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    118a <main+0x6a>
lea    0xeb8(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xebd(%rip),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%rax
and    $0x3,%eax
movslq (%rbx,%rax,4),%rdi
add    %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     1160 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.2 = [3 x i8] c"1\0A\00"
@.str.3 = [3 x i8] c"3\0A\00"
@.str.4 = [3 x i8] c"9\0A\00"
@.str.5 = [3 x i8] c"7\0A\00"
@reltable.main = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.5 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.4 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = bitcast i32* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %0, %8
%9 = phi i32 [ %16, %8 ], [ 0, %0 ]
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%11 = load i64, i64* %2
%12 = and i64 %11, 3
%13 = shl i64 %12, 2
%14 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.main to i8*), i64 %13)
%15 = call i32 @printf(i8* %14, i64 undef)
%16 = add nuw nsw i32 %9, 1
%17 = load i32, i32* %1
%18 = icmp slt i32 %16, %17
br i1 %18, label %8, label %19
19: ; preds = %8, %0
ret i32 0
}