// File: /workspace/github_cpp_makefile_star2_O2/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 %r8, %r15
movq %rcx, %rbp
movq %rcx, %r13
subq %r9, %r13
leaq 0x64(%r13), %rax
cmpq %r9, %rax
jge 0x27fc6
movq 0x90(%rsp), %r10
movq %rsi, 0x50(%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,%r9,8), %rax
movq %r9, %rbx
leaq 0x1(%r13), %r12
movq %r13, %r8
notq %r8
leaq (%rax,%r8,8), %r8
movq %r10, 0x8(%rsp)
movq %r10, (%rsp)
movq %rsi, 0x40(%rsp)
movq %rcx, 0x20(%rsp)
movq %rdi, %r14
movq %r12, %r9
callq 0x280b7
movq %rax, 0x10(%rsp)
movq %rbx, 0x30(%rsp)
movq %r12, 0x38(%rsp)
subq %r12, %rbx
cmpq %r13, %rbx
movq %r15, 0x18(%rsp)
movq %r14, 0x28(%rsp)
jle 0x27fdf
movq 0x8(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %r13, %r8
jmp 0x27ff0
movq %rbp, %rcx
movq %r15, %r8
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x280b7
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
movq %rbx, %r8
callq 0x18a58
movq 0x20(%rsp), %r15
negq %r15
cmpq $0x0, 0x10(%rsp)
movq 0x30(%rsp), %r12
je 0x28025
movq 0x8(%rsp), %r14
leaq (%r14,%r13,8), %rdi
movq %rdi, %rsi
movq 0x18(%rsp), %rdx
movq %rbx, %rcx
callq 0x17cf0
jmp 0x2802c
xorl %eax, %eax
movq 0x8(%rsp), %r14
movq %rax, -0x8(%r14,%r12,8)
movq %rbp, %rcx
subq 0x20(%rsp), %rcx
movq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
movq %r14, %rdx
callq 0x17ed0
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 0x17eb0
testq %rax, %rax
je 0x280a0
pushq $0x1
popq %rcx
movq 0x28(%rsp), %rdi
movq %rdi, %rsi
movq %r13, %rdx
callq 0x17e44
movq 0x10(%rsp), %r14
subq %rax, %r14
movq %rbx, %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %rdx
movq %r12, %rcx
callq 0x17cf0
jmp 0x280a5
movq 0x10(%rsp), %r14
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq