// File: /workspace/github_cpp_makefile_star2_O2/marxn[P]pupp/3rdparty/gmp/mpn/toom33_mul.c
// Function: _gmpn_toom33_mul
void
mpn_toom33_mul (mp_ptr pp,
		mp_srcptr ap, mp_size_t an,
		mp_srcptr bp, mp_size_t bn,
		mp_ptr scratch)
{
  const int __gmpn_cpuvec_initialized = 1;
  mp_size_t n, s, t;
  int vm1_neg;
  mp_limb_t cy, vinf0;
  mp_ptr gp;
  mp_ptr as1, asm1, as2;
  mp_ptr bs1, bsm1, bs2;

#define a0  ap
#define a1  (ap + n)
#define a2  (ap + 2*n)
#define b0  bp
#define b1  (bp + n)
#define b2  (bp + 2*n)

  n = (an + 2) / (size_t) 3;

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

  ASSERT (an >= bn);

  ASSERT (0 < s && s <= n);
  ASSERT (0 < t && t <= n);

  as1  = scratch + 4 * n + 4;
  asm1 = scratch + 2 * n + 2;
  as2 = pp + n + 1;

  bs1 = pp;
  bsm1 = scratch + 3 * n + 3; /* we need 4n+4 <= 4n+s+t */
  bs2 = pp + 2 * n + 2;

  gp = scratch;

  vm1_neg = 0;

  /* Compute as1 and asm1.  */
  cy = mpn_add (gp, a0, n, a2, s);
#if HAVE_NATIVE_mpn_add_n_sub_n
  if (cy == 0 && mpn_cmp (gp, a1, n) < 0)
    {
      cy = mpn_add_n_sub_n (as1, asm1, a1, gp, n);
      as1[n] = cy >> 1;
      asm1[n] = 0;
      vm1_neg = 1;
    }
  else
    {
      mp_limb_t cy2;
      cy2 = mpn_add_n_sub_n (as1, asm1, gp, a1, n);
      as1[n] = cy + (cy2 >> 1);
      asm1[n] = cy - (cy2 & 1);
    }
#else
  as1[n] = cy + mpn_add_n (as1, gp, a1, n);
  if (cy == 0 && mpn_cmp (gp, a1, n) < 0)
    {
      mpn_sub_n (asm1, a1, gp, n);
      asm1[n] = 0;
      vm1_neg = 1;
    }
  else
    {
      cy -= mpn_sub_n (asm1, gp, a1, n);
      asm1[n] = cy;
    }
#endif

  /* Compute as2.  */
#if HAVE_NATIVE_mpn_rsblsh1_n
  cy = mpn_add_n (as2, a2, as1, s);
  if (s != n)
    cy = mpn_add_1 (as2 + s, as1 + s, n - s, cy);
  cy += as1[n];
  cy = 2 * cy + mpn_rsblsh1_n (as2, a0, as2, n);
#else
#if HAVE_NATIVE_mpn_addlsh1_n
  cy  = mpn_addlsh1_n (as2, a1, a2, s);
  if (s != n)
    cy = mpn_add_1 (as2 + s, a1 + s, n - s, cy);
  cy = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n);
#else
  cy = mpn_add_n (as2, a2, as1, s);
  if (s != n)
    cy = mpn_add_1 (as2 + s, as1 + s, n - s, cy);
  cy += as1[n];
  cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
  cy -= mpn_sub_n (as2, as2, a0, n);
#endif
#endif
  as2[n] = cy;

  /* Compute bs1 and bsm1.  */
  cy = mpn_add (gp, b0, n, b2, t);
#if HAVE_NATIVE_mpn_add_n_sub_n
  if (cy == 0 && mpn_cmp (gp, b1, n) < 0)
    {
      cy = mpn_add_n_sub_n (bs1, bsm1, b1, gp, n);
      bs1[n] = cy >> 1;
      bsm1[n] = 0;
      vm1_neg ^= 1;
    }
  else
    {
      mp_limb_t cy2;
      cy2 = mpn_add_n_sub_n (bs1, bsm1, gp, b1, n);
      bs1[n] = cy + (cy2 >> 1);
      bsm1[n] = cy - (cy2 & 1);
    }
