// File: /workspace/github_cpp_makefile_star2_O3/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 0x4421
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 0x4443
movslq (%r14), %rax
movq 0x8(%r14), %rdi
cmpq %rax, %r12
jle 0x4445
leaq (,%r12,8), %rdx
xorl %esi, %esi
callq *0xbcab(%rip)           # 0x100a8
movq %rax, %rdi
movq %rax, 0x8(%r14)
movl %r12d, (%r14)
movl 0x4(%r14), %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl %ecx, %r12d
jae 0x4445
movl $0x0, 0x4(%r14)
jmp 0x4445
testq %r14, %r14
je 0x442e
movl $0x0, 0x4(%r14)
xorl %eax, %eax
movl $0x0, %ebx
testq %rsi, %rsi
jne 0x450f
jmp 0x4512
xorl %edi, %edi
movq 0x8(%r13), %rsi
movq %rdi, -0x38(%rbp)
movq %r12, %rdx
movq %rbx, %rcx
callq 0x485c
subq %rax, %rbx
jbe 0x4524
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
movl %ecx, %r13d
negl %r13d
testl %r15d, %r15d
cmovnsl %ecx, %r13d
testq %rax, %rax
movq -0x38(%rbp), %rdi
je 0x44a6
testl %r15d, %r15d
sets %sil
setns %cl
movl -0x2c(%rbp), %edx
testl %edx, %edx
sete %r8b
cmpl $0x1, %edx
sete %dl
testb %sil, %r8b
jne 0x44aa
andb %cl, %dl
jne 0x44aa
movq %rax, %rbx
jmp 0x44cf
xorl %ebx, %ebx
jmp 0x44cf
testq %r14, %r14
je 0x44cc
movl $0x1, %ecx
movq %rdi, %rsi
movq %r12, %rdx
callq 0x155d
movq -0x38(%rbp), %rdi
testq %rax, %rax
jne 0x4562
negl %r13d
movq -0x40(%rbp), %rcx
testq %rcx, %rcx
je 0x44e3
movq 0x8(%rcx), %rax
movq %rbx, (%rax)
movl %r13d, 0x4(%rcx)
testq %r14, %r14
je 0x4512
xorl %eax, %eax
cmpq $0x0, -0x8(%rdi,%r12,8)
sete %al
subq %rax, %r12
je 0x4500
cmpq $0x0, -0x8(%rdi,%r12,8)
je 0x4543
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 0x6d4c(%rip), %rdi      # 0xb277
leaq 0x5b32(%rip), %rsi      # 0xa064
leaq 0x6d45(%rip), %rcx      # 0xb27e
movl $0x9e1, %edx            # imm = 0x9E1
callq 0x1090
leaq 0x6dae(%rip), %rdi      # 0xb2f8
leaq 0x5b13(%rip), %rsi      # 0xa064
leaq 0x6d26(%rip), %rcx      # 0xb27e
movl $0x9f7, %edx            # imm = 0x9F7
callq 0x1090
leaq 0x5ecc(%rip), %rdi      # 0xa435
leaq 0x5af4(%rip), %rsi      # 0xa064
leaq 0x6d07(%rip), %rcx      # 0xb27e
movl $0x9ea, %edx            # imm = 0x9EA
callq 0x1090