// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/3rdparty/gmp/mpn/toom43_mul.c
// Function: _gmpn_toom43_mul
void
mpn_toom43_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;
  enum toom6_flags flags;
  mp_limb_t cy;

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

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

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

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

  /* This is true whenever an >= 25 or bn >= 19, I think. It
     guarantees that we can fit 5 values of size n+1 in the product
     area. */
  ASSERT (s+t >= 5);

#define v0    pp				/* 2n */
#define vm1   (scratch)				/* 2n+1 */
#define v1    (pp + 2*n)			/* 2n+1 */
#define vm2   (scratch + 2 * n + 1)		/* 2n+1 */
#define v2    (scratch + 4 * n + 2)		/* 2n+1 */
#define vinf  (pp + 5 * n)			/* s+t */
#define bs1    pp				/* n+1 */
#define bsm1  (scratch + 2 * n + 2)		/* n+1 */
#define asm1  (scratch + 3 * n + 3)		/* n+1 */
#define asm2  (scratch + 4 * n + 4)		/* n+1 */
#define bsm2  (pp + n + 1)			/* n+1 */
#define bs2   (pp + 2 * n + 2)			/* n+1 */
#define as2   (pp + 3 * n + 3)			/* n+1 */
#define as1   (pp + 4 * n + 4)			/* n+1 */

  /* Total sccratch need is 6 * n + 3 + 1; we allocate one extra
     limb, because products will overwrite 2n+2 limbs. */

#define a0a2  scratch
#define b0b2  scratch
#define a1a3  asm1
#define b1d   bsm1

  /* Compute as2 and asm2.  */
  flags = (enum toom6_flags) (toom6_vm2_neg & mpn_toom_eval_dgr3_pm2 (as2, asm2, ap, n, s, a1a3));

  /* Compute bs2 and bsm2.  */
  b1d[n] = mpn_lshift (b1d, b1, n, 1);			/*       2b1      */
  cy  = mpn_lshift (b0b2, b2, t, 2);			/*  4b2           */
  cy += mpn_add_n (b0b2, b0b2, b0, t);			/*  4b2      + b0 */
  if (t != n)
    cy = mpn_add_1 (b0b2 + t, b0 + t, n - t, cy);
  b0b2[n] = cy;

#if HAVE_NATIVE_mpn_add_n_sub_n
  if (mpn_cmp (b0b2, b1d, n+1) < 0)
    {
      mpn_add_n_sub_n (bs2, bsm2, b1d, b0b2, n+1);
      flags = (enum toom6_flags) (flags ^ toom6_vm2_neg);
    }
  else
    {
      mpn_add_n_sub_n (bs2, bsm2, b0b2, b1d, n+1);
    }
#else
  mpn_add_n (bs2, b0b2, b1d, n+1);
  if (mpn_cmp (b0b2, b1d, n+1) < 0)
    {
      mpn_sub_n (bsm2, b1d, b0b2, n+1);
      flags = (enum toom6_flags) (flags ^ toom6_vm2_neg);
    }
  else
    {
      mpn_sub_n (bsm2, b0b2, b1d, n+1);
    }
#endif

  /* Compute as1 and asm1.  */
  flags = (enum toom6_flags) (flags ^ (toom6_vm1_neg & mpn_toom_eval_dgr3_pm1 (as1, asm1, ap, n, s, a0a2)));

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

  ASSERT (as1[n] <= 3);
  ASSERT (bs1[n] <= 2);
  ASSERT (asm1[n] <= 1);
  ASSERT (bsm1[n] <= 1);
  ASSERT (as2[n] <=14);
  ASSERT (bs2[n] <= 6);
  ASSERT (asm2[n] <= 9);
  ASSERT (bsm2[n] <= 4);

  /* vm1, 2n+1 limbs */
  mpn_mul_n (vm1, asm1, bsm1, n+1);  /* W4 */

  /* vm2, 2n+1 limbs */
  mpn_mul_n (vm2, asm2, bsm2, n+1);  /* W2 */

  /* v2, 2n+1 limbs */
  mpn_mul_n (v2, as2, bs2, n+1);  /* W1 */

  /* v1, 2n+1 limbs */
  mpn_mul_n (v1, as1, bs1, n+1);  /* W3 */

  /* vinf, s+t limbs */   /* W0 */
  if (s > t)  mpn_mul (vinf, a3, s, b2, t);
  else        mpn_mul (vinf, b2, t, a3, s);

  /* v0, 2n limbs */
  mpn_mul_n (v0, ap, bp, n);  /* W5 */

  mpn_toom_interpolate_6pts (pp, n, flags, vm1, vm2, v2, t + s);

