// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movq %r8, %rbx
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, 0x20(%rsp)
movq %rdi, %r15
movl 0x60(%rsp), %r13d
movl %r13d, %ecx
imull %edx, %ecx
movq %r14, %rsi
movq %r8, %rdx
callq 0x1bf80
movq %rax, (%r15,%rbx,8)
movq %r14, 0x10(%rsp)
leaq (%r14,%rbx,8), %rsi
movq 0x68(%rsp), %r14
leal -0x1(%rbp), %ecx
movl %ecx, 0xc(%rsp)
imull %r13d, %ecx
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1bf80
movq %rax, (%r14,%rbx,8)
testb $0x1, %bpl
jne 0x27f01
testq %r12, %r12
movq 0x10(%rsp), %r13
je 0x27f69
movl %ebp, %eax
imulq %rbx, %rax
leaq (,%rax,8), %rdx
addq %r13, %rdx
movq %r15, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq 0x1ba80
testq %rax, %rax
je 0x27f69
cmpq %rbx, %r12
jg 0x27f69
incq (%r15,%r12,8)
leaq 0x1(%r12), %r12
je 0x27eef
jmp 0x27f69
testq %r12, %r12
movq 0x10(%rsp), %r13
je 0x27f3f
movl %ebp, %eax
imulq %rbx, %rax
leaq (,%rax,8), %rdx
addq %r13, %rdx
movq %r14, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x1ba80
testq %rax, %rax
je 0x27f3f
cmpq %rbx, %r12
jg 0x27f3f
incq (%r14,%r12,8)
leaq 0x1(%r12), %r12
je 0x27f2f
movl 0xc(%rsp), %eax
imulq %rbx, %rax
leaq (,%rax,8), %rdx
addq %r13, %rdx
movq %r15, %rdi
movq %r15, %rsi
movq %rbx, %rcx
movl 0x60(%rsp), %r8d
callq 0x2f8f0
addq %rax, (%r15,%rbx,8)
cmpl $0x3, 0xc(%rsp)
movq %r14, %rsi
movq %rbp, %r14
movq %r15, %rbp
jb 0x28008
movq %r13, %rcx
leal -0x2(%r14), %r12d
movl 0x60(%rsp), %eax
imull %eax, %r12d
leal (%rax,%rax), %edx
movl %edx, 0x1c(%rsp)
addl $-0x3, %r14d
imull %eax, %r14d
movl $0x2, %r13d
movl %r13d, %eax
imulq %rbx, %rax
leaq (%rcx,%rax,8), %rdx
movq %rsi, %r15
movq %rbp, %rdi
movq %rbp, %rsi
movq %rbx, %rcx
movl %r12d, %r8d
callq 0x2f8f0
addq %rax, (%rbp,%rbx,8)
leal 0x1(%r13), %eax
imulq %rbx, %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %rdx
movq %r15, %rdi
movq %r15, %rsi
movq %rbx, %rcx
movl %r14d, %r8d
callq 0x2f8f0
movq %r15, %rsi
movq 0x10(%rsp), %rcx
addq %rax, (%r15,%rbx,8)
addl $0x2, %r13d
movl 0x1c(%rsp), %eax
subl %eax, %r12d
subl %eax, %r14d
cmpl 0xc(%rsp), %r13d
jb 0x27fa1
incq %rbx
movq %rbx, %rax
movq %rsi, %r14
movq %rbp, %r15
testq %rax, %rax
jle 0x2802e
movq -0x8(%r14,%rax,8), %rcx
leaq -0x1(%rax), %rdx
cmpq %rcx, -0x8(%r15,%rax,8)
movq %rdx, %rax
je 0x28014
jbe 0x28045
movq 0x20(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x1bca0
xorl %ebp, %ebp
jmp 0x2805d
movq 0x20(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x1bca0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %r15, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x1ba80
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop