#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 check(long);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  long T[10000];
  int n;
  scanf("%d", &n);
  int i;
  for (i = 0; i < n; i++)
    scanf("%ld", &T[i]);
  for (i = 0; i < n; i++) {
    if (check(T[i]) == 1)
      printf("1\n");
    else
      printf("0\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x138a0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x13894(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x13898(%rbp)
mov    -0x13898(%rbp),%eax
cmp    -0x13894(%rbp),%eax
jge    11aa <main+0x7a>
movslq -0x13898(%rbp),%rax
lea    -0x13890(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x13898(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13898(%rbp)
jmp    1161 <main+0x31>
movl   $0x0,-0x13898(%rbp)
mov    -0x13898(%rbp),%eax
cmp    -0x13894(%rbp),%eax
jge    1219 <main+0xe9>
movslq -0x13898(%rbp),%rax
mov    -0x13890(%rbp,%rax,8),%rdi
ff
call   1050 <check@plt>
cmp    $0x1,%eax
jne    11f4 <main+0xc4>
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
jmp    1200 <main+0xd0>
lea    0xe0f(%rip),%rdi
call   1030 <printf@plt>
jmp    1205 <main+0xd5>
mov    -0x13898(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13898(%rbp)
jmp    11b4 <main+0x84>
mov    -0x4(%rbp),%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    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11d7 <main+0xa7>
lea    0x10(%rsp),%r15
lea    0xe9d(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x8,%r15
cmp    %rax,%rbx
jl     1170 <main+0x40>
test   %eax,%eax
jle    11d7 <main+0xa7>
xor    %ebx,%ebx
lea    0xe6d(%rip),%r14
lea    0xe64(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x10(%rsp,%rbx,8),%rdi
call   1050 <check@plt>
cmp    $0x1,%eax
mov    %r15,%rdi
cmove  %r14,%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
cmp    %rax,%rbx
jl     11b0 <main+0x80>
xor    %eax,%eax
add    $0x13890,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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