// File: 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
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x34ca4
jmp 0x34c88
movq -0x8(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x34c9f
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x336c0
jmp 0x351e1
cmpq $0x0, -0x48(%rbp)
jne 0x34cb5
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x34c88
movq -0x40(%rbp), %rax
xorq -0x48(%rbp), %rax
cmpq $0x0, %rax
jge 0x34d06
xorl %eax, %eax
subq -0x48(%rbp), %rax
movl %eax, -0x94(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x351f0
jmp 0x351e1
movq $0x0, -0x80(%rbp)
cmpq $0x0, -0x40(%rbp)
setl %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x74(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x34d66
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x40(%rbp)
jl 0x34d7a
movq -0x40(%rbp), %rax
movq %rax, -0xd0(%rbp)
jmp 0x34d87
xorl %eax, %eax
subq -0x40(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x48(%rbp)
jl 0x34da6
movq -0x48(%rbp), %rax
movq %rax, -0xd8(%rbp)
jmp 0x34db3
xorl %eax, %eax
subq -0x48(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x48(%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 -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movslq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
subq 0x8(%rcx), %rax
movq %rax, -0x68(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x58(%rbp), %rax
jle 0x34e33
movq -0x40(%rbp), %rax
subq -0x58(%rbp), %rax
shlq $0x3, %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x48(%rbp), %rax
addq -0x68(%rbp), %rax
cmpq -0x58(%rbp), %rax
jle 0x34e65
movq -0x48(%rbp), %rax
addq -0x68(%rbp), %rax
subq -0x58(%rbp), %rax
shlq $0x3, %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x58(%rbp), %rax
subq -0x68(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x58(%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 0x34eb0
movq -0x58(%rbp), %rax
leaq 0xf(,%rax,8), %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0xe0(%rbp)
jmp 0x34ec8
movq -0x58(%rbp), %rsi
shlq $0x3, %rsi
leaq -0x80(%rbp), %rdi
callq 0x56430
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x58(%rbp), %rax
jl 0x34f11
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0x34f04
jmp 0x34ee9
jmp 0x34eeb
jmp 0x34eed
jmp 0x34eef
jmp 0x34ef1
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x554c6
jmp 0x34f04
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x3517a
movq -0x40(%rbp), %rax
cmpq -0x68(%rbp), %rax
jle 0x3503a
movq -0x48(%rbp), %rax
addq -0x68(%rbp), %rax
cmpq -0x40(%rbp), %rax
jg 0x34fb5
movq -0x40(%rbp), %rax
subq -0x68(%rbp), %rax
subq -0x48(%rbp), %rax
movq %rax, -0xa8(%rbp)
jmp 0x34f46
jmp 0x34f48
jmp 0x34f4a
jmp 0x34f4c
jmp 0x34f4e
jmp 0x34f50
jmp 0x34f52
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xa8(%rbp), %rdx
callq 0x554c6
jmp 0x34f68
movq -0x38(%rbp), %rdi
movq -0xa8(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movq -0xa8(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x40(%rbp), %rdx
subq -0xa8(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x48(%rbp), %r8
callq 0x36b60
movq %rax, -0x70(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x35035
movq -0x48(%rbp), %rax
addq -0x68(%rbp), %rax
subq -0x40(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x34fca
jmp 0x34fcc
jmp 0x34fce
jmp 0x34fd0
jmp 0x34fd2
jmp 0x34fd4
jmp 0x34fd6
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0xb0(%rbp), %rdx
callq 0x554c6
jmp 0x34fec
movq -0x38(%rbp), %rdi
movq -0xb0(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0xb0(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x40(%rbp), %r8
subq -0x68(%rbp), %r8
callq 0x36b60
movq %rax, -0x70(%rbp)
movq -0x48(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x3512f
movq -0x48(%rbp), %rax
addq -0x68(%rbp), %rax
subq -0x40(%rbp), %rax
movq %rax, -0xb8(%rbp)
jmp 0x3504f
jmp 0x35051
jmp 0x35053
jmp 0x35055
jmp 0x35057
jmp 0x35059
jmp 0x3505b
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x554c6
jmp 0x3506e
jmp 0x35070
jmp 0x35072
jmp 0x35074
movq -0x68(%rbp), %rax
subq -0x40(%rbp), %rax
cmpq $0x0, %rax
je 0x350e5
jmp 0x35084
movq -0x38(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0x68(%rbp), %rax
subq -0x40(%rbp), %rax
movq %rax, -0xc8(%rbp)
jmp 0x350ab
jmp 0x350ad
movq -0xc0(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0xc0(%rbp)
movq $0x0, (%rax)
movq -0xc8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, %rax
jne 0x350ad
jmp 0x350e3
jmp 0x350e5
jmp 0x350e7
jmp 0x350e9
jmp 0x350eb
jmp 0x350ed
jmp 0x350ef
jmp 0x350f1
jmp 0x350f3
jmp 0x350f5
jmp 0x350f7
movq -0x38(%rbp), %rdi
movq -0xb8(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x554c6
jmp 0x35118
movq $0x0, -0x70(%rbp)
movq -0xb8(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x35131
jmp 0x35133
jmp 0x35135
jmp 0x35137
jmp 0x35139
jmp 0x3513b
jmp 0x3513d
jmp 0x3513f
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x554c6
jmp 0x35152
movq -0x70(%rbp), %rdx
movq -0x30(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x70(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x70(%rbp), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpl $0x0, -0x74(%rbp)
je 0x3518f
xorl %eax, %eax
subq -0x50(%rbp), %rax
movq %rax, -0xe8(%rbp)
jmp 0x3519a
movq -0x50(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x60(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, -0x80(%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 0x351df
movq -0x80(%rbp), %rdi
callq 0x564a0
jmp 0x351e1
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)