// File: /workspace/github_cpp_makefile_star2_O2/marxn[P]pupp/3rdparty/gmp/mpn/toom_eval_pm2rexp.c
// Function: _gmpn_toom_eval_pm2rexp
int
mpn_toom_eval_pm2rexp (mp_ptr rp, mp_ptr rm,
		      unsigned int q, mp_srcptr ap, mp_size_t n, mp_size_t t,
		      unsigned int s, mp_ptr ws)
{
  unsigned int i;
  int neg;
  /* {ap,q*n+t} -> {rp,n+1} {rm,n+1} , with {ws, n+1}*/
  ASSERT (n >= t);
  ASSERT (s != 0); /* or _eval_pm1 should be used */
  ASSERT (q > 1);
  ASSERT (s*q < GMP_NUMB_BITS);
  rp[n] = mpn_lshift(rp, ap, n, s*q);
  ws[n] = mpn_lshift(ws, ap+n, n, s*(q-1));
  if( (q & 1) != 0) {
    ASSERT_NOCARRY(mpn_add(ws,ws,n+1,ap+n*q,t));
    rp[n] += DO_mpn_addlsh_n(rp, ap+n*(q-1), n, s, rm);
  } else {
    ASSERT_NOCARRY(mpn_add(rp,rp,n+1,ap+n*q,t));
  }
  for(i=2; i<q-1; i++)
  {
    rp[n] += DO_mpn_addlsh_n(rp, ap+n*i, n, s*(q-i), rm);
    i++;
    ws[n] += DO_mpn_addlsh_n(ws, ap+n*i, n, s*(q-i), rm);
  };

  neg = (mpn_cmp (rp, ws, n + 1) < 0) ? ~0 : 0;

#if HAVE_NATIVE_mpn_add_n_sub_n
  if (neg)
    mpn_add_n_sub_n (rp, rm, ws, rp, n + 1);
  else
    mpn_add_n_sub_n (rp, rm, rp, ws, n + 1);
#else /* !HAVE_NATIVE_mpn_add_n_sub_n */
  if (neg)
    mpn_sub_n (rm, ws, rp, n + 1);
  else
    mpn_sub_n (rm, rp, ws, n + 1);

  ASSERT_NOCARRY (mpn_add_n (rp, rp, ws, n + 1));
#endif /* !HAVE_NATIVE_mpn_add_n_sub_n */

  return neg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, (%rsp)
movq %r8, %r13
movq %rcx, %r15
movl %edx, %ebp
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
movl 0x60(%rsp), %ebx
movl %ebx, %ecx
imull %edx, %ecx
movq %r15, %rsi
movq %r8, %rdx
callq 0x181a0
movq %rax, (%r14,%r13,8)
leaq (%r15,%r13,8), %rsi
leal -0x1(%rbp), %r12d
movl %r12d, %ecx
imull %ebx, %ecx
movq 0x68(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rdx
callq 0x181a0
movq %rax, (%rbx,%r13,8)
leaq 0x1(%r13), %rdx
movl %ebp, %eax
imulq %r13, %rax
leaq (%r15,%rax,8), %rcx
testb $0x1, %bpl
movl %r12d, 0xc(%rsp)
movq %r13, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
jne 0x22d28
movq %r14, %rdi
movq %r14, %rsi
movq (%rsp), %r8
callq 0x17c54
movq %r14, %rbx
movl 0x60(%rsp), %r12d
jmp 0x22d5f
movq %rbx, %rdi
movq %rbx, %rsi
movq (%rsp), %r8
callq 0x17c54
movl %r12d, %eax
imulq %r13, %rax
leaq (%r15,%rax,8), %rdx
movq %r14, %rdi
movq %r14, %rsi
movq %r13, %rcx
movl 0x60(%rsp), %r12d
movl %r12d, %r8d
callq 0x298b0
addq %rax, (%r14,%r13,8)
movq %r14, %rbx
leal -0x3(%rbp), %r13d
imull %r12d, %r13d
leal (%r12,%r12), %ecx
movl %ecx, 0x8(%rsp)
addl $-0x2, %ebp
imull %r12d, %ebp
movq %rbp, %r12
pushq $0x3
popq %r14
movq 0x20(%rsp), %rbp
leal -0x1(%r14), %eax
cmpl 0xc(%rsp), %eax
jae 0x22df4
movl %eax, %eax
imulq %rbp, %rax
leaq (%r15,%rax,8), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
movq %rbp, %rcx
movl %r12d, %r8d
callq 0x298b0
addq %rax, (%rbx,%rbp,8)
movl %r14d, %eax
imulq %rbp, %rax
leaq (%r15,%rax,8), %rdx
movq %r14, (%rsp)
movq %r15, %r14
movq %rbx, %r15
movq 0x68(%rsp), %rbx
movq %rbx, %rdi
movq %rbx, %rsi
movq %rbp, %rcx
movl %r13d, %r8d
callq 0x298b0
addq %rax, (%rbx,%rbp,8)
movq %r15, %rbx
movq %r14, %r15
movq (%rsp), %r14
addl $0x2, %r14d
movl 0x8(%rsp), %eax
subl %eax, %r13d
subl %eax, %r12d
jmp 0x22d82
movq %rbx, %rdi
movq 0x68(%rsp), %r14
movq %r14, %rsi
movq 0x18(%rsp), %r15
movq %r15, %rdx
callq 0x1ac5c
movl %eax, %ebp
testl %eax, %eax
js 0x22e1f
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
jmp 0x22e2a
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x17ed0
sarl $0x1f, %ebp
movq %rbx, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x17cf0
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop