// File: /workspace/github_cpp_makefile_star2_O1/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, %r12d
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 0x699b
cmpl $0x1, %eax
sete %dl
cmpq $0x2, %rcx
sete %cl
andb %dl, %cl
movzbl %cl, %ecx
addl %ecx, %ecx
xorl %r15d, %r15d
cmpl $0x2, %eax
cmovbl %ecx, %r15d
jmp 0x6caa
movq %rdi, %rbx
movl $0xc0cfd797, %r15d      # imm = 0xC0CFD797
cmpl $0x1, %eax
ja 0x69cf
setne %al
cmpq $0x40, %rcx
setb %dl
orb %al, %dl
cmpb $0x1, %dl
jne 0x69cf
shrl %ecx
addq $0x899bf45, %r15        # imm = 0x899BF45
shrq %cl, %r15
andl $0x2, %r15d
jmp 0x6caa
xorl %r15d, %r15d
movl $0xc0cfd797, %edx       # imm = 0xC0CFD797
xorl %edi, %edi
movq %rbx, %rsi
callq 0x4783
cmpq $0x1, %rax
jne 0x6caa
movl 0x4(%rbx), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl $0x1, %ecx
jbe 0x6a77
movl $0x1, %r15d
leaq -0x50(%rbp), %r14
movq %r15, (%r14)
movl $0x8, %edi
callq *0x968e(%rip)           # 0x100a0
movq %rax, 0x8(%r14)
movq %r15, -0x90(%rbp)
movl $0x8, %edi
callq *0x9678(%rip)           # 0x100a0
movq %rax, -0x88(%rbp)
movq %r15, -0x40(%rbp)
movl $0x8, %edi
callq *0x9662(%rip)           # 0x100a0
movq %rax, -0x38(%rbp)
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2f80
movl %eax, 0x4(%r14)
testl %eax, %eax
je 0x6a99
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movq -0x48(%rbp), %rdx
movq (%rdx), %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x1c4a
movq %rax, %r14
jmp 0x6aa0
movl $0x2, %r15d
jne 0x6caa
movq 0x8(%rbx), %rax
cmpq $0x3c1, (%rax)          # imm = 0x3C1
jae 0x69fa
jmp 0x6caa
movq $-0x1, %r14
leaq -0x90(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movq %r14, %rdx
movl $0x2, %ecx
callq 0x3ea2
testl %r12d, %r12d
jle 0x6aed
leaq -0x40(%rbp), %rdi
movl $0x1, 0x4(%rdi)
movq 0x8(%rdi), %rax
movq $0x29, (%rax)
leaq -0x50(%rbp), %rsi
callq 0x2d3a
testl %eax, %eax
js 0x6af8
movl $0x1, %r15d
xorl %eax, %eax
jmp 0x6c7f
movl $0x1, %r15d
jmp 0x6c83
movq %r14, -0xa0(%rbp)
leaq -0x1(%r14), %rax
movq %rax, -0x78(%rbp)
movl %r12d, %eax
movq %rax, -0x98(%rbp)
xorl %r13d, %r13d
leaq -0x40(%rbp), %r12
cmpq $0x0, -0xa0(%rbp)
je 0x6cbc
movq %r13, %r14
movq %r12, %rdi
movq %r12, %rsi
leaq -0x90(%rbp), %rdx
movq %rbx, %rcx
callq 0x56d1
cmpl $0x1, -0x3c(%rbp)
jne 0x6b58
movq -0x38(%rbp), %rax
movl $0x1, %r15d
cmpq $0x1, (%rax)
je 0x6c31
movq %r12, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2d3a
xorl %r15d, %r15d
testl %eax, %eax
sete %r15b
je 0x6c31
cmpq $0x0, -0x78(%rbp)
je 0x6c31
movq $0x2, -0x58(%rbp)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, -0x70(%rbp)
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq %r12, %rdi
movq %r12, %rsi
leaq -0x70(%rbp), %rdx
movq %rbx, %rcx
callq 0x56d1
movq %r12, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2d3a
testl %eax, %eax
je 0x6c2b
movq -0x78(%rbp), %r13
movl -0x3c(%rbp), %eax
cmpl $0x1, %eax
jle 0x6bd4
decq %r13
jne 0x6beb
jmp 0x6c73
xorl %r15d, %r15d
cmpl $0x1, %eax
jne 0x6c31
movq -0x38(%rbp), %rax
cmpq $0x2, (%rax)
jb 0x6c31
decq %r13
je 0x6c31
movq $0x2, -0x58(%rbp)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, -0x70(%rbp)
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq %r12, %rdi
movq %r12, %rsi
leaq -0x70(%rbp), %rdx
movq %rbx, %rcx
callq 0x56d1
movq %r12, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2d3a
testl %eax, %eax
jne 0x6bc2
movl $0x1, %r15d
testl %r15d, %r15d
je 0x6c83
leaq 0x1(%r14), %r13
cmpq -0x98(%rbp), %r13
jae 0x6c83
leaq 0x2(%r14), %rax
imulq %r13, %rax
addq $0x29, %rax
movl $0x1, -0x3c(%rbp)
movq -0x38(%rbp), %rcx
movq %rax, (%rcx)
movq %r12, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2d3a
testl %eax, %eax
js 0x6b18
jmp 0x6c78
xorl %r15d, %r15d
jmp 0x6c31
cmpq $0x1d, %r14
setae %al
testb %al, %al
je 0x6cdb
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq *0x9421(%rip)           # 0x100b0
movq -0x88(%rbp), %rdi
xorl %esi, %esi
callq *0x9412(%rip)           # 0x100b0
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq *0x9406(%rip)           # 0x100b0
movl %r15d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4954(%rip), %rdi      # 0xb617
leaq 0x339a(%rip), %rsi      # 0xa064
leaq 0x494c(%rip), %rcx      # 0xb61d
movl $0xd1a, %edx            # imm = 0xD1A
callq 0x1090
leaq 0x39ac(%rip), %rdi      # 0xa68e
leaq 0x337b(%rip), %rsi      # 0xa064
leaq 0x396c(%rip), %rcx      # 0xa65c
movl $0xd68, %edx            # imm = 0xD68
callq 0x1090