// File: /workspace/github_cpp_makefile_star2_O2/marxn[P]pupp/3rdparty/gmp/mpn/toom63_mul.c
// Function: _gmpn_toom63_mul
void
mpn_toom63_mul (mp_ptr pp,
		mp_srcptr ap, mp_size_t an,
		mp_srcptr bp, mp_size_t bn, mp_ptr scratch)
{
  mp_size_t n, s, t;
  mp_limb_t cy;
  int sign;

  /***************************** decomposition *******************************/
#define a5  (ap + 5 * n)
#define b0  (bp + 0 * n)
#define b1  (bp + 1 * n)
#define b2  (bp + 2 * n)

  ASSERT (an >= bn);
  n = 1 + (an >= 2 * bn ? (an - 1) / (size_t) 6 : (bn - 1) / (size_t) 3);

  s = an - 5 * n;
  t = bn - 2 * n;

  ASSERT (0 < s && s <= n);
  ASSERT (0 < t && t <= n);
  /* WARNING! it assumes s+t>=n */
  ASSERT ( s + t >= n );
  ASSERT ( s + t > 4);
  /* WARNING! it assumes n>1 */
  ASSERT ( n > 2);

#define   r8    pp				/* 2n   */
#define   r7    scratch				/* 3n+1 */
#define   r5    (pp + 3*n)			/* 3n+1 */
#define   v0    (pp + 3*n)			/* n+1 */
#define   v1    (pp + 4*n+1)			/* n+1 */
#define   v2    (pp + 5*n+2)			/* n+1 */
#define   v3    (pp + 6*n+3)			/* n+1 */
#define   r3    (scratch + 3 * n + 1)		/* 3n+1 */
#define   r1    (pp + 7*n)			/* s+t <= 2*n */
#define   ws    (scratch + 6 * n + 2)		/* ??? */

  /* Alloc also 3n+1 limbs for ws... mpn_toom_interpolate_8pts may
     need all of them, when DO_mpn_sublsh_n usea a scratch  */
/*   if (scratch == NULL) scratch = TMP_SALLOC_LIMBS (9 * n + 3); */

  /********************** evaluation and recursive calls *********************/
  /* $\pm4$ */
  sign = mpn_toom_eval_pm2exp (v2, v0, 5, ap, n, s, 2, pp);
  pp[n] = mpn_lshift (pp, b1, n, 2); /* 4b1 */
  /* FIXME: use addlsh */
  v3[t] = mpn_lshift (v3, b2, t, 4);/* 16b2 */
  if ( n == t )
    v3[n]+= mpn_add_n (v3, v3, b0, n); /* 16b2+b0 */
  else
    v3[n] = mpn_add (v3, b0, n, v3, t+1); /* 16b2+b0 */
  sign ^= abs_sub_add_n (v1, v3, pp, n + 1);
  TOOM_63_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-4)*B(-4) */
  TOOM_63_MUL_N_REC(r3, v2, v3, n + 1, ws); /* A(+4)*B(+4) */
  mpn_toom_couple_handling (r3, 2*n+1, pp, sign, n, 2, 4);

  /* $\pm1$ */
  sign = mpn_toom_eval_pm1 (v2, v0, 5, ap, n, s,    pp);
  /* Compute bs1 and bsm1. Code taken from toom33 */
  cy = mpn_add (ws, b0, n, b2, t);
#if HAVE_NATIVE_mpn_add_n_sub_n
  if (cy == 0 && mpn_cmp (ws, b1, n) < 0)
    {
      cy = mpn_add_n_sub_n (v3, v1, b1, ws, n);
      v3[n] = cy >> 1;
      v1[n] = 0;
      sign = ~sign;
    }
  else
    {
      mp_limb_t cy2;
      cy2 = mpn_add_n_sub_n (v3, v1, ws, b1, n);
      v3[n] = cy + (cy2 >> 1);
      v1[n] = cy - (cy2 & 1);
    }
#else
  v3[n] = cy + mpn_add_n (v3, ws, b1, n);
  if (cy == 0 && mpn_cmp (ws, b1, n) < 0)
    {
      mpn_sub_n (v1, b1, ws, n);
      v1[n] = 0;
      sign = ~sign;
    }
  else
    {
      cy -= mpn_sub_n (v1, ws, b1, n);
      v1[n] = cy;
    }
#endif
  TOOM_63_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-1)*B(-1) */
  TOOM_63_MUL_N_REC(r7, v2, v3, n + 1, ws); /* A(1)*B(1) */
  mpn_toom_couple_handling (r7, 2*n+1, pp, sign, n, 0, 0);

  /* $\pm2$ */
  sign = mpn_toom_eval_pm2 (v2, v0, 5, ap, n, s, pp);
  pp[n] = mpn_lshift (pp, b1, n, 1); /* 2b1 */
  /* FIXME: use addlsh or addlsh2 */
  v3[t] = mpn_lshift (v3, b2, t, 2);/* 4b2 */
  if ( n == t )
    v3[n]+= mpn_add_n (v3, v3, b0, n); /* 4b2+b0 */
  else
    v3[n] = mpn_add (v3, b0, n, v3, t+1); /* 4b2+b0 */
  sign ^= abs_sub_add_n (v1, v3, pp, n + 1);
  TOOM_63_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-2)*B(-2) */
  TOOM_63_MUL_N_REC(r5, v2, v3, n + 1, ws); /* A(+2)*B(+2) */
  mpn_toom_couple_handling (r5, 2*n+1, pp, sign, n, 1, 2);

  /* A(0)*B(0) */
  TOOM_63_MUL_N_REC(pp, ap, bp, n, ws);

  /* Infinity */
  if (s > t) {
    TOOM_63_MUL_REC(r1, a5, s, b2, t, ws);
  } else {
    TOOM_63_MUL_REC(r1, b2, t, a5, s, ws);
  };

  mpn_toom_interpolate_8pts (pp, n, r3, r7, s + t, ws);

