// File: marxn[P]pupp/3rdparty/gmp/mpn/dcpi1_div_qr.c
// Function: _gmpn_dcpi1_div_qr_n
mp_limb_t
mpn_dcpi1_div_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
		    gmp_pi1_t *dinv, mp_ptr tp)
{
  mp_size_t lo, hi;
  mp_limb_t cy, qh, ql;

  lo = n >> 1;			/* floor(n/2) */
  hi = n - lo;			/* ceil(n/2) */

  if (BELOW_THRESHOLD (hi, DC_DIV_QR_THRESHOLD))
    qh = mpn_sbpi1_div_qr (qp + lo, np + 2 * lo, 2 * hi, dp + lo, hi, dinv->inv32);
  else
    qh = mpn_dcpi1_div_qr_n (qp + lo, np + 2 * lo, dp + lo, hi, dinv, tp);

  mpn_mul (tp, qp + lo, hi, dp, lo);

  cy = mpn_sub_n (np + lo, np + lo, tp, n);
  if (qh != 0)
    cy += mpn_sub_n (np + n, np + n, dp, lo);

  while (cy != 0)
    {
      qh -= mpn_sub_1 (qp + lo, qp + lo, hi, 1);
      cy -= mpn_add_n (np + lo, np + lo, dp, n);
    }

  if (BELOW_THRESHOLD (lo, DC_DIV_QR_THRESHOLD))
    ql = mpn_sbpi1_div_qr (qp, np + hi, 2 * lo, dp + hi, lo, dinv->inv32);
  else
    ql = mpn_dcpi1_div_qr_n (qp, np + hi, dp + hi, lo, dinv, tp);

  mpn_mul (tp, dp, hi, qp, lo);

  cy = mpn_sub_n (np, np, tp, n);
  if (ql != 0)
    cy += mpn_sub_n (np + lo, np + lo, dp, hi);

  while (cy != 0)
    {
      mpn_sub_1 (qp, qp, lo, 1);
      cy -= mpn_add_n (np, np, dp, n);
    }

  return qh;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x20(%rbp), %rax
sarq %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
subq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x33, -0x40(%rbp)
jge 0x51b3b
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rax
shlq %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x40(%rbp), %rdx
shlq %rdx
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x40(%rbp), %r8
movq -0x28(%rbp), %rax
movq (%rax), %r9
callq 0x505f0
movq %rax, -0x50(%rbp)
jmp 0x51b80
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rax
shlq %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x18(%rbp), %rdx
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
callq 0x51ab0
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x40(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %r8
callq 0x37f00
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x30(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x36fe0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x51c0d
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x18(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x36fe0
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x51c0f
cmpq $0x0, -0x48(%rbp)
je 0x51c8b
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x8(%rbp), %rsi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq 0x36e60
movq %rax, %rcx
movq -0x50(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x36c80
movq %rax, %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
jmp 0x51c0f
cmpq $0x33, -0x38(%rbp)
jge 0x51cd1
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x38(%rbp), %rdx
shlq %rdx
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x38(%rbp), %r8
movq -0x28(%rbp), %rax
movq (%rax), %r9
callq 0x505f0
movq %rax, -0x58(%rbp)
jmp 0x51d08
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x18(%rbp), %rdx
movq -0x40(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
callq 0x51ab0
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x8(%rbp), %rcx
movq -0x38(%rbp), %r8
callq 0x37f00
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x36fe0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x51d74
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x18(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x36fe0
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x51d76
cmpq $0x0, -0x48(%rbp)
je 0x51db8
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl $0x1, %ecx
callq 0x36e60
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x36c80
movq %rax, %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
jmp 0x51d76
movq -0x50(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)