// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/3rdparty/gmp/mpn/mul_fft.c
// Function: mpn_fft_mul_2exp_modF
static void
mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, mp_bitcnt_t d, mp_size_t n)
{
  unsigned int sh;
  mp_size_t m;
  mp_limb_t cc, rd;

  sh = d % GMP_NUMB_BITS;
  m = d / GMP_NUMB_BITS;

  if (m >= n)			/* negate */
    {
      /* r[0..m-1]  <-- lshift(a[n-m]..a[n-1], sh)
	 r[m..n-1]  <-- -lshift(a[0]..a[n-m-1],  sh) */

      m -= n;
      if (sh != 0)
	{
	  /* no out shift below since a[n] <= 1 */
	  mpn_lshift (r, a + n - m, m + 1, sh);
	  rd = r[m];
	  cc = mpn_lshiftc (r + m, a, n - m, sh);
	}
      else
	{
	  MPN_COPY (r, a + n - m, m);
	  rd = a[n];
	  mpn_com (r + m, a, n - m);
	  cc = 0;
	}

      /* add cc to r[0], and add rd to r[m] */

      /* now add 1 in r[m], subtract 1 in r[n], i.e. add 1 in r[0] */

      r[n] = 0;
      /* cc < 2^sh <= 2^(GMP_NUMB_BITS-1) thus no overflow here */
      cc++;
      mpn_incr_u (r, cc);

      rd++;
      /* rd might overflow when sh=GMP_NUMB_BITS-1 */
      cc = (rd == 0) ? 1 : rd;
      r = r + m + (rd == 0);
      mpn_incr_u (r, cc);
    }
  else
    {
      /* r[0..m-1]  <-- -lshift(a[n-m]..a[n-1], sh)
	 r[m..n-1]  <-- lshift(a[0]..a[n-m-1],  sh)  */
      if (sh != 0)
	{
	  /* no out bits below since a[n] <= 1 */
	  mpn_lshiftc (r, a + n - m, m + 1, sh);
	  rd = ~r[m];
	  /* {r, m+1} = {a+n-m, m+1} << sh */
	  cc = mpn_lshift (r + m, a, n - m, sh); /* {r+m, n-m} = {a, n-m}<<sh */
	}
      else
	{
	  /* r[m] is not used below, but we save a test for m=0 */
	  mpn_com (r, a + n - m, m + 1);
	  rd = a[n];
	  MPN_COPY (r + m, a, n - m);
	  cc = 0;
	}

      /* now complement {r, m}, subtract cc from r[0], subtract rd from r[m] */

      /* if m=0 we just have r[0]=a[n] << sh */
      if (m != 0)
	{
	  /* now add 1 in r[0], subtract 1 in r[m] */
	  if (cc-- == 0) /* then add 1 to r[0] */
	    cc = mpn_add_1 (r, r, n, CNST_LIMB(1));
	  cc = mpn_sub_1 (r, r, m, cc) + 1;
	  /* add 1 to cc instead of rd since rd might overflow */
	}

      /* now subtract cc and rd from r[m..n] */

      r[n] = -mpn_sub_1 (r + m, r + m, n - m, cc);
      r[n] -= mpn_sub_1 (r + m, r + m, n - m, rd);
      if (r[n] & GMP_LIMB_HIGHBIT)
	r[n] = mpn_add_1 (r, r, n, CNST_LIMB(1));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r12
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %rbx
movl %r15d, %ebp
andl $0x3f, %ebp
movq %rdx, %r14
shrq $0x6, %r14
movq %rcx, %rax
subq %r14, %rax
movq %rax, (%rsp)
jle 0x31a53
leaq (,%r12,8), %rsi
addq %r13, %rsi
leaq (,%r14,8), %rax
subq %rax, %rsi
leaq 0x1(%r14), %rdx
movq %rbx, %rdi
testl %ebp, %ebp
je 0x31aa6
movl %ebp, %ecx
callq 0x34520
leaq (%rbx,%r14,8), %rdi
movq (%rdi), %rax
notq %rax
movq %rax, 0x10(%rsp)
movq %r13, %rsi
movq (%rsp), %r13
movq %r13, %rdx
movl %ebp, %ecx
callq 0x1bf80
cmpq $0x40, %r15
jae 0x31b50
movq %r12, %rsi
jmp 0x31bc0
subq %r12, %r14
leaq (,%r12,8), %rsi
addq %r13, %rsi
leaq (,%r14,8), %rax
subq %rax, %rsi
leaq (%rbx,%r14,8), %rax
movq %rax, (%rsp)
testl %ebp, %ebp
je 0x31ae5
leaq 0x1(%r14), %rdx
movq %rbx, %rdi
movl %ebp, %ecx
callq 0x1bf80
movq (%rbx,%r14,8), %r15
movq %r12, %rdx
subq %r14, %rdx
movq (%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
movl %ebp, %ecx
callq 0x34520
incq %rax
jmp 0x31b0f
callq 0x1bde0
movq (%r13,%r12,8), %rax
movq %rax, 0x10(%rsp)
leaq (%rbx,%r14,8), %rbp
movq %r12, 0x8(%rsp)
subq %r14, %r12
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x2f106
cmpq $0x40, %r15
jae 0x31b67
xorl %eax, %eax
movq 0x8(%rsp), %rsi
jmp 0x31bff
movq %rbx, %rdi
movq %r14, %rdx
callq 0x2f106
movq (%r13,%r12,8), %r15
movq %r12, %rdx
subq %r14, %rdx
movq (%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x1bde0
movl $0x1, %eax
movq $0x0, (%rbx,%r12,8)
addq %rax, (%rbx)
jae 0x31b27
addq $0x1, 0x8(%rbx)
leaq 0x8(%rbx), %rbx
jb 0x31b1c
xorl %eax, %eax
incq %r15
sete %al
leaq (%r14,%rax,8), %rax
cmpq $0x1, %r15
adcq $0x0, %r15
addq %r15, (%rax)
jae 0x31b4b
addq $0x1, 0x8(%rax)
leaq 0x8(%rax), %rax
jb 0x31b40
jmp 0x31c75
testq %rax, %rax
movq %r12, %rsi
je 0x31b70
decq %rax
subq %rax, (%rbx)
movl $0x1, %eax
jb 0x31b92
jmp 0x31bc0
movq 0x8(%rsp), %rsi
movq (%rsp), %r13
movl $0x1, %eax
incq (%rbx)
jne 0x31bc0
cmpq %rax, %rsi
je 0x31b8b
incq (%rbx,%rax,8)
leaq 0x1(%rax), %rax
je 0x31b7a
jmp 0x31bb4
movq $-0x1, (%rbx)
cmpq $0x2, %r14
movl $0x1, %ecx
movl $0x1, %eax
cmovgeq %r14, %rax
cmpq %rcx, %rax
je 0x31bbb
subq $0x1, (%rbx,%rcx,8)
leaq 0x1(%rcx), %rcx
jb 0x31ba4
movl $0x1, %eax
jmp 0x31bc0
movl $0x2, %eax
leaq (%rbx,%r14,8), %rbp
subq %rax, (%rbp)
jae 0x31bf1
cmpq $0x2, %r13
movl $0x1, %edx
movl $0x1, %ecx
cmovgeq %r13, %rcx
xorl %eax, %eax
cmpq %rdx, %rcx
je 0x31bf5
subq $0x1, (%rbp,%rdx,8)
leaq 0x1(%rdx), %rdx
jb 0x31bde
jmp 0x31bfc
xorl %eax, %eax
jmp 0x31bfc
movq $-0x1, %rax
movq %r13, %r12
movq %rax, (%rbx,%rsi,8)
movq 0x10(%rsp), %rax
subq %rax, (%rbp)
jae 0x31c33
cmpq $0x2, %r12
movl $0x1, %ecx
cmovlq %rcx, %r12
leaq (%rbx,%r14,8), %rdx
xorl %eax, %eax
cmpq %rcx, %r12
je 0x31c37
subq $0x1, (%rdx,%rcx,8)
leaq 0x1(%rcx), %rcx
jb 0x31c21
jmp 0x31c3e
xorl %eax, %eax
jmp 0x31c3e
movq $-0x1, %rax
addq %rax, (%rbx,%rsi,8)
jns 0x31c75
incq (%rbx)
jne 0x31c6f
cmpq $0x2, %rsi
movl $0x1, %eax
movl $0x1, %ecx
cmovgeq %rsi, %rcx
movl $0x1, %edx
cmpq %rdx, %rcx
je 0x31c71
incq (%rbx,%rdx,8)
leaq 0x1(%rdx), %rdx
je 0x31c60
xorl %eax, %eax
movq %rax, (%rbx,%rsi,8)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq