#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 */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
scalar_t__ isMersenne(int /*<<< orphan*/ const);
int /*<<< orphan*/ isPrime(int /*<<< orphan*/ const, int);
int /*<<< orphan*/ mpz_out_str(int /*<<< orphan*/, int,
                               int /*<<< orphan*/ const);
int mpz_probab_prime_p(int /*<<< orphan*/ const, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
void checkPrimality(const mpz_t num) {
  mpz_out_str(stdout, 10, num);
  if (!isPrime(num, 1)) {
    printf(" is not a prime\n");
    return;
  }
  if (isMersenne(num))
    printf(" is a Mersenne prime\n");
  else
    printf(" is an ordinal prime number (%d)\n", mpz_probab_prime_p(num, 23));
}


x86 assembly (clang, -O0):
<checkPrimality>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    $0xa,%esi
call   1060 <mpz_out_str@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1050 <isPrime@plt>
cmp    $0x0,%eax
jne    119a <checkPrimality+0x4a>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11dc <checkPrimality+0x8c>
mov    -0x4(%rbp),%edi
call   1070 <isMersenne@plt>
cmp    $0x0,%rax
je     11bf <checkPrimality+0x6f>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11dc <checkPrimality+0x8c>
mov    -0x4(%rbp),%edi
mov    $0x17,%esi
call   1030 <mpz_probab_prime_p@plt>
mov    %eax,%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkPrimality>:
push   %rbx
mov    %edi,%ebx
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    $0xa,%esi
mov    %ebx,%edx
call   1070 <mpz_out_str@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1060 <isPrime@plt>
test   %eax,%eax
je     11a1 <checkPrimality+0x41>
mov    %ebx,%edi
call   1080 <isMersenne@plt>
test   %rax,%rax
je     11ae <checkPrimality+0x4e>
lea    0xe97(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>
lea    0xe7a(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>
mov    %ebx,%edi
mov    $0x17,%esi
call   1030 <mpz_probab_prime_p@plt>
lea    0xe3f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
pop    %rbx
jmp    1050 <printf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [17 x i8] c" is not a prime\0A\00"
@.str.1 = [22 x i8] c" is a Mersenne prime\0A\00"
@.str.2 = [34 x i8] c" is an ordinal prime number (%d)\0A\00"
define void @checkPrimality(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stdout
%4 = load i32, i32* %2
%5 = call i32 @mpz_out_str(i32 %3, i32 10, i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @isPrime(i32 %6, i32 1)
%8 = icmp ne i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %21
11: ; preds = %1
%12 = load i32, i32* %2
%13 = call i64 @isMersenne(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %21
17: ; preds = %11
%18 = load i32, i32* %2
%19 = call i32 @mpz_probab_prime_p(i32 %18, i32 23)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %9, %17, %15
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str.2 = [34 x i8] c" is an ordinal prime number (%d)\0A\00"
@str = [16 x i8] c" is not a prime\00"
@str.3 = [21 x i8] c" is a Mersenne prime\00"
define void @checkPrimality(i32 %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @mpz_out_str(i32 %2, i32 10, i32 %0)
%4 = tail call i32 @isPrime(i32 %0, i32 1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %16
8: ; preds = %1
%9 = tail call i64 @isMersenne(i32 %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.3, i64 0, i64 0))
br label %16
13: ; preds = %8
%14 = tail call i32 @mpz_probab_prime_p(i32 %0, i32 23)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %6, %13, %11
ret void
}