// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/3rdparty/gmp/mpn/toom_eval_dgr3_pm2.c
// Function: _gmpn_toom_eval_dgr3_pm2
int
mpn_toom_eval_dgr3_pm2 (mp_ptr xp2, mp_ptr xm2,
			mp_srcptr xp, mp_size_t n, mp_size_t x3n, mp_ptr tp)
{
  mp_limb_t cy;
  int neg;

  ASSERT (x3n > 0);
  ASSERT (x3n <= n);

  /* (x0 + 4 * x2) +/- (2 x1 + 8 x_3) */
#if HAVE_NATIVE_mpn_addlsh_n || HAVE_NATIVE_mpn_addlsh2_n
#if HAVE_NATIVE_mpn_addlsh2_n
  xp2[n] = mpn_addlsh2_n (xp2, xp, xp + 2*n, n);

  cy = mpn_addlsh2_n (tp, xp + n, xp + 3*n, x3n);
#else /* HAVE_NATIVE_mpn_addlsh_n */
  xp2[n] = mpn_addlsh_n (xp2, xp, xp + 2*n, n, 2);

  cy = mpn_addlsh_n (tp, xp + n, xp + 3*n, x3n, 2);
#endif
  if (x3n < n)
    cy = mpn_add_1 (tp + x3n, xp + n + x3n, n - x3n, cy);
  tp[n] = cy;
#else
  cy = mpn_lshift (tp, xp + 2*n, n, 2);
  xp2[n] = cy + mpn_add_n (xp2, tp, xp, n);

  tp[x3n] = mpn_lshift (tp, xp + 3*n, x3n, 2);
  if (x3n < n)
    tp[n] = mpn_add (tp, xp + n, n, tp, x3n + 1);
  else
    tp[n] += mpn_add_n (tp, xp + n, tp, n);
#endif
  mpn_lshift (tp, tp, n+1, 1);

  neg = (mpn_cmp (xp2, tp, n + 1) < 0) ? ~0 : 0;

#if HAVE_NATIVE_mpn_add_n_sub_n
  if (neg)
    mpn_add_n_sub_n (xp2, xm2, tp, xp2, n + 1);
  else
    mpn_add_n_sub_n (xp2, xm2, xp2, tp, n + 1);
#else
  if (neg)
    mpn_sub_n (xm2, tp, xp2, n + 1);
  else
    mpn_sub_n (xm2, xp2, tp, n + 1);

  mpn_add_n (xp2, xp2, tp, n + 1);
#endif

  ASSERT (xp2[n] < 15);
  ASSERT (xm2[n] < 10);

  return neg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %rbp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, (%rsp)
movq %rdi, %r15
movq %rcx, %rdx
shlq $0x4, %rdx
addq %r12, %rdx
movq %r12, %rsi
callq 0x2f7a0
movq %rax, (%r15,%r14,8)
leaq (%r12,%r14,8), %r13
leaq (%r14,%r14,2), %rax
leaq (%r12,%rax,8), %rdx
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rcx
callq 0x2f7a0
movq %r14, %rcx
subq %rbp, %rcx
jle 0x2775b
addq (%r13,%rbp,8), %rax
movq %rax, (%rbx,%rbp,8)
jae 0x27730
leaq (%rbx,%rbp,8), %rdx
leaq (,%rbp,8), %rsi
addq %r13, %rsi
cmpq $0x2, %rcx
movl $0x1, %eax
movl $0x1, %r8d
cmovgeq %rcx, %r8
movl $0x1, %r9d
cmpq %r9, %r8
je 0x2775b
movq (%rsi,%r9,8), %r10
leaq 0x1(%r9), %rdi
incq %r10
movq %r10, (%rdx,%r9,8)
movq %rdi, %r9
je 0x276ed
cmpq %rbx, %r13
setne %al
cmpq %rcx, %rdi
setl %r8b
andb %al, %r8b
cmpb $0x1, %r8b
jne 0x27759
xorl %eax, %eax
movq (%rsi,%rdi,8), %r8
movq %r8, (%rdx,%rdi,8)
incq %rdi
cmpq %rcx, %rdi
jl 0x2771e
jmp 0x2775b
cmpq %rbx, %r13
sete %al
cmpq $0x2, %rcx
setl %cl
orb %al, %cl
jne 0x27759
incq %rbp
xorl %eax, %eax
movq (%r13,%rbp,8), %rcx
movq %rcx, (%rbx,%rbp,8)
incq %rbp
cmpq %rbp, %r14
jne 0x27746
jmp 0x2775b
xorl %eax, %eax
movq %rax, (%rbx,%r14,8)
incq %r14
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movl $0x1, %ecx
callq 0x1bf80
movq %r14, %rax
testq %rax, %rax
jle 0x27792
movq -0x8(%rbx,%rax,8), %rcx
leaq -0x1(%rax), %rdx
cmpq %rcx, -0x8(%r15,%rax,8)
movq %rdx, %rax
je 0x27778
jbe 0x277a8
movq (%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x1bca0
xorl %ebp, %ebp
jmp 0x277bf
movq (%rsp), %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x1bca0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %r15, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x1ba80
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)