#undef v0
#undef vm1
#undef v1
#undef vm2
#undef v2
#undef vinf
#undef bs1
#undef bs2
#undef bsm1
#undef bsm2
#undef asm1
#undef asm2
/* #undef as1 */
/* #undef as2 */
#undef a0a2
#undef b0b2
#undef a1a3
#undef b1d
#undef a0
#undef a1
#undef a2
#undef a3
#undef b0
#undef b1
#undef b2
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r9, %r14
movq %r8, %r12
movq %rcx, 0x28(%rsp)
movq %rdx, %r8
movq %rsi, 0x50(%rsp)
leaq (%rdx,%rdx,2), %rax
leaq (,%r12,4), %rcx
cmpq %rcx, %rax
jge 0x21943
leaq -0x1(%r12), %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
movq %rdx, %r13
shrq %r13
jmp 0x2194b
leaq -0x1(%r8), %r13
sarq $0x2, %r13
leaq 0x1(%r13), %rbx
leaq (%rbx,%rbx,2), %rcx
subq %rcx, %r8
leaq 0x2(,%r13,2), %rax
movq %r12, 0x58(%rsp)
movq %rax, 0x68(%rsp)
subq %rax, %r12
movq %rdi, 0x30(%rsp)
leaq (%rdi,%rcx,8), %rdi
addq $0x18, %rdi
movq %rbx, %rax
shlq $0x5, %rax
movq %rax, 0x80(%rsp)
leaq (%r14,%rax), %rsi
addq $0x20, %rsi
movq %rcx, 0xb0(%rsp)
leaq 0x18(%r14,%rcx,8), %r9
movq %rdi, 0xa8(%rsp)
movq %rsi, 0xa0(%rsp)
movq 0x50(%rsp), %rdx
movq %rbx, %rcx
movq %r8, 0x88(%rsp)
movq %r9, 0x40(%rsp)
callq 0x27660
movl %eax, 0x14(%rsp)
movq %rbx, %rbp
shlq $0x4, %rbp
leaq (%r14,%rbp), %rax
movq %rax, 0x48(%rsp)
leaq (%r14,%rbp), %rdi
addq $0x10, %rdi
movq 0x28(%rsp), %r15
leaq 0x8(%r15,%r13,8), %rsi
movq %rdi, 0x18(%rsp)
movq %rsi, 0x38(%rsp)
movq %rbx, %rdx
movl $0x1, %ecx
callq 0x1bf80
movq %r13, 0x20(%rsp)
movq 0x48(%rsp), %rcx
movq %rax, 0x18(%rcx,%r13,8)
addq %r15, %rbp
movq %r14, %rdi
movq %rbp, 0x70(%rsp)
movq %rbp, %rsi
movq %r14, %rbp
movq %r12, %rdx
movl $0x2, %ecx
callq 0x1bf80
movq %rax, %r13
movq %r14, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x1ba80
addq %r13, %rax
movq %rbx, %rcx
subq %r12, %rcx
movq %r12, 0x78(%rsp)
jne 0x21a6d
movq 0x20(%rsp), %r14
movq 0x40(%rsp), %r13
movq 0x18(%rsp), %rdx
movl 0x14(%rsp), %r12d
jmp 0x21b61
addq (%r15,%r12,8), %rax
movq %rax, (%rbp,%r12,8)
jae 0x21b08
cmpq $0x2, %rcx
movl $0x1, %r8d
cmovgeq %rcx, %r8
movl $0x1, %eax
movq 0x58(%rsp), %rdx
leaq (,%rdx,8), %r11
movq 0x20(%rsp), %r14
movq %r14, %rsi
shlq $0x4, %rsi
subq %rsi, %r11
leaq (%r11,%rbp), %rsi
addq %r15, %r11
movl $0x1, %r9d
movq 0x40(%rsp), %r13
movl 0x14(%rsp), %r12d
cmpq %r9, %r8
je 0x21b5c
movq -0x10(%r11,%r9,8), %r10
leaq 0x1(%r9), %rdi
incq %r10
movq %r10, -0x10(%rsi,%r9,8)
movq %rdi, %r9
je 0x21ac2
xorl %eax, %eax
cmpq %rbp, %r15
movq 0x18(%rsp), %rdx
je 0x21b61
cmpq %rcx, %rdi
jge 0x21b61
xorl %eax, %eax
movq -0x10(%r11,%rdi,8), %r8
movq %r8, -0x10(%rsi,%rdi,8)
incq %rdi
cmpq %rcx, %rdi
jl 0x21af4
jmp 0x21b61
xorl %eax, %eax
cmpq %rbp, %r15
movq 0x20(%rsp), %r14
movq 0x40(%rsp), %r13
movq 0x18(%rsp), %rdx
movl 0x14(%rsp), %r12d
je 0x21b61
cmpq $0x2, %rcx
jl 0x21b61
leaq (%r14,%r14,2), %rcx
addq $0x2, %rcx
movq %r14, %r9
shlq $0x4, %r9
xorq $-0x8, %r9
leaq (%r9,%rbp), %rsi
addq %r15, %r9
xorl %eax, %eax
movq 0x58(%rsp), %rdi
movq (%r9,%rdi,8), %r8
movq %r8, (%rsi,%rdi,8)
incq %rdi
cmpq %rdi, %rcx
jne 0x21b4a
jmp 0x21b61
movq 0x18(%rsp), %rdx
leaq 0x4(,%r14,4), %rcx
movq %rcx, 0x60(%rsp)
addq %rbp, 0x80(%rsp)
andl $0x2, %r12d
movq %rax, 0x8(%rbp,%r14,8)
movq 0x30(%rsp), %rax
movq 0x68(%rsp), %rsi
leaq (%rax,%rsi,8), %rcx
movq %rcx, 0x98(%rsp)
leaq 0x10(%rax,%rsi,8), %rdi
leaq 0x2(%r14), %r15
movq %rdi, 0x68(%rsp)
movq %rbp, %rsi
movq %r15, %rcx
callq 0x1ba80
leaq (%r14,%r14,2), %rax
movq %rax, 0x90(%rsp)
leaq 0x28(,%rax,8), %rax
addq %rbp, %rax
movq %r15, 0x20(%rsp)
testq %r15, %r15
jle 0x21be6
leaq -0x1(%r15), %rdx
movq (%rax), %rsi
addq $-0x8, %rax
cmpq %rsi, -0x8(%rbp,%r15,8)
movq %rdx, %r15
je 0x21bca
jbe 0x21c0c
movl %r12d, 0x14(%rsp)
movq 0x30(%rsp), %r15
leaq (%r15,%rbx,8), %rdi
addq $0x8, %rdi
movq %rbp, %rsi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x1bca0
jmp 0x21c34
movq 0x30(%rsp), %r15
leaq (%r15,%rbx,8), %rdi
addq $0x8, %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
movq 0x20(%rsp), %rcx
callq 0x1bca0
xorl $0x2, %r12d
movl %r12d, 0x14(%rsp)
movq 0x60(%rsp), %rax
leaq (%r15,%rax,8), %rdi
addq $0x20, %rdi
movq %rdi, 0x60(%rsp)
movq %r13, %rsi
movq 0x50(%rsp), %rdx
movq %rbx, %rcx
movq 0x88(%rsp), %r8
movq %rbp, %r9
callq 0x27544
movl %eax, %r12d
andl $0x1, %r12d
movq 0x78(%rsp), %rcx
testq %rcx, %rcx
je 0x21cce
movq 0x18(%rsp), %r13
movq %r13, %rdi
movq 0x28(%rsp), %r15
movq %r15, %rsi
movq 0x70(%rsp), %rdx
callq 0x1ba80
movq %r13, %rsi
movq 0x78(%rsp), %rdi
movq %rdi, %rcx
testq %rax, %rax
movq 0x38(%rsp), %rdx
je 0x21cdf
movq 0x58(%rsp), %rax
leaq 0x10(,%rax,8), %rax
addq %rbp, %rax
movq %rdi, %rcx
cmpq %r14, %rcx
jg 0x21d0a
movq (%r15,%rcx,8), %rdi
incq %rcx
incq %rdi
movq %rdi, (%rax)
leaq 0x8(%rax), %rax
je 0x21cb4
jmp 0x21cdf
xorl %ecx, %ecx
movq 0x28(%rsp), %r15
movq 0x18(%rsp), %rsi
movq 0x38(%rsp), %rdx
cmpq %r15, %rsi
setne %al
cmpq %r14, %rcx
setle %dil
andb %al, %dil
xorl %r13d, %r13d
cmpb $0x1, %dil
jne 0x21d10
movq (%r15,%rcx,8), %rax
movq %rax, (%rsi,%rcx,8)
incq %rcx
cmpq %rcx, %rbx
jne 0x21cf8
jmp 0x21d10
movl $0x1, %r13d
xorl 0x14(%rsp), %r12d
movl %r12d, 0x14(%rsp)
movq %r13, 0x8(%rsi,%r14,8)
movq 0x30(%rsp), %r15
movq %r15, %rdi
movq %rdx, %r12
movq %rbx, %rcx
callq 0x1ba80
movq 0x18(%rsp), %rdi
addq %r13, %rax
leaq (%r15,%rbx,8), %rcx
movq %rcx, 0x38(%rsp)
movq %rax, 0x8(%r15,%r14,8)
cmpq $0x0, 0x8(%rdi,%r14,8)
movq 0x88(%rsp), %r15
je 0x21e7c
movq %rdi, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x1bca0
movq 0x18(%rsp), %rdx
subq %rax, 0x8(%rdx,%r14,8)
movq %rbp, %rdi
movq 0x40(%rsp), %rsi
movq 0x20(%rsp), %r12
movq %r12, %rcx
callq 0x1d348
movq 0x48(%rsp), %rdi
addq $0x8, %rdi
movq 0x38(%rsp), %rdx
addq $0x8, %rdx
movq %rdi, 0x48(%rsp)
movq 0xa0(%rsp), %rsi
movq %r12, %rcx
callq 0x1d348
movq 0x80(%rsp), %r13
addq $0x10, %r13
movq %r13, %rdi
movq 0xa8(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %r12, %rcx
callq 0x1d348
movq 0x98(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x30(%rsp), %r14
movq %r14, %rdx
movq %r12, %rcx
callq 0x1d348
leaq (%rbx,%rbx,4), %rax
leaq (%r14,%rax,8), %rdi
movq 0x50(%rsp), %rax
movq 0xb0(%rsp), %rcx
leaq (%rax,%rcx,8), %rcx
movq 0x78(%rsp), %r12
cmpq %r12, %r15
jle 0x21e24
movq %rcx, %rsi
movq %r15, %rdx
movq 0x70(%rsp), %rcx
movq %r12, %r8
jmp 0x21e2f
movq 0x70(%rsp), %rsi
movq %r12, %rdx
movq %r15, %r8
callq 0x1c838
movq %r14, %rdi
movq 0x50(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rcx
callq 0x1d348
addq %r15, %r12
movq %r12, (%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movl 0x14(%rsp), %edx
movq %rbp, %rcx
movq 0x48(%rsp), %r8
movq %r13, %r9
callq 0x282d8
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rax
shlq $0x4, %rax
movq 0x28(%rsp), %rcx
addq %rcx, %rax
addq $0x8, %rax
movq 0x90(%rsp), %rcx
leaq 0x20(,%rcx,8), %rcx
addq %rbp, %rcx
xorl %edx, %edx
leaq (%rbx,%rdx), %rsi
testq %rsi, %rsi
jle 0x21d5c
movq (%rax,%rdx,8), %rsi
leaq -0x1(%rdx), %r8
cmpq %rsi, (%rcx,%rdx,8)
movq %r8, %rdx
je 0x21ea4
ja 0x21d5c
movq %r12, %rsi
movq %rdi, %rdx
movq %rbx, %rcx
callq 0x1bca0
movq 0x18(%rsp), %rdx
xorl $0x1, 0x14(%rsp)
jmp 0x21d74
nopl (%rax)