// File: /workspace/github_cpp_makefile_star2_O1/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 $0xb8, %rsp
movq %r9, 0x20(%rsp)
movq %r8, %r15
movq %rcx, %r13
movq %rdx, %r9
movq %rsi, %rcx
movq %rdi, %r14
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
leaq 0x1(%rax), %r12
leaq (%r12,%r12,4), %rax
subq %rax, %r9
leaq 0x2(,%rbx,2), %rbp
movq %r8, 0x68(%rsp)
subq %rbp, %r15
movq %rax, 0xb0(%rsp)
leaq (%rdi,%rax,8), %rdi
addq $0x10, %rdi
leaq (%r12,%r12,2), %rax
movq %rax, 0x10(%rsp)
leaq (%r14,%rax,8), %rsi
movq %r14, 0x8(%rsp)
movl $0x2, (%rsp)
movq %rdi, 0x80(%rsp)
movq %rsi, 0x38(%rsp)
movl $0x5, %edx
movq %rcx, 0x90(%rsp)
movq %r12, %r8
movq %r9, 0x98(%rsp)
callq 0x27fb4
movl %eax, 0x48(%rsp)
leaq 0x8(,%rbx,8), %rsi
addq %r13, %rsi
movq %r14, %rdi
movq %rsi, 0x28(%rsp)
movq %r12, %rdx
movl $0x2, %ecx
callq 0x1c4a0
movq %rax, 0x8(%r14,%rbx,8)
movq %rbp, 0x60(%rsp)
leaq (,%rbp,2), %rax
addq %rbp, %rax
leaq (%r14,%rax,8), %rbp
movq %r14, 0x18(%rsp)
movq %rax, 0x70(%rsp)
leaq (%r14,%rax,8), %r14
addq $0x18, %r14
movq %r12, %rsi
shlq $0x4, %rsi
addq %r13, %rsi
movq %r14, %rdi
movq %rsi, 0x58(%rsp)
movq %r15, %rdx
movl $0x4, %ecx
callq 0x1c4a0
movq %rax, 0x18(%rbp,%r15,8)
cmpq %r15, %r12
movq %r15, 0x88(%rsp)
movq %r13, 0x50(%rsp)
jne 0x22e81
movq %r14, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x1bfa0
addq %rax, 0x8(%r14,%rbx,8)
jmp 0x22f01
incq %r15
jne 0x22e8b
xorl %r15d, %r15d
jmp 0x22ed6
movq %r14, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x1bfa0
testq %rax, %rax
je 0x22ed6
movq %rbx, %rax
shlq $0x5, %rax
movq 0x68(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq 0x18(%rsp), %rcx
addq %rcx, %rax
addq $0x40, %rax
cmpq %rbx, %r15
jg 0x22ef7
movq (%r13,%r15,8), %rcx
incq %r15
incq %rcx
movq %rcx, (%rax)
leaq 0x8(%rax), %rax
je 0x22ebd
xorl %eax, %eax
cmpq %r13, %r14
je 0x22efc
cmpq %rbx, %r15
jg 0x22efc
xorl %eax, %eax
movq (%r13,%r15,8), %rcx
movq %rcx, (%r14,%r15,8)
incq %r15
cmpq %r15, %r12
jne 0x22ee4
jmp 0x22efc
movl $0x1, %eax
movq %rax, 0x8(%r14,%rbx,8)
movq %r14, %rsi
movq %r14, 0x30(%rsp)
movq %r12, %rax
shlq $0x5, %rax
movq 0x18(%rsp), %r15
leaq (%r15,%rax), %rbp
addq $0x8, %rbp
movq %rbx, 0x78(%rsp)
leaq 0x2(%rbx), %r14
movq %rbp, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x23400
movl 0x48(%rsp), %r13d
xorl %eax, %r13d
movq %r15, %rdi
movq 0x38(%rsp), %rsi
movq %rbp, 0xa8(%rsp)
movq %rbp, %rdx
movq %r14, %rcx
callq 0x1d864
movq 0x20(%rsp), %rbp
movq 0x10(%rsp), %rax
leaq 0x8(,%rax,8), %rbx
addq %rbp, %rbx
movq %rbx, %rdi
movq 0x80(%rsp), %rbp
movq %rbp, %rsi
movq 0x30(%rsp), %rdx
movq %r14, 0x48(%rsp)
movq %r14, %rcx
callq 0x1d864
movq 0x60(%rsp), %rsi
orq $0x1, %rsi
movl $0x4, (%rsp)
movq %rbx, 0xa0(%rsp)
movq %rbx, %rdi
movq %rsi, 0x60(%rsp)
movq %r15, %rdx
movl %r13d, %ecx
movq %r12, %r8
movl $0x2, %r9d
callq 0x26da4
movq %r15, (%rsp)
movq %rbp, %rdi
movq 0x38(%rsp), %rsi
movl $0x5, %edx
movq 0x90(%rsp), %rcx
movq %r12, %r8
movq 0x98(%rsp), %r9
callq 0x27b38
movl %eax, 0x10(%rsp)
movq 0x70(%rsp), %rax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax,8), %rbp
addq $0x10, %rbp
movq 0x88(%rsp), %r15
testq %r15, %r15
je 0x23075
movq %rbp, %rdi
movq 0x50(%rsp), %r13
movq %r13, %rsi
movq 0x58(%rsp), %rdx
movq %r15, %rcx
callq 0x1bfa0
movq %r15, %rcx
testq %rax, %rax
movq 0x78(%rsp), %rbx
movq 0x30(%rsp), %r14
movq 0x28(%rsp), %rdx
je 0x2308b
movq %rbx, %rax
shlq $0x5, %rax
movq 0x68(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq 0x20(%rsp), %rcx
addq %rcx, %rax
addq $0x30, %rax
movq %r15, %rcx
cmpq %rbx, %rcx
jg 0x230be
movq (%r13,%rcx,8), %rsi
incq %rcx
incq %rsi
movq %rsi, (%rax)
leaq 0x8(%rax), %rax
je 0x2305a
jmp 0x2308b
xorl %ecx, %ecx
movq 0x78(%rsp), %rbx
movq 0x30(%rsp), %r14
movq 0x50(%rsp), %r13
movq 0x28(%rsp), %rdx
cmpq %r13, %rbp
setne %al
cmpq %rbx, %rcx
setle %sil
andb %al, %sil
movb $0x1, %al
movl %eax, 0x44(%rsp)
xorl %r15d, %r15d
cmpb $0x1, %sil
jne 0x230cc
movq (%r13,%rcx,8), %rax
movq %rax, (%rbp,%rcx,8)
incq %rcx
cmpq %rcx, %r12
jne 0x230aa
jmp 0x230cc
movl $0x1, %r15d
movl $0x0, 0x44(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rcx
callq 0x1bfa0
addq %r15, %rax
movq %rax, 0x8(%r14,%rbx,8)
cmpb $0x0, 0x44(%rsp)
movq 0xa8(%rsp), %r14
movq %rbp, 0x70(%rsp)
je 0x23136
movq %rbx, %rax
shlq $0x4, %rax
addq %r13, %rax
addq $0x8, %rax
imulq $0x38, %rbx, %rcx
movq 0x20(%rsp), %rdx
addq %rdx, %rcx
addq $0x40, %rcx
xorl %edx, %edx
leaq (%r12,%rdx), %rsi
testq %rsi, %rsi
jle 0x23136
movq (%rax,%rdx,8), %rsi
leaq -0x1(%rdx), %rdi
cmpq %rsi, (%rcx,%rdx,8)
movq %rdi, %rdx
je 0x23116
jbe 0x232bc
movq %r14, %rdi
movq %rbp, %rsi
movq 0x28(%rsp), %rdx
movq %r12, %rcx
callq 0x1c1c0
subq %rax, %r15
movq %r15, 0x8(%r14,%rbx,8)
movq 0x18(%rsp), %rbp
movq %rbp, %rdi
movq 0x38(%rsp), %rsi
movq %r14, %rdx
movq 0x48(%rsp), %r14
movq %r14, %rcx
callq 0x1d864
movq 0x20(%rsp), %r15
movq %r15, %rdi
movq 0x80(%rsp), %rbx
movq %rbx, %rsi
movq 0x30(%rsp), %rdx
movq %r14, %rcx
movq %rdx, %r14
callq 0x1d864
movl $0x0, (%rsp)
movq %r15, %rdi
movq 0x60(%rsp), %rsi
movq %rbp, %rdx
movl 0x10(%rsp), %ecx
movq %r12, %r8
xorl %r9d, %r9d
callq 0x26da4
movq %rbp, (%rsp)
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
movl $0x5, %edx
movq 0x90(%rsp), %rcx
movq %r12, %r8
movq 0x98(%rsp), %r9
callq 0x27d20
movl %eax, 0x10(%rsp)
movq %rbp, %rdi
movq 0x28(%rsp), %rsi
movq %r12, %rdx
movl $0x1, %ecx
callq 0x1c4a0
movq 0x78(%rsp), %rbx
movq %rax, 0x8(%rbp,%rbx,8)
movq %r14, %rdi
movq 0x58(%rsp), %rsi
movq 0x88(%rsp), %rbp
movq %rbp, %rdx
movl $0x2, %ecx
callq 0x1c4a0
movq %rax, (%r14,%rbp,8)
cmpq %rbp, %r12
jne 0x2323f
movq %r14, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x1bfa0
addq 0x8(%r14,%rbx,8), %rax
jmp 0x232e6
movq %rbp, %r15
incq %r15
jne 0x2324c
xorl %r15d, %r15d
jmp 0x23297
movq %r14, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x1bfa0
testq %rax, %rax
je 0x23297
movq %rbx, %rax
shlq $0x5, %rax
movq 0x68(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq 0x18(%rsp), %rcx
addq %rcx, %rax
addq $0x40, %rax
cmpq %rbx, %r15
jg 0x232e1
movq (%r13,%r15,8), %rcx
incq %r15
incq %rcx
movq %rcx, (%rax)
leaq 0x8(%rax), %rax
je 0x2327e
xorl %eax, %eax
cmpq %r13, %r14
je 0x232e6
cmpq %rbx, %r15
jg 0x232e6
xorl %eax, %eax
movq 0x50(%rsp), %rdx
movq (%rdx,%r15,8), %rcx
movq %rcx, (%r14,%r15,8)
incq %r15
cmpq %r15, %r12
jne 0x232aa
jmp 0x232e6
movq %r14, %rdi
movq 0x28(%rsp), %rsi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x1c1c0
movq $0x0, 0x8(%r14,%rbx,8)
notl 0x10(%rsp)
jmp 0x23151
movl $0x1, %eax
movq %rax, 0x8(%r14,%rbx,8)
movq 0xa8(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
movq 0x48(%rsp), %r14
movq %r14, %rcx
callq 0x23400
movl 0x10(%rsp), %r13d
xorl %eax, %r13d
movq %rbx, %rdi
movq 0x38(%rsp), %r15
movq %r15, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x1d864
movq %r15, %rdi
movq 0x80(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r14, %rcx
callq 0x1d864
movl $0x2, (%rsp)
movq %r15, %rdi
movq 0x60(%rsp), %rsi
movq %rbx, %rdx
movl %r13d, %ecx
movq %r12, %r8
movl $0x1, %r9d
callq 0x26da4
movq %rbx, %rdi
movq 0x90(%rsp), %r14
movq %r14, %rsi
movq 0x50(%rsp), %rdx
movq %r12, %rcx
callq 0x1d864
imulq $0x38, %r12, %rdi
addq %rbx, %rdi
movq 0xb0(%rsp), %rax
leaq (%r14,%rax,8), %rcx
movq 0x98(%rsp), %rbx
movq 0x88(%rsp), %r14
cmpq %r14, %rbx
jle 0x233ba
movq %rcx, %rsi
movq %rbx, %rdx
movq 0x58(%rsp), %rcx
movq %r14, %r8
jmp 0x233c5
movq 0x58(%rsp), %rsi
movq %r14, %rdx
movq %rbx, %r8
callq 0x1cd58
movq 0xa0(%rsp), %rdx
addq %r14, %rbx
movq 0x18(%rsp), %rdi
movq %r12, %rsi
movq 0x20(%rsp), %rcx
movq %rbx, %r8
movq 0x70(%rsp), %r9
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6ebf