#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 n, count = 0;
  printf("Informe um numero positovo\n");
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    if (n % i == 0) {
      count++;
    }
    if (count > 2) {
      break;
    }
  }
  if (count > 2) {
    printf("Não é primo\n");
  } else {
    printf("É 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
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11a0 <main+0x80>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    117e <main+0x5e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jle    118d <main+0x6d>
jmp    11a0 <main+0x80>
jmp    1192 <main+0x72>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1159 <main+0x39>
cmpl   $0x2,-0xc(%rbp)
jle    11bb <main+0x9b>
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
jmp    11c7 <main+0xa7>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%r10d
lea    0xed4(%rip),%rdi
test   %r10d,%r10d
jle    1195 <main+0x75>
mov    %r10d,%r8d
neg    %r8d
xor    %esi,%esi
mov    $0x1,%ecx
lea    0xec4(%rip),%r9
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r10d,%eax
cltd
idiv   %ecx
cmp    $0x1,%edx
adc    $0x0,%esi
cmp    $0x3,%esi
jae    1192 <main+0x72>
lea    (%r8,%rcx,1),%eax
add    $0x1,%eax
add    $0x1,%ecx
cmp    $0x1,%eax
jne    1170 <main+0x50>
jmp    1195 <main+0x75>
mov    %r9,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Informe um numero positovo\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"N\C3\A3o \C3\A9 primo\0A\00"
@.str.3 = [10 x i8] c"\C3\89 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 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 1, i32* %4
br label %7
7: ; preds = %24, %0
%8 = load i32, i32* %4
%9 = load i32, i32* %2
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %27
11: ; preds = %7
%12 = load i32, i32* %2
%13 = load i32, i32* %4
%14 = srem i32 %12, %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %19
19: ; preds = %16, %11
%20 = load i32, i32* %3
%21 = icmp sgt i32 %20, 2
br i1 %21, label %22, label %23
22: ; preds = %19
br label %27
23: ; preds = %19
br label %24
24: ; preds = %23
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %7
27: ; preds = %22, %7
%28 = load i32, i32* %3
%29 = icmp sgt i32 %28, 2
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %34
32: ; preds = %27
%33 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [27 x i8] c"Informe um numero positovo\00"
@str.4 = [9 x i8] c"\C3\89 primo\00"
@str.5 = [14 x i8] c"N\C3\A3o \C3\A9 primo\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1
br i1 %6, label %18, label %10
7: ; preds = %10
%8 = add nuw i32 %11, 1
%9 = icmp eq i32 %11, %5
br i1 %9, label %18, label %10
10: ; preds = %0, %7
%11 = phi i32 [ %8, %7 ], [ 1, %0 ]
%12 = phi i32 [ %16, %7 ], [ 0, %0 ]
%13 = srem i32 %5, %11
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = add nuw nsw i32 %12, %15
%17 = icmp ugt i32 %16, 2
br i1 %17, label %18, label %7
18: ; preds = %7, %10, %0
%19 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0), %0 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @str.5, i64 0, i64 0), %10 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0), %7 ]
%20 = call i32 @puts(i8* dereferenceable(1) %19)
ret i32 0
}