#else
  bs1[n] = cy + mpn_add_n (bs1, gp, b1, n);
  if (cy == 0 && mpn_cmp (gp, b1, n) < 0)
    {
      mpn_sub_n (bsm1, b1, gp, n);
      bsm1[n] = 0;
      vm1_neg ^= 1;
    }
  else
    {
      cy -= mpn_sub_n (bsm1, gp, b1, n);
      bsm1[n] = cy;
    }
#endif

  /* Compute bs2.  */
#if HAVE_NATIVE_mpn_rsblsh1_n
  cy = mpn_add_n (bs2, b2, bs1, t);
  if (t != n)
    cy = mpn_add_1 (bs2 + t, bs1 + t, n - t, cy);
  cy += bs1[n];
  cy = 2 * cy + mpn_rsblsh1_n (bs2, b0, bs2, n);
#else
#if HAVE_NATIVE_mpn_addlsh1_n
  cy  = mpn_addlsh1_n (bs2, b1, b2, t);
  if (t != n)
    cy = mpn_add_1 (bs2 + t, b1 + t, n - t, cy);
  cy = 2 * cy + mpn_addlsh1_n (bs2, b0, bs2, n);
#else
  cy  = mpn_add_n (bs2, bs1, b2, t);
  if (t != n)
    cy = mpn_add_1 (bs2 + t, bs1 + t, n - t, cy);
  cy += bs1[n];
  cy = 2 * cy + mpn_lshift (bs2, bs2, n, 1);
  cy -= mpn_sub_n (bs2, bs2, b0, n);
#endif
#endif
  bs2[n] = cy;

  ASSERT (as1[n] <= 2);
  ASSERT (bs1[n] <= 2);
  ASSERT (asm1[n] <= 1);
  ASSERT (bsm1[n] <= 1);
  ASSERT (as2[n] <= 6);
  ASSERT (bs2[n] <= 6);

#define v0    pp				/* 2n */
#define v1    (pp + 2 * n)			/* 2n+1 */
#define vinf  (pp + 4 * n)			/* s+t */
#define vm1   scratch				/* 2n+1 */
#define v2    (scratch + 2 * n + 1)		/* 2n+2 */
#define scratch_out  (scratch + 5 * n + 5)

  /* vm1, 2n+1 limbs */
#ifdef SMALLER_RECURSION
  TOOM33_MUL_N_REC (vm1, asm1, bsm1, n, scratch_out);
  cy = 0;
  if (asm1[n] != 0)
    cy = bsm1[n] + mpn_add_n (vm1 + n, vm1 + n, bsm1, n);
  if (bsm1[n] != 0)
    cy += mpn_add_n (vm1 + n, vm1 + n, asm1, n);
  vm1[2 * n] = cy;
#else
  TOOM33_MUL_N_REC (vm1, asm1, bsm1, n + 1, scratch_out);
#endif

  TOOM33_MUL_N_REC (v2, as2, bs2, n + 1, scratch_out);	/* v2, 2n+1 limbs */

  /* vinf, s+t limbs */
  if (s > t)  mpn_mul (vinf, a2, s, b2, t);
  else        TOOM33_MUL_N_REC (vinf, a2, b2, s, scratch_out);

  vinf0 = vinf[0];				/* v1 overlaps with this */

#ifdef SMALLER_RECURSION
  /* v1, 2n+1 limbs */
  TOOM33_MUL_N_REC (v1, as1, bs1, n, scratch_out);
  if (as1[n] == 1)
    {
      cy = bs1[n] + mpn_add_n (v1 + n, v1 + n, bs1, n);
    }
  else if (as1[n] != 0)
    {
#if HAVE_NATIVE_mpn_addlsh1_n
      cy = 2 * bs1[n] + mpn_addlsh1_n (v1 + n, v1 + n, bs1, n);
#else
      cy = 2 * bs1[n] + mpn_addmul_1 (v1 + n, bs1, n, CNST_LIMB(2));
#endif
    }
  else
    cy = 0;
  if (bs1[n] == 1)
    {
      cy += mpn_add_n (v1 + n, v1 + n, as1, n);
    }
  else if (bs1[n] != 0)
    {
#if HAVE_NATIVE_mpn_addlsh1_n
      cy += mpn_addlsh1_n (v1 + n, v1 + n, as1, n);
#else
      cy += mpn_addmul_1 (v1 + n, as1, n, CNST_LIMB(2));
#endif
    }
  v1[2 * n] = cy;
#else
  cy = vinf[1];
  TOOM33_MUL_N_REC (v1, as1, bs1, n + 1, scratch_out);
  vinf[1] = cy;
#endif

  TOOM33_MUL_N_REC (v0, ap, bp, n, scratch_out);	/* v0, 2n limbs */

  mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + t, vm1_neg, vinf0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r9, %rbx
movq %r8, 0x88(%rsp)
movq %rcx, 0x48(%rsp)
movq %rdx, %r8
movq %rsi, %rbp
leaq 0x2(%rdx), %rax
movq $0x0, 0x30(%rsp)
pushq $0x3
popq %rcx
movq %rax, 0x78(%rsp)
xorl %edx, %edx
divq %rcx
movq %rax, %r15
leaq (%rax,%rax), %rcx
movq %r8, 0x98(%rsp)
movq %rcx, 0x10(%rsp)
subq %rcx, %r8
shlq $0x5, %rax
leaq (%r9,%rax), %r13
leaq (%r9,%rax), %r14
addq $0x20, %r14
movq %r15, %rax
shlq $0x4, %rax
leaq (%r9,%rax), %rcx
addq $0x10, %rcx
movq %rcx, 0x38(%rsp)
movq %rdi, 0xa0(%rsp)
leaq 0x8(%rdi,%r15,8), %rcx
movq %rcx, 0x60(%rsp)
movq %rax, 0x18(%rsp)
leaq (%rsi,%rax), %rcx
movq %r9, %rdi
movq %r15, %rdx
movq %rcx, 0x40(%rsp)
movq %r8, 0x20(%rsp)
callq 0x17c54
movq %rax, %r12
movq %rbp, 0x70(%rsp)
leaq (%rbp,%r15,8), %rbp
movq %r14, 0x68(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x17cf0
addq %r12, %rax
movq %rax, 0x20(%r13,%r15,8)
testq %r12, %r12
movq %rbx, 0x58(%rsp)
jne 0x1d3d3
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x1ac5c
testl %eax, %eax
js 0x1d78a
movq 0x38(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x17ed0
subq %rax, %r12
movq %r14, %rcx
imulq $0x18, %r15, %r14
movq 0x88(%rsp), %rax
subq 0x10(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r12, (%rcx,%r15,8)
movq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq 0x40(%rsp), %rsi
movq 0x68(%rsp), %rbp
movq %rbp, %rdx
movq 0x20(%rsp), %r13
movq %r13, %rcx
callq 0x17cf0
movq %rax, %r12
movq %r15, %rdx
subq %r13, %rdx
je 0x1d450
leaq (%rbx,%r13,8), %rdi
leaq (,%r13,8), %rsi
addq %rbp, %rsi
movq %r12, %rcx
callq 0x29e1c
movq %rax, %r12
movq %rbp, %rax
movq 0x18(%rsp), %rcx
movq 0x58(%rsp), %r13
leaq (%r14,%r13), %rbp
addq $0x18, %rbp
movq 0xa0(%rsp), %r14
addq %r14, %rcx
addq $0x10, %rcx
movq %rcx, 0x28(%rsp)
addq (%rax,%r15,8), %r12
movq %rbx, %rdi
movq 0x70(%rsp), %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x293e0
leaq (%rax,%r12,2), %rax
movq %rax, (%rbx,%r15,8)
movq %r13, %rbx
movq 0x48(%rsp), %r13
movq 0x10(%rsp), %rax
leaq (%r13,%rax,8), %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rcx, 0x10(%rsp)
movq 0x50(%rsp), %r8
callq 0x17c54
movq %rax, %r12
leaq (%r13,%r15,8), %r13
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x17cf0
addq %r12, %rax
movq %rax, (%r14,%r15,8)
testq %r12, %r12
jne 0x1d4fd
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x1ac5c
testl %eax, %eax
js 0x1d7b0
movq %rbp, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x17ed0
subq %rax, %r12
movq %r12, (%rbp,%r15,8)
leaq (%r14,%r15,8), %rax
movq %rax, 0x90(%rsp)
movq 0x28(%rsp), %r13
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movq %r14, %rdx
movq 0x50(%rsp), %r12
movq %r12, %rcx
callq 0x17cf0
movq %r12, %rcx
movq %rax, %r12
movq %r15, %rdx
subq %rcx, %rdx
movq %rbp, 0x80(%rsp)
je 0x1d56f
leaq (,%rcx,8), %rdi
addq %r13, %rdi
leaq (%r14,%rcx,8), %rsi
movq %r12, %rcx
callq 0x29e1c
movq %rax, %r12
movq 0x18(%rsp), %rax
movq %r13, %rbp
leaq (%rbx,%rax), %r13
movq 0x90(%rsp), %rax
addq (%rax), %r12
movq %rbp, %rdi
movq 0x48(%rsp), %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x293e0
leaq (%rax,%r12,2), %rax
movq %rax, (%rbp,%r15,8)
leaq 0x1(%r15), %r12
cmpq $0x50, 0x78(%rsp)
movq %r13, 0x28(%rsp)
jbe 0x1d5f9
imulq $0x28, %r15, %rax
leaq (%rbx,%rax), %r9
addq $0x28, %r9
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
movq %r12, %rdx
movq 0x80(%rsp), %rcx
movq %r12, %r8
movq %r9, %rbx
callq 0x1c488
leaq 0x8(%r13), %rdi
movq 0x60(%rsp), %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq %r12, %r8
movq %rbx, %r9
callq 0x1c488
jmp 0x1d62b
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
movq %r12, %rdx
movq 0x80(%rsp), %rcx
movq %r12, %r8
callq 0x19820
leaq 0x8(%r13), %rdi
movq 0x60(%rsp), %rsi
movq %r12, %rdx
movq %rbp, %rcx
movq %r12, %r8
callq 0x19820
movq 0x20(%rsp), %rdx
leaq (,%r15,4), %rbp
movq 0x98(%rsp), %rax
cmpq 0x88(%rsp), %rax
jle 0x1d669
leaq (%r14,%rbp,8), %rdi
movq 0x40(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq 0x50(%rsp), %r8
callq 0x18a58
movq 0x58(%rsp), %rbx
jmp 0x1d6aa
leaq (%r14,%rbp,8), %rdi
cmpq $0x1b, %rdx
movq 0x58(%rsp), %rbx
jle 0x1d698
imulq $0x28, %r15, %rax
leaq (%rbx,%rax), %r9
addq $0x28, %r9
movq 0x40(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq %rdx, %r8
callq 0x1c488
jmp 0x1d6aa
movq 0x40(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq %rdx, %r8
callq 0x19820
movq 0x18(%rsp), %rdi
addq %r14, %rdi
movq (%r14,%rbp,8), %rax
movq %rax, 0x18(%rsp)
movq 0x8(%r14,%rbp,8), %r13
movq 0x78(%rsp), %rax
cmpq $0x50, %rax
jbe 0x1d719
imulq $0x28, %r15, %rax
addq %rbx, %rax
addq $0x28, %rax
movq 0x68(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %r12, %r8
movq %rax, %r12
movq %rax, %r9
callq 0x1c488
movq %r13, 0x8(%r14,%rbp,8)
cmpq $0x53, 0x78(%rsp)
jbe 0x1d731
movq %r14, %rdi
movq 0x70(%rsp), %rsi
movq %r15, %rdx
movq 0x48(%rsp), %rcx
movq %r15, %r8
movq %r12, %r9
callq 0x1c488
jmp 0x1d749
movq 0x68(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %r12, %r8
callq 0x19820
movq %r13, 0x8(%r14,%rbp,8)
movq %r14, %rdi
movq 0x70(%rsp), %rsi
movq %r15, %rdx
movq 0x48(%rsp), %rcx
movq %r15, %r8
callq 0x19820
movq 0x20(%rsp), %r8
movq 0x28(%rsp), %rsi
addq $0x8, %rsi
addq 0x50(%rsp), %r8
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %rcx
movq 0x30(%rsp), %r9
callq 0x22e58
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x17ed0
pushq $0x1
popq %rax
movq %rax, 0x30(%rsp)
xorl %r12d, %r12d
jmp 0x1d3ec
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x17ed0
andq $0x0, (%rbp,%r15,8)
movq 0x30(%rsp), %rax
xorl $0x1, %eax
movq %rax, 0x30(%rsp)
jmp 0x1d516
nopl (%rax)