// File: 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
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x61d3
cmpq $0x0, -0x10(%rbp)
je 0x61b4
movq -0x10(%rbp), %rax
movl $0x0, 0x4(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x61c6
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x6402
cmpq $0x0, -0x38(%rbp)
jl 0x61e4
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x61ee
xorl %eax, %eax
subq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x6236
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rax
jle 0x6220
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3440
movq %rax, -0x70(%rbp)
jmp 0x622c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x623e
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x6a30
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x6267
jmp 0x6286
leaq 0x947e(%rip), %rdi      # 0xf6ec
leaq 0x7e5f(%rip), %rsi      # 0xe0d4
movl $0x9e1, %edx            # imm = 0x9E1
leaq 0x9472(%rip), %rcx      # 0xf6f3
callq 0x1070
cmpq $0x0, -0x50(%rbp)
seta %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x38(%rbp)
jge 0x62ac
xorl %eax, %eax
subq -0x58(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x62b4
movq -0x58(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x50(%rbp)
jbe 0x6342
cmpl $0x0, -0x2c(%rbp)
jne 0x62d0
cmpq $0x0, -0x38(%rbp)
jl 0x62dd
cmpl $0x1, -0x2c(%rbp)
jne 0x6342
cmpq $0x0, -0x38(%rbp)
jl 0x6342
cmpq $0x0, -0x10(%rbp)
je 0x632c
jmp 0x62e6
movq -0x48(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq 0x1560
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x6309
jmp 0x6328
leaq 0x8195(%rip), %rdi      # 0xe4a5
leaq 0x7dbd(%rip), %rsi      # 0xe0d4
movl $0x9ea, %edx            # imm = 0x9EA
leaq 0x93d0(%rip), %rcx      # 0xf6f3
callq 0x1070
jmp 0x632a
jmp 0x632c
movq -0x28(%rbp), %rax
subq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
xorl %eax, %eax
subq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x6365
movq -0x50(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
cmpq $0x0, -0x10(%rbp)
je 0x63fa
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
subq $0x1, %rcx
cmpq $0x0, (%rax,%rcx,8)
sete %al
andb $0x1, %al
movzbl %al, %eax
movslq %eax, %rcx
movq -0x40(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x63b1
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
subq $0x1, %rcx
cmpq $0x0, (%rax,%rcx,8)
jbe 0x63b3
jmp 0x63d2
leaq 0x93b3(%rip), %rdi      # 0xf76d
leaq 0x7d13(%rip), %rsi      # 0xe0d4
movl $0x9f7, %edx            # imm = 0x9F7
leaq 0x9326(%rip), %rcx      # 0xf6f3
callq 0x1070
cmpq $0x0, -0x38(%rbp)
jge 0x63e5
xorl %eax, %eax
subq -0x40(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x63ed
movq -0x40(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nop