#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 /*<<< orphan*/ scanf(char *, int *);
int sqrt(int);
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n, f = 1, i;
    scanf("%d", &n);
    int r = sqrt(n);
    for (i = 2; i < r; i++) {
      if (n % i == 0) {
        f = 0;
        break;
      }
    }
    f == 0 ? printf("no\n") : printf("yes\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11f3 <main+0xc3>
movl   $0x1,-0x10(%rbp)
lea    0xe8f(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,-0x18(%rbp)
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11c7 <main+0x97>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    11b4 <main+0x84>
movl   $0x0,-0x10(%rbp)
jmp    11c7 <main+0x97>
jmp    11b9 <main+0x89>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118c <main+0x5c>
cmpl   $0x0,-0x10(%rbp)
jne    11e2 <main+0xb2>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
jmp    11ee <main+0xbe>
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
jmp    114f <main+0x1f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x4(%rsp)
jae    115e <main+0x2e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe9b(%rip),%r14
mov    %rsp,%r15
lea    0xe94(%rip),%rbx
lea    0xe91(%rip),%r12
jmp    118f <main+0x5f>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
subl   $0x1,0x4(%rsp)
jb     1150 <main+0x20>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%edi
call   1050 <sqrt@plt>
mov    %rbx,%rdi
cmp    $0x3,%eax
jl     1183 <main+0x53>
mov    %eax,%ecx
mov    $0x2,%edi
mov    (%rsp),%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %esi,%eax
cltd
idiv   %edi
test   %edx,%edx
je     1180 <main+0x50>
add    $0x1,%edi
cmp    %edi,%ecx
jne    11c0 <main+0x90>
mov    %rbx,%rdi
jmp    1183 <main+0x53>

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

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