#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 *);
main() {
  int i, num, vezes = 0;
  printf("*** Verifica se o n%cmero %c "
         "primo ***\n",
         163, 130);
  printf("\nDigite um n%cmero inteiro: \n\n", 163);
  scanf("%d", &num);
  printf("\n\n\n");
  for (i = 1; i <= num; i++) {
    if (num % i == 0)
      vezes++;
  }
  if (vezes == 2)
    printf("\nO n%cmero %d %c primo.\n", 163, num, 130);
  else
    printf("O n%cmero %d n%co %c primo.", 163, num, 198, 130);
  printf("\n\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0xa3,%esi
mov    $0x82,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0xa3,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11be <main+0x9e>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    11ab <main+0x8b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b0 <main+0x90>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1186 <main+0x66>
cmpl   $0x2,-0x10(%rbp)
jne    11e8 <main+0xc8>
mov    -0xc(%rbp),%edx
lea    0xe7c(%rip),%rdi
mov    $0xa3,%esi
mov    $0x82,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1209 <main+0xe9>
mov    -0xc(%rbp),%edx
lea    0xe75(%rip),%rdi
mov    $0xa3,%esi
mov    $0xc6,%ecx
mov    $0x82,%r8d
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %ebx,%ebx
mov    $0xa3,%esi
mov    $0x82,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
mov    $0xa3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xede(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
jle    1202 <main+0xd2>
cmp    $0x1,%ecx
jne    1193 <main+0x63>
mov    $0x1,%esi
jmp    11d1 <main+0xa1>
mov    %ecx,%r8d
and    $0xfffffffe,%r8d
mov    $0x1,%esi
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ecx,%eax
cltd
idiv   %esi
cmp    $0x1,%edx
adc    $0x0,%ebx
lea    0x1(%rsi),%edi
mov    %ecx,%eax
cltd
idiv   %edi
cmp    $0x1,%edx
adc    $0x0,%ebx
add    $0x2,%esi
cmp    %r8d,%edi
jne    11b0 <main+0x80>
test   $0x1,%cl
je     11e1 <main+0xb1>
mov    %ecx,%eax
cltd
idiv   %esi
cmp    $0x1,%edx
adc    $0x0,%ebx
cmp    $0x2,%ebx
jne    1202 <main+0xd2>
lea    0xe5d(%rip),%rdi
mov    $0xa3,%esi
mov    %ecx,%edx
mov    $0x82,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1222 <main+0xf2>
lea    0xe5a(%rip),%rdi
mov    $0xa3,%esi
mov    %ecx,%edx
mov    $0xc6,%ecx
mov    $0x82,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe1b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"*** Verifica se o n%cmero %c primo ***\0A\00"
@.str.1 = [31 x i8] c"\0ADigite um n%cmero inteiro: \0A\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"\0A\0A\0A\00"
@.str.4 = [25 x i8] c"\0AO n%cmero %d %c primo.\0A\00"
@.str.5 = [28 x i8] c"O n%cmero %d n%co %c primo.\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* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 163, i32 130)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 163)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %2
br label %9
9: ; preds = %22, %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %25
13: ; preds = %9
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = srem i32 %14, %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %21
21: ; preds = %18, %13
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %9
25: ; preds = %9
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %3
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 163, i32 %29, i32 130)
br label %34
31: ; preds = %25
%32 = load i32, i32* %3
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 163, i32 %32, i32 198, i32 130)
br label %34
34: ; preds = %31, %28
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

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