// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpz_probab_prime_p
int
mpz_probab_prime_p (const mpz_t n, int reps)
{
  mpz_t nm1;
  mpz_t q;
  mpz_t y;
  mp_bitcnt_t k;
  int is_prime;
  int j;

  /* Note that we use the absolute value of n only, for compatibility
     with the real GMP. */
  if (mpz_even_p (n))
    return (mpz_cmpabs_ui (n, 2) == 0) ? 2 : 0;

  /* Above test excludes n == 0 */
  assert (n->_mp_size != 0);

  if (mpz_cmpabs_ui (n, 64) < 0)
    return (GMP_PRIME_MASK >> (n->_mp_d[0] >> 1)) & 2;

  if (mpz_gcd_ui (NULL, n, GMP_PRIME_PRODUCT) != 1)
    return 0;

  /* All prime factors are >= 31. */
  if (mpz_cmpabs_ui (n, 31*31) < 0)
    return 2;

  /* Use Miller-Rabin, with a deterministic sequence of bases, a[j] =
     j^2 + j + 41 using Euler's polynomial. We potentially stop early,
     if a[j] >= n - 1. Since n >= 31*31, this can happen only if reps >
     30 (a[30] == 971 > 31*31 == 961). */

  mpz_init (nm1);
  mpz_init (q);
  mpz_init (y);

  /* Find q and k, where q is odd and n = 1 + 2**k * q.  */
  nm1->_mp_size = mpz_abs_sub_ui (nm1, n, 1);
  k = mpz_scan1 (nm1, 0);
  mpz_tdiv_q_2exp (q, nm1, k);

  for (j = 0, is_prime = 1; is_prime & (j < reps); j++)
    {
      mpz_set_ui (y, (unsigned long) j*j+j+41);
      if (mpz_cmp (y, nm1) >= 0)
	{
	  /* Don't try any further bases. This "early" break does not affect
	     the result for any reasonable reps value (<=5000 was tested) */
	  assert (j >= 30);
	  break;
	}
      is_prime = gmp_millerrabin (n, nm1, y, q, k);
    }
  mpz_clear (nm1);
  mpz_clear (q);
  mpz_clear (y);

  return is_prime;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %esi, %r14d
movl 0x4(%rdi), %edx
testl %edx, %edx
sete %al
movq 0x8(%rdi), %rcx
movq (%rcx), %rcx
testb $0x1, %cl
sete %sil
orb %al, %sil
movl %edx, %eax
negl %eax
cmovsl %edx, %eax
cmpb $0x1, %sil
jne 0x68e7
xorl %r13d, %r13d
cmpl $0x1, %eax
ja 0x6bc5
sete %al
cmpq $0x2, %rcx
sete %cl
andb %al, %cl
movzbl %cl, %r13d
addl %r13d, %r13d
jmp 0x6bc5
movl $0xc0cfd797, %r13d      # imm = 0xC0CFD797
cmpl $0x2, %eax
setb %al
cmpq $0x40, %rcx
setb %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x6916
shrl %ecx
addq $0x899bf45, %r13        # imm = 0x899BF45
shrq %cl, %r13
andl $0x2, %r13d
jmp 0x6bc5
movq %rdi, %rbx
xorl %r13d, %r13d
movl $0xc0cfd797, %edx       # imm = 0xC0CFD797
xorl %edi, %edi
movq %rbx, %rsi
callq 0x46f6
cmpq $0x1, %rax
jne 0x6bc5
movl 0x4(%rbx), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl $0x1, %ecx
jbe 0x69c1
movl $0x1, %r12d
leaq -0x50(%rbp), %r15
movq %r12, (%r15)
movl $0x8, %edi
callq *0x9744(%rip)           # 0x100a0
movq %rax, 0x8(%r15)
movq %r12, -0x90(%rbp)
movl $0x8, %edi
callq *0x972e(%rip)           # 0x100a0
movq %rax, -0x88(%rbp)
movq %r12, -0x40(%rbp)
movl $0x8, %edi
callq *0x9718(%rip)           # 0x100a0
movq %rax, -0x38(%rbp)
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2f41
movl %eax, 0x4(%r15)
testl %eax, %eax
je 0x69e3
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movq -0x48(%rbp), %rdx
movq (%rdx), %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x1c38
movq %rax, %r15
jmp 0x69ea
movl $0x2, %r13d
jne 0x6bc5
movq 0x8(%rbx), %rax
cmpq $0x3c1, (%rax)          # imm = 0x3C1
jae 0x6944
jmp 0x6bc5
movq $-0x1, %r15
leaq -0x90(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq %r15, %rdx
movl $0x2, %ecx
callq 0x3e53
movl $0x1, %r13d
testl %r14d, %r14d
jle 0x6b9e
movq %r15, -0xa0(%rbp)
leaq -0x1(%r15), %rax
movq %rax, -0x78(%rbp)
movl %r14d, %eax
movq %rax, -0x98(%rbp)
xorl %r12d, %r12d
leaq -0x40(%rbp), %r15
leaq 0x1(%r12), %r14
movq %r14, %rax
imulq %r12, %rax
addq $0x29, %rax
movq -0x38(%rbp), %rcx
movq %rax, (%rcx)
movl $0x1, -0x3c(%rbp)
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2cfb
testl %eax, %eax
jns 0x6b92
cmpq $0x0, -0xa0(%rbp)
je 0x6bd7
movq %r15, %rdi
movq %r15, %rsi
leaq -0x90(%rbp), %rdx
movq %rbx, %rcx
callq 0x564f
cmpl $0x1, -0x3c(%rbp)
jne 0x6aa0
movq -0x38(%rbp), %rax
movl $0x1, %r13d
cmpq $0x1, (%rax)
je 0x6b76
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2cfb
xorl %r13d, %r13d
testl %eax, %eax
sete %r13b
je 0x6b76
cmpq $0x0, -0x78(%rbp)
je 0x6b76
movq $0x2, -0x58(%rbp)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, -0x70(%rbp)
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq %r15, %rdi
movq %r15, %rsi
leaq -0x70(%rbp), %rdx
movq %rbx, %rcx
callq 0x564f
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2cfb
testl %eax, %eax
je 0x6b70
movq -0x78(%rbp), %r12
movl -0x3c(%rbp), %eax
cmpl $0x1, %eax
jle 0x6b19
decq %r12
jne 0x6b30
jmp 0x6b8d
xorl %r13d, %r13d
cmpl $0x1, %eax
jne 0x6b9e
movq -0x38(%rbp), %rax
cmpq $0x2, (%rax)
jb 0x6b9e
decq %r12
je 0x6b9e
movq $0x2, -0x58(%rbp)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, -0x70(%rbp)
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq %r15, %rdi
movq %r15, %rsi
leaq -0x70(%rbp), %rdx
movq %rbx, %rcx
callq 0x564f
movq %r15, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2cfb
testl %eax, %eax
jne 0x6b0a
movl $0x1, %r13d
testl %r13d, %r13d
je 0x6b9e
movq %r14, %r12
cmpq -0x98(%rbp), %r14
jb 0x6a31
jmp 0x6b9e
xorl %r13d, %r13d
jmp 0x6b9e
movl $0x1, %r13d
cmpq $0x1d, %r12
jbe 0x6bf6
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq *0x9506(%rip)           # 0x100b0
movq -0x88(%rbp), %rdi
xorl %esi, %esi
callq *0x94f7(%rip)           # 0x100b0
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq *0x94eb(%rip)           # 0x100b0
movl %r13d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4a31(%rip), %rdi      # 0xb60f
leaq 0x347f(%rip), %rsi      # 0xa064
leaq 0x4a29(%rip), %rcx      # 0xb615
movl $0xd1a, %edx            # imm = 0xD1A
callq 0x1090
leaq 0x3a91(%rip), %rdi      # 0xa68e
leaq 0x3460(%rip), %rsi      # 0xa064
leaq 0x3a51(%rip), %rcx      # 0xa65c
movl $0xd68, %edx            # imm = 0xD68
callq 0x1090