// File: /workspace/github_cpp_makefile_star2_O1/marxn[P]pupp/3rdparty/gmp/mpf/div.c
// Function: _gmpf_div
void
mpf_div (mpf_ptr r, mpf_srcptr u, mpf_srcptr v)
{
  mp_srcptr up, vp;
  mp_ptr rp, tp, new_vp;
  mp_size_t usize, vsize, rsize, prospective_rsize, tsize, zeros;
  mp_size_t sign_quotient, prec, high_zero, chop;
  mp_exp_t rexp;
  int copy_u;
  TMP_DECL;

  usize = SIZ(u);
  vsize = SIZ(v);

  if (UNLIKELY (vsize == 0))
    DIVIDE_BY_ZERO;

  if (usize == 0)
    {
      SIZ(r) = 0;
      EXP(r) = 0;
      return;
    }

  sign_quotient = usize ^ vsize;
  usize = ABS (usize);
  vsize = ABS (vsize);
  prec = PREC(r);

  TMP_MARK;
  rexp = EXP(u) - EXP(v) + 1;

  rp = PTR(r);
  up = PTR(u);
  vp = PTR(v);

  prospective_rsize = usize - vsize + 1; /* quot from using given u,v sizes */
  rsize = prec + 1;			 /* desired quot */

  zeros = rsize - prospective_rsize;	 /* padding u to give rsize */
  copy_u = (zeros > 0 || rp == up);	 /* copy u if overlap or padding */

  chop = MAX (-zeros, 0);		 /* negative zeros means shorten u */
  up += chop;
  usize -= chop;
  zeros += chop;			 /* now zeros >= 0 */

  tsize = usize + zeros;		 /* size for possible copy of u */

  /* copy and possibly extend u if necessary */
  if (copy_u)
    {
      tp = TMP_ALLOC_LIMBS (tsize + 1);	/* +1 for mpn_div_q's scratch needs */
      MPN_ZERO (tp, zeros);
      MPN_COPY (tp+zeros, up, usize);
      up = tp;
      usize = tsize;
    }
  else
    {
      tp = TMP_ALLOC_LIMBS (usize + 1);
    }

  /* ensure divisor doesn't overlap quotient */
  if (rp == vp)
    {
      new_vp = TMP_ALLOC_LIMBS (vsize);
      MPN_COPY (new_vp, vp, vsize);
      vp = new_vp;
    }

  ASSERT (usize-vsize+1 == rsize);
  mpn_div_q (rp, up, usize, vp, vsize, tp);

  /* strip possible zero high limb */
  high_zero = (rp[rsize-1] == 0);
  rsize -= high_zero;
  rexp -= high_zero;

  SIZ(r) = sign_quotient >= 0 ? rsize : -rsize;
  EXP(r) = rexp;
  TMP_FREE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movslq 0x4(%rdx), %rax
testq %rax, %rax
je 0x1bd2e
movslq 0x4(%rsi), %r11
testl %r11d, %r11d
je 0x1bc2c
movq %r11, %r13
negq %r13
cmovsq %r11, %r13
movq %rax, %r14
negq %r14
movq %rax, -0x48(%rbp)
cmovsq %rax, %r14
movslq (%rdi), %r8
xorl %r10d, %r10d
movq %r10, -0x40(%rbp)
movq 0x8(%rsi), %rax
movq %rax, -0x70(%rbp)
movq 0x10(%rsi), %rsi
movq 0x8(%rdx), %rax
movq %rax, -0x68(%rbp)
movq 0x10(%rdx), %rcx
movq %rdi, -0x78(%rbp)
movq 0x10(%rdi), %r9
movq %r13, %rax
notq %rax
addq %r14, %rax
movq %r8, -0x50(%rbp)
addq %r8, %rax
incq %rax
testq %rax, %rax
setg %dl
cmpq %rsi, %r9
sete %dil
orb %dl, %dil
movq %rax, %rbx
negq %rbx
testq %rbx, %rbx
cmovleq %r10, %rbx
leaq (%rsi,%rbx,8), %rdx
movq %r13, %r15
subq %rbx, %r15
cmpb $0x1, %dil
jne 0x1bc40
addq %rax, %rbx
addq %rax, %r13
leaq 0x8(,%r13,8), %rsi
cmpq $0x7f00, %rsi           # imm = 0x7F00
movq %r9, -0x38(%rbp)
movq %r11, -0x58(%rbp)
ja 0x1bd3a
movq %rsp, %r12
addq $0xf, %rsi
andq $-0x10, %rsi
subq %rsi, %r12
movq %r12, %rsp
movq %rcx, -0x60(%rbp)
testq %rbx, %rbx
je 0x1bc0c
movq %rdx, -0x30(%rbp)
leaq (,%rbx,8), %rdx
movq %r12, %rdi
xorl %esi, %esi
callq 0x6170
movq -0x30(%rbp), %rdx
leaq (%r12,%rbx,8), %rdi
movq %rdx, %rsi
movq %r15, %rdx
callq 0x2f4c6
movq %r12, %rdx
movq -0x38(%rbp), %r9
movq -0x60(%rbp), %rcx
movq -0x58(%rbp), %r11
jmp 0x1bc69
movl $0x0, 0x4(%rdi)
movq $0x0, 0x8(%rdi)
jmp 0x1bd1f
leaq 0x8(,%r15,8), %rsi
cmpq $0x7f00, %rsi           # imm = 0x7F00
ja 0x1bd59
movq %rsp, %r12
addq $0xf, %rsi
andq $-0x10, %rsi
subq %rsi, %r12
movq %r12, %rsp
movq %r15, %r13
movq -0x48(%rbp), %r15
xorq %r11, %r15
movq -0x50(%rbp), %rax
leaq 0x1(%rax), %rbx
cmpq %rcx, %r9
jne 0x1bccc
movq %rdx, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq %r15, -0x48(%rbp)
leaq (,%r14,8), %rsi
cmpq $0xfe0, %r14            # imm = 0xFE0
ja 0x1bd84
movq %rsp, %r15
addq $0xf, %rsi
andq $-0x10, %rsi
subq %rsi, %r15
movq %r15, %rsp
movq %r15, %rdi
movq %rcx, %rsi
movq %r14, %rdx
callq 0x2f4c6
movq %r15, %rcx
movq -0x48(%rbp), %r15
movq -0x38(%rbp), %r9
movq -0x30(%rbp), %rdx
movq %r9, %rdi
movq %rdx, %rsi
movq %r13, %rdx
movq %r14, %r8
movq %r9, %r14
movq %r12, %r9
callq 0x1f030
xorl %eax, %eax
movq -0x50(%rbp), %rcx
cmpq $0x0, (%r14,%rcx,8)
sete %al
subl %eax, %ebx
movq -0x70(%rbp), %rdx
subq -0x68(%rbp), %rdx
subq %rax, %rdx
incq %rdx
movl %ebx, %eax
negl %eax
testq %r15, %r15
cmovnsl %ebx, %eax
movq -0x78(%rbp), %rcx
movl %eax, 0x4(%rcx)
movq %rdx, 0x8(%rcx)
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
jne 0x1bd33
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x30104
callq 0x301a3
jmp 0x1bd1f
leaq -0x40(%rbp), %rdi
movq %rcx, %r12
movq %rdx, -0x30(%rbp)
callq 0x30170
movq -0x30(%rbp), %rdx
movq %r12, %rcx
movq %rax, %r12
jmp 0x1bbe9
leaq -0x40(%rbp), %rdi
movq %r9, -0x38(%rbp)
movq %rcx, %r12
movq %rdx, %r13
movq %r11, %rbx
callq 0x30170
movq %rbx, %r11
movq %r13, %rdx
movq %r12, %rcx
movq -0x38(%rbp), %r9
movq %rax, %r12
jmp 0x1bc66
leaq -0x40(%rbp), %rdi
movq %rcx, %r15
callq 0x30170
movq %r15, %rcx
movq %rax, %r15
jmp 0x1bcaf
nop