// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/3rdparty/gmp/mpn/toom42_mul.c
// Function: _gmpn_toom42_mul
void
mpn_toom42_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;
  int vm1_neg;
  mp_limb_t cy, vinf0;
  mp_ptr a0_a2;
  mp_ptr as1, asm1, as2;
  mp_ptr bs1, bsm1, bs2;
  mp_ptr tmp;
  TMP_DECL;

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

  n = an >= 2 * bn ? (an + 3) >> 2 : (bn + 1) >> 1;

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

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

  TMP_MARK;

  tmp = TMP_ALLOC_LIMBS (6 * n + 5);
  as1  = tmp; tmp += n + 1;
  asm1 = tmp; tmp += n + 1;
  as2  = tmp; tmp += n + 1;
  bs1  = tmp; tmp += n + 1;
  bsm1 = tmp; tmp += n;
  bs2  = tmp; tmp += n + 1;

  a0_a2 = pp;

  /* Compute as1 and asm1.  */
  vm1_neg = mpn_toom_eval_dgr3_pm1 (as1, asm1, ap, n, s, a0_a2) & 1;

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

  /* Compute bs1 and bsm1.  */
  if (t == n)
    {
#if HAVE_NATIVE_mpn_add_n_sub_n
      if (mpn_cmp (b0, b1, n) < 0)
	{
	  cy = mpn_add_n_sub_n (bs1, bsm1, b1, b0, n);
	  vm1_neg ^= 1;
	}
      else
	{
	  cy = mpn_add_n_sub_n (bs1, bsm1, b0, b1, n);
	}
      bs1[n] = cy >> 1;
#else
      bs1[n] = mpn_add_n (bs1, b0, b1, n);

      if (mpn_cmp (b0, b1, n) < 0)
	{
	  mpn_sub_n (bsm1, b1, b0, n);
	  vm1_neg ^= 1;
	}
      else
	{
	  mpn_sub_n (bsm1, b0, b1, n);
	}
#endif
    }
  else
    {
      bs1[n] = mpn_add (bs1, b0, n, b1, t);

      if (mpn_zero_p (b0 + t, n - t) && mpn_cmp (b0, b1, t) < 0)
	{
	  mpn_sub_n (bsm1, b1, b0, t);
	  MPN_ZERO (bsm1 + t, n - t);
	  vm1_neg ^= 1;
	}
      else
	{
	  mpn_sub (bsm1, b0, n, b1, t);
	}
    }

  /* Compute bs2, recycling bs1. bs2=bs1+b1  */
  mpn_add (bs2, bs1, n + 1, b1, t);

  ASSERT (as1[n] <= 3);
  ASSERT (bs1[n] <= 1);
  ASSERT (asm1[n] <= 1);
/*ASSERT (bsm1[n] == 0);*/
  ASSERT (as2[n] <= 14);
  ASSERT (bs2[n] <= 2);

#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 + 4 * n + 4	/* Currently unused. */

  /* vm1, 2n+1 limbs */
  TOOM42_MUL_N_REC (vm1, asm1, bsm1, n, scratch_out);
  cy = 0;
  if (asm1[n] != 0)
    cy = mpn_add_n (vm1 + n, vm1 + n, bsm1, n);
  vm1[2 * n] = cy;

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

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

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

  /* v1, 2n+1 limbs */
  TOOM42_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] == 2)
    {
#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 if (as1[n] == 3)
    {
      cy = 3 * bs1[n] + mpn_addmul_1 (v1 + n, bs1, n, CNST_LIMB(3));
    }
  else
    cy = 0;
  if (bs1[n] != 0)
    cy += mpn_add_n (v1 + n, v1 + n, as1, n);
  v1[2 * n] = cy;

  TOOM42_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);

  TMP_FREE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, -0xa8(%rbp)
movq %r8, %r14
movq %rcx, -0x98(%rbp)
movq %rdx, %r15
movq %rsi, -0x60(%rbp)
movq %rdi, %r9
leaq (%r8,%r8), %rax
leaq 0x3(%rdx), %rsi
sarq $0x2, %rsi
leaq 0x1(%r8), %r13
sarq %r13
cmpq %rdx, %rax
cmovleq %rsi, %r13
leaq (,%r13,2), %rsi
addq %r13, %rsi
movq %rdx, -0x38(%rbp)
subq %rsi, %r15
movq $0x0, -0xb0(%rbp)
movq %rsi, -0x88(%rbp)
shlq $0x4, %rsi
addq $0x28, %rsi
cmpq $0x7f00, %rsi           # imm = 0x7F00
ja 0x210cb
movq %rsp, %rdi
addq $0xf, %rsi
andq $-0x10, %rsi
subq %rsi, %rdi
movq %rdi, %rsp
movq %r14, %rax
subq %r13, %rax
movq %rax, -0x50(%rbp)
leaq (%rdi,%r13,8), %rsi
addq $0x8, %rsi
leaq 0x8(%rsi,%r13,8), %rbx
leaq 0x8(%rbx,%r13,8), %rax
movq %rax, -0x30(%rbp)
movq %rdi, -0x48(%rbp)
movq %rsi, -0xb8(%rbp)
movq -0x60(%rbp), %r12
movq %r12, %rdx
movq %r13, %rcx
movq %r15, %r8
movq %r9, -0xa0(%rbp)
callq 0x27544
movl %eax, -0x54(%rbp)
movq %r13, %rax
shlq $0x4, %rax
movq %rax, -0x70(%rbp)
leaq (%r12,%rax), %rsi
movq -0x88(%rbp), %rax
leaq (%r12,%rax,8), %rdx
movq %rbx, %rdi
movq %rsi, -0x68(%rbp)
movq %rdx, -0x90(%rbp)
movq %r15, %rcx
callq 0x2f200
movq %rax, %r12
movq %r13, %r11
movq %r13, %rax
subq %r15, %rax
movq %rbx, -0x78(%rbp)
movq %r15, -0x80(%rbp)
jne 0x20afd
movq -0x30(%rbp), %rax
movq %r11, %r15
leaq (%rax,%r15,8), %rcx
addq $0x8, %rcx
movq %rcx, -0x38(%rbp)
andl $0x1, -0x54(%rbp)
leaq (%r15,%r15), %rcx
movq %rcx, -0x68(%rbp)
movq -0x60(%rbp), %rbx
leaq (%rbx,%r15,8), %rsi
movq -0x78(%rbp), %r13
movq %r13, %rdi
movq %r13, %rdx
movq %r15, %rcx
callq 0x2f200
shlq $0x2, %r12
leaq (%r12,%rax,2), %r12
movq %r13, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x2f200
addq %r12, %rax
movq %rax, (%r13,%r15,8)
movq %r15, %rbx
movq -0x98(%rbp), %r12
leaq (%r12,%r15,8), %rdx
movq -0x50(%rbp), %rcx
subq %rcx, %rbx
movq %rdx, -0x40(%rbp)
jne 0x20bcf
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rcx
callq 0x1ba80
movq %rax, (%rbx,%r15,8)
movq -0x70(%rbp), %rax
addq %r12, %rax
addq $-0x8, %rax
movq %r15, %rcx
movq -0x38(%rbp), %rdi
testq %rcx, %rcx
jle 0x20ae1
leaq -0x1(%rcx), %rdx
movq (%rax), %rsi
addq $-0x8, %rax
cmpq %rsi, -0x8(%r12,%rcx,8)
movq %rdx, %rcx
je 0x20ac1
jbe 0x20ce8
movq %r12, %rsi
movq -0x40(%rbp), %rdx
movq %r15, %rcx
callq 0x1bca0
movq -0x38(%rbp), %r8
movq -0x30(%rbp), %rsi
jmp 0x20d03
movq -0x68(%rbp), %r13
addq (%r13,%r15,8), %r12
movq %r12, (%rbx,%r15,8)
jae 0x20c2e
cmpq $0x2, %rax
movl $0x1, %edx
cmovgeq %rax, %rdx
movl $0x1, %r12d
movq -0x38(%rbp), %rcx
leaq (,%rcx,8), %rcx
leaq (,%r11,8), %rsi
subq %rsi, %rcx
movq -0x60(%rbp), %rsi
addq %rcx, %rsi
addq $0x8, %rsi
movq -0x48(%rbp), %rdi
addq %rcx, %rdi
addq $0x18, %rdi
decq %rdx
xorl %r9d, %r9d
cmpq %r9, %rdx
je 0x20a20
movq (%rsi,%r9,8), %r10
leaq 0x1(%r9), %r8
incq %r10
movq %r10, (%rdi,%r9,8)
movq %r8, %r9
je 0x20b56
cmpq -0x78(%rbp), %r13
setne %dl
leaq 0x1(%r8), %rsi
cmpq %rax, %rsi
setl %al
andb %dl, %al
cmpb $0x1, %al
jne 0x21074
movq -0x48(%rbp), %rax
addq %rcx, %rax
leaq (%rax,%r8,8), %rdi
addq $0x18, %rdi
addq -0x60(%rbp), %rcx
leaq (%rcx,%r8,8), %rsi
addq $0x8, %rsi
movq -0x38(%rbp), %rax
notq %rax
movq %r11, %r15
leaq (%rax,%r11,4), %rdx
subq %r8, %rdx
shlq $0x3, %rdx
callq 0x6200
xorl %r12d, %r12d
movq -0x30(%rbp), %rax
jmp 0x20a27
testq %rcx, %rcx
je 0x20c9a
movq -0x30(%rbp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x1ba80
movq %r13, %rsi
movq -0x50(%rbp), %rcx
movq %rcx, %r8
testq %rax, %rax
je 0x20ca1
movq -0x70(%rbp), %rax
leaq (%rax,%r14,8), %rax
movq -0x48(%rbp), %rdx
addq %rdx, %rax
addq $0x18, %rax
movq %rcx, %r8
cmpq %r15, %r8
jge 0x20d0c
movq (%r12,%r8,8), %rdx
incq %r8
incq %rdx
movq %rdx, (%rax)
leaq 0x8(%rax), %rax
je 0x20c10
jmp 0x20ca1
xorl %r12d, %r12d
cmpq $0x2, %rax
movq -0x30(%rbp), %rax
jl 0x20a24
cmpq -0x78(%rbp), %r13
movq %r11, %r15
je 0x20a27
movq -0x38(%rbp), %rdx
leaq (,%rdx,8), %rax
leaq (,%r15,8), %rcx
subq %rcx, %rax
movq -0x48(%rbp), %rcx
leaq (%rax,%rcx), %rdi
addq $0x18, %rdi
movq -0x60(%rbp), %rcx
leaq (%rax,%rcx), %rsi
addq $0x8, %rsi
notq %rdx
movq %r15, %rax
shlq $0x5, %rax
leaq (%rax,%rdx,8), %rdx
callq 0x6200
movq -0x30(%rbp), %rax
xorl %r12d, %r12d
jmp 0x20a27
xorl %r8d, %r8d
movq -0x30(%rbp), %rsi
xorl %eax, %eax
cmpq %r12, %rsi
je 0x20d11
movq %r15, %rdx
subq %r8, %rdx
jle 0x20d11
leaq (,%r8,8), %rax
movq -0x88(%rbp), %rcx
leaq (%rax,%rcx,8), %rax
movq -0x48(%rbp), %rcx
leaq (%rcx,%rax), %rdi
addq $0x18, %rdi
leaq (%r12,%r8,8), %rsi
shlq $0x3, %rdx
callq 0x6200
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rcx
xorl %eax, %eax
jmp 0x20d11
movq -0x40(%rbp), %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x1bca0
movq -0x38(%rbp), %r8
movq -0x30(%rbp), %rsi
xorl $0x1, -0x54(%rbp)
movq -0x50(%rbp), %rcx
jmp 0x20e0b
movl $0x1, %eax
movq %rax, (%rsi,%r15,8)
movq %r14, %rax
subq -0x68(%rbp), %rax
leaq (%r12,%r15,8), %rdi
addq $-0x8, %rdi
xorl %edx, %edx
cmpq $0x0, (%rdi,%rdx,8)
jne 0x20d69
decq %rdx
cmpq %rdx, %rax
jne 0x20d26
leaq (%r12,%r14,8), %r8
addq $-0x8, %r8
leaq (,%r15,8), %rax
negq %rax
movq %rcx, %rdx
testq %rdx, %rdx
jle 0x20d69
decq %rdx
movq (%r8), %r9
leaq -0x8(%r8), %rdi
cmpq %r9, (%r8,%rax)
movq %rdi, %r8
je 0x20d4b
jbe 0x2107c
testq %rcx, %rcx
je 0x20dca
movq -0x38(%rbp), %rdi
movq %r12, %rsi
movq -0x40(%rbp), %rdx
callq 0x1bca0
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rcx
movq %rcx, %r8
testq %rax, %rax
je 0x20dcd
leaq (,%r14,8), %rax
movq -0x88(%rbp), %rdx
leaq (%rax,%rdx,8), %rax
movq -0x48(%rbp), %rdx
addq %rdx, %rax
addq $0x20, %rax
movq %rcx, %r8
cmpq %r15, %r8
jge 0x20e07
movq (%r12,%r8,8), %rdx
incq %r8
subq $0x1, %rdx
movq %rdx, (%rax)
leaq 0x8(%rax), %rax
jb 0x20daf
jmp 0x20dcd
xorl %r8d, %r8d
cmpq %r12, -0x38(%rbp)
je 0x20e07
movq %r15, %rdx
subq %r8, %rdx
jle 0x20e07
movq %r15, %rax
shlq $0x5, %rax
leaq (%rax,%r8,8), %rax
movq -0x48(%rbp), %rcx
leaq (%rcx,%rax), %rdi
addq $0x20, %rdi
leaq (%r12,%r8,8), %rsi
shlq $0x3, %rdx
callq 0x6200
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rcx
movq -0x38(%rbp), %r8
leaq 0x1(%r15), %rbx
leaq (%r8,%r15,8), %r12
testq %rcx, %rcx
je 0x20e6c
movq %r12, %rdi
movq -0x40(%rbp), %rdx
callq 0x1ba80
movq -0x38(%rbp), %r8
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rcx
testq %rax, %rax
je 0x20e6e
movq %r15, %rax
negq %rax
movq -0x48(%rbp), %rcx
movq -0x70(%rbp), %rdx
addq %rcx, %rdx
addq $0x18, %rdx
leaq (%rax,%r14), %rcx
cmpq %r15, %rcx
jg 0x20e88
movq (%rdx,%r14,8), %rdi
leaq 0x1(%r14), %rcx
incq %rdi
movq %rdi, (%r8,%r14,8)
movq %rcx, %r14
je 0x20e4a
subq %r15, %rcx
jmp 0x20e6e
xorl %ecx, %ecx
cmpq %rsi, %r12
je 0x20e88
cmpq %r15, %rcx
jg 0x20e88
movq (%rsi,%rcx,8), %rax
movq %rax, (%r12,%rcx,8)
incq %rcx
cmpq %rcx, %rbx
jne 0x20e78
movq -0xa8(%rbp), %r14
movq %r14, %rdi
movq -0xb8(%rbp), %r13
movq %r13, %rsi
movq %r8, %rdx
movq %r15, %rcx
callq 0x1d348
cmpq $0x0, (%r13,%r15,8)
je 0x20ec4
leaq (%r14,%r15,8), %rdi
movq %rdi, %rsi
movq -0x38(%rbp), %rdx
movq %r15, %rcx
callq 0x1ba80
jmp 0x20ec6
xorl %eax, %eax
movq -0x80(%rbp), %r13
movq -0x68(%rbp), %rcx
leaq (%r14,%rcx,8), %r14
addq $0x8, %r14
movq %rax, -0x8(%r14)
movq %r14, %rdi
movq -0x78(%rbp), %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x1d348
movq %r15, %rbx
shlq $0x5, %rbx
movq -0xa0(%rbp), %r12
leaq (%r12,%rbx), %rdi
movq -0x50(%rbp), %rax
cmpq %rax, %r13
jle 0x20f1a
movq -0x90(%rbp), %rsi
movq %r13, %rdx
movq -0x40(%rbp), %rcx
movq %rax, %r8
jmp 0x20f2b
movq -0x40(%rbp), %rsi
movq %rax, %rdx
movq -0x90(%rbp), %rcx
movq %r13, %r8
callq 0x1c838
movq (%r12,%rbx), %rax
movq %rax, -0x38(%rbp)
movq -0x68(%rbp), %rax
leaq (%r12,%rax,8), %rbx
movq %rbx, %rdi
movq -0x48(%rbp), %r12
movq %r12, %rsi
movq -0x30(%rbp), %rdx
movq %r15, %rcx
callq 0x1d348
movq (%r12,%r15,8), %rax
cmpq $0x3, %rax
je 0x20fb5
cmpq $0x2, %rax
je 0x20f8d
cmpq $0x1, %rax
movq -0x30(%rbp), %rdx
jne 0x20fe5
movq (%rdx,%r15,8), %rax
movq %rax, -0x40(%rbp)
leaq (%rbx,%r15,8), %rdi
movq %rdi, %rsi
movq %r15, %rcx
callq 0x1ba80
movq -0x30(%rbp), %rdx
jmp 0x20fdc
movq -0x30(%rbp), %r13
movq (%r13,%r15,8), %r12
leaq (%rbx,%r15,8), %rdi
movq %rdi, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x2f200
movq %r13, %rdx
movq -0x80(%rbp), %r13
leaq (%rax,%r12,2), %r12
jmp 0x20fe8
movq -0x30(%rbp), %r12
movq (%r12,%r15,8), %rax
leaq (%rax,%rax,2), %rax
movq %rax, -0x40(%rbp)
leaq (%rbx,%r15,8), %rdi
movl $0x3, %ecx
movq %r12, %rsi
movq %r15, %rdx
callq 0x2fea0
movq %r12, %rdx
movq %rax, %r12
addq -0x40(%rbp), %r12
jmp 0x20fe8
xorl %r12d, %r12d
cmpq $0x0, (%rdx,%r15,8)
je 0x21005
leaq (%rbx,%r15,8), %rdi
movq %rdi, %rsi
movq -0x48(%rbp), %rdx
movq %r15, %rcx
callq 0x1ba80
addq %rax, %r12
movq -0x68(%rbp), %rax
movq %r12, (%rbx,%rax,8)
movq -0xa0(%rbp), %rbx
movq %rbx, %rdi
movq -0x60(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq %r15, %rcx
callq 0x1d348
addq -0x50(%rbp), %r13
subq $0x8, %rsp
movq %rbx, %rdi
movq %r14, %rsi
movq -0xa8(%rbp), %rdx
movq %r15, %rcx
movq %r13, %r8
movl -0x54(%rbp), %r9d
pushq -0x38(%rbp)
callq 0x28080
addq $0x10, %rsp
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
jne 0x210e5
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
jmp 0x20a20
movq -0x38(%rbp), %r13
movq %r13, %rdi
movq -0x40(%rbp), %rsi
movq %r12, %rdx
movq %rcx, %r12
callq 0x1bca0
testq %rbx, %rbx
je 0x210b8
leaq (,%r12,8), %rdi
addq %r13, %rdi
leaq (,%r14,8), %rax
movq -0x70(%rbp), %rdx
subq %rax, %rdx
xorl %esi, %esi
callq 0x6170
xorl $0x1, -0x54(%rbp)
movq %r12, %rcx
movq -0x30(%rbp), %rsi
movq %r13, %r8
jmp 0x20e0b
leaq -0xb0(%rbp), %rdi
movq %r9, %rbx
callq 0x2fdb0
movq %rbx, %r9
movq %rax, %rdi
jmp 0x2098f
callq 0x2fde3
jmp 0x21065
nop