#undef a5
#undef b0
#undef b1
#undef b2
#undef r1
#undef r3
#undef r5
#undef v0
#undef v1
#undef v2
#undef v3
#undef r7
#undef r8
#undef ws
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r9, 0x58(%rsp)
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %r9
movq %rsi, %rcx
movq %rdi, %r12
leaq (%r8,%r8), %rax
xorl %edx, %edx
cmpq %r9, %rax
movq %r9, %rax
cmovgq %r8, %rax
setle %dl
leaq (%rdx,%rdx,2), %rsi
addq $0x3, %rsi
decq %rax
xorl %edx, %edx
divq %rsi
movq %rax, %rbx
movq %rax, 0x38(%rsp)
leaq 0x1(%rax), %r13
leaq (,%r13,4), %rax
addq %r13, %rax
subq %rax, %r9
leaq 0x2(,%rbx,2), %rdx
movq %rdx, 0x50(%rsp)
subq %rdx, %r15
movq %rax, 0xa0(%rsp)
leaq (%rdi,%rax,8), %rdi
addq $0x10, %rdi
leaq (%r13,%r13,2), %rax
movq %rax, 0x60(%rsp)
leaq (%r12,%rax,8), %rsi
movq %r12, 0x8(%rsp)
movl $0x2, (%rsp)
pushq $0x5
popq %rdx
movq %rdi, 0x78(%rsp)
movq %rsi, 0x28(%rsp)
movq %rcx, 0x88(%rsp)
movq %r13, %r8
movq %r9, 0x90(%rsp)
callq 0x22abc
movl %eax, 0x14(%rsp)
leaq (%r14,%rbx,8), %rsi
addq $0x8, %rsi
pushq $0x2
popq %rcx
movq %r12, %rdi
movq %rsi, 0x20(%rsp)
movq %r13, %rdx
callq 0x181a0
movq %rbx, 0x48(%rsp)
movq %rax, 0x8(%r12,%rbx,8)
imulq $0x6, %r13, %rax
leaq (%r12,%rax,8), %rbx
movq %rax, 0x30(%rsp)
leaq (%r12,%rax,8), %rbp
addq $0x18, %rbp
movq %r13, %rsi
shlq $0x4, %rsi
movq %r14, 0x18(%rsp)
addq %r14, %rsi
pushq $0x4
popq %rcx
movq %rbp, %rdi
movq %rsi, 0x40(%rsp)
movq %r15, %rdx
callq 0x181a0
movq %rax, 0x18(%rbx,%r15,8)
cmpq %r15, %r13
movq %r15, 0x80(%rsp)
jne 0x1e382
movq %rbp, %rdi
movq %rbp, %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
callq 0x17cf0
movq 0x38(%rsp), %rcx
addq %rax, 0x8(%rbp,%rcx,8)
jmp 0x1e3a3
leaq 0x1(%r15), %r8
movq %rbp, %rdi
movq 0x18(%rsp), %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x17c54
movq 0x38(%rsp), %rcx
movq %rax, 0x8(%rbp,%rcx,8)
movq %r13, %rax
shlq $0x5, %rax
leaq (%r12,%rax), %rbx
addq $0x8, %rbx
movq 0x48(%rsp), %r14
addq $0x2, %r14
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x1e753
movq %rbp, 0x70(%rsp)
movq %r12, %rbp
movl 0x14(%rsp), %r12d
xorl %eax, %r12d
movq %rbp, %rdi
movq 0x28(%rsp), %rsi
movq %rbx, 0x68(%rsp)
movq %rbx, %rdx
movq %r14, %rcx
callq 0x19500
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rcx
leaq (%rcx,%rax,8), %r15
addq $0x8, %r15
movq %r15, %rdi
movq 0x78(%rsp), %rbx
movq %rbx, %rsi
movq 0x70(%rsp), %rdx
movq %r14, 0x48(%rsp)
movq %r14, %rcx
callq 0x19500
movq 0x50(%rsp), %rsi
orq $0x1, %rsi
movl $0x4, (%rsp)
pushq $0x2
popq %r9
movq %r15, 0x60(%rsp)
movq %r15, %rdi
movq %rsi, 0x50(%rsp)
movq %rbp, %rdx
movl %r12d, %ecx
movq %rbp, %r12
movq 0x70(%rsp), %rbp
movq %r13, %r8
callq 0x21dbc
movq %r12, (%rsp)
pushq $0x5
popq %rdx
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
movq 0x88(%rsp), %rcx
movq %r13, %r8
movq 0x90(%rsp), %r9
callq 0x227d0
movl %eax, 0x14(%rsp)
movq 0x30(%rsp), %rax
movq 0x58(%rsp), %rcx
leaq (%rcx,%rax,8), %rbx
addq $0x10, %rbx
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
movq %r13, %rdx
movq 0x40(%rsp), %rcx
movq 0x80(%rsp), %r8
callq 0x17c54
movq %rax, %r14
movq %rbp, %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %rdx
movq %r13, %rcx
callq 0x17cf0
addq %r14, %rax
movq 0x38(%rsp), %rcx
movq %rax, 0x8(%rbp,%rcx,8)
testq %r14, %r14
movq %rcx, %r15
movq %rbx, 0x30(%rsp)
jne 0x1e4fc
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
movq %r13, %rdx
callq 0x1ac5c
testl %eax, %eax
js 0x1e729
movq %r12, 0x98(%rsp)
movq %r15, %r12
movq 0x68(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %rdx
movq %r13, %rcx
callq 0x17ed0
subq %rax, %r14
movq %r14, 0x8(%r15,%r12,8)
movq 0x98(%rsp), %r12
movq %r15, %rdx
movq %r12, %rdi
movq 0x28(%rsp), %rsi
movq 0x48(%rsp), %r15
movq %r15, %rcx
callq 0x19500
movq 0x58(%rsp), %r14
movq %r14, %rdi
movq 0x78(%rsp), %rbx
movq %rbx, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x19500
andl $0x0, (%rsp)
movq %r14, %rdi
movq 0x50(%rsp), %rsi
movq %r12, %rdx
movl 0x14(%rsp), %ecx
movq %r13, %r8
xorl %r9d, %r9d
callq 0x21dbc
movq %r12, (%rsp)
pushq $0x5
popq %rdx
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
movq 0x88(%rsp), %rcx
movq %r13, %r8
movq 0x90(%rsp), %r9
callq 0x22924
movl %eax, 0x14(%rsp)
pushq $0x1
popq %rcx
movq %r12, %rdi
movq 0x20(%rsp), %rsi
movq %r13, %rdx
callq 0x181a0
movq 0x38(%rsp), %rbx
movq %rax, 0x8(%r12,%rbx,8)
pushq $0x2
popq %rcx
movq %rbp, %rdi
movq 0x40(%rsp), %rsi
movq 0x80(%rsp), %r15
movq %r15, %rdx
callq 0x181a0
movq %rax, (%rbp,%r15,8)
cmpq %r15, %r13
jne 0x1e607
movq %rbp, %rdi
movq %rbp, %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
callq 0x17cf0
addq 0x8(%rbp,%rbx,8), %rax
jmp 0x1e61e
leaq 0x1(%r15), %r8
movq %rbp, %rdi
movq 0x18(%rsp), %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x17c54
movq %rax, 0x8(%rbp,%rbx,8)
movq 0x68(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq 0x48(%rsp), %rbx
movq %rbx, %rcx
callq 0x1e753
movq %r12, %rbp
movl 0x14(%rsp), %r12d
xorl %eax, %r12d
movq %rbp, %rdi
movq 0x28(%rsp), %r15
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x19500
movq %r15, %rdi
movq 0x78(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq %rbx, %rcx
callq 0x19500
movl $0x2, (%rsp)
pushq $0x1
popq %r9
movq %r15, %rdi
movq 0x50(%rsp), %rsi
movq %rbp, %rdx
movl %r12d, %ecx
movq %r13, %r8
callq 0x21dbc
movq %rbp, %rdi
movq 0x88(%rsp), %rbx
movq %rbx, %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
callq 0x19500
imulq $0x38, %r13, %rdi
addq %rbp, %rdi
movq 0xa0(%rsp), %rax
leaq (%rbx,%rax,8), %rcx
movq 0x90(%rsp), %rbx
movq 0x80(%rsp), %r14
cmpq %r14, %rbx
jle 0x1e6e8
movq %rcx, %rsi
movq %rbx, %rdx
movq 0x40(%rsp), %rcx
movq %r14, %r8
jmp 0x1e6f3
movq 0x40(%rsp), %rsi
movq %r14, %rdx
movq %rbx, %r8
callq 0x18a58
movq 0x30(%rsp), %r9
addq %r14, %rbx
movq %rbp, %rdi
movq %r13, %rsi
movq 0x60(%rsp), %rdx
movq 0x58(%rsp), %rcx
movq %rbx, %r8
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x23878
movq 0x68(%rsp), %r14
movq %r14, %rdi
movq 0x20(%rsp), %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x17ed0
andq $0x0, 0x8(%r14,%r15,8)
notl 0x14(%rsp)
movq %r14, %rdx
jmp 0x1e532