#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 j, N, X, i = 0, resu[1000][2], cont_r = -1;
  scanf("%d", &N);
  while (i < N) {
    cont_r++;
    scanf(" %d", &X);
    resu[cont_r][0] = X;
    j = 2;
    while (j <= X) {
      if (X % j == 0)
        break;
      j++;
    }
    if (j == X)
      resu[cont_r][1] = 1;
    else
      resu[cont_r][1] = 0;
    i++;
  }
  i = 0;
  while (i <= cont_r) {
    if (resu[i][1] == 1)
      printf("%d eh primo\n", resu[i][0]);
    else
      printf("%d nao eh primo\n", resu[i][0]);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0xffffffff,-0x1f64(%rbp)
ff ff ff
lea    0xeb7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1208 <main+0xe8>
mov    -0x1f64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f64(%rbp)
lea    0xe8b(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%ecx
movslq -0x1f64(%rbp),%rax
mov    %ecx,-0x1f60(%rbp,%rax,8)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11c5 <main+0xa5>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    11b7 <main+0x97>
jmp    11c5 <main+0xa5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1196 <main+0x76>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11e8 <main+0xc8>
movslq -0x1f64(%rbp),%rax
movl   $0x1,-0x1f5c(%rbp,%rax,8)
jmp    11fa <main+0xda>
movslq -0x1f64(%rbp),%rax
movl   $0x0,-0x1f5c(%rbp,%rax,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <main+0x33>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1f64(%rbp),%eax
jg     1271 <main+0x151>
movslq -0x14(%rbp),%rax
cmpl   $0x1,-0x1f5c(%rbp,%rax,8)
01
jne    124c <main+0x12c>
movslq -0x14(%rbp),%rax
mov    -0x1f60(%rbp,%rax,8),%esi
lea    0xdc2(%rip),%rdi
call   1030 <printf@plt>
jmp    1263 <main+0x143>
movslq -0x14(%rbp),%rax
mov    -0x1f60(%rbp,%rax,8),%esi
lea    0xdb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    120f <main+0xef>
xor    %eax,%eax
add    $0x1f70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1f58,%rsp
lea    0xec9(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    122d <main+0x10d>
xor    %ebp,%ebp
mov    $0xffffffffffffffff,%r12
mov    $0x1,%eax
lea    0xe9e(%rip),%r14
lea    0xc(%rsp),%r15
jmp    1184 <main+0x64>
nopl   0x0(%rax)
xor    %eax,%eax
mov    %eax,0x14(%rsp,%r12,8)
add    $0x1,%ebp
lea    0x1(%r13),%rax
cmp    0x8(%rsp),%ebp
jge    11ed <main+0xcd>
mov    %r12,%rbx
mov    %rax,%r13
add    $0x1,%r12
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    %ecx,0x18(%rsp,%rbx,8)
mov    $0x2,%esi
cmp    $0x2,%ecx
jge    11c0 <main+0xa0>
mov    $0x1,%eax
cmp    %ecx,%esi
jne    1170 <main+0x50>
jmp    1172 <main+0x52>
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,%edi
neg    %edi
mov    $0x2,%esi
nopl   0x0(%rax)
mov    %ecx,%eax
cltd
idiv   %esi
test   %edx,%edx
je     11ab <main+0x8b>
lea    (%rdi,%rsi,1),%eax
add    $0x1,%eax
mov    %esi,%edx
add    $0x1,%edx
mov    %edx,%esi
cmp    $0x1,%eax
jne    11d0 <main+0xb0>
jmp    1170 <main+0x50>
test   $0x80000000,%r12d
jne    122d <main+0x10d>
lea    0x14(%rsp),%rbp
lea    0xe02(%rip),%r14
lea    0xe08(%rip),%r15
nopl   0x0(%rax)
mov    -0x4(%rbp),%esi
cmpl   $0x1,0x0(%rbp)
mov    %r15,%rdi
cmove  %r14,%rdi
call   1030 <printf@plt>
add    $0x8,%rbp
add    $0xffffffffffffffff,%r13
jne    1210 <main+0xf0>
xor    %eax,%eax
add    $0x1f58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [13 x i8] c"%d eh primo\0A\00"
@.str.3 = [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 [1000 x [2 x i32]]
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 -1, i32* %7
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %9
9: ; preds = %49, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %52
13: ; preds = %9
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
store i32 %15, i32* %7
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = load i32, i32* %4
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [1000 x [2 x i32]], [1000 x [2 x i32]]* %6, i64 0, i64 %19
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %20, i64 0, i64 0
store i32 %17, i32* %21
store i32 2, i32* %2
br label %22
22: ; preds = %32, %13
%23 = load i32, i32* %2
%24 = load i32, i32* %4
%25 = icmp sle i32 %23, %24
br i1 %25, label %26, label %35
26: ; preds = %22
%27 = load i32, i32* %4
%28 = load i32, i32* %2
%29 = srem i32 %27, %28
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %26
br label %35
32: ; preds = %26
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %22
35: ; preds = %31, %22
%36 = load i32, i32* %2
%37 = load i32, i32* %4
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %44
39: ; preds = %35
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [1000 x [2 x i32]], [1000 x [2 x i32]]* %6, i64 0, i64 %41
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %42, i64 0, i64 1
store i32 1, i32* %43
br label %49
44: ; preds = %35
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [1000 x [2 x i32]], [1000 x [2 x i32]]* %6, i64 0, i64 %46
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %47, i64 0, i64 1
store i32 0, i32* %48
br label %49
49: ; preds = %44, %39
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %9
52: ; preds = %9
store i32 0, i32* %5
br label %53
53: ; preds = %78, %52
%54 = load i32, i32* %5
%55 = load i32, i32* %7
%56 = icmp sle i32 %54, %55
br i1 %56, label %57, label %81
57: ; preds = %53
%58 = load i32, i32* %5
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [1000 x [2 x i32]], [1000 x [2 x i32]]* %6, i64 0, i64 %59
%61 = getelementptr inbounds [2 x i32], [2 x i32]* %60, i64 0, i64 1
%62 = load i32, i32* %61
%63 = icmp eq i32 %62, 1
br i1 %63, label %64, label %71
64: ; preds = %57
%65 = load i32, i32* %5
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [1000 x [2 x i32]], [1000 x [2 x i32]]* %6, i64 0, i64 %66
%68 = getelementptr inbounds [2 x i32], [2 x i32]* %67, i64 0, i64 0
%69 = load i32, i32* %68
%70 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %69)
br label %78
71: ; preds = %57
%72 = load i32, i32* %5
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [1000 x [2 x i32]], [1000 x [2 x i32]]* %6, i64 0, i64 %73
%75 = getelementptr inbounds [2 x i32], [2 x i32]* %74, i64 0, i64 0
%76 = load i32, i32* %75
%77 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %76)
br label %78
78: ; preds = %71, %64
%79 = load i32, i32* %5
%80 = add nsw i32 %79, 1
store i32 %80, i32* %5
br label %53
81: ; preds = %53
ret i32 0
}

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