// File: /workspace/github_cpp_makefile_star2_O1/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), %r13d
movl %r13d, %eax
shrl $0x1f, %eax
notl %ecx
testl %ecx, %eax
jne 0x63e3
testq %r15, %r15
je 0x63e8
movq %rdx, %r14
movq %rsi, %rbx
movl %r13d, %eax
negl %eax
cmovsl %r13d, %eax
cmpl $0x1, %eax
jbe 0x60e7
movq %rdi, -0x90(%rbp)
movq $0x1, -0x50(%rbp)
movl $0x8, %edi
callq *0x9ff2(%rip)           # 0x100a0
movq %rax, -0x48(%rbp)
movl 0x4(%r14), %eax
testl %eax, %eax
movq %rbx, -0x88(%rbp)
movq %r14, -0x60(%rbp)
je 0x6115
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 0x7a30
addq %rbx, %rax
jmp 0x611a
jne 0x60f3
movq 0x8(%r14), %rax
cmpq $0x1, (%rax)
ja 0x6094
testq %rdi, %rdi
je 0x6100
movq %r14, %rsi
callq 0x24be
testq %rbx, %rbx
je 0x63d4
movl $0x0, 0x4(%rbx)
jmp 0x63d4
movl $0x1, %eax
xorl %edx, %edx
divq %r15
leaq 0x1(%rax), %rbx
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 *0x9f4c(%rip)           # 0x100a0
movq %rax, 0x8(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x536d
cmpq $0x2, %r15
movq %r15, -0x70(%rbp)
jne 0x6233
leaq -0x50(%rbp), %rbx
movl (%rbx), %r15d
movl 0x4(%rbx), %r12d
movq 0x8(%rbx), %r13
movl %r12d, %eax
movl %r15d, %ecx
movq %r13, %rdx
movl -0x40(%rbp), %r15d
movl -0x3c(%rbp), %r12d
movl %r12d, -0x4c(%rbp)
movl %eax, -0x3c(%rbp)
movl %r15d, -0x50(%rbp)
movl %ecx, -0x40(%rbp)
movq -0x38(%rbp), %r13
movq %r13, -0x48(%rbp)
movq %rdx, -0x38(%rbp)
movq %r14, %rdi
xorl %esi, %esi
movq -0x60(%rbp), %rdx
movq %rbx, %rcx
movl $0x2, %r8d
callq 0x3989
movq %r14, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x30fc
movl $0x1, %edx
movq %r14, %rdi
movq %r14, %rsi
movl $0x2, %ecx
callq 0x3ea2
movl -0x3c(%rbp), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl %r12d, %eax
negl %eax
cmovsl %r12d, %eax
cmpl %eax, %ecx
jne 0x6223
movq -0x38(%rbp), %rax
movl %ecx, %ecx
testq %rcx, %rcx
jle 0x635b
movq -0x8(%r13,%rcx,8), %rdx
leaq -0x1(%rcx), %rsi
cmpq %rdx, -0x8(%rax,%rcx,8)
movq %rsi, %rcx
je 0x6202
setbe %al
jmp 0x6226
setb %al
testb %al, %al
jne 0x6180
jmp 0x635b
movq $0x1, -0x80(%rbp)
movl $0x8, %edi
callq *0x9e5a(%rip)           # 0x100a0
movq %rax, -0x78(%rbp)
testl %r13d, %r13d
jns 0x6252
negl -0x3c(%rbp)
leaq -0x1(%r15), %rax
movq %rax, -0x98(%rbp)
leaq -0x50(%rbp), %rax
movl (%rax), %edi
movl 0x4(%rax), %r8d
movq 0x8(%rax), %r12
movq -0x98(%rbp), %r14
movl %edi, %ecx
movq %r12, %rdx
movl -0x40(%rbp), %esi
movl -0x3c(%rbp), %edi
movl %edi, -0x64(%rbp)
movl %edi, -0x4c(%rbp)
movl %r8d, -0x3c(%rbp)
movl %esi, -0x54(%rbp)
movl %esi, -0x50(%rbp)
movl %ecx, -0x40(%rbp)
movq -0x38(%rbp), %r12
movq %r12, -0x48(%rbp)
movq %rdx, -0x38(%rbp)
leaq -0x40(%rbp), %r15
movq %r15, %rdi
leaq -0x50(%rbp), %r13
movq %r13, %rsi
movq %r14, %rdx
callq 0x55de
movq %r15, %rdi
xorl %esi, %esi
movq -0x60(%rbp), %rdx
movq %r15, %rcx
movl $0x2, %r8d
callq 0x3989
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x3484
movq %r15, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x30fc
movq %r15, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq -0x70(%rbp), %rcx
movl $0x2, %r8d
callq 0x4419
movl -0x64(%rbp), %r8d
movl -0x3c(%rbp), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movl %r8d, %eax
negl %eax
cmovsl %r8d, %eax
cmpl %eax, %ecx
jne 0x6341
movq -0x38(%rbp), %rax
movl %ecx, %ecx
movl -0x54(%rbp), %edi
testq %rcx, %rcx
jle 0x634f
movq -0x8(%r12,%rcx,8), %rdx
leaq -0x1(%rcx), %rsi
cmpq %rdx, -0x8(%rax,%rcx,8)
movq %rsi, %rcx
je 0x6324
setbe %al
jmp 0x6347
setb %al
movl -0x54(%rbp), %edi
testb %al, %al
jne 0x6272
movq -0x78(%rbp), %rdi
xorl %esi, %esi
callq *0x9d55(%rip)           # 0x100b0
movq -0x88(%rbp), %r14
testq %r14, %r14
je 0x638a
leaq -0x40(%rbp), %rbx
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
movq -0x70(%rbp), %rdx
callq 0x55de
movq %r14, %rdi
movq -0x60(%rbp), %rsi
movq %rbx, %rdx
callq 0x3412
movq -0x90(%rbp), %rdx
testq %rdx, %rdx
je 0x63bc
movl 0x4(%rdx), %eax
movl -0x4c(%rbp), %ecx
movl %ecx, 0x4(%rdx)
movl %eax, -0x4c(%rbp)
movl (%rdx), %eax
movl -0x50(%rbp), %ecx
movl %ecx, (%rdx)
movl %eax, -0x50(%rbp)
movq 0x8(%rdx), %rax
movq -0x48(%rbp), %rcx
movq %rcx, 0x8(%rdx)
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
xorl %esi, %esi
callq *0x9ce8(%rip)           # 0x100b0
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq *0x9cdc(%rip)           # 0x100b0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x11f8
callq 0x1220