#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 main() {
  int i, count = 0, n;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    if (n % i == 0) {
      count++;
    }
  }
  if (count == 2) {
    printf("O número é primo\n");
  } else {
    printf("O número não é primo\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1185 <main+0x65>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    1172 <main+0x52>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1177 <main+0x57>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x2d>
cmpl   $0x2,-0xc(%rbp)
jne    11a0 <main+0x80>
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
jmp    11ac <main+0x8c>
lea    0xe70(%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>
mov    $0x1,%edi
xor    %esi,%esi
jmp    1183 <main+0x63>
mov    %r9d,%r8d
and    $0xfffffffe,%r8d
mov    $0x1,%edi
xor    %esi,%esi
nopl   0x0(%rax)
mov    %r9d,%eax
cltd
idiv   %edi
cmp    $0x1,%edx
adc    $0x0,%esi
lea    0x1(%rdi),%ecx
mov    %r9d,%eax
cltd
idiv   %ecx
cmp    $0x1,%edx
adc    $0x0,%esi
add    $0x2,%edi
cmp    %r8d,%ecx
jne    1160 <main+0x40>
test   $0x1,%r9b
je     1195 <main+0x75>
mov    %r9d,%eax
cltd
idiv   %edi
cmp    $0x1,%edx
adc    $0x0,%esi
cmp    $0x2,%esi
jne    11a3 <main+0x83>
lea    0xe7a(%rip),%rdi
jmp    11aa <main+0x8a>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [20 x i8] c"O n\C3\BAmero \C3\A9 primo\0A\00"
@.str.2 = [25 x i8] c"O n\C3\BAmero n\C3\A3o \C3\A9 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* %3
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 1, i32* %2
br label %6
6: ; preds = %19, %0
%7 = load i32, i32* %2
%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* %2
%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* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %18
18: ; preds = %15, %10
br label %19
19: ; preds = %18
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %6
22: ; preds = %6
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 2
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %29
27: ; preds = %22
%28 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [24 x i8] c"O n\C3\BAmero n\C3\A3o \C3\A9 primo\00"
@str.3 = [19 x i8] c"O n\C3\BAmero \C3\A9 primo\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 [ 0, %9 ], [ %23, %11 ]
%13 = phi i32 [ 1, %9 ], [ %24, %11 ]
%14 = phi i32 [ 0, %9 ], [ %25, %11 ]
%15 = srem i32 %4, %13
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
%18 = add nuw nsw i32 %12, %17
%19 = add nuw i32 %13, 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 %13, 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 [ 0, %6 ], [ %23, %11 ]
%30 = phi i32 [ 1, %6 ], [ %24, %11 ]
%31 = icmp eq i32 %7, 0
br i1 %31, label %37, label %32
32: ; preds = %27
%33 = srem i32 %4, %30
%34 = icmp eq i32 %33, 0
%35 = zext i1 %34 to i32
%36 = add nuw nsw i32 %29, %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 ([24 x i8], [24 x i8]* @str, i64 0, i64 0), %40 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.3, i64 0, i64 0), %37 ]
%43 = call i32 @puts(i8* dereferenceable(1) %42)
ret i32 0
}