// File: 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
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
jmp 0x4a538
jmp 0x4a53a
jmp 0x4a53c
jmp 0x4a53e
jmp 0x4a540
jmp 0x4a542
jmp 0x4a544
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl 0x10(%rbp), %ecx
imull -0x14(%rbp), %ecx
callq 0x37320
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x28(%rbp), %rdx
movl 0x10(%rbp), %ecx
movl -0x14(%rbp), %eax
subl $0x1, %eax
imull %eax, %ecx
callq 0x37320
movq %rax, %rdx
movq 0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4a622
movq 0x18(%rbp), %rdi
movq 0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq $0x1, %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movl -0x14(%rbp), %r8d
imulq %r8, %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x30(%rbp), %r8
callq 0x36b60
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
imulq %rcx, %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0x28(%rbp), %rcx
movl 0x10(%rbp), %r8d
callq 0x55cb0
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x4a652
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq $0x1, %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movl -0x14(%rbp), %r8d
imulq %r8, %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x30(%rbp), %r8
callq 0x36b60
movl $0x2, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jae 0x4a711
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq %rcx, %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0x28(%rbp), %rcx
movl 0x10(%rbp), %r8d
movl -0x14(%rbp), %eax
subl -0x34(%rbp), %eax
imull %eax, %r8d
callq 0x55cb0
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq 0x18(%rbp), %rdi
movq 0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq %rcx, %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0x28(%rbp), %rcx
movl 0x10(%rbp), %r8d
movl -0x14(%rbp), %eax
subl -0x34(%rbp), %eax
imull %eax, %r8d
callq 0x55cb0
movq %rax, %rdx
movq 0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x4a659
movq -0x8(%rbp), %rdi
movq 0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq $0x1, %rdx
callq 0x3b060
movl %eax, %edx
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x0, %edx
cmovll %ecx, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0x4a759
movq -0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
movq -0x8(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
callq 0x36fe0
jmp 0x4a772
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq 0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
callq 0x36fe0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq 0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
callq 0x36c80
movl -0x38(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop