// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/3rdparty/gmp/mpn/toom_eval_pm2.c
// Function: _gmpn_toom_eval_pm2
int
mpn_toom_eval_pm2 (mp_ptr xp2, mp_ptr xm2, unsigned k,
		   mp_srcptr xp, mp_size_t n, mp_size_t hn, mp_ptr tp)
{
  int i;
  int neg;
  mp_limb_t cy;

  ASSERT (k >= 3);
  ASSERT (k < GMP_NUMB_BITS);

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

  /* The degree k is also the number of full-size coefficients, so
   * that last coefficient, of size hn, starts at xp + k*n. */

  cy = 0;
  DO_addlsh2 (xp2, xp + (k-2) * n, xp + k * n, hn, cy);
  if (hn != n)
    cy = mpn_add_1 (xp2 + hn, xp + (k-2) * n + hn, n - hn, cy);
  for (i = k - 4; i >= 0; i -= 2)
    DO_addlsh2 (xp2, xp + i * n, xp2, n, cy);
  xp2[n] = cy;

  k--;

  cy = 0;
  DO_addlsh2 (tp, xp + (k-2) * n, xp + k * n, n, cy);
  for (i = k - 4; i >= 0; i -= 2)
    DO_addlsh2 (tp, xp + i * n, tp, n, cy);
  tp[n] = cy;

  if (k & 1)
    ASSERT_NOCARRY(mpn_lshift (tp , tp , n + 1, 1));
  else
    ASSERT_NOCARRY(mpn_lshift (xp2, xp2, 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 /* !HAVE_NATIVE_mpn_add_n_sub_n */
  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 /* !HAVE_NATIVE_mpn_add_n_sub_n */

  ASSERT (xp2[n] < (1<<(k+2))-1);
  ASSERT (xm2[n] < ((1<<(k+3))-1 - (1^k&1))/3);

  neg ^= ((k & 1) - 1);

  return neg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r12
movq %r8, %rbp
movq %rcx, %r13
movq %rsi, 0x8(%rsp)
movq %rdi, %r14
leal -0x2(%rdx), %eax
imulq %r8, %rax
leaq (%rcx,%rax,8), %rbx
movq %rdx, 0x18(%rsp)
movl %edx, %eax
imulq %r8, %rax
leaq (%rcx,%rax,8), %rdx
movq %rbx, %rsi
movq %r9, %rcx
callq 0x2f7a0
movq %rax, %r15
movq %rbp, %rax
subq %r12, %rax
je 0x27ab7
addq (%rbx,%r12,8), %r15
movq %r15, (%r14,%r12,8)
jae 0x27a8b
leaq (%r14,%r12,8), %rcx
leaq (%rbx,%r12,8), %rdx
cmpq $0x2, %rax
movl $0x1, %r15d
movl $0x1, %edi
cmovgeq %rax, %rdi
movl $0x1, %r8d
cmpq %r8, %rdi
je 0x27ab7
movq (%rdx,%r8,8), %r9
leaq 0x1(%r8), %rsi
incq %r9
movq %r9, (%rcx,%r8,8)
movq %rsi, %r8
je 0x27a46
cmpq %r14, %rbx
setne %dil
cmpq %rax, %rsi
setl %r8b
andb %dil, %r8b
cmpb $0x1, %r8b
jne 0x27ab4
xorl %r15d, %r15d
movq (%rdx,%rsi,8), %rdi
movq %rdi, (%rcx,%rsi,8)
incq %rsi
cmpq %rax, %rsi
jl 0x27a79
jmp 0x27ab7
cmpq %r14, %rbx
sete %cl
cmpq $0x2, %rax
setl %al
orb %cl, %al
jne 0x27ab4
incq %r12
xorl %r15d, %r15d
movq (%rbx,%r12,8), %rax
movq %rax, (%r14,%r12,8)
incq %r12
cmpq %r12, %rbp
jne 0x27aa2
jmp 0x27ab7
xorl %r15d, %r15d
movq %r13, 0x10(%rsp)
movq 0x18(%rsp), %rax
addl $-0x4, %eax
js 0x27b09
movl %eax, %r13d
movq %rbp, %rax
imulq %r13, %rax
addq $0x2, %r13
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %r12
movq %rbp, %rbx
shlq $0x4, %rbx
negq %rbx
movq %r14, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbp, %rcx
callq 0x2f7a0
leaq (%rax,%r15,4), %r15
addq $-0x2, %r13
addq %rbx, %r12
cmpq $0x1, %r13
ja 0x27ae7
movq %r14, (%rsp)
movq %r15, (%r14,%rbp,8)
movq 0x18(%rsp), %r15
leal -0x1(%r15), %ecx
leal -0x3(%r15), %eax
imulq %rbp, %rax
movq 0x10(%rsp), %rbx
leaq (%rbx,%rax,8), %rsi
movq %rcx, 0x20(%rsp)
movq %rcx, %rax
imulq %rbp, %rax
leaq (%rbx,%rax,8), %rdx
movq 0x60(%rsp), %rdi
movq %rbp, %rcx
callq 0x2f7a0
movq %rax, %r12
addl $-0x5, %r15d
js 0x27b99
movl %r15d, %r15d
movq %rbp, %rax
imulq %r15, %rax
addq $0x2, %r15
leaq (%rbx,%rax,8), %r13
movq %rbp, %rbx
shlq $0x4, %rbx
negq %rbx
movq %rbp, %r14
movq 0x60(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x2f7a0
leaq (%rax,%r12,4), %r12
addq $-0x2, %r15
addq %rbx, %r13
cmpq $0x1, %r15
ja 0x27b75
jmp 0x27ba1
movq %rbp, %r14
movq 0x60(%rsp), %rbp
movq %r12, (%rbp,%r14,8)
incq %r14
movq 0x20(%rsp), %r13
andl $0x1, %r13d
jne 0x27bbd
movq (%rsp), %rdi
movq %rdi, %rsi
jmp 0x27bc3
movq %rbp, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movl $0x1, %ecx
callq 0x1bf80
movq %r14, %rax
movq (%rsp), %rsi
testq %rax, %rax
jle 0x27bf1
movq -0x8(%rbp,%rax,8), %rcx
leaq -0x1(%rax), %rdx
cmpq %rcx, -0x8(%rsi,%rax,8)
movq %rdx, %rax
je 0x27bd7
jbe 0x27c0c
movq 0x8(%rsp), %rdi
movq (%rsp), %r12
movq %r12, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x1bca0
xorl %ebx, %ebx
jmp 0x27c28
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq (%rsp), %r12
movq %r12, %rdx
movq %r14, %rcx
callq 0x1bca0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %r12, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x1ba80
decl %r13d
xorl %ebx, %r13d
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)