#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 p;
  do {
    printf("digite um número maior que 0: ");
    scanf("%d", &p);
  } while (p < 1);
  if (p == 2 || p == 3 || p == 5 || p == 7) {
    printf("primo\n");
  } else if (p % 2 == 0 || p % 3 == 0 || p % 5 == 0 || p % 7 == 0) {
    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)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jl     112f <main+0xf>
cmpl   $0x2,-0x8(%rbp)
je     117d <main+0x5d>
cmpl   $0x3,-0x8(%rbp)
je     117d <main+0x5d>
cmpl   $0x5,-0x8(%rbp)
je     117d <main+0x5d>
cmpl   $0x7,-0x8(%rbp)
jne    118e <main+0x6e>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    1200 <main+0xe0>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11de <main+0xbe>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11de <main+0xbe>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11de <main+0xbe>
mov    -0x8(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ef <main+0xcf>
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
jmp    11fb <main+0xdb>
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
jmp    1200 <main+0xe0>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%r14
lea    0xed9(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1150 <main+0x20>
lea    -0x2(%rax),%ecx
cmp    $0x6,%ecx
jae    117d <main+0x4d>
mov    $0x2b,%edx
bt     %ecx,%edx
jb     11c3 <main+0x93>
imul   $0xaaaaaaab,%eax,%ecx
imul   $0xcccccccd,%eax,%edx
imul   $0xb6db6db7,%eax,%esi
cmp    $0x24924925,%esi
lea    0xe87(%rip),%rsi
lea    0xe88(%rip),%rdi
cmovb  %rsi,%rdi
cmp    $0x33333334,%edx
cmovb  %rsi,%rdi
cmp    $0x55555556,%ecx
cmovb  %rsi,%rdi
test   $0x1,%al
cmove  %rsi,%rdi
jmp    11ca <main+0x9a>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"digite um n\C3\BAmero maior que 0: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [7 x i8] c"primo\0A\00"
@.str.3 = [15 x i8] c"n\C3\A3o \C3\A9 primo\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %6, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %3
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1
br i1 %8, label %3, label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 2
br i1 %11, label %21, label %12
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 3
br i1 %14, label %21, label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 5
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 7
br i1 %20, label %21, label %23
21: ; preds = %18, %15, %12, %9
%22 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %44
23: ; preds = %18
%24 = load i32, i32* %2
%25 = srem i32 %24, 2
%26 = icmp eq i32 %25, 0
br i1 %26, label %39, label %27
27: ; preds = %23
%28 = load i32, i32* %2
%29 = srem i32 %28, 3
%30 = icmp eq i32 %29, 0
br i1 %30, label %39, label %31
31: ; preds = %27
%32 = load i32, i32* %2
%33 = srem i32 %32, 5
%34 = icmp eq i32 %33, 0
br i1 %34, label %39, label %35
35: ; preds = %31
%36 = load i32, i32* %2
%37 = srem i32 %36, 7
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %35, %31, %27, %23
%40 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %43
41: ; preds = %35
%42 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
br label %44
44: ; preds = %43, %21
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"digite um n\C3\BAmero maior que 0: \00"
@.str.1 = [3 x i8] c"%d\00"
@str.4 = [14 x i8] c"n\C3\A3o \C3\A9 primo\00"
@str.5 = [6 x i8] c"primo\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
br i1 %7, label %3, label %8
8: ; preds = %3
%9 = add i32 %6, -2
%10 = icmp ult i32 %9, 6
br i1 %10, label %24, label %11
11: ; preds = %24, %8
%12 = and i32 %6, 1
%13 = icmp eq i32 %12, 0
%14 = urem i32 %6, 3
%15 = icmp eq i32 %14, 0
%16 = or i1 %13, %15
%17 = urem i32 %6, 5
%18 = icmp eq i32 %17, 0
%19 = select i1 %16, i1 true, i1 %18
%20 = urem i32 %6, 7
%21 = icmp eq i32 %20, 0
%22 = select i1 %19, i1 true, i1 %21
%23 = select i1 %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0)
br label %29
24: ; preds = %8
%25 = trunc i32 %9 to i8
%26 = lshr i8 43, %25
%27 = and i8 %26, 1
%28 = icmp eq i8 %27, 0
br i1 %28, label %11, label %29
29: ; preds = %24, %11
%30 = phi i8* [ %23, %11 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0), %24 ]
%31 = call i32 @puts(i8* dereferenceable(1) %30)
ret i32 0
}