// File: /workspace/github_cpp_makefile_star2_O1/marxn[P]pupp/3rdparty/gmp/mpn/toom22_mul.c
// Function: _gmpn_toom22_mul
void
mpn_toom22_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, cy2;
  mp_ptr asm1;
  mp_ptr bsm1;

#define a0  ap
#define a1  (ap + n)
#define b0  bp
#define b1  (bp + n)

  s = an >> 1;
  n = an - s;
  t = bn - n;

  ASSERT (an >= bn);

  ASSERT (0 < s && s <= n && s >= n - 1);
  ASSERT (0 < t && t <= s);

  asm1 = pp;
  bsm1 = pp + n;

  vm1_neg = 0;

  /* Compute asm1.  */
  if (s == n)
    {
      if (mpn_cmp (a0, a1, n) < 0)
	{
	  mpn_sub_n (asm1, a1, a0, n);
	  vm1_neg = 1;
	}
      else
	{
	  mpn_sub_n (asm1, a0, a1, n);
	}
    }
  else /* n - s == 1 */
    {
      if (a0[s] == 0 && mpn_cmp (a0, a1, s) < 0)
	{
	  mpn_sub_n (asm1, a1, a0, s);
	  asm1[s] = 0;
	  vm1_neg = 1;
	}
      else
	{
	  asm1[s] = a0[s] - mpn_sub_n (asm1, a0, a1, s);
	}
    }

  /* Compute bsm1.  */
  if (t == 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);
	}
    }
  else
    {
      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);
	}
    }

#define v0	pp				/* 2n */
#define vinf	(pp + 2 * n)			/* s+t */
#define vm1	scratch				/* 2n */
#define scratch_out	scratch + 2 * n

  /* vm1, 2n limbs */
  TOOM22_MUL_N_REC (vm1, asm1, bsm1, n, scratch_out);

  if (s > t)  TOOM22_MUL_REC (vinf, a1, s, b1, t, scratch_out);
  else        TOOM22_MUL_N_REC (vinf, a1, b1, s, scratch_out);

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

  /* H(v0) + L(vinf) */
  cy = mpn_add_n (pp + 2 * n, v0 + n, vinf, n);

  /* L(v0) + H(v0) */
  cy2 = cy + mpn_add_n (pp + n, pp + 2 * n, v0, n);

  /* L(vinf) + H(vinf) */
  cy += mpn_add (pp + 2 * n, pp + 2 * n, n, vinf + n, s + t - n);

  if (vm1_neg)
    cy += mpn_add_n (pp + n, pp + n, vm1, 2 * n);
  else
    cy -= mpn_sub_n (pp + n, pp + n, vm1, 2 * n);

  ASSERT (cy + 1  <= 3);
  ASSERT (cy2 <= 2);

  MPN_INCR_U (pp + 2 * n, s + t, cy2);
  if (LIKELY (cy <= 2))
    /* if s+t==n, cy is zero, but we should not acces pp[3*n] at all. */
    MPN_INCR_U (pp + 3 * n, s + t - n, cy);
  else
    MPN_DECR_U (pp + 3 * n, s + t - n, 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %rbx
movq %rcx, %r15
movq %rdx, %rbp
movq %rsi, %r9
movq %rdx, %rcx
sarq %rcx
movq %rdx, %r14
subq %rcx, %r14
movq %r8, 0x28(%rsp)
subq %r14, %r8
movq %r8, 0x38(%rsp)
movq %rcx, %r12
leaq (%rsi,%r14,8), %rdx
subq %r14, %r12
movq %rdi, 0x8(%rsp)
movq %rbx, 0x30(%rsp)
movq %rcx, 0x18(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x20(%rsp)
jne 0x209b8
movq %rdi, %r13
movq %rbp, %rax
shlq $0x4, %rax
shlq $0x4, %rcx
subq %rcx, %rax
addq %r9, %rax
addq $-0x8, %rax
movq %r14, %rcx
testq %rcx, %rcx
jle 0x2099b
leaq -0x1(%rcx), %rdi
movq (%rax), %rsi
addq $-0x8, %rax
cmpq %rsi, -0x8(%r9,%rcx,8)
movq %rdi, %rcx
je 0x2097b
jbe 0x20c08
movq %r13, %rdi
movq %r9, %rsi
movq %r14, %rcx
callq 0x1c1c0
movq 0x18(%rsp), %rsi
movl $0x0, 0x4(%rsp)
jmp 0x209ef
movq (%r9,%rcx,8), %rbx
testq %rbx, %rbx
je 0x20b0f
movq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r9, %rsi
callq 0x1c1c0
movq 0x18(%rsp), %rsi
subq %rax, %rbx
movq %rbx, (%r13,%rsi,8)
movl $0x0, 0x4(%rsp)
movq 0x30(%rsp), %rbx
leaq (,%r14,8), %rdi
addq %r13, %rdi
movq %r14, %r13
subq 0x38(%rsp), %r13
movq %rdi, 0x10(%rsp)
jne 0x20a60
leaq (%r15,%r14,8), %rdx
shlq $0x4, %rbp
movq %rsi, %rax
shlq $0x4, %rax
subq %rax, %rbp
leaq (%r15,%rbp), %rax
addq $-0x8, %rax
movq %r14, %rcx
movq 0x8(%rsp), %r13
movq 0x38(%rsp), %rbp
testq %rcx, %rcx
jle 0x20a50
leaq -0x1(%rcx), %rsi
movq (%rax), %r8
addq $-0x8, %rax
cmpq %r8, -0x8(%r15,%rcx,8)
movq %rsi, %rcx
je 0x20a30
jbe 0x20c2b
movq %r15, %rsi
movq %r14, %rcx
callq 0x1c1c0
jmp 0x20c3e
movq 0x28(%rsp), %rax
leaq (%rax,%rsi,2), %rax
subq %rbp, %rax
subq %rbp, %rax
shlq $0x3, %rbp
leaq (,%rsi,8), %rcx
subq %rcx, %rbp
addq %r15, %rbp
movq $-0x1, %rcx
movq (%rbp,%rcx,8), %rdx
testq %rdx, %rdx
jne 0x20a9e
leaq -0x1(%rcx), %rsi
cmpq %rcx, %rax
movq %rsi, %rcx
jne 0x20a88
testq %rdx, %rdx
movq 0x38(%rsp), %rbp
je 0x20b6c
testq %rbp, %rbp
je 0x20bdc
leaq (%r15,%r14,8), %rdx
movq %r15, %rsi
movq %rbp, %rcx
callq 0x1c1c0
movq 0x10(%rsp), %rdi
movq %rbp, %rcx
testq %rax, %rax
movq 0x8(%rsp), %r13
je 0x20be3
movq 0x28(%rsp), %rax
leaq (,%rax,8), %rax
addq %r13, %rax
movq %rbp, %rcx
cmpq %r14, %rcx
jge 0x20c3e
movq (%r15,%rcx,8), %rdx
incq %rcx
subq $0x1, %rdx
movq %rdx, (%rax)
leaq 0x8(%rax), %rax
jb 0x20aed
jmp 0x20be3
leaq (%r9,%rbp,8), %rax
addq $-0x8, %rax
movq %rcx, %rdi
testq %rdi, %rdi
jle 0x209c5
leaq -0x1(%rdi), %r8
movq (%rax), %rsi
addq $-0x8, %rax
cmpq %rsi, -0x8(%r9,%rdi,8)
movq %r8, %rdi
je 0x20b1a
ja 0x209c5
movq 0x8(%rsp), %r13
movq %r13, %rdi
movq %rdx, %rsi
movq %r9, %rdx
callq 0x1c1c0
movq 0x18(%rsp), %rsi
movq $0x0, (%r13,%rsi,8)
movl $0x1, 0x4(%rsp)
jmp 0x209ea
leaq (%r15,%r14,8), %rsi
movq 0x28(%rsp), %rax
leaq (%r15,%rax,8), %rax
addq $-0x8, %rax
movq %rbp, %rcx
testq %rcx, %rcx
jle 0x20aac
leaq -0x1(%rcx), %rdx
movq (%rax), %r8
addq $-0x8, %rax
cmpq %r8, -0x8(%r15,%rcx,8)
movq %rdx, %rcx
je 0x20b80
ja 0x20aac
movq %r15, %rdx
movq %rbp, %rcx
callq 0x1c1c0
testq %r13, %r13
je 0x20bd0
movq 0x8(%rsp), %rax
movq 0x28(%rsp), %rcx
leaq (%rax,%rcx,8), %rdi
shlq $0x3, %r13
xorl %esi, %esi
movq %r13, %rdx
callq 0x6170
xorl $0x1, 0x4(%rsp)
movq 0x8(%rsp), %r13
jmp 0x20c3e
xorl %ecx, %ecx
movq 0x8(%rsp), %r13
cmpq %r15, %rdi
setne %al
cmpq %r14, %rcx
setl %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x20c3e
movq (%r15,%rcx,8), %rax
movq %rax, (%rdi,%rcx,8)
incq %rcx
cmpq %rcx, %r14
jne 0x20bf6
jmp 0x20c3e
movq %r13, %rdi
movq %rdx, %rsi
movq %r9, %rdx
movq %r14, %rcx
callq 0x1c1c0
movq 0x18(%rsp), %rsi
movl $0x1, 0x4(%rsp)
jmp 0x209ef
movq %rdx, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x1c1c0
xorl $0x1, 0x4(%rsp)
cmpq $0x1b, %r14
jle 0x20c66
movq %r14, %r9
shlq $0x4, %r9
addq %rbx, %r9
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq 0x10(%rsp), %rcx
movq %r14, %r8
callq 0x20908
jmp 0x20c7c
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq 0x10(%rsp), %rcx
movq %r14, %r8
callq 0x1dbb0
movq 0x18(%rsp), %r8
cmpq %rbp, %r8
jle 0x20cc7
cmpq $0x1b, %rbp
jle 0x20cee
leaq (,%r8,4), %rax
leaq (,%rbp,4), %rdx
addq %rbp, %rdx
movq %r14, %r9
shlq $0x4, %r9
leaq (%r9,%r13), %rdi
addq %rbx, %r9
leaq (%r15,%r14,8), %rcx
cmpq %rdx, %rax
jge 0x20e64
movq 0x20(%rsp), %rsi
movq %r8, %rdx
movq %rbp, %r8
jmp 0x20ce7
leaq (%r15,%r14,8), %rcx
cmpq $0x1b, %r8
jle 0x20d09
movq %r14, %r9
shlq $0x4, %r9
leaq (%r9,%r13), %rdi
addq %rbx, %r9
movq 0x20(%rsp), %rsi
movq %r8, %rdx
callq 0x20908
jmp 0x20d20
movq %r14, %rdi
shlq $0x4, %rdi
addq %r13, %rdi
leaq (%r15,%r14,8), %rcx
movq 0x20(%rsp), %rsi
movq %r8, %rdx
movq %rbp, %r8
jmp 0x20d1b
movq %r14, %rdi
shlq $0x4, %rdi
addq %r13, %rdi
movq 0x20(%rsp), %rsi
movq %r8, %rdx
callq 0x1dbb0
cmpq $0x1b, %r14
jle 0x20d48
movq %r14, %r9
shlq $0x4, %r9
addq %rbx, %r9
movq %r13, %rdi
movq 0x40(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %r14, %r8
callq 0x20908
jmp 0x20d5e
movq %r13, %rdi
movq 0x40(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %r14, %r8
callq 0x1dbb0
movq %r14, %rbx
shlq $0x4, %rbx
addq %r13, %rbx
movq %rbx, %rdi
movq 0x10(%rsp), %r15
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x1bfa0
movq %r13, %rdx
movq %rax, %r13
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rcx
callq 0x1bfa0
movq %rax, %r15
addq %rbp, %r12
je 0x20dde
leaq (%rbx,%r14,8), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
movq %r12, %rcx
callq 0x1bfa0
testq %rax, %rax
je 0x20dde
movq 0x18(%rsp), %rcx
addq 0x28(%rsp), %rcx
movq 0x8(%rsp), %rax
leaq (%rax,%rcx,8), %rax
xorl %ebp, %ebp
movq 0x10(%rsp), %rdi
cmpq %r14, %r12
jge 0x20de7
incq %r12
incq (%rax)
leaq 0x8(%rax), %rax
je 0x20dcb
jmp 0x20dec
xorl %ebp, %ebp
movq 0x10(%rsp), %rdi
jmp 0x20dec
movl $0x1, %ebp
leaq (%r14,%r14), %rcx
addq %r13, %r15
addq %r13, %rbp
cmpl $0x0, 0x4(%rsp)
je 0x20e0f
movq %rdi, %rsi
movq 0x30(%rsp), %rdx
callq 0x1bfa0
addq %rbp, %rax
jmp 0x20e22
movq %rdi, %rsi
movq 0x30(%rsp), %rdx
callq 0x1c1c0
subq %rax, %rbp
movq %rbp, %rax
movq 0x8(%rsp), %rdx
addq %r15, (%rbx)
jae 0x20e37
addq $0x1, 0x8(%rbx)
leaq 0x8(%rbx), %rbx
jb 0x20e2c
leaq (%r14,%r14,2), %rcx
leaq (%rdx,%rcx,8), %rcx
cmpq $0x2, %rax
ja 0x20e79
addq %rax, (%rcx)
jae 0x20e55
addq $0x1, 0x8(%rcx)
leaq 0x8(%rcx), %rcx
jb 0x20e4a
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rsp), %rsi
movq %r8, %rdx
movq %rbp, %r8
callq 0x66c6
jmp 0x20d20
subq $0x1, (%rcx)
leaq 0x8(%rcx), %rcx
jb 0x20e79
jmp 0x20e55
nopl (%rax)