// File: marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpn_div_qr_pi1
static void
mpn_div_qr_pi1 (mp_ptr qp,
		mp_ptr np, mp_size_t nn, mp_limb_t n1,
		mp_srcptr dp, mp_size_t dn,
		mp_limb_t dinv)
{
  mp_size_t i;

  mp_limb_t d1, d0;
  mp_limb_t cy, cy1;
  mp_limb_t q;

  assert (dn > 2);
  assert (nn >= dn);

  d1 = dp[dn - 1];
  d0 = dp[dn - 2];

  assert ((d1 & GMP_LIMB_HIGHBIT) != 0);
  /* Iteration variable is the index of the q limb.
   *
   * We divide <n1, np[dn-1+i], np[dn-2+i], np[dn-3+i],..., np[i]>
   * by            <d1,          d0,        dp[dn-3],  ..., dp[0] >
   */

  i = nn - dn;
  do
    {
      mp_limb_t n0 = np[dn-1+i];

      if (n1 == d1 && n0 == d0)
	{
	  q = GMP_LIMB_MAX;
	  mpn_submul_1 (np+i, dp, dn, q);
	  n1 = np[dn-1+i];	/* update n1, last loop's value will now be invalid */
	}
      else
	{
	  gmp_udiv_qr_3by2 (q, n1, n0, n1, n0, np[dn-2+i], d1, d0, dinv);

	  cy = mpn_submul_1 (np + i, dp, dn-2, q);

	  cy1 = n0 < cy;
	  n0 = n0 - cy;
	  cy = n1 < cy1;
	  n1 = n1 - cy1;
	  np[dn-2+i] = n0;

	  if (cy != 0)
	    {
	      n1 += d1 + mpn_add_n (np + i, np + i, dp, dn - 1);
	      q--;
	    }
	}

      if (qp)
	qp[i] = q;
    }
  while (--i >= 0);

  np[dn - 1] = n1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpq $0x2, -0x30(%rbp)
jle 0xce50
jmp 0xce6f
leaq 0x2bbd(%rip), %rdi      # 0xfa14
leaq 0x1276(%rip), %rsi      # 0xe0d4
movl $0x3e6, %edx            # imm = 0x3E6
leaq 0x2bb1(%rip), %rcx      # 0xfa1b
callq 0x1070
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
jl 0xce7b
jmp 0xce9a
leaq 0x27fa(%rip), %rdi      # 0xf67c
leaq 0x124b(%rip), %rsi      # 0xe0d4
movl $0x3e7, %edx            # imm = 0x3E7
leaq 0x2b86(%rip), %rcx      # 0xfa1b
callq 0x1070
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
subq $0x2, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq -0x40(%rbp), %rax
cmpq $0x0, %rax
je 0xced8
jmp 0xcef7
leaq 0x2b97(%rip), %rdi      # 0xfa76
leaq 0x11ee(%rip), %rsi      # 0xe0d4
movl $0x3ec, %edx            # imm = 0x3EC
leaq 0x2b29(%rip), %rcx      # 0xfa1b
callq 0x1070
movq -0x18(%rbp), %rax
subq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
subq $0x1, %rcx
addq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x40(%rbp), %rax
jne 0xcf74
movq -0x68(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0xcf74
movq $-0x1, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x60(%rbp), %rcx
callq 0x1d40
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
subq $0x1, %rcx
addq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
jmp 0xd4f7
jmp 0xcf76
jmp 0xcf78
movq -0x20(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0xc0(%rbp), %rax
movl %eax, -0xac(%rbp)
movq -0xc0(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0xb4(%rbp)
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0xc8(%rbp), %rax
movl %eax, -0xb0(%rbp)
movq -0xc8(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0xb8(%rbp)
movl -0xac(%rbp), %eax
movl -0xb0(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0x90(%rbp)
movl -0xac(%rbp), %eax
movl -0xb8(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0x98(%rbp)
movl -0xb4(%rbp), %eax
movl -0xb0(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0xa0(%rbp)
movl -0xb4(%rbp), %eax
movl -0xb8(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0x90(%rbp), %rax
shrq $0x20, %rax
addq -0x98(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0xa0(%rbp), %rax
addq -0x98(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jae 0xd090
movabsq $0x100000000, %rax      # imm = 0x100000000
addq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq -0x98(%rbp), %rcx
shrq $0x20, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x98(%rbp), %rax
shlq $0x20, %rax
movabsq $0xffffffff, %rcx       # imm = 0xFFFFFFFF
andq -0x90(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
jmp 0xd0ce
movq -0x70(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x60(%rbp), %rax
addq -0x20(%rbp), %rax
movq -0xd0(%rbp), %rcx
cmpq -0x70(%rbp), %rcx
setb %cl
andb $0x1, %cl
movzbl %cl, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
movq -0x40(%rbp), %rcx
imulq -0x60(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
subq $0x2, %rcx
addq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
subq -0x48(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x20(%rbp), %rax
subq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rdx
subq $0x2, %rdx
addq -0x38(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpq -0x48(%rbp), %rcx
setb %cl
andb $0x1, %cl
movzbl %cl, %ecx
movslq %ecx, %rcx
subq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0xd181
movq -0x48(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x118(%rbp)
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0x110(%rbp), %rax
movl %eax, -0xfc(%rbp)
movq -0x110(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0x104(%rbp)
movabsq $0xffffffff, %rax       # imm = 0xFFFFFFFF
andq -0x118(%rbp), %rax
movl %eax, -0x100(%rbp)
movq -0x118(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0x108(%rbp)
movl -0xfc(%rbp), %eax
movl -0x100(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0xe0(%rbp)
movl -0xfc(%rbp), %eax
movl -0x108(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0xe8(%rbp)
movl -0x104(%rbp), %eax
movl -0x100(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0xf0(%rbp)
movl -0x104(%rbp), %eax
movl -0x108(%rbp), %ecx
imulq %rcx, %rax
movq %rax, -0xf8(%rbp)
movq -0xe0(%rbp), %rax
shrq $0x20, %rax
addq -0xe8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xf0(%rbp), %rax
addq -0xe8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
cmpq -0xf0(%rbp), %rax
jae 0xd299
movabsq $0x100000000, %rax      # imm = 0x100000000
addq -0xf8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movq -0xe8(%rbp), %rcx
shrq $0x20, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0xe8(%rbp), %rax
shlq $0x20, %rax
movabsq $0xffffffff, %rcx       # imm = 0xFFFFFFFF
andq -0xe0(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
jmp 0xd2d7
movq -0x68(%rbp), %rax
subq -0x80(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x20(%rbp), %rax
subq -0x78(%rbp), %rax
movq -0x68(%rbp), %rcx
cmpq -0x80(%rbp), %rcx
setb %cl
andb $0x1, %cl
movzbl %cl, %ecx
movslq %ecx, %rcx
subq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x120(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x70(%rbp), %rax
setae %al
andb $0x1, %al
movzbl %al, %eax
movslq %eax, %rcx
xorl %eax, %eax
subq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x68(%rbp), %rax
movq -0x88(%rbp), %rcx
andq -0x48(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x128(%rbp)
movq -0x20(%rbp), %rax
movq -0x88(%rbp), %rcx
andq -0x40(%rbp), %rcx
addq %rcx, %rax
movq -0x128(%rbp), %rcx
cmpq -0x68(%rbp), %rcx
setb %cl
andb $0x1, %cl
movzbl %cl, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x128(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x40(%rbp), %rax
jb 0xd40d
movq -0x20(%rbp), %rax
cmpq -0x40(%rbp), %rax
ja 0xd3c0
movq -0x68(%rbp), %rax
cmpq -0x48(%rbp), %rax
jb 0xd40b
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x68(%rbp), %rax
subq -0x48(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x20(%rbp), %rax
subq -0x40(%rbp), %rax
movq -0x68(%rbp), %rcx
cmpq -0x48(%rbp), %rcx
setb %cl
andb $0x1, %cl
movzbl %cl, %ecx
movslq %ecx, %rcx
subq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x130(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0xd40b
jmp 0xd40d
jmp 0xd40f
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
subq $0x2, %rdx
movq -0x60(%rbp), %rcx
callq 0x1d40
movq %rax, -0x50(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x50(%rbp), %rax
setb %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x58(%rbp)
movq -0x68(%rbp), %rax
subq -0x50(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x58(%rbp), %rax
setb %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
subq -0x58(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x68(%rbp), %rdx
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
subq $0x2, %rcx
addq -0x38(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
cmpq $0x0, -0x50(%rbp)
je 0xd4f5
movq -0x40(%rbp), %rax
movq %rax, -0x138(%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 -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
subq $0x1, %rcx
callq 0x1600
movq %rax, %rcx
movq -0x138(%rbp), %rax
addq %rcx, %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x60(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0xd4f7
cmpq $0x0, -0x8(%rbp)
je 0xd50e
movq -0x60(%rbp), %rdx
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0xd510
movq -0x38(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jge 0xcf03
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
subq $0x1, %rcx
movq %rdx, (%rax,%rcx,8)
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq