// File: /workspace/github_cpp_makefile_star2_O1/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, -0xa0(%rbp)
movq %rdx, %r13
movq %rsi, -0x58(%rbp)
movq %rdi, -0x68(%rbp)
leaq (%r8,%r8), %rax
leaq 0x3(%rdx), %rcx
sarq $0x2, %rcx
leaq 0x1(%r8), %r15
sarq %r15
cmpq %rdx, %rax
cmovleq %rcx, %r15
leaq (%r15,%r15,2), %rsi
movq %rdx, -0x30(%rbp)
subq %rsi, %r13
movq $0x0, -0xb0(%rbp)
movq %rsi, -0x78(%rbp)
shlq $0x4, %rsi
addq $0x28, %rsi
cmpq $0x7f00, %rsi           # imm = 0x7F00
ja 0x2167e
movq %rsp, %rdi
addq $0xf, %rsi
andq $-0x10, %rsi
subq %rsi, %rdi
movq %rdi, %rsp
movq %r14, %rax
subq %r15, %rax
movq %rax, -0x50(%rbp)
leaq (%rdi,%r15,8), %rsi
addq $0x8, %rsi
leaq 0x8(%rsi,%r15,8), %rbx
leaq 0x8(%rbx,%r15,8), %rax
movq %rax, -0x38(%rbp)
movq %rdi, -0x48(%rbp)
movq %rsi, -0xc0(%rbp)
movq -0x58(%rbp), %r12
movq %r12, %rdx
movq %r15, %rcx
movq %r13, %r8
movq -0x68(%rbp), %r9
callq 0x27890
movl %eax, -0x3c(%rbp)
movq %r15, %rax
shlq $0x4, %rax
movq %rax, -0x70(%rbp)
leaq (%r12,%rax), %rsi
movq -0x78(%rbp), %rax
leaq (%r12,%rax,8), %rdx
movq %rbx, %rdi
movq %rsi, -0x60(%rbp)
movq %rdx, -0x88(%rbp)
movq %r13, %rcx
callq 0x2f5c0
movq %rax, %r12
movq %r15, %r11
movq %r15, %rax
subq %r13, %rax
movq %r13, -0x98(%rbp)
movq %rbx, -0x90(%rbp)
jne 0x2108b
movl -0x3c(%rbp), %ebx
movq -0x38(%rbp), %rax
movq %r11, %r15
leaq (%rax,%r15,8), %rcx
addq $0x8, %rcx
movq %rcx, -0x30(%rbp)
andl $0x1, %ebx
movl %ebx, -0x3c(%rbp)
leaq (%r15,%r15), %rcx
movq %rcx, -0x60(%rbp)
movq -0x58(%rbp), %rbx
leaq (%rbx,%r15,8), %rsi
movq -0x90(%rbp), %r13
movq %r13, %rdi
movq %r13, %rdx
movq %r15, %rcx
callq 0x2f5c0
shlq $0x2, %r12
leaq (%r12,%rax,2), %r12
movq %r13, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x2f5c0
addq %r12, %rax
movq %rax, (%r13,%r15,8)
movq %r15, %rax
movq -0xa0(%rbp), %r12
leaq (%r12,%r15,8), %r13
movq -0x50(%rbp), %rcx
subq %rcx, %rax
movq %r13, -0x80(%rbp)
jne 0x2115e
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x1bfa0
movq %rax, (%rbx,%r15,8)
movq -0x70(%rbp), %rbx
leaq (%rbx,%r12), %rax
addq $-0x8, %rax
movq %r15, %rcx
movq -0x30(%rbp), %rdi
testq %rcx, %rcx
jle 0x21070
leaq -0x1(%rcx), %rdx
movq (%rax), %rsi
addq $-0x8, %rax
cmpq %rsi, -0x8(%r12,%rcx,8)
movq %rdx, %rcx
je 0x21050
jbe 0x2128a
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0x1c1c0
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rsi
jmp 0x212a4
movq -0x60(%rbp), %r15
addq (%r15,%r13,8), %r12
movq %r12, (%rbx,%r13,8)
jae 0x211d1
cmpq $0x2, %rax
movl $0x1, %edx
cmovgeq %rax, %rdx
movl $0x1, %r12d
movq -0x30(%rbp), %rcx
leaq (,%rcx,8), %rcx
leaq (,%r11,8), %rsi
subq %rsi, %rcx
movq -0x58(%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 0x20fa3
movq (%rsi,%r9,8), %r10
leaq 0x1(%r9), %r8
incq %r10
movq %r10, (%rdi,%r9,8)
movq %r8, %r9
je 0x210e3
cmpq %rbx, %r15
setne %dl
leaq 0x1(%r8), %rsi
cmpq %rax, %rsi
setl %al
andb %dl, %al
cmpb $0x1, %al
jne 0x21676
movq -0x48(%rbp), %rax
addq %rcx, %rax
leaq (%rax,%r8,8), %rdi
addq $0x18, %rdi
addq -0x58(%rbp), %rcx
leaq (%rcx,%r8,8), %rsi
addq $0x8, %rsi
movq -0x30(%rbp), %rax
notq %rax
movq %r11, %r15
leaq (%rax,%r11,4), %rdx
subq %r8, %rdx
shlq $0x3, %rdx
callq 0x6200
xorl %r12d, %r12d
movl -0x3c(%rbp), %ebx
movq -0x38(%rbp), %rax
jmp 0x20fad
movq %rax, -0xb8(%rbp)
testq %rcx, %rcx
movq -0x70(%rbp), %rbx
je 0x2123f
movq %r12, %rbx
movq -0x38(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x1bfa0
movq %r12, %rsi
movq %rbx, %r12
movq -0x70(%rbp), %rbx
movq -0x50(%rbp), %rcx
movq %rcx, %r8
testq %rax, %rax
je 0x21246
leaq (%rbx,%r14,8), %rax
movq -0x48(%rbp), %rdx
addq %rdx, %rax
addq $0x18, %rax
movq %rcx, %r8
cmpq %r15, %r8
jge 0x212ad
movq (%r12,%r8,8), %rdx
incq %r8
incq %rdx
movq %rdx, (%rax)
leaq 0x8(%rax), %rax
je 0x211b3
jmp 0x21246
xorl %r12d, %r12d
cmpq $0x2, %rax
movq -0x38(%rbp), %rax
jl 0x2166e
cmpq %rbx, %r15
movl -0x3c(%rbp), %ebx
movq %r11, %r15
je 0x20fad
movq -0x30(%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 -0x58(%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 -0x38(%rbp), %rax
xorl %r12d, %r12d
jmp 0x20fad
xorl %r8d, %r8d
movq -0x38(%rbp), %rsi
xorl %eax, %eax
cmpq %r12, %rsi
je 0x212b2
movq %r15, %rdx
subq %r8, %rdx
jle 0x212b2
leaq (,%r8,8), %rax
movq -0x78(%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 -0x38(%rbp), %rsi
movq -0x50(%rbp), %rcx
xorl %eax, %eax
jmp 0x212b2
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x1c1c0
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rsi
xorl $0x1, -0x3c(%rbp)
movq -0x50(%rbp), %rcx
jmp 0x2140c
movl $0x1, %eax
movq %rax, (%rsi,%r15,8)
movq %r14, %rax
subq -0x60(%rbp), %rax
movq $-0x1, %rdi
movq (%r13,%rdi,8), %rdx
testq %rdx, %rdx
jne 0x212da
leaq -0x1(%rdi), %r8
cmpq %rdi, %rax
movq %r8, %rdi
jne 0x212c4
testq %rdx, %rdx
je 0x2134b
testq %rcx, %rcx
je 0x213cb
movq -0x30(%rbp), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x1c1c0
movq -0x38(%rbp), %rsi
movq -0x50(%rbp), %rcx
movq %rcx, %r8
testq %rax, %rax
je 0x213ce
leaq (,%r14,8), %rax
movq -0x78(%rbp), %rdx
leaq (%rax,%rdx,8), %rax
movq -0x48(%rbp), %rdx
addq %rdx, %rax
addq $0x20, %rax
movq %rcx, %r8
cmpq %r15, %r8
jge 0x21408
movq (%r12,%r8,8), %rdx
incq %r8
subq $0x1, %rdx
movq %rdx, (%rax)
leaq 0x8(%rax), %rax
jb 0x21329
jmp 0x213ce
leaq (%r12,%r14,8), %r8
addq $-0x8, %r8
leaq (,%r15,8), %rax
negq %rax
movq %rcx, %rdx
testq %rdx, %rdx
jle 0x212df
decq %rdx
movq (%r8), %r9
leaq -0x8(%r8), %rdi
cmpq %r9, (%r8,%rax)
movq %rdi, %r8
je 0x21361
ja 0x212df
movq %r12, %rdx
movq -0x30(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
movq %rcx, %r13
callq 0x1c1c0
cmpq $0x0, -0xb8(%rbp)
je 0x213bb
leaq (%r12,%r13,8), %rdi
leaq (,%r14,8), %rax
movq %rbx, %rdx
subq %rax, %rdx
xorl %esi, %esi
callq 0x6170
xorl $0x1, -0x3c(%rbp)
movq %r13, %rcx
movq -0x38(%rbp), %rsi
movq %r12, %rdx
jmp 0x2140c
xorl %r8d, %r8d
cmpq %r12, -0x30(%rbp)
je 0x21408
movq %r15, %rdx
subq %r8, %rdx
jle 0x21408
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 -0x38(%rbp), %rsi
movq -0x50(%rbp), %rcx
movq -0x30(%rbp), %rdx
leaq 0x1(%r15), %r12
leaq (%rdx,%r15,8), %r13
testq %rcx, %rcx
je 0x2146a
movq %r13, %rdi
movq -0x80(%rbp), %rdx
callq 0x1bfa0
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rsi
movq -0x50(%rbp), %rcx
testq %rax, %rax
je 0x2146c
movq %r15, %rax
negq %rax
movq -0x48(%rbp), %rcx
leaq (%rbx,%rcx), %r8
addq $0x18, %r8
leaq (%rax,%r14), %rcx
cmpq %r15, %rcx
jg 0x21487
movq (%r8,%r14,8), %rdi
leaq 0x1(%r14), %rcx
incq %rdi
movq %rdi, (%rdx,%r14,8)
movq %rcx, %r14
je 0x21448
subq %r15, %rcx
jmp 0x2146c
xorl %ecx, %ecx
cmpq %rsi, %r13
je 0x21487
cmpq %r15, %rcx
jg 0x21487
movq (%rsi,%rcx,8), %rax
movq %rax, (%r13,%rcx,8)
incq %rcx
cmpq %rcx, %r12
jne 0x21476
movq -0xa8(%rbp), %r14
movq %r14, %rdi
movq -0xc0(%rbp), %rbx
movq %rbx, %rsi
movq %r15, %rcx
callq 0x1d864
cmpq $0x0, (%rbx,%r15,8)
je 0x214bf
leaq (%r14,%r15,8), %rdi
movq %rdi, %rsi
movq -0x30(%rbp), %rdx
movq %r15, %rcx
callq 0x1bfa0
jmp 0x214c1
xorl %eax, %eax
movq -0x60(%rbp), %rcx
leaq (%r14,%rcx,8), %r14
addq $0x8, %r14
movq %rax, -0x8(%r14)
movq %r14, %rdi
movq -0x90(%rbp), %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x1d864
movq %r15, %r12
shlq $0x5, %r12
movq -0x68(%rbp), %rax
leaq (%rax,%r12), %rdi
movq -0x98(%rbp), %r8
movq -0x50(%rbp), %rax
cmpq %rax, %r8
jle 0x21518
movq -0x88(%rbp), %rsi
movq %r8, %rdx
movq -0x80(%rbp), %rcx
movq %rax, %r8
jmp 0x21526
movq -0x80(%rbp), %rsi
movq %rax, %rdx
movq -0x88(%rbp), %rcx
callq 0x1cd58
movq -0x68(%rbp), %rax
movq (%rax,%r12), %r13
movq -0x60(%rbp), %rcx
leaq (%rax,%rcx,8), %rbx
movq %rbx, %rdi
movq -0x48(%rbp), %r12
movq %r12, %rsi
movq -0x38(%rbp), %rdx
movq %r15, %rcx
callq 0x1d864
movq (%r12,%r15,8), %rax
cmpq $0x3, %rax
je 0x215b3
cmpq $0x2, %rax
je 0x21588
cmpq $0x1, %rax
movq -0x38(%rbp), %rdx
jne 0x215e3
movq (%rdx,%r15,8), %rax
movq %rax, -0x30(%rbp)
leaq (%rbx,%r15,8), %rdi
movq %rdi, %rsi
movq %r15, %rcx
callq 0x1bfa0
movq -0x38(%rbp), %rdx
jmp 0x215da
movq -0x38(%rbp), %r12
movq (%r12,%r15,8), %rax
movq %rax, -0x30(%rbp)
leaq (%rbx,%r15,8), %rdi
movq %rdi, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x2f5c0
movq %r12, %rdx
movq -0x30(%rbp), %rcx
leaq (%rax,%rcx,2), %r12
jmp 0x215e6
movq -0x38(%rbp), %r12
movq (%r12,%r15,8), %rax
leaq (%rax,%rax,2), %rax
movq %rax, -0x30(%rbp)
leaq (%rbx,%r15,8), %rdi
movl $0x3, %ecx
movq %r12, %rsi
movq %r15, %rdx
callq 0x30260
movq %r12, %rdx
movq %rax, %r12
addq -0x30(%rbp), %r12
jmp 0x215e6
xorl %r12d, %r12d
cmpq $0x0, (%rdx,%r15,8)
je 0x21603
leaq (%rbx,%r15,8), %rdi
movq %rdi, %rsi
movq -0x48(%rbp), %rdx
movq %r15, %rcx
callq 0x1bfa0
addq %rax, %r12
movq -0x60(%rbp), %rax
movq %r12, (%rbx,%rax,8)
movq -0x68(%rbp), %rbx
movq %rbx, %rdi
movq -0x58(%rbp), %rsi
movq -0xa0(%rbp), %rdx
movq %r15, %rcx
callq 0x1d864
movq -0x98(%rbp), %r8
addq -0x50(%rbp), %r8
subq $0x8, %rsp
movq %rbx, %rdi
movq %r14, %rsi
movq -0xa8(%rbp), %rdx
movq %r15, %rcx
movl -0x3c(%rbp), %r9d
pushq %r13
callq 0x283e8
addq $0x10, %rsp
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
jne 0x21692
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x3c(%rbp), %ebx
jmp 0x20faa
xorl %r12d, %r12d
jmp 0x20fa3
leaq -0xb0(%rbp), %rdi
callq 0x30170
movq %rax, %rdi
jmp 0x20f12
callq 0x301a3
jmp 0x2165f
nopl (%rax)