// File: 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
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x36274
callq 0x56350
cmpq $0x0, -0x48(%rbp)
jne 0x36297
movq -0x8(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x8(%rax)
jmp 0x36743
movq -0x48(%rbp), %rax
xorq -0x50(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x48(%rbp)
jl 0x362b7
movq -0x48(%rbp), %rax
movq %rax, -0xc0(%rbp)
jmp 0x362c4
xorl %eax, %eax
subq -0x48(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x50(%rbp)
jl 0x362e3
movq -0x50(%rbp), %rax
movq %rax, -0xc8(%rbp)
jmp 0x362f0
xorl %eax, %eax
subq -0x50(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x80(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
subq 0x8(%rcx), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
subq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movb $0x1, %al
cmpq $0x0, -0x70(%rbp)
movb %al, -0xc9(%rbp)
jg 0x36398
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
sete %al
movb %al, -0xc9(%rbp)
movb -0xc9(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x9c(%rbp)
xorl %eax, %eax
subq -0x70(%rbp), %rax
cmpq $0x0, %rax
jle 0x363c4
xorl %eax, %eax
subq -0x70(%rbp), %rax
movq %rax, -0xd8(%rbp)
jmp 0x363cf
xorl %eax, %eax
movq %rax, -0xd8(%rbp)
jmp 0x363cf
movq -0xd8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
shlq $0x3, %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x90(%rbp), %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x90(%rbp), %rax
addq -0x70(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x48(%rbp), %rax
addq -0x70(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x9c(%rbp)
je 0x36544
movq -0x68(%rbp), %rax
addq $0x1, %rax
shlq $0x3, %rax
cmpq $0x7f00, %rax           # imm = 0x7F00
setbe %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x36479
movq -0x68(%rbp), %rax
leaq 0x17(,%rax,8), %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0xe0(%rbp)
jmp 0x36498
movq -0x68(%rbp), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
leaq -0xa8(%rbp), %rdi
callq 0x56430
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x364a5
jmp 0x364a7
cmpq $0x0, -0x70(%rbp)
je 0x36502
jmp 0x364b0
movq -0x38(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xb8(%rbp)
jmp 0x364c8
jmp 0x364ca
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0xb0(%rbp)
movq $0x0, (%rax)
movq -0xb8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0xb8(%rbp)
cmpq $0x0, %rax
jne 0x364ca
jmp 0x36500
jmp 0x36502
jmp 0x36504
jmp 0x36506
jmp 0x36508
jmp 0x3650a
jmp 0x3650c
jmp 0x3650e
jmp 0x36510
jmp 0x36512
jmp 0x36514
movq -0x38(%rbp), %rdi
movq -0x70(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x554c6
jmp 0x36532
movq -0x38(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x365bd
movq -0x48(%rbp), %rax
addq $0x1, %rax
shlq $0x3, %rax
cmpq $0x7f00, %rax           # imm = 0x7F00
setbe %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x36593
movq -0x48(%rbp), %rax
leaq 0x17(,%rax,8), %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0xe8(%rbp)
jmp 0x365b2
movq -0x48(%rbp), %rsi
addq $0x1, %rsi
shlq $0x3, %rsi
leaq -0xa8(%rbp), %rdi
callq 0x56430
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
jne 0x36665
movq -0x50(%rbp), %rax
shlq $0x3, %rax
cmpq $0x7f00, %rax           # imm = 0x7F00
setbe %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x36616
movq -0x50(%rbp), %rax
leaq 0xf(,%rax,8), %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0xf0(%rbp)
jmp 0x36631
movq -0x50(%rbp), %rsi
shlq $0x3, %rsi
leaq -0xa8(%rbp), %rdi
callq 0x56430
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x3663e
jmp 0x36640
jmp 0x36642
jmp 0x36644
jmp 0x36646
jmp 0x36648
jmp 0x3664a
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x554c6
jmp 0x3665d
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x36667
jmp 0x36669
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x50(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x3b0f0
movq -0x30(%rbp), %rax
movq -0x58(%rbp), %rcx
subq $0x1, %rcx
cmpq $0x0, (%rax,%rcx,8)
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rcx
movq -0x58(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x88(%rbp), %rcx
movq -0x98(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x78(%rbp)
jl 0x366e6
movq -0x58(%rbp), %rax
movq %rax, -0xf8(%rbp)
jmp 0x366f3
xorl %eax, %eax
subq -0x58(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x98(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, -0xa8(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x36741
movq -0xa8(%rbp), %rdi
callq 0x564a0
jmp 0x36743
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax,%rax)