// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpz_rootrem
void
mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z)
{
  int sgn;
  mpz_t t, u;

  sgn = y->_mp_size < 0;
  if ((~z & sgn) != 0)
    gmp_die ("mpz_rootrem: Negative argument, with even root.");
  if (z == 0)
    gmp_die ("mpz_rootrem: Zeroth root.");

  if (mpz_cmpabs_ui (y, 1) <= 0) {
    if (x)
      mpz_set (x, y);
    if (r)
      r->_mp_size = 0;
    return;
  }

  mpz_init (u);
  {
    mp_bitcnt_t tb;
    tb = mpz_sizeinbase (y, 2) / z + 1;
    mpz_init2 (t, tb + 1);
    mpz_setbit (t, tb);
  }

  if (z == 2) /* simplify sqrt loop: z-1 == 1 */
    do {
      mpz_swap (u, t);			/* u = x */
      mpz_tdiv_q (t, y, u);		/* t = y/x */
      mpz_add (t, t, u);		/* t = y/x + x */
      mpz_tdiv_q_2exp (t, t, 1);	/* x'= (y/x + x)/2 */
    } while (mpz_cmpabs (t, u) < 0);	/* |x'| < |x| */
  else /* z != 2 */ {
    mpz_t v;

    mpz_init (v);
    if (sgn)
      mpz_neg (t, t);

    do {
      mpz_swap (u, t);			/* u = x */
      mpz_pow_ui (t, u, z - 1);		/* t = x^(z-1) */
      mpz_tdiv_q (t, y, t);		/* t = y/x^(z-1) */
      mpz_mul_ui (v, u, z - 1);		/* v = x*(z-1) */
      mpz_add (t, t, v);		/* t = y/x^(z-1) + x*(z-1) */
      mpz_tdiv_q_ui (t, t, z);		/* x'=(y/x^(z-1) + x*(z-1))/z */
    } while (mpz_cmpabs (t, u) < 0);	/* |x'| < |x| */

    mpz_clear (v);
  }

  if (r) {
    mpz_pow_ui (t, u, z);
    mpz_sub (r, y, t);
  }
  if (x)
    mpz_swap (x, u);
  mpz_clear (u);
  mpz_clear (t);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %r15
movl 0x4(%rdx), %r12d
movl %r12d, %eax
shrl $0x1f, %eax
notl %ecx
testl %ecx, %eax
jne 0x632f
testq %r15, %r15
je 0x6334
movq %rdx, %r14
movq %rsi, %rbx
movl %r12d, %eax
negl %eax
cmovsl %r12d, %eax
cmpl $0x1, %eax
jbe 0x6029
movq %rdi, -0x78(%rbp)
movl $0x8, %edi
callq *0xa0b0(%rip)           # 0x100a0
movq %rax, %r13
movl 0x4(%r14), %eax
testl %eax, %eax
movq %r15, -0x60(%rbp)
movq %rbx, -0x70(%rbp)
movq %r14, -0x68(%rbp)
je 0x6057
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movq 0x8(%r14), %rax
leaq -0x1(%rcx), %rbx
shlq $0x6, %rbx
movq -0x8(%rax,%rcx,8), %rdi
callq 0x78eb
addq %rbx, %rax
jmp 0x605c
jne 0x6035
movq 0x8(%r14), %rax
cmpq $0x1, (%rax)
ja 0x5fe1
testq %rdi, %rdi
je 0x6042
movq %r14, %rsi
callq 0x24a2
testq %rbx, %rbx
je 0x6320
movl $0x0, 0x4(%rbx)
jmp 0x6320
movl $0x1, %eax
xorl %r15d, %r15d
xorl %edx, %edx
movq -0x60(%rbp), %rbx
divq %rbx
leaq 0x1(%rax), %rcx
movq %rcx, -0x58(%rbp)
addq $0x2, %rax
cmpq $0x1, %rax
adcq $-0x1, %rax
shrq $0x6, %rax
leaq 0x1(%rax), %rcx
leaq -0x40(%rbp), %r14
movl %ecx, (%r14)
movl $0x0, 0x4(%r14)
leaq 0x8(,%rax,8), %rdi
callq *0x9fff(%rip)           # 0x100a0
movq %rax, 0x8(%r14)
movq %r14, %rdi
movq -0x58(%rbp), %rsi
callq 0x5305
cmpq $0x2, %rbx
jne 0x617f
leaq -0x40(%rbp), %rbx
movl 0x4(%rbx), %ecx
xorl %r15d, %r15d
movl $0x1, %r12d
movq 0x8(%rbx), %rax
leaq -0x50(%rbp), %r14
movl %r12d, %esi
movl %r15d, -0x3c(%rbp)
movl %ecx, %r15d
movl -0x40(%rbp), %r12d
movl %esi, -0x40(%rbp)
movq %r13, -0x38(%rbp)
movq %rax, %r13
movl %ecx, -0x4c(%rbp)
movl %r12d, -0x50(%rbp)
movq %rax, -0x48(%rbp)
movq %rbx, %rdi
xorl %esi, %esi
movq -0x68(%rbp), %rdx
movq %r14, %rcx
movl $0x2, %r8d
callq 0x3943
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x30c3
movl $0x1, %edx
movq %rbx, %rdi
movq %rbx, %rsi
movl $0x2, %ecx
callq 0x3e53
movq -0x38(%rbp), %rax
movl -0x3c(%rbp), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
movl %r15d, %esi
negl %esi
cmovsl %r15d, %esi
cmpl %esi, %edx
jne 0x6174
movl %edx, %edx
testq %rdx, %rdx
jle 0x62b3
movq -0x8(%r13,%rdx,8), %rsi
leaq -0x1(%rdx), %rdi
cmpq %rsi, -0x8(%rax,%rdx,8)
movq %rdi, %rdx
je 0x614d
jbe 0x60d3
jmp 0x62b3
jb 0x60d3
jmp 0x62b3
leaq -0xa0(%rbp), %r14
movq $0x1, (%r14)
movl $0x8, %edi
callq *0x9f08(%rip)           # 0x100a0
leaq -0x40(%rbp), %rsi
movl 0x4(%rsi), %edx
movl %edx, %ecx
negl %ecx
testl %r12d, %r12d
movq %rax, 0x8(%r14)
cmovnsl %edx, %ecx
leaq -0x1(%rbx), %rax
movq %rax, -0x80(%rbp)
movl $0x1, %r12d
movq 0x8(%rsi), %rax
movl %r15d, -0x3c(%rbp)
movl %ecx, %edx
movq %rdx, -0x88(%rbp)
movl -0x40(%rbp), %ecx
movl %r12d, -0x40(%rbp)
movq %r13, -0x38(%rbp)
movq %rax, %r13
movl %edx, -0x4c(%rbp)
movl %ecx, -0x58(%rbp)
movl %ecx, -0x50(%rbp)
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %r15
movq %r15, %rdi
leaq -0x50(%rbp), %r14
movq %r14, %rsi
movq -0x80(%rbp), %r12
movq %r12, %rdx
callq 0x556b
movq %r15, %rdi
xorl %esi, %esi
movq -0x68(%rbp), %rdx
movq %r15, %rcx
movl $0x2, %r8d
callq 0x3943
leaq -0xa0(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x3441
movq %r15, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x30c3
movq %r15, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq -0x88(%rbp), %r15
movq -0x60(%rbp), %rcx
movl $0x2, %r8d
callq 0x43a7
movq -0x38(%rbp), %rax
movl -0x3c(%rbp), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
movl %r15d, %esi
negl %esi
cmovsl %r15d, %esi
cmpl %esi, %edx
jne 0x629a
movl %edx, %edx
movl -0x58(%rbp), %r12d
testq %rdx, %rdx
jle 0x62a4
movq -0x8(%r13,%rdx,8), %rsi
leaq -0x1(%rdx), %rdi
cmpq %rsi, -0x8(%rax,%rdx,8)
movq %rdi, %rdx
je 0x627a
jbe 0x61bf
jmp 0x62a4
movl -0x58(%rbp), %r12d
jb 0x61bf
movq -0x98(%rbp), %rdi
xorl %esi, %esi
callq *0x9dfd(%rip)           # 0x100b0
movq -0x70(%rbp), %r14
testq %r14, %r14
je 0x62df
leaq -0x40(%rbp), %rbx
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
movq -0x60(%rbp), %rdx
callq 0x556b
movq %r14, %rdi
movq -0x68(%rbp), %rsi
movq %rbx, %rdx
callq 0x33cf
movq -0x78(%rbp), %rcx
testq %rcx, %rcx
je 0x6309
movl 0x4(%rcx), %eax
movl %r15d, 0x4(%rcx)
movl %eax, -0x4c(%rbp)
movl (%rcx), %eax
movl %r12d, (%rcx)
movl %eax, -0x50(%rbp)
movq 0x8(%rcx), %rax
movq %r13, 0x8(%rcx)
movq %rax, -0x48(%rbp)
movq %rax, %r13
movq %r13, %rdi
xorl %esi, %esi
callq *0x9d9c(%rip)           # 0x100b0
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq *0x9d90(%rip)           # 0x100b0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x11f8
callq 0x1220