#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 p = 0, i, n1;
  scanf("%d", &n1);
  for (i = 1; i <= n1; i = i + 1) {
    if ((n1 % i) == 0)
      p = p + 1;
  }
  if (p == 2)
    printf("%d e primo\n", n1);
  else
    printf("%d nao e primo\n", n1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1185 <main+0x65>
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1172 <main+0x52>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1177 <main+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <main+0x2d>
cmpl   $0x2,-0x8(%rbp)
jne    11a3 <main+0x83>
mov    -0x10(%rbp),%esi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <main+0x92>
mov    -0x10(%rbp),%esi
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%r9d
test   %r9d,%r9d
jle    11a3 <main+0x83>
cmp    $0x1,%r9d
jne    114b <main+0x2b>
xor    %ecx,%ecx
mov    $0x1,%edi
jmp    1183 <main+0x63>
mov    %r9d,%r8d
and    $0xfffffffe,%r8d
xor    %ecx,%ecx
mov    $0x1,%edi
nopl   0x0(%rax)
mov    %r9d,%eax
cltd
idiv   %edi
cmp    $0x1,%edx
adc    $0x0,%ecx
lea    0x1(%rdi),%esi
mov    %r9d,%eax
cltd
idiv   %esi
cmp    $0x1,%edx
adc    $0x0,%ecx
add    $0x2,%edi
cmp    %r8d,%esi
jne    1160 <main+0x40>
test   $0x1,%r9b
je     1195 <main+0x75>
mov    %r9d,%eax
cltd
idiv   %edi
cmp    $0x1,%edx
adc    $0x0,%ecx
cmp    $0x2,%ecx
jne    11a3 <main+0x83>
lea    0xe62(%rip),%rdi
jmp    11aa <main+0x8a>
lea    0xe65(%rip),%rdi
mov    %r9d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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