// File: /workspace/github_cpp_makefile_star2_O3/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, 0x30(%rsp)
movq %r8, %r15
movq %rcx, %r13
movq %rdx, %r9
movq %rsi, %rcx
movq %rdi, %rbx
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, %r14
leaq 0x1(%rax), %r12
leaq (%r12,%r12,4), %rax
subq %rax, %r9
leaq 0x2(,%r14,2), %rbp
movq %r8, 0x70(%rsp)
subq %rbp, %r15
movq %rax, 0xb0(%rsp)
leaq (%rdi,%rax,8), %rdi
addq $0x10, %rdi
leaq (%r12,%r12,2), %rax
movq %rax, 0x18(%rsp)
leaq (%rbx,%rax,8), %rsi
movq %rbx, 0x8(%rsp)
movl $0x2, (%rsp)
movq %rdi, 0x88(%rsp)
movq %rsi, 0x40(%rsp)
movl $0x5, %edx
movq %rcx, 0x98(%rsp)
movq %r12, %r8
movq %r9, 0xa0(%rsp)
callq 0x27c54
movl %eax, 0x50(%rsp)
leaq 0x8(,%r14,8), %rsi
addq %r13, %rsi
movq %rbx, %rdi
movq %rsi, 0x20(%rsp)
movq %r12, %rdx
movl $0x2, %ecx
callq 0x1bf80
movq %rax, 0x8(%rbx,%r14,8)
movq %rbp, 0x68(%rsp)
leaq (,%rbp,2), %rax
addq %rbp, %rax
leaq (%rbx,%rax,8), %rbp
movq %rbx, 0x28(%rsp)
movq %rax, 0x48(%rsp)
leaq (%rbx,%rax,8), %rbx
addq $0x18, %rbx
movq %r12, %rsi
shlq $0x4, %rsi
addq %r13, %rsi
movq %rbx, %rdi
movq %rsi, 0x58(%rsp)
movq %r15, %rdx
movl $0x4, %ecx
callq 0x1bf80
movq %rax, 0x18(%rbp,%r15,8)
cmpq %r15, %r12
movq %r15, 0x90(%rsp)
movq %r13, 0x10(%rsp)
jne 0x228cd
movq %rbx, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x1ba80
addq %rax, 0x8(%rbx,%r14,8)
jmp 0x22959
incq %r15
jne 0x228d7
xorl %r15d, %r15d
jmp 0x2292a
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x1ba80
testq %rax, %rax
je 0x2292a
movq %r14, %rax
shlq $0x5, %rax
movq 0x70(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq 0x28(%rsp), %rcx
addq %rcx, %rax
addq $0x40, %rax
movq 0x10(%rsp), %rdx
cmpq %r14, %r15
jg 0x2294f
movq (%rdx,%r15,8), %rcx
incq %r15
incq %rcx
movq %rcx, (%rax)
leaq 0x8(%rax), %rax
je 0x22910
jmp 0x2292f
movq 0x10(%rsp), %rdx
xorl %eax, %eax
cmpq %rdx, %rbx
je 0x22954
cmpq %r14, %r15
jg 0x22954
xorl %eax, %eax
movq (%rdx,%r15,8), %rcx
movq %rcx, (%rbx,%r15,8)
incq %r15
cmpq %r15, %r12
jne 0x2293d
jmp 0x22954
movl $0x1, %eax
movq %rax, 0x8(%rbx,%r14,8)
movq %r12, %rax
shlq $0x5, %rax
movq 0x28(%rsp), %r15
leaq (%r15,%rax), %rbp
addq $0x8, %rbp
movq %r14, 0x80(%rsp)
addq $0x2, %r14
movq %rbp, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x22e90
movl 0x50(%rsp), %r13d
xorl %eax, %r13d
movq %r15, %rdi
movq 0x40(%rsp), %rsi
movq %rbp, 0x78(%rsp)
movq %rbp, %rdx
movq %r14, %rcx
callq 0x1d348
movq 0x30(%rsp), %rbp
movq %rbx, %rdx
movq 0x18(%rsp), %rax
leaq 0x8(,%rax,8), %rbx
addq %rbp, %rbx
movq %rbx, %rdi
movq 0x88(%rsp), %rbp
movq %rbp, %rsi
movq %rdx, 0x60(%rsp)
movq %r14, 0x50(%rsp)
movq %r14, %rcx
callq 0x1d348
movq 0x68(%rsp), %rsi
orq $0x1, %rsi
movl $0x4, (%rsp)
movq %rbx, 0xa8(%rsp)
movq %rbx, %rdi
movq %rsi, 0x68(%rsp)
movq %r15, %rdx
movl %r13d, %ecx
movq %r12, %r8
movl $0x2, %r9d
callq 0x269f8
movq %r15, (%rsp)
movq %rbp, %rdi
movq 0x40(%rsp), %rsi
movl $0x5, %edx
movq 0x98(%rsp), %rcx
movq %r12, %r8
movq 0xa0(%rsp), %r9
callq 0x277e4
movl %eax, 0x18(%rsp)
movq 0x48(%rsp), %rax
movq 0x30(%rsp), %rcx
leaq (%rcx,%rax,8), %rbp
addq $0x10, %rbp
movq 0x90(%rsp), %r15
testq %r15, %r15
movq %rbp, 0x48(%rsp)
je 0x22ad4
movq %rbp, %rdi
movq 0x10(%rsp), %rbx
movq %rbx, %rsi
movq 0x58(%rsp), %rdx
movq %r15, %rcx
callq 0x1ba80
movq %rbx, %rsi
movq %r15, %rcx
testq %rax, %rax
movq 0x60(%rsp), %rbx
movq 0x80(%rsp), %r14
je 0x22ae8
movq %r14, %rax
shlq $0x5, %rax
movq 0x70(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq 0x30(%rsp), %rcx
addq %rcx, %rax
addq $0x30, %rax
movq %r15, %rcx
cmpq %r14, %rcx
jg 0x22b81
movq (%rsi,%rcx,8), %rdx
incq %rcx
incq %rdx
movq %rdx, (%rax)
leaq 0x8(%rax), %rax
je 0x22ab6
jmp 0x22ae8
xorl %ecx, %ecx
movq 0x60(%rsp), %rbx
movq 0x80(%rsp), %r14
movq 0x10(%rsp), %rsi
cmpq %rsi, %rbp
setne %al
cmpq %r14, %rcx
setle %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x22b0c
movq (%rsi,%rcx,8), %rax
movq %rax, (%rbp,%rcx,8)
incq %rcx
cmpq %rcx, %r12
jne 0x22afb
movq %rbx, %rdi
movq %rsi, %r15
movq %rbp, %rsi
movq 0x20(%rsp), %rdx
movq %r12, %rcx
callq 0x1ba80
leaq (%rbx,%r12,8), %rcx
movq %rcx, 0x38(%rsp)
movq %rax, 0x8(%rbx,%r14,8)
movq %r14, %rax
shlq $0x4, %rax
addq %r15, %rax
addq $0x8, %rax
imulq $0x38, %r14, %rcx
movq 0x30(%rsp), %rdx
addq %rdx, %rcx
addq $0x40, %rcx
xorl %r15d, %r15d
xorl %edx, %edx
movq 0x78(%rsp), %rbx
leaq (%r12,%rdx), %rsi
testq %rsi, %rsi
jle 0x22b7a
movq (%rcx,%rdx,8), %rsi
movq (%rax,%rdx,8), %rdi
decq %rdx
cmpq %rdi, %rsi
je 0x22b58
jbe 0x22d54
xorl %r15d, %r15d
movq 0x20(%rsp), %r13
jmp 0x22bb4
movq %rbx, %rdi
movq %rbp, %rsi
movq 0x20(%rsp), %r15
movq %r15, %rdx
movq %r12, %rcx
callq 0x1ba80
movq %r15, %r13
incq %rax
leaq (%rbx,%r12,8), %rcx
movq %rcx, 0x38(%rsp)
movq %rax, (%rcx)
movl $0x1, %r15d
movq 0x78(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x1bca0
subq %rax, %r15
movq %r15, 0x8(%rbx,%r14,8)
movq 0x28(%rsp), %rbp
movq %rbp, %rdi
movq 0x40(%rsp), %rsi
movq %rbx, %rdx
movq 0x50(%rsp), %r14
movq %r14, %rcx
callq 0x1d348
movq 0x30(%rsp), %r15
movq %r15, %rdi
movq 0x88(%rsp), %r13
movq %r13, %rsi
movq 0x60(%rsp), %rbx
movq %rbx, %rdx
movq %r14, %rcx
callq 0x1d348
movl $0x0, (%rsp)
movq %r15, %rdi
movq 0x68(%rsp), %rsi
movq %rbp, %rdx
movl 0x18(%rsp), %ecx
movq %r12, %r8
xorl %r9d, %r9d
callq 0x269f8
movq %rbp, (%rsp)
movq %r13, %rdi
movq 0x40(%rsp), %rsi
movl $0x5, %edx
movq 0x98(%rsp), %rcx
movq %r12, %r8
movq 0xa0(%rsp), %r9
callq 0x279c8
movl %eax, 0x18(%rsp)
movq %rbp, %rdi
movq 0x20(%rsp), %rsi
movq %r12, %rdx
movl $0x1, %ecx
callq 0x1bf80
movq 0x80(%rsp), %r14
movq %rax, 0x8(%rbp,%r14,8)
movq %rbx, %rdi
movq 0x58(%rsp), %rsi
movq 0x90(%rsp), %r15
movq %r15, %rdx
movl $0x2, %ecx
callq 0x1bf80
movq %rax, (%rbx,%r15,8)
cmpq %r15, %r12
jne 0x22cc3
movq %rbx, %rdi
movq %rbx, %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rcx
callq 0x1ba80
movq 0x38(%rsp), %rsi
addq (%rsi), %rax
jmp 0x22d7e
incq %r15
jne 0x22ccd
xorl %r15d, %r15d
jmp 0x22d25
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x1ba80
testq %rax, %rax
je 0x22d25
movq %r14, %rax
shlq $0x5, %rax
movq 0x70(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq 0x28(%rsp), %rcx
addq %rcx, %rax
addq $0x40, %rax
movq 0x10(%rsp), %rdx
movq 0x38(%rsp), %rsi
cmpq %r14, %r15
jg 0x22d79
movq (%rdx,%r15,8), %rcx
incq %r15
incq %rcx
movq %rcx, (%rax)
leaq 0x8(%rax), %rax
je 0x22d0b
jmp 0x22d2f
movq 0x10(%rsp), %rdx
movq 0x38(%rsp), %rsi
xorl %eax, %eax
cmpq %rdx, %rbx
je 0x22d7e
cmpq %r14, %r15
jg 0x22d7e
xorl %eax, %eax
movq 0x10(%rsp), %rdx
movq (%rdx,%r15,8), %rcx
movq %rcx, (%rbx,%r15,8)
incq %r15
cmpq %r15, %r12
jne 0x22d42
jmp 0x22d7e
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x1bca0
movq $0x0, 0x8(%rbx,%r14,8)
notl 0x18(%rsp)
jmp 0x22bcd
movl $0x1, %eax
movq %rax, (%rsi)
movq 0x78(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq 0x28(%rsp), %r15
movq %r15, %rdx
movq 0x50(%rsp), %r14
movq %r14, %rcx
callq 0x22e90
movl 0x18(%rsp), %ebx
xorl %eax, %ebx
movq %r15, %rdi
movq 0x40(%rsp), %rbp
movq %rbp, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x1d348
movq %rbp, %rdi
movq 0x88(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %r14, %rcx
callq 0x1d348
movl $0x2, (%rsp)
movq %rbp, %rdi
movq 0x68(%rsp), %rsi
movq %r15, %rdx
movl %ebx, %ecx
movq %r12, %r8
movl $0x1, %r9d
callq 0x269f8
movq %r15, %rdi
movq 0x98(%rsp), %rbx
movq %rbx, %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rcx
callq 0x1d348
imulq $0x38, %r12, %rdi
addq %r15, %rdi
movq 0xb0(%rsp), %rax
leaq (%rbx,%rax,8), %rcx
movq 0x90(%rsp), %rbx
movq 0xa0(%rsp), %r14
cmpq %rbx, %r14
jle 0x22e4a
movq %rcx, %rsi
movq %r14, %rdx
movq 0x58(%rsp), %rcx
movq %rbx, %r8
jmp 0x22e55
movq 0x58(%rsp), %rsi
movq %rbx, %rdx
movq %r14, %r8
callq 0x1c838
movq 0xa8(%rsp), %rdx
movq 0x48(%rsp), %r9
addq %rbx, %r14
movq 0x28(%rsp), %rdi
movq %r12, %rsi
movq 0x30(%rsp), %rcx
movq %r14, %r8
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6e8e