// File: /workspace/github_cpp_makefile_star2_O1/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 %rdx, %rbp
movq %rsi, %r13
movq %rdi, %rbx
movl %ebp, %r14d
andl $0x3f, %r14d
movq %rdx, %r12
shrq $0x6, %r12
movq %rcx, %r15
subq %r12, %r15
jle 0x31e0b
movq %r13, 0x8(%rsp)
leaq (,%rcx,8), %rsi
addq %r13, %rsi
leaq (,%r12,8), %rax
subq %rax, %rsi
leaq 0x1(%r12), %rdx
testl %r14d, %r14d
movq %rcx, 0x10(%rsp)
je 0x31e6e
movq %rbx, %rdi
movl %r14d, %ecx
callq 0x349a0
leaq (%rbx,%r12,8), %rdi
movq (%rdi), %r13
notq %r13
movq 0x8(%rsp), %rsi
movq %r15, %rdx
movl %r14d, %ecx
callq 0x1c4a0
jmp 0x31e90
subq %rcx, %r12
leaq (,%rcx,8), %rsi
addq %r13, %rsi
leaq (,%r12,8), %rax
subq %rax, %rsi
leaq (%rbx,%r12,8), %rax
movq %rax, 0x8(%rsp)
testl %r14d, %r14d
movq %rcx, %r15
je 0x31f0d
leaq 0x1(%r12), %rdx
movq %rbx, %rdi
movl %r14d, %ecx
callq 0x1c4a0
movq (%rbx,%r12,8), %rbp
movq %r15, %rdx
subq %r12, %rdx
movq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
movl %r14d, %ecx
callq 0x349a0
incq %rax
jmp 0x31f38
movq %rcx, %r13
movq %rbx, %rdi
callq 0x1c300
movq 0x8(%rsp), %rsi
movq (%rsi,%r13,8), %r13
leaq (%rbx,%r12,8), %rdi
movq %r15, %rdx
callq 0x2f4c6
xorl %eax, %eax
cmpq $0x40, %rbp
jae 0x31ea0
movq 0x10(%rsp), %rdi
jmp 0x31f7e
subq $0x1, %rax
movq %rax, %rcx
movq 0x10(%rsp), %rdi
jae 0x31edb
incq (%rbx)
jne 0x31ed9
cmpq $0x2, %rdi
movl $0x1, %ecx
movl $0x1, %eax
cmovgeq %rdi, %rax
movl $0x1, %edx
cmpq %rdx, %rax
je 0x31edb
incq (%rbx,%rdx,8)
leaq 0x1(%rdx), %rdx
je 0x31eca
xorl %ecx, %ecx
movl $0x1, %eax
subq %rcx, (%rbx)
jae 0x31f7e
cmpq $0x2, %r12
movl $0x1, %ecx
cmovgeq %r12, %rax
cmpq %rcx, %rax
je 0x31f79
subq $0x1, (%rbx,%rcx,8)
leaq 0x1(%rcx), %rcx
jb 0x31ef6
movl $0x1, %eax
jmp 0x31f7e
movq %rbx, %rdi
movq %r12, %rdx
callq 0x2f4c6
movq (%r13,%r15,8), %rbp
movq %r15, %rdx
subq %r12, %rdx
movq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x1c300
movl $0x1, %eax
movq $0x0, (%rbx,%r15,8)
addq %rax, (%rbx)
jae 0x31f50
addq $0x1, 0x8(%rbx)
leaq 0x8(%rbx), %rbx
jb 0x31f45
xorl %eax, %eax
incq %rbp
sete %al
leaq (%r12,%rax,8), %rax
cmpq $0x1, %rbp
adcq $0x0, %rbp
addq %rbp, (%rax)
jae 0x31f74
addq $0x1, 0x8(%rax)
leaq 0x8(%rax), %rax
jb 0x31f69
jmp 0x32024
movl $0x2, %eax
leaq (%rbx,%r12,8), %rcx
subq %rax, (%rcx)
jae 0x31fad
cmpq $0x2, %r15
movl $0x1, %esi
movl $0x1, %edx
cmovgeq %r15, %rdx
xorl %eax, %eax
cmpq %rsi, %rdx
je 0x31fb1
subq $0x1, (%rcx,%rsi,8)
leaq 0x1(%rsi), %rsi
jb 0x31f9b
jmp 0x31fb8
xorl %eax, %eax
jmp 0x31fb8
movq $-0x1, %rax
movq %rax, (%rbx,%rdi,8)
subq %r13, (%rcx)
jae 0x31fe2
cmpq $0x2, %r15
movl $0x1, %edx
cmovlq %rdx, %r15
xorl %eax, %eax
cmpq %rdx, %r15
je 0x31fe6
subq $0x1, (%rcx,%rdx,8)
leaq 0x1(%rdx), %rdx
jb 0x31fd0
jmp 0x31fed
xorl %eax, %eax
jmp 0x31fed
movq $-0x1, %rax
addq %rax, (%rbx,%rdi,8)
jns 0x32024
incq (%rbx)
jne 0x3201e
cmpq $0x2, %rdi
movl $0x1, %eax
movl $0x1, %ecx
cmovgeq %rdi, %rcx
movl $0x1, %edx
cmpq %rdx, %rcx
je 0x32020
incq (%rbx,%rdx,8)
leaq 0x1(%rdx), %rdx
je 0x3200f
xorl %eax, %eax
movq %rax, (%rbx,%rdi,8)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq