// File: /workspace/github_cpp_makefile_star2_O2/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 $0x58, %rsp
movq %rcx, %r10
movq %rsi, %r11
movl 0x90(%rsp), %r12d
movq %rdx, %rax
xorq %r8, %rax
xorq %r9, %rcx
xorl %r15d, %r15d
orq %rax, %rcx
sete %al
decq %rsi
movl %r12d, %ecx
sarq %cl, %rsi
incq %rsi
shlq %cl, %rsi
cmpq %r11, %rsi
jne 0x2a621
movq %rdi, %rbp
movq %rdx, 0x50(%rsp)
movq %r10, 0x10(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
movq %rsp, %rbx
andq $0x0, (%rbx)
movb %al, %r15b
movslq %r12d, %r14
leaq 0x8(,%r14,8), %rsi
movq %rbx, %rdi
movq %r11, 0x30(%rsp)
callq 0x29dc0
movq %rax, %r13
pushq $0x8
popq %rax
movl %r12d, %ecx
shlq %cl, %rax
movq %rbx, %rdi
movq %rax, %rbx
movq %rax, %rsi
callq 0x29dc0
movq 0x30(%rsp), %rsi
xorl %ecx, %ecx
pushq $0x1
popq %r12
cmpq %r14, %rcx
jg 0x2a3ce
movq %r12, %rdx
shlq %cl, %rdx
movq %rax, (%r13,%rcx,8)
leaq (%rax,%rdx,4), %rax
incq %rcx
jmp 0x2a3b5
movq %rbx, 0x28(%rsp)
movq %rbp, 0x38(%rsp)
movq %rsi, %rbx
shlq $0x6, %rbx
movq %r13, %rdi
movl 0x90(%rsp), %ebp
movl %ebp, %esi
callq 0x2a658
movl %ebp, %ecx
sarq %cl, %rbx
leaq -0x1(%rbx), %rax
pushq $0x40
popq %rsi
cqto
idivq %rsi
movq %rax, %rdi
movl %ebp, %eax
testb $0x1, %sil
jne 0x2a417
testl %eax, %eax
jle 0x2a417
shrq %rsi
decl %eax
jmp 0x2a406
movq %r12, %r8
movl 0x90(%rsp), %ecx
shlq %cl, %r8
shlq %cl, %rsi
leaq (%r14,%rbx,2), %rax
addq $0x2, %rax
cqto
idivq %rsi
movq %rax, %rbx
incq %rbx
imulq %rsi, %rbx
pushq $0x40
popq %rcx
movq %rbx, %rax
cqto
idivq %rcx
movq %rax, %r14
testl %r15d, %r15d
movl $0x23a, %eax            # imm = 0x23A
movl $0x28e, %ecx            # imm = 0x28E
cmovneq %rax, %rcx
cmpq %rcx, %r14
jge 0x2a467
movq %rdi, %rbp
jmp 0x2a4a5
movq %r8, 0x8(%rsp)
movq %rdi, %rbp
movq %r14, %rdi
movl %r15d, %esi
callq 0x2a2c8
movq %r12, %rdx
movl %eax, %ecx
shlq %cl, %rdx
leaq -0x1(%rdx), %rax
testq %r14, %rax
je 0x2a4a0
addq %r14, %rax
negq %rdx
andq %rax, %rdx
movq %rdx, %rbx
shlq $0x6, %rbx
movq %rdx, %r14
jmp 0x2a46f
movq 0x8(%rsp), %r8
movq 0x30(%rsp), %rax
cmpq %rax, %r14
jge 0x2a639
incq %rbp
movq %rbp, 0x8(%rsp)
leaq 0x1(%r14), %r12
movq %r12, %rsi
shlq $0x4, %rsi
movq %rsp, %rdi
movq %r8, %rbp
callq 0x29dc0
movq %rax, 0x20(%rsp)
movl 0x90(%rsp), %ecx
sarq %cl, %rbx
shlq %cl, %r12
shlq $0x3, %r12
movq %rsp, %rdi
movq %r12, %rsi
callq 0x29dc0
movq %rax, 0x18(%rsp)
movq %rsp, %rdi
movq 0x28(%rsp), %rsi
callq 0x29dc0
subq $0x8, %rsp
movq 0x20(%rsp), %rdi
movq %rax, 0x20(%rsp)
movq %rax, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq 0x58(%rsp), %r8
movq 0x18(%rsp), %r9
pushq 0x28(%rsp)
pushq %rbx
pushq 0x20(%rsp)
callq 0x2a6bd
addq $0x20, %rsp
testl %r15d, %r15d
je 0x2a57a
decq %rbp
imulq 0x8(%rsp), %rbp
addq %r14, %rbp
leaq 0x8(,%rbp,8), %rsi
movq %rsp, %r12
movq %r12, %rdi
callq 0x29dc0
movq %rax, %rbp
movq %r12, %rdi
movq 0x28(%rsp), %rsi
callq 0x29dc0
movq %rax, %r12
movq 0x38(%rsp), %rdi
movq 0x20(%rsp), %rax
jmp 0x2a5d7
movq %rsp, %rdi
movq %r12, %rsi
callq 0x29dc0
movq %rax, 0x10(%rsp)
movq %rsp, %rdi
movq 0x28(%rsp), %rsi
callq 0x29dc0
movq %rax, %r12
subq $0x8, %rsp
movq 0x18(%rsp), %rdi
movq %rax, %rsi
movq %rbp, %rdx
movq %r14, %rcx
movq 0x48(%rsp), %r8
movq 0x50(%rsp), %r9
movq 0x28(%rsp), %rbp
pushq %rbp
pushq %rbx
pushq 0x20(%rsp)
callq 0x2a6bd
addq $0x20, %rsp
movq 0x38(%rsp), %rdi
movq %rbp, %rax
movq 0x10(%rsp), %rbp
movq 0x30(%rsp), %rsi
movl 0x90(%rsp), %edx
movq 0x18(%rsp), %rcx
movq %r12, %r8
movq %rbp, %r9
pushq %r15
pushq %rax
pushq %r13
pushq %rbx
pushq 0x28(%rsp)
pushq %r14
callq 0x2a9c8
addq $0x30, %rsp
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
jne 0x2a651
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x98e8(%rip), %rdi      # 0x33f10
leaq 0x98eb(%rip), %rdx      # 0x33f1a
movl $0x349, %esi            # imm = 0x349
callq 0x29ce6
leaq 0x98d0(%rip), %rdi      # 0x33f10
leaq 0x98f6(%rip), %rdx      # 0x33f3d
movl $0x36f, %esi            # imm = 0x36F
callq 0x29ce6
callq 0x29df3
jmp 0x2a60f