// File: /workspace/github_cpp_makefile_star2_O1/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 0x44a8
movq %rcx, %rbx
movq %rdx, %r13
movl %r8d, -0x34(%rbp)
movl %r15d, %r12d
negl %r12d
cmovsl %r15d, %r12d
testq %r14, %r14
movq %rsi, -0x40(%rbp)
je 0x44ca
movslq (%r14), %rax
cmpq %rax, %r12
jle 0x44ce
movq %rbx, -0x30(%rbp)
cmpq $0x2, %r12
movl $0x1, %ebx
cmovgeq %r12, %rbx
movq 0x8(%r14), %rdi
leaq (,%rbx,8), %rdx
xorl %esi, %esi
callq *0xbc28(%rip)           # 0x100a8
movq %rax, %rdi
movq %rax, 0x8(%r14)
movl %ebx, (%r14)
movl 0x4(%r14), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpq %rcx, %rbx
jae 0x44a2
movl $0x0, 0x4(%r14)
movq -0x30(%rbp), %rbx
jmp 0x44d2
testq %r14, %r14
je 0x44b5
movl $0x0, 0x4(%r14)
xorl %eax, %eax
movl $0x0, %ebx
testq %rsi, %rsi
jne 0x459c
jmp 0x459f
xorl %edi, %edi
jmp 0x44d2
movq 0x8(%r14), %rdi
movq 0x8(%r13), %rsi
movq %rdi, -0x30(%rbp)
movq %r12, %rdx
movq %rbx, %rcx
callq 0x48f5
subq %rax, %rbx
jbe 0x45b1
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
movq %rcx, %r13
negq %r13
testl %r15d, %r15d
cmovnsq %rcx, %r13
testq %rax, %rax
je 0x452f
testl %r15d, %r15d
sets %sil
setns %cl
movl -0x34(%rbp), %edx
testl %edx, %edx
sete %dil
cmpl $0x1, %edx
sete %dl
testb %sil, %dil
jne 0x4533
andb %cl, %dl
jne 0x4533
movq %rax, %rbx
jmp 0x4558
xorl %ebx, %ebx
jmp 0x4558
testq %r14, %r14
je 0x4555
movl $0x1, %ecx
movq -0x30(%rbp), %rdi
movq %rdi, %rsi
movq %r12, %rdx
callq 0x155d
testq %rax, %rax
jne 0x45ef
negq %r13
movq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
testq %rcx, %rcx
je 0x4570
movq 0x8(%rcx), %rax
movq %rbx, (%rax)
movl %r13d, 0x4(%rcx)
testq %r14, %r14
je 0x459f
xorl %eax, %eax
cmpq $0x0, -0x8(%rdx,%r12,8)
sete %al
subq %rax, %r12
je 0x458d
cmpq $0x0, -0x8(%rdx,%r12,8)
je 0x45d0
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 0x6cbf(%rip), %rdi      # 0xb277
leaq 0x5aa5(%rip), %rsi      # 0xa064
leaq 0x6cb8(%rip), %rcx      # 0xb27e
movl $0x9e1, %edx            # imm = 0x9E1
callq 0x1090
leaq 0x6d21(%rip), %rdi      # 0xb2f8
leaq 0x5a86(%rip), %rsi      # 0xa064
leaq 0x6c99(%rip), %rcx      # 0xb27e
movl $0x9f7, %edx            # imm = 0x9F7
callq 0x1090
leaq 0x5e3f(%rip), %rdi      # 0xa435
leaq 0x5a67(%rip), %rsi      # 0xa064
leaq 0x6c7a(%rip), %rcx      # 0xb27e
movl $0x9ea, %edx            # imm = 0x9EA
callq 0x1090