// File: /workspace/github_cpp_makefile_star2_O1/marxn[P]pupp/3rdparty/gmp/mpn/mu_div_qr.c
// Function: _gmpn_mu_div_qr
mp_limb_t
mpn_mu_div_qr (mp_ptr qp,
	       mp_ptr rp,
	       mp_srcptr np,
	       mp_size_t nn,
	       mp_srcptr dp,
	       mp_size_t dn,
	       mp_ptr scratch)
{
  mp_size_t qn;
  mp_limb_t cy, qh;

  qn = nn - dn;
  if (qn + MU_DIV_QR_SKEW_THRESHOLD < dn)
    {
      /* |______________|_ign_first__|   dividend			  nn
		|_______|_ign_first__|   divisor			  dn

		|______|	     quotient (prel)			  qn

		 |___________________|   quotient * ignored-divisor-part  dn-1
      */

      /* Compute a preliminary quotient and a partial remainder by dividing the
	 most significant limbs of each operand.  */
      qh = mpn_mu_div_qr2 (qp, rp + nn - (2 * qn + 1),
			   np + nn - (2 * qn + 1), 2 * qn + 1,
			   dp + dn - (qn + 1), qn + 1,
			   scratch);

      /* Multiply the quotient by the divisor limbs ignored above.  */
      if (dn - (qn + 1) > qn)
	mpn_mul (scratch, dp, dn - (qn + 1), qp, qn);  /* prod is dn-1 limbs */
      else
	mpn_mul (scratch, qp, qn, dp, dn - (qn + 1));  /* prod is dn-1 limbs */

      if (qh)
	cy = mpn_add_n (scratch + qn, scratch + qn, dp, dn - (qn + 1));
      else
	cy = 0;
      scratch[dn - 1] = cy;

      cy = mpn_sub_n (rp, np, scratch, nn - (2 * qn + 1));
      cy = mpn_sub_nc (rp + nn - (2 * qn + 1),
		       rp + nn - (2 * qn + 1),
		       scratch + nn - (2 * qn + 1),
		       qn + 1, cy);
      if (cy)
	{
	  qh -= mpn_sub_1 (qp, qp, qn, 1);
	  mpn_add_n (rp, rp, dp, dn);
	}
    }
  else
    {
      qh = mpn_mu_div_qr2 (qp, rp, np, nn, dp, dn, scratch);
    }

  return qh;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, %rbx
movq %r8, %r15
movq %rcx, %rbp
movq %rdi, %r12
movq %rcx, %r13
subq %r9, %r13
leaq 0x64(%r13), %rax
cmpq %r9, %rax
jge 0x2df5b
movq 0x90(%rsp), %r9
movq %rsi, 0x18(%rsp)
leaq (%rsi,%rbp,8), %rsi
leaq (,%r13,2), %rax
leaq 0x1(,%r13,2), %rcx
leaq 0x8(,%rax,8), %rax
subq %rax, %rsi
movq %rdx, 0x48(%rsp)
leaq (%rdx,%rbp,8), %rdx
subq %rax, %rdx
leaq (%r15,%rbx,8), %rax
leaq 0x1(%r13), %r14
movq %r13, %rdi
notq %rdi
leaq (%rax,%rdi,8), %r8
movq %r9, 0x28(%rsp)
movq %r9, (%rsp)
movq %r12, %rdi
movq %rsi, 0x40(%rsp)
movq %rcx, 0x30(%rsp)
movq %r14, %r9
callq 0x2e073
movq %rax, 0x20(%rsp)
movq %rbx, 0x50(%rsp)
movq %r14, 0x38(%rsp)
subq %r14, %rbx
cmpq %r13, %rbx
movq %r15, 0x10(%rsp)
jle 0x2df7a
movq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r12, %rcx
movq %r13, %r8
jmp 0x2df8e
movq %r12, %rdi
movq %rbp, %rcx
movq %r15, %r8
movq %rbx, %r9
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2e073
movq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
movq %rbx, %r8
callq 0x1cd58
movq 0x30(%rsp), %r15
negq %r15
cmpq $0x0, 0x20(%rsp)
je 0x2dfb9
leaq (%r14,%r13,8), %rdi
movq %rdi, %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rcx
callq 0x1bfa0
jmp 0x2dfbb
xorl %eax, %eax
movq 0x50(%rsp), %rbx
movq %rax, -0x8(%r14,%rbx,8)
movq %rbp, %rcx
subq 0x30(%rsp), %rcx
movq 0x18(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq %r14, %rdx
callq 0x1c1c0
leaq (%r14,%rbp,8), %rcx
leaq (%rcx,%r15,8), %rdx
movq 0x40(%rsp), %rdi
movq %rdi, %rsi
movq 0x38(%rsp), %rcx
movq %rax, %r8
callq 0x1c1a0
testq %rax, %rax
je 0x2e034
subq $0x1, (%r12)
jae 0x2e03b
cmpq $0x2, %r13
movl $0x1, %eax
cmovlq %rax, %r13
xorl %r14d, %r14d
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rdi
cmpq %rax, %r13
je 0x2e04a
subq $0x1, (%r12,%rax,8)
leaq 0x1(%rax), %rax
jb 0x2e022
jmp 0x2e051
movq 0x20(%rsp), %r14
jmp 0x2e061
xorl %r14d, %r14d
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rdi
jmp 0x2e051
movq $-0x1, %r14
addq 0x20(%rsp), %r14
movq %rdi, %rsi
movq %rbx, %rcx
callq 0x1bfa0
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq