// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/3rdparty/gmp/mpn/mul_fft.c
// Function: _gmpn_mul_fft
mp_limb_t
mpn_mul_fft (mp_ptr op, mp_size_t pl,
	     mp_srcptr n, mp_size_t nl,
	     mp_srcptr m, mp_size_t ml,
	     int k)
{
  int i;
  mp_size_t K, maxLK;
  mp_size_t N, Nprime, nprime, M, Mp, l;
  mp_ptr *Ap, *Bp, A, T, B;
  int **fft_l, *tmp;
  int sqr = (n == m && nl == ml);
  mp_limb_t h;
  TMP_DECL;

  TRACE (printf ("\nmpn_mul_fft pl=%ld nl=%ld ml=%ld k=%d\n", pl, nl, ml, k));
  ASSERT_ALWAYS (mpn_fft_next_size (pl, k) == pl);

  TMP_MARK;
  N = pl * GMP_NUMB_BITS;
  fft_l = TMP_BALLOC_TYPE (k + 1, int *);
  tmp = TMP_BALLOC_TYPE ((size_t) 2 << k, int);
  for (i = 0; i <= k; i++)
    {
      fft_l[i] = tmp;
      tmp += (mp_size_t) 1 << i;
    }

  mpn_fft_initl (fft_l, k);
  K = (mp_size_t) 1 << k;
  M = N >> k;	/* N = 2^k M */
  l = 1 + (M - 1) / GMP_NUMB_BITS;
  maxLK = mpn_mul_fft_lcm (GMP_NUMB_BITS, k); /* lcm (GMP_NUMB_BITS, 2^k) */

  Nprime = (1 + (2 * M + k + 2) / maxLK) * maxLK;
  /* Nprime = ceil((2*M+k+3)/maxLK)*maxLK; */
  nprime = Nprime / GMP_NUMB_BITS;
  TRACE (printf ("N=%ld K=%ld, M=%ld, l=%ld, maxLK=%ld, Np=%ld, np=%ld\n",
		 N, K, M, l, maxLK, Nprime, nprime));
  /* we should ensure that recursively, nprime is a multiple of the next K */
  if (nprime >= (sqr ? SQR_FFT_MODF_THRESHOLD : MUL_FFT_MODF_THRESHOLD))
    {
      mp_size_t K2;
      for (;;)
	{
	  K2 = (mp_size_t) 1 << mpn_fft_best_k (nprime, sqr);
	  if ((nprime & (K2 - 1)) == 0)
	    break;
	  nprime = (nprime + K2 - 1) & -K2;
	  Nprime = nprime * GMP_LIMB_BITS;
	  /* warning: since nprime changed, K2 may change too! */
	}
      TRACE (printf ("new maxLK=%ld, Np=%ld, np=%ld\n", maxLK, Nprime, nprime));
    }
  ASSERT_ALWAYS (nprime < pl); /* otherwise we'll loop */

  T = TMP_BALLOC_LIMBS (2 * (nprime + 1));
  Mp = Nprime >> k;

  TRACE (printf ("%ldx%ld limbs -> %ld times %ldx%ld limbs (%1.2f)\n",
		pl, pl, K, nprime, nprime, 2.0 * (double) N / Nprime / K);
	 printf ("   temp space %ld\n", 2 * K * (nprime + 1)));

  A = TMP_BALLOC_LIMBS (K * (nprime + 1));
  Ap = TMP_BALLOC_MP_PTRS (K);
  mpn_mul_fft_decompose (A, Ap, K, nprime, n, nl, l, Mp, T);
  if (sqr)
    {
      mp_size_t pla;
      pla = l * (K - 1) + nprime + 1; /* number of required limbs for p */
      B = TMP_BALLOC_LIMBS (pla);
      Bp = TMP_BALLOC_MP_PTRS (K);
    }
  else
    {
      B = TMP_BALLOC_LIMBS (K * (nprime + 1));
      Bp = TMP_BALLOC_MP_PTRS (K);
      mpn_mul_fft_decompose (B, Bp, K, nprime, m, ml, l, Mp, T);
    }
  h = mpn_mul_fft_internal (op, pl, k, Ap, Bp, A, B, nprime, l, Mp, fft_l, T, sqr);

  TMP_FREE;
  return h;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, %r10
movl 0xa0(%rsp), %r13d
movq %rdx, %rax
xorq %r8, %rax
xorq %r9, %rcx
orq %rax, %rcx
sete %bpl
leaq -0x1(%rsi), %rax
movl %r13d, %ecx
sarq %cl, %rax
incq %rax
shlq %cl, %rax
cmpq %rsi, %rax
jne 0x30691
movq %rdx, 0x58(%rsp)
movq %r10, 0x18(%rsp)
movq %r8, 0x38(%rsp)
movq %r9, 0x40(%rsp)
movq %rdi, 0x60(%rsp)
leaq 0x8(%rsp), %rbx
movq $0x0, (%rbx)
movq %rsi, 0x30(%rsp)
movq %rsi, %r14
shlq $0x6, %r14
leal 0x1(%r13), %r15d
movslq %r15d, %rsi
shlq $0x3, %rsi
movq %rbx, %rdi
callq 0x2fdb0
movq %rax, %r12
movl $0x8, %eax
movl %r13d, %ecx
shlq %cl, %rax
movq %rbx, %rdi
movq %rax, %rbx
movq %rax, %rsi
callq 0x2fdb0
testl %r13d, %r13d
js 0x303f5
movl %r15d, %edx
xorl %ecx, %ecx
movl $0x1, %esi
shlq %cl, %rsi
movq %rax, (%r12,%rcx,8)
leaq (%rax,%rsi,4), %rax
incq %rcx
cmpq %rcx, %rdx
jne 0x303dd
xorl %r15d, %r15d
movb %bpl, %r15b
movq %r12, %rdi
movl %r13d, %esi
callq 0x306a2
movl $0x1, %eax
movl %r13d, %ecx
shlq %cl, %rax
movq %rax, 0x50(%rsp)
sarq %cl, %r14
leaq -0x1(%r14), %rax
leaq 0x3e(%r14), %r9
testq %rax, %rax
cmovnsq %rax, %r9
movl $0x40, %esi
testl %r13d, %r13d
jle 0x3044a
movl %r13d, %eax
movq %rsi, %rcx
shrq %rsi
testb $0x2, %cl
jne 0x3044a
leal -0x1(%rax), %ecx
cmpl $0x1, %eax
movl %ecx, %eax
ja 0x30435
movq %rbx, 0x20(%rsp)
movl %r13d, %ecx
shlq %cl, %rsi
movslq %r13d, %rax
leaq (%rax,%r14,2), %rax
addq $0x2, %rax
cqto
idivq %rsi
movq %rax, %r13
incq %r13
imulq %rsi, %r13
leaq 0x3f(%r13), %rbx
testq %r13, %r13
cmovnsq %r13, %rbx
sarq $0x6, %rbx
testl %r15d, %r15d
movl $0x23a, %eax            # imm = 0x23A
movl $0x28e, %ecx            # imm = 0x28E
cmovneq %rax, %rcx
cmpq %rcx, %rbx
jge 0x3057e
cmpq 0x30(%rsp), %rbx
jge 0x30696
sarq $0x6, %r9
incq %r9
movq %r9, 0x10(%rsp)
leaq 0x1(%rbx), %rbp
movq %rbp, %rsi
shlq $0x4, %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x2fdb0
movq %rax, 0x28(%rsp)
movl 0xa0(%rsp), %ecx
sarq %cl, %r13
shlq %cl, %rbp
shlq $0x3, %rbp
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2fdb0
movq %r15, %r14
movq %rax, %r15
leaq 0x8(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x2fdb0
subq $0x8, %rsp
movq %r15, %rdi
movq %r14, %r15
movq %rax, 0x50(%rsp)
movq %rax, %rsi
movq 0x58(%rsp), %r14
movq %r14, %rdx
movq %rbx, %rcx
movq 0x60(%rsp), %r8
movq 0x20(%rsp), %r9
pushq 0x30(%rsp)
pushq %r13
pushq 0x28(%rsp)
callq 0x30703
addq $0x20, %rsp
movq %r15, 0x18(%rsp)
testl %r15d, %r15d
je 0x305e9
decq %r14
imulq 0x10(%rsp), %r14
addq %rbx, %r14
leaq 0x8(,%r14,8), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x2fdb0
movq %rax, %rbp
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0x2fdb0
movq %rax, %r14
jmp 0x3063c
movl %r15d, %eax
imulq $0x358, %rax, %rax      # imm = 0x358
leaq 0x99f1(%rip), %rcx      # 0x39f80
addq %rcx, %rax
addq $0x4, %rax
movl -0x4(%rax), %edx
movq %rax, %rsi
movl %edx, %edi
movl %edi, %ecx
shrl $0x1b, %ecx
movl (%rsi), %edi
movl %edi, %r8d
andl $0x7ffffff, %r8d        # imm = 0x7FFFFFF
shlq %cl, %r8
addq $0x4, %rsi
cmpq %rbx, %r8
jl 0x3059e
movl $0x1, %esi
shlq %cl, %rsi
leaq -0x1(%rsi), %rcx
testq %rbx, %rcx
je 0x30498
leaq (%rbx,%rsi), %rcx
decq %rcx
negq %rsi
andq %rcx, %rsi
movq %rsi, %r13
shlq $0x6, %r13
movq %rsi, %rbx
jmp 0x30599
movq %r14, %r15
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2fdb0
movq %rax, %rbp
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0x2fdb0
movq %rax, %r14
subq $0x8, %rsp
movq %rbp, %rdi
movq %rax, %rsi
movq %r15, %rdx
movq %rbx, %rcx
movq 0x40(%rsp), %r8
movq 0x48(%rsp), %r9
pushq 0x30(%rsp)
pushq %r13
pushq 0x28(%rsp)
callq 0x30703
addq $0x20, %rsp
movq 0x60(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl 0xa0(%rsp), %edx
movq 0x48(%rsp), %rcx
movq %r14, %r8
movq %rbp, %r9
pushq 0x18(%rsp)
pushq 0x30(%rsp)
pushq %r12
pushq %r13
pushq 0x30(%rsp)
pushq %rbx
callq 0x30b3a
addq $0x30, %rsp
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
jne 0x3069b
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x74fd
callq 0x7516
callq 0x2fde3
jmp 0x3067f