#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 EXIT_SUCCESS;
int isPrime(long);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, long *);
int main(int argc, char const *argv[]) {
  long int n;
  int a;
  printf("Digit a number to check if it's a Valgueiro number: ");
  scanf(" %ld", &n);
  if (n <= 5) {
    printf("It isn't a Valgueiro Prime.\n");
    return 0;
  }
  a = isPrime(n);
  if (a == 1) {
    printf("It isn't a Valgueiro Prime.\n");
  } else {
    if (n % 2 == 0) {
      printf("It's a Valgueiro Prime!!!\n");
    } else {
      a = isPrime(n - 2);
      if (a == 1) {
        printf("It's a Valgueiro Prime!!!\n");
      } else {
        printf("It isn't a Valgueiro Prime.\n");
      }
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
cmpq   $0x5,-0x18(%rbp)
jg     1185 <main+0x55>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1222 <main+0xf2>
mov    -0x18(%rbp),%rdi
call   1040 <isPrime@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    11ac <main+0x7c>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
jmp    1216 <main+0xe6>
mov    -0x18(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    11d5 <main+0xa5>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
jmp    1211 <main+0xe1>
mov    -0x18(%rbp),%rdi
sub    $0x2,%rdi
call   1040 <isPrime@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    1200 <main+0xd0>
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
jmp    120c <main+0xdc>
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
jmp    1211 <main+0xe1>
jmp    1216 <main+0xe6>
mov    0x2dc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
lea    0xee1(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%rdi
cmp    $0x5,%rdi
jg     1176 <main+0x36>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
call   1050 <isPrime@plt>
cmp    $0x1,%eax
jne    1189 <main+0x49>
lea    0xecd(%rip),%rdi
jmp    11ba <main+0x7a>
mov    (%rsp),%rdi
test   $0x1,%dil
jne    119c <main+0x5c>
lea    0xea0(%rip),%rdi
jmp    11ba <main+0x7a>
add    $0xfffffffffffffffe,%rdi
call   1050 <isPrime@plt>
cmp    $0x1,%eax
lea    0xe8b(%rip),%rax
lea    0xe9e(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [53 x i8] c"Digit a number to check if it's a Valgueiro number: \00"
@.str.1 = [5 x i8] c" %ld\00"
@.str.2 = [29 x i8] c"It isn't a Valgueiro Prime.\0A\00"
@.str.3 = [27 x i8] c"It's a Valgueiro Prime!!!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %6)
%10 = load i64, i64* %6
%11 = icmp sle i64 %10, 5
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %41
14: ; preds = %2
%15 = load i64, i64* %6
%16 = call i32 @isPrime(i64 %15)
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %39
21: ; preds = %14
%22 = load i64, i64* %6
%23 = srem i64 %22, 2
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %38
27: ; preds = %21
%28 = load i64, i64* %6
%29 = sub nsw i64 %28, 2
%30 = call i32 @isPrime(i64 %29)
store i32 %30, i32* %7
%31 = load i32, i32* %7
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %37
35: ; preds = %27
%36 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
br label %38
38: ; preds = %37, %25
br label %39
39: ; preds = %38, %19
%40 = load i32, i32* @EXIT_SUCCESS
store i32 %40, i32* %3
br label %41
41: ; preds = %39, %12
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [53 x i8] c"Digit a number to check if it's a Valgueiro number: \00"
@.str.1 = [5 x i8] c" %ld\00"
@EXIT_SUCCESS = global i32 0
@str.5 = [26 x i8] c"It's a Valgueiro Prime!!!\00"
@str.7 = [28 x i8] c"It isn't a Valgueiro Prime.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%7 = load i64, i64* %3
%8 = icmp slt i64 %7, 6
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0))
br label %27
11: ; preds = %2
%12 = call i32 @isPrime(i64 %7)
%13 = icmp eq i32 %12, 1
br i1 %13, label %23, label %14
14: ; preds = %11
%15 = load i64, i64* %3
%16 = and i64 %15, 1
%17 = icmp eq i64 %16, 0
br i1 %17, label %23, label %18
18: ; preds = %14
%19 = add nsw i64 %15, -2
%20 = call i32 @isPrime(i64 %19)
%21 = icmp eq i32 %20, 1
%22 = select i1 %21, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0)
br label %23
23: ; preds = %18, %14, %11
%24 = phi i8* [ getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0), %11 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0), %14 ], [ %22, %18 ]
%25 = call i32 @puts(i8* dereferenceable(1) %24)
%26 = load i32, i32* @EXIT_SUCCESS
br label %27
27: ; preds = %23, %9
%28 = phi i32 [ 0, %9 ], [ %26, %23 ]
ret i32 %28
}