#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 isPrime(long);
int /*<<< orphan*/ primeDivisors(long, int *, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
void trata(long int n) {
  int ct = 0, ct1 = 0;
  if (isPrime(n) == 1) {
    printf("Primo\n");
    return;
  }
  primeDivisors(n, &ct, &ct1);
  if (ct == 2 && ct1 == 0) {
    puts("Quase primo");
    return;
  }
  puts("Nem primo nem quase primo");
}


x86 assembly (clang, -O0):
<trata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <isPrime@plt>
cmp    $0x1,%eax
jne    117d <trata+0x3d>
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
jmp    11bf <trata+0x7f>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1060 <primeDivisors@plt>
cmpl   $0x2,-0xc(%rbp)
jne    11b3 <trata+0x73>
cmpl   $0x0,-0x10(%rbp)
jne    11b3 <trata+0x73>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
jmp    11bf <trata+0x7f>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trata>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
call   1040 <isPrime@plt>
cmp    $0x1,%eax
jne    1163 <trata+0x33>
lea    0xecd(%rip),%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <puts@plt>
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1050 <primeDivisors@plt>
cmpl   $0x2,0xc(%rsp)
jne    118c <trata+0x5c>
cmpl   $0x0,0x8(%rsp)
jne    118c <trata+0x5c>
lea    0xe76(%rip),%rdi
jmp    1193 <trata+0x63>
lea    0xe79(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Primo\0A\00"
@.str.1 = [12 x i8] c"Quase primo\00"
@.str.2 = [26 x i8] c"Nem primo nem quase primo\00"
define void @trata(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
store i64 %0, i64* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = load i64, i64* %2
%6 = call i32 @isPrime(i64 %5)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %22
10: ; preds = %1
%11 = load i64, i64* %2
%12 = call i32 @primeDivisors(i64 %11, i32* %3, i32* %4)
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %22
20: ; preds = %15, %10
%21 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %18, %8
ret void
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"Quase primo\00"
@.str.2 = [26 x i8] c"Nem primo nem quase primo\00"
@str = [6 x i8] c"Primo\00"
define void @trata(i64 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = tail call i32 @isPrime(i64 %0)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %21
10: ; preds = %1
%11 = call i32 @primeDivisors(i64 %0, i32* %2, i32* %3)
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 2
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 0
%16 = select i1 %13, i1 %15, i1 false
br i1 %16, label %17, label %19
17: ; preds = %10
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %21
19: ; preds = %10
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %17, %8
ret void
}