#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 */
typedef struct TYPE_6__ TYPE_1__;

/* Type definitions */
typedef TYPE_1__ *mpz_t;
struct TYPE_6__ {
  int /*<<< orphan*/ *_mp_d;
};

/* Variables and functions */
int mpz_probab_prime_p(TYPE_1__ *, int);
scalar_t__ mpz_sgn(TYPE_1__ *);
int mpz_size(TYPE_1__ *);
int pt64(int /*<<< orphan*/);
int psp(mpz_t n) {
  if (mpz_size(n) < 2) {
    if (mpz_sgn(n) != 0)
      return pt64(n[0]._mp_d[0]);
    return 0;
  }
  return mpz_probab_prime_p(n, 1);
}


x86 assembly (clang, -O0):
<psp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <mpz_size@plt>
cmp    $0x2,%eax
jge    1193 <psp+0x53>
mov    -0x10(%rbp),%rdi
call   1060 <mpz_sgn@plt>
cmp    $0x0,%rax
je     1187 <psp+0x47>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
call   1040 <pt64@plt>
mov    %eax,-0x4(%rbp)
jmp    11a4 <psp+0x64>
movl   $0x0,-0x4(%rbp)
jmp    11a4 <psp+0x64>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <mpz_probab_prime_p@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psp>:
push   %rbx
mov    %rdi,%rbx
call   1050 <mpz_size@plt>
cmp    $0x1,%eax
jg     1166 <psp+0x26>
mov    %rbx,%rdi
call   1060 <mpz_sgn@plt>
test   %rax,%rax
je     1174 <psp+0x34>
mov    (%rbx),%rax
mov    (%rax),%edi
pop    %rbx
jmp    1040 <pt64@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1030 <mpz_probab_prime_p@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32* }
define i32 @psp(%struct.TYPE_6__* %0) {
%2 = alloca i32
%3 = alloca %struct.TYPE_6__*
store %struct.TYPE_6__* %0, %struct.TYPE_6__** %3
%4 = load %struct.TYPE_6__*, %struct.TYPE_6__** %3
%5 = call i32 @mpz_size(%struct.TYPE_6__* %4)
%6 = icmp slt i32 %5, 2
br i1 %6, label %7, label %20
7: ; preds = %1
%8 = load %struct.TYPE_6__*, %struct.TYPE_6__** %3
%9 = call i64 @mpz_sgn(%struct.TYPE_6__* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %7
%12 = load %struct.TYPE_6__*, %struct.TYPE_6__** %3
%13 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %12, i64 0
%14 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %13, i32 0, i32 0
%15 = load i32*, i32** %14
%16 = getelementptr inbounds i32, i32* %15, i64 0
%17 = load i32, i32* %16
%18 = call i32 @pt64(i32 %17)
store i32 %18, i32* %2
br label %23
19: ; preds = %7
store i32 0, i32* %2
br label %23
20: ; preds = %1
%21 = load %struct.TYPE_6__*, %struct.TYPE_6__** %3
%22 = call i32 @mpz_probab_prime_p(%struct.TYPE_6__* %21, i32 1)
store i32 %22, i32* %2
br label %23
23: ; preds = %20, %19, %11
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i32* }
define i32 @psp(%struct.TYPE_6__* %0) {
%2 = tail call i32 @mpz_size(%struct.TYPE_6__* %0)
%3 = icmp slt i32 %2, 2
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = tail call i64 @mpz_sgn(%struct.TYPE_6__* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 0
%9 = load i32*, i32** %8
%10 = load i32, i32* %9
%11 = tail call i32 @pt64(i32 %10)
br label %14
12: ; preds = %1
%13 = tail call i32 @mpz_probab_prime_p(%struct.TYPE_6__* %0, i32 1)
br label %14
14: ; preds = %4, %12, %7
%15 = phi i32 [ %11, %7 ], [ %13, %12 ], [ 0, %4 ]
ret i32 %15
}