// File: /workspace/github_cpp_makefile_star2_O1/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, %r13
movq %rcx, %rbp
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 0x2fb60
movq %rax, %r15
movq %r13, %rax
subq %r12, %rax
je 0x27e0f
addq (%rbx,%r12,8), %r15
movq %r15, (%r14,%r12,8)
jae 0x27de3
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 0x27e0f
movq (%rdx,%r8,8), %r9
leaq 0x1(%r8), %rsi
incq %r9
movq %r9, (%rcx,%r8,8)
movq %rsi, %r8
je 0x27d9e
cmpq %r14, %rbx
setne %dil
cmpq %rax, %rsi
setl %r8b
andb %dil, %r8b
cmpb $0x1, %r8b
jne 0x27e0c
xorl %r15d, %r15d
movq (%rdx,%rsi,8), %rdi
movq %rdi, (%rcx,%rsi,8)
incq %rsi
cmpq %rax, %rsi
jl 0x27dd1
jmp 0x27e0f
cmpq %r14, %rbx
sete %cl
cmpq $0x2, %rax
setl %al
orb %cl, %al
jne 0x27e0c
incq %r12
xorl %r15d, %r15d
movq (%rbx,%r12,8), %rax
movq %rax, (%r14,%r12,8)
incq %r12
cmpq %r12, %r13
jne 0x27dfa
jmp 0x27e0f
xorl %r15d, %r15d
movq %rbp, 0x10(%rsp)
movq 0x18(%rsp), %rax
addl $-0x4, %eax
js 0x27e60
movl %eax, %ebp
movq %r13, %rax
imulq %rbp, %rax
addq $0x2, %rbp
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %r12
movq %r13, %rbx
shlq $0x4, %rbx
negq %rbx
movq %r14, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %r13, %rcx
callq 0x2fb60
leaq (%rax,%r15,4), %r15
addq $-0x2, %rbp
addq %rbx, %r12
cmpq $0x1, %rbp
jg 0x27e3e
movq %r14, (%rsp)
movq %r15, (%r14,%r13,8)
movq 0x18(%rsp), %r14
leal -0x1(%r14), %ecx
leal -0x3(%r14), %eax
imulq %r13, %rax
movq 0x10(%rsp), %rbx
leaq (%rbx,%rax,8), %rsi
movq %rcx, 0x20(%rsp)
movq %rcx, %rax
imulq %r13, %rax
leaq (%rbx,%rax,8), %rdx
movq 0x60(%rsp), %rdi
movq %r13, %rcx
callq 0x2fb60
movq %rax, %r12
addl $-0x5, %r14d
js 0x27eed
movl %r14d, %r15d
movq %r13, %rax
imulq %r15, %rax
addq $0x2, %r15
leaq (%rbx,%rax,8), %rbp
movq %r13, %r14
shlq $0x4, %r13
negq %r13
movq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x2fb60
leaq (%rax,%r12,4), %r12
addq $-0x2, %r15
addq %r13, %rbp
cmpq $0x1, %r15
jg 0x27ec9
jmp 0x27ef5
movq 0x60(%rsp), %rbx
movq %r13, %r14
movq %r12, (%rbx,%r14,8)
incq %r14
movq 0x20(%rsp), %r12
andl $0x1, %r12d
movq %r14, %r15
jne 0x27f28
movq (%rsp), %r14
movq %r14, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x1c4a0
movq 0x8(%rsp), %rdi
jmp 0x27f44
movq %rbx, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl $0x1, %ecx
callq 0x1c4a0
movq 0x8(%rsp), %rdi
movq (%rsp), %r14
movq %r15, %rax
testq %rax, %rax
jle 0x27f6b
movq -0x8(%r14,%rax,8), %rcx
movq -0x8(%rbx,%rax,8), %rdx
decq %rax
cmpq %rdx, %rcx
je 0x27f47
xorl %ebp, %ebp
cmpq %rcx, %rdx
adcl $-0x1, %ebp
orl $0x1, %ebp
jmp 0x27f6d
xorl %ebp, %ebp
testl %ebp, %ebp
js 0x27f79
movq %r14, %rsi
movq %rbx, %rdx
jmp 0x27f7f
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x1c1c0
sarl $0x1f, %ebp
movq %r14, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x1bfa0
decl %r12d
xorl %ebp, %r12d
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop