// File: /workspace/github_cpp_makefile_star2_O2/marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpz_div_qr_ui
static unsigned long
mpz_div_qr_ui (mpz_t q, mpz_t r,
	       const mpz_t n, unsigned long d, enum mpz_div_round_mode mode)
{
  mp_size_t ns, qn;
  mp_ptr qp;
  mp_limb_t rl;
  mp_size_t rs;

  ns = n->_mp_size;
  if (ns == 0)
    {
      if (q)
	q->_mp_size = 0;
      if (r)
	r->_mp_size = 0;
      return 0;
    }

  qn = GMP_ABS (ns);
  if (q)
    qp = MPZ_REALLOC (q, qn);
  else
    qp = NULL;

  rl = mpn_div_qr_1 (qp, n->_mp_d, qn, d);
  assert (rl < d);

  rs = rl > 0;
  rs = (ns < 0) ? -rs : rs;

  if (rl > 0 && ( (mode == GMP_DIV_FLOOR && ns < 0)
		  || (mode == GMP_DIV_CEIL && ns >= 0)))
    {
      if (q)
	gmp_assert_nocarry (mpn_add_1 (qp, qp, qn, 1));
      rl = d - rl;
      rs = -rs;
    }

  if (r)
    {
      r->_mp_d[0] = rl;
      r->_mp_size = rs;
    }
  if (q)
    {
      qn -= (qp[qn-1] == 0);
      assert (qn == 0 || qp[qn-1] > 0);

      q->_mp_size = (ns < 0) ? - qn : qn;
    }

  return rl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movl 0x4(%rdx), %r15d
testl %r15d, %r15d
je 0x3c51
movq %rcx, %rbx
movq %rdx, %r13
movl %r8d, -0x2c(%rbp)
movl %r15d, %r12d
negl %r12d
cmovsl %r15d, %r12d
testq %r14, %r14
movq %rsi, -0x40(%rbp)
je 0x3c70
movslq (%r14), %rax
cmpq %rax, %r12
jle 0x3c74
movq %r14, %rdi
movq %r12, %rsi
callq 0x228f
movq %rax, %rdi
jmp 0x3c78
testq %r14, %r14
je 0x3c5b
andl $0x0, 0x4(%r14)
xorl %eax, %eax
movl $0x0, %ebx
testq %rsi, %rsi
jne 0x3d40
jmp 0x3d43
xorl %edi, %edi
jmp 0x3c78
movq 0x8(%r14), %rdi
movq 0x8(%r13), %rsi
movq %rdi, -0x38(%rbp)
movq %r12, %rdx
movq %rbx, %rcx
callq 0x4062
subq %rax, %rbx
jbe 0x3d55
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
movl %ecx, %r13d
negl %r13d
testl %r15d, %r15d
cmovnsl %ecx, %r13d
testq %rax, %rax
je 0x3cd5
testl %r15d, %r15d
sets %sil
setns %cl
movl -0x2c(%rbp), %edx
testl %edx, %edx
sete %dil
cmpl $0x1, %edx
sete %dl
testb %sil, %dil
jne 0x3cd9
andb %cl, %dl
jne 0x3cd9
movq %rax, %rbx
jmp 0x3cfc
xorl %ebx, %ebx
jmp 0x3cfc
testq %r14, %r14
je 0x3cf9
pushq $0x1
popq %rcx
movq -0x38(%rbp), %rdi
movq %rdi, %rsi
movq %r12, %rdx
callq 0x13a4
testq %rax, %rax
jne 0x3d93
negl %r13d
movq -0x40(%rbp), %rcx
testq %rcx, %rcx
je 0x3d10
movq 0x8(%rcx), %rax
movq %rbx, (%rax)
movl %r13d, 0x4(%rcx)
testq %r14, %r14
je 0x3d43
xorl %eax, %eax
movq -0x38(%rbp), %rcx
cmpq $0x0, -0x8(%rcx,%r12,8)
sete %al
subq %rax, %r12
je 0x3d31
cmpq $0x0, -0x8(%rcx,%r12,8)
je 0x3d74
movl %r12d, %eax
negl %eax
testl %r15d, %r15d
cmovnsl %r12d, %eax
movq %r14, %rsi
movl %eax, 0x4(%rsi)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x651b(%rip), %rdi      # 0xa277
leaq 0x5301(%rip), %rsi      # 0x9064
leaq 0x6514(%rip), %rcx      # 0xa27e
movl $0x9e1, %edx            # imm = 0x9E1
callq 0x1090
leaq 0x657d(%rip), %rdi      # 0xa2f8
leaq 0x52e2(%rip), %rsi      # 0x9064
leaq 0x64f5(%rip), %rcx      # 0xa27e
movl $0x9f7, %edx            # imm = 0x9F7
callq 0x1090
leaq 0x569b(%rip), %rdi      # 0x9435
leaq 0x52c3(%rip), %rsi      # 0x9064
leaq 0x64d6(%rip), %rcx      # 0xa27e
movl $0x9ea, %edx            # imm = 0x9EA
callq 0x1090