// File: /workspace/github_cpp_makefile_star2_O2/marxn[P]pupp/3rdparty/gmp/mpf/add.c
// Function: _gmpf_add
void
mpf_add (mpf_ptr r, mpf_srcptr u, mpf_srcptr v)
{
  mp_srcptr up, vp;
  mp_ptr rp, tp;
  mp_size_t usize, vsize, rsize;
  mp_size_t prec;
  mp_exp_t uexp;
  mp_size_t ediff;
  mp_limb_t cy;
  int negate;
  TMP_DECL;

  usize = u->_mp_size;
  vsize = v->_mp_size;

  /* Handle special cases that don't work in generic code below.  */
  if (usize == 0)
    {
    set_r_v_maybe:
      if (r != v)
        mpf_set (r, v);
      return;
    }
  if (vsize == 0)
    {
      v = u;
      goto set_r_v_maybe;
    }

  /* If signs of U and V are different, perform subtraction.  */
  if ((usize ^ vsize) < 0)
    {
      __mpf_struct v_negated;
      v_negated._mp_size = -vsize;
      v_negated._mp_exp = v->_mp_exp;
      v_negated._mp_d = v->_mp_d;
      mpf_sub (r, u, &v_negated);
      return;
    }

  TMP_MARK;

  /* Signs are now known to be the same.  */
  negate = usize < 0;

  /* Make U be the operand with the largest exponent.  */
  if (u->_mp_exp < v->_mp_exp)
    {
      mpf_srcptr t;
      t = u; u = v; v = t;
      usize = u->_mp_size;
      vsize = v->_mp_size;
    }

  usize = ABS (usize);
  vsize = ABS (vsize);
  up = u->_mp_d;
  vp = v->_mp_d;
  rp = r->_mp_d;
  prec = r->_mp_prec;
  uexp = u->_mp_exp;
  ediff = u->_mp_exp - v->_mp_exp;

  /* If U extends beyond PREC, ignore the part that does.  */
  if (usize > prec)
    {
      up += usize - prec;
      usize = prec;
    }

  /* If V extends beyond PREC, ignore the part that does.
     Note that this may make vsize negative.  */
  if (vsize + ediff > prec)
    {
      vp += vsize + ediff - prec;
      vsize = prec - ediff;
    }

#if 0
  /* Locate the least significant non-zero limb in (the needed parts
     of) U and V, to simplify the code below.  */
  while (up[0] == 0)
    up++, usize--;
  while (vp[0] == 0)
    vp++, vsize--;
#endif

  /* Allocate temp space for the result.  Allocate
     just vsize + ediff later???  */
  tp = TMP_ALLOC_LIMBS (prec);

  if (ediff >= prec)
    {
      /* V completely cancelled.  */
      if (rp != up)
	MPN_COPY_INCR (rp, up, usize);
      rsize = usize;
    }
  else
    {
      /* uuuu     |  uuuu     |  uuuu     |  uuuu     |  uuuu    */
      /* vvvvvvv  |  vv       |    vvvvv  |    v      |       vv */

      if (usize > ediff)
	{
	  /* U and V partially overlaps.  */
	  if (vsize + ediff <= usize)
	    {
	      /* uuuu     */
	      /*   v      */
	      mp_size_t size;
	      size = usize - ediff - vsize;
	      MPN_COPY (tp, up, size);
	      cy = mpn_add (tp + size, up + size, usize - size, vp, vsize);
	      rsize = usize;
	    }
	  else
	    {
	      /* uuuu     */
	      /*   vvvvv  */
	      mp_size_t size;
	      size = vsize + ediff - usize;
	      MPN_COPY (tp, vp, size);
	      cy = mpn_add (tp + size, up, usize, vp + size, usize - ediff);
	      rsize = vsize + ediff;
	    }
	}
      else
	{
	  /* uuuu     */
	  /*      vv  */
	  mp_size_t size;
	  size = vsize + ediff - usize;
	  MPN_COPY (tp, vp, vsize);
	  MPN_ZERO (tp + vsize, ediff - usize);
	  MPN_COPY (tp + size, up, usize);
	  cy = 0;
	  rsize = size + usize;
	}

      MPN_COPY (rp, tp, rsize);
      rp[rsize] = cy;
      rsize += cy;
      uexp += cy;
    }

  r->_mp_size = negate ? -rsize : rsize;
  r->_mp_exp = uexp;
  TMP_FREE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movslq 0x4(%rsi), %r8
testq %r8, %r8
je 0x16931
movslq 0x4(%rdx), %rcx
testl %ecx, %ecx
je 0x1692e
movq %rcx, %rax
xorq %r8, %rax
js 0x16950
andq $0x0, -0x88(%rbp)
movq 0x8(%rsi), %rax
movq 0x8(%rdx), %r9
cmpq %r9, %rax
jge 0x16979
movq %rax, %r11
movq %r8, %r10
movq %rsi, %rax
jmp 0x1698b
movq %rsi, %rdx
cmpq %rdi, %rdx
je 0x16bbd
movq %rdx, %rsi
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x15fe4
negl %ecx
leaq -0x88(%rbp), %rax
movl %ecx, 0x4(%rax)
movq 0x8(%rdx), %rcx
movq %rcx, 0x8(%rax)
movq 0x10(%rdx), %rcx
movq %rcx, 0x10(%rax)
movq %rax, %rdx
callq 0x16c1c
jmp 0x16bbd
movq %r9, %r11
movq %rax, %r9
movq %rcx, %r10
movq %r8, %rcx
movq %rdx, %rax
movq %rsi, %rdx
movq %rcx, %r12
negq %r12
cmovsq %rcx, %r12
movq %r10, %rcx
negq %rcx
movq %r10, -0x70(%rbp)
cmovsq %r10, %rcx
movslq (%rdi), %r14
movq %r9, %r15
subq %r11, %r15
xorl %esi, %esi
movq %r12, %rbx
subq %r14, %rbx
movq %r14, %r10
cmovlq %r12, %r10
cmovleq %rsi, %rbx
shlq $0x3, %rbx
addq 0x10(%rdx), %rbx
leaq (%r15,%rcx), %r13
movq %r14, %rdx
subq %r15, %rdx
subq %r14, %r13
cmovleq %rcx, %rdx
cmovleq %rsi, %r13
movq 0x10(%rdi), %rcx
shlq $0x3, %r13
addq 0x10(%rax), %r13
leaq (,%r14,8), %rsi
cmpq $0x7f00, %rsi           # imm = 0x7F00
ja 0x16bcc
movq %rsp, %rax
addq $0xf, %rsi
andq $-0x10, %rsi
subq %rsi, %rax
movq %rax, %rsp
cmpq %r15, %r14
jle 0x16a81
leaq (%rdx,%r15), %rsi
cmpq %r15, %r12
movq %rdi, -0x60(%rbp)
movq %r8, -0x58(%rbp)
movq %r9, -0x40(%rbp)
movq %rcx, -0x50(%rbp)
movq %rsi, -0x30(%rbp)
jle 0x16ab5
movq %rsi, %rcx
subq %r10, %rcx
movq %r10, -0x38(%rbp)
jle 0x16b33
movq %rax, %rdi
movq %r13, %rsi
movq %rcx, %r14
movq %rcx, %rdx
movq %rax, %r12
callq 0x290c6
leaq (%r12,%r14,8), %rdi
leaq (,%r14,8), %rcx
addq %r13, %rcx
movq -0x38(%rbp), %rdx
movq %rdx, %r8
subq %r15, %r8
movq %rbx, %rsi
callq 0x17c54
movq %rax, %r14
jmp 0x16b6f
cmpq %rbx, %rcx
je 0x16b9e
movq %rdi, %r14
movq %rcx, %rdi
movq %rbx, %rsi
movq %r10, %rdx
movq %r8, %rbx
movq %r9, %r15
movq %r10, %r12
callq 0x290c6
movq %r12, %r10
movq %r15, %r9
movq %rbx, %r8
movq %r14, %rdi
jmp 0x16b9e
movq %r11, -0x48(%rbp)
movq %rsi, %r12
subq %r10, %r12
movq %rax, %rdi
movq %r13, %rsi
movq %r10, %r13
movq %rax, -0x68(%rbp)
callq 0x290c6
movq %r13, %rdx
subq %r13, %r15
je 0x16b1b
movq -0x70(%rbp), %rcx
movq %rcx, %rax
negq %rax
cmovsq %rcx, %rax
movq -0x40(%rbp), %rcx
addq %rcx, %rax
movq -0x48(%rbp), %rdx
subq %rdx, %rax
cmpq %r14, %rax
cmovgeq %r14, %rax
addq %rdx, %rax
subq %rcx, %rax
movq -0x68(%rbp), %rcx
leaq (%rcx,%rax,8), %rdi
shlq $0x3, %r15
xorl %esi, %esi
movq %r15, %rdx
callq 0x6170
movq %r13, %rdx
movq -0x68(%rbp), %rax
leaq (%rax,%r12,8), %rdi
movq %rax, %r12
movq %rbx, %rsi
callq 0x290c6
xorl %r14d, %r14d
jmp 0x16b6f
movq %rdx, %r14
movq %r10, %r15
subq %rsi, %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %rax, %r12
callq 0x290c6
leaq (%r12,%r15,8), %rdi
leaq (%rbx,%r15,8), %rsi
movq -0x30(%rbp), %rdx
movq %r13, %rcx
movq %r14, %r8
callq 0x17c54
movq %rax, %r14
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq -0x30(%rbp), %r15
movq %r15, %rdx
callq 0x290c6
movq %r14, (%rbx,%r15,8)
addq %r14, %r15
movq -0x40(%rbp), %r9
addq %r14, %r9
movq %r15, %r10
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %r8
movl %r10d, %eax
negl %eax
testl %r8d, %r8d
cmovnsl %r10d, %eax
movl %eax, 0x4(%rdi)
movq %r9, 0x8(%rdi)
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
jne 0x16c15
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, -0x60(%rbp)
leaq -0x88(%rbp), %rdi
movq %r8, -0x58(%rbp)
movq %r9, -0x40(%rbp)
movq %r10, -0x38(%rbp)
movq %rcx, -0x50(%rbp)
movq %r11, -0x48(%rbp)
movq %rdx, -0x30(%rbp)
callq 0x29dc0
movq -0x30(%rbp), %rdx
movq -0x48(%rbp), %r11
movq -0x50(%rbp), %rcx
movq -0x38(%rbp), %r10
movq -0x40(%rbp), %r9
movq -0x58(%rbp), %r8
movq -0x60(%rbp), %rdi
jmp 0x16a0e
callq 0x29df3
jmp 0x16bbd