#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  int i, j, num, maxSuspect;
  int isPrime;
  for (i = 0; i < n; i++) {
    scanf("%d", &num);
    maxSuspect = num / 2;
    isPrime = 1;
    for (j = 2; isPrime && j <= maxSuspect; j++)
      if (num % j == 0)
        isPrime = 0;
    if (isPrime)
      printf("%d eh primo\n", num);
    else
      printf("%d nao eh primo\n", num);
  }
  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
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1213 <main+0xf3>
lea    0xea7(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x2,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
je     1199 <main+0x79>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
setle  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    11a9 <main+0x89>
jmp    11d3 <main+0xb3>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11c0 <main+0xa0>
movl   $0x0,-0x1c(%rbp)
jmp    11c5 <main+0xa5>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117e <main+0x5e>
cmpl   $0x0,-0x1c(%rbp)
je     11f1 <main+0xd1>
mov    -0x14(%rbp),%esi
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
jmp    1200 <main+0xe0>
mov    -0x14(%rbp),%esi
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
jmp    1205 <main+0xe5>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x26>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11c4 <main+0xa4>
xor    %ebp,%ebp
lea    0xeaf(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xea6(%rip),%rbx
lea    0xeac(%rip),%r12
jmp    1187 <main+0x67>
cs nopw 0x0(%rax,%rax,1)
test   %edx,%edx
mov    %r12,%rdi
cmovne %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
jge    11c4 <main+0xa4>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
cmp    $0x4,%esi
jl     1179 <main+0x59>
mov    %esi,%ecx
shr    $0x1f,%ecx
add    %esi,%ecx
sar    %ecx
mov    $0x2,%edi
nopl   0x0(%rax)
mov    %esi,%eax
cltd
idiv   %edi
test   %edx,%edx
je     1170 <main+0x50>
lea    0x1(%rdi),%eax
cmp    %ecx,%edi
mov    %eax,%edi
jl     11b0 <main+0x90>
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"%d eh primo\0A\00"
@.str.2 = [17 x i8] c"%d nao eh primo\0A\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 = bitcast i32* %2 to i8*
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %29
8: ; preds = %0, %23
%9 = phi i32 [ %26, %23 ], [ 0, %0 ]
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 2
%13 = icmp sgt i32 %11, 3
br i1 %13, label %14, label %23
14: ; preds = %8, %14
%15 = phi i32 [ %18, %14 ], [ 2, %8 ]
%16 = srem i32 %11, %15
%17 = icmp ne i32 %16, 0
%18 = add nuw nsw i32 %15, 1
%19 = icmp slt i32 %15, %12
%20 = and i1 %17, %19
br i1 %20, label %14, label %21
21: ; preds = %14
%22 = select i1 %17, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0)
br label %23
23: ; preds = %21, %8
%24 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %8 ], [ %22, %21 ]
%25 = call i32 @printf(i8* %24, i32 %11)
%26 = add nuw nsw i32 %9, 1
%27 = load i32, i32* %1
%28 = icmp slt i32 %26, %27
br i1 %28, label %8, label %29
29: ; preds = %23, %0
ret i32 0
}