// File: /workspace/github_c_makefile_star2_O3/diaxen[P]fft-garden/sr_dit_bi_G_L_S_P.c
// Function: fft
void
fft(unsigned N, complex double * restrict out,
    const complex double * restrict in)
{
  unsigned log2_N = 31 - clz32(N);

  /* stage 0 */
  for (unsigned j = 0, is = 0; is < N; is += 2)
    {
      unsigned i0 = sr_input_lut[is / 2];

      if (sr_sched_off[j] * 2 > is)
        {
          out[is    ] = in[i0];
          out[is + 1] = in[i0 + N / 2];
        }
      else
        {
          ct_dit_bf2_0(1, N / 2, out + is, in + i0);
          j++;
        }
    }

  /* stage 1 */
  if (log2_N > 1)
    {
      unsigned c = sr_sched_cnt[1];
      for (unsigned i = 0; i < c; i++)
        {
          unsigned o = sr_sched_off[i] << 2;
          sr_dit_bf4_0(1, out + o);
        }
    }

  /* stage 2 */
  if (log2_N > 2)
    {
      unsigned c = sr_sched_cnt[2];
      for (unsigned i = 0; i < c; i++)
        {
          unsigned o = sr_sched_off[i] << 3;

          sr_dit_bf4_0(2, out + o);
          sr_dit_bf4_pi4(2, out + o + 1);
        }
    }

  /* stage >= 3 */
  if (log2_N > 3)
    for (unsigned k = 3; k < log2_N; k++)
      {
        unsigned t = log2_N - k - 1;
        unsigned n2 = 1 << (k - 1);
        unsigned n4 = 1 << (k - 2);

        unsigned c = sr_sched_cnt[k];
        for (unsigned i = 0; i < c; i++)
          {
            unsigned o = sr_sched_off[i] << (k + 1);

            sr_dit_bf4_0(n2, out + o);
            sr_dit_bf4_pi4(n2, out + o + n4);
          }

        for (unsigned j0 = 1; j0 < n4; j0++)
          {
            complex double w1 = get_twiddle(j0 << t, log2_N);
            complex double w3 = get_twiddle_sr(j0 << t, log2_N);

            unsigned c = sr_sched_cnt[k];
            for (unsigned i = 0; i < c; i++)
              {
                unsigned o = sr_sched_off[i] << (k + 1);

                sr_dit_bf4(n2, out + o + j0, w1, w3);
                sr_dit_bf4(n2, out + o + n2 - j0, conj(w1 * I), -conj(w3 * I));
              }
          }
      }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
bsrl %edi, %eax
movl %eax, 0x4(%rsp)
je 0x1ac4
leaq 0x3667(%rip), %rax      # 0x5098
movq (%rax), %rax
leaq 0x366d(%rip), %rcx      # 0x50a8
movq (%rcx), %rcx
movl %edi, %r15d
shrl %edi
leaq 0x10(%rsi), %r8
xorl %r9d, %r9d
movq %rdi, %r10
shlq $0x4, %r10
xorl %r11d, %r11d
movl (%rax,%r9,2), %ebx
movl %r11d, %r14d
movl (%rcx,%r14,4), %r14d
addl %r14d, %r14d
cmpq %r14, %r9
jae 0x1a8a
movq %rbx, %r14
shlq $0x4, %r14
movups (%rdx,%r14), %xmm0
movups %xmm0, -0x10(%r8)
addl %edi, %ebx
shlq $0x4, %rbx
movupd (%rdx,%rbx), %xmm0
movupd %xmm0, (%r8)
jmp 0x1ab7
shlq $0x4, %rbx
leaq (%rdx,%rbx), %r14
movupd (%rdx,%rbx), %xmm0
movupd (%r10,%r14), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd %xmm2, -0x10(%r8)
subpd %xmm1, %xmm0
movupd %xmm0, (%r8)
incl %r11d
addq $0x2, %r9
addq $0x20, %r8
cmpq %r15, %r9
jb 0x1a54
cmpl $0x1, 0x4(%rsp)
jbe 0x218b
movl 0x4(%rsp), %ecx
xorl $0x1f, %ecx
leaq 0x35c3(%rip), %rax      # 0x50a0
movq (%rax), %rax
movl 0x4(%rax), %edx
testq %rdx, %rdx
je 0x1b78
leaq 0x35b5(%rip), %rdi      # 0x50a8
movq (%rdi), %r9
xorl %edi, %edi
movl (%r9,%rdi,4), %r8d
shll $0x2, %r8d
shlq $0x4, %r8
movupd (%rsi,%r8), %xmm0
movupd 0x10(%rsi,%r8), %xmm1
movupd 0x20(%rsi,%r8), %xmm2
movupd 0x30(%rsi,%r8), %xmm3
movapd %xmm2, %xmm4
addpd %xmm3, %xmm4
movapd %xmm0, %xmm5
addpd %xmm4, %xmm5
movupd %xmm5, (%rsi,%r8)
subpd %xmm3, %xmm2
shufpd $0x1, %xmm2, %xmm2      # xmm2 = xmm2[1,0]
movapd %xmm1, %xmm3
addpd %xmm2, %xmm3
subpd %xmm2, %xmm1
movapd %xmm1, %xmm2
movsd %xmm3, %xmm2            # xmm2 = xmm3[0],xmm2[1]
movupd %xmm2, 0x10(%rsi,%r8)
subpd %xmm4, %xmm0
movupd %xmm0, 0x20(%rsi,%r8)
shufpd $0x2, %xmm3, %xmm1      # xmm1 = xmm1[0],xmm3[1]
movupd %xmm1, 0x30(%rsi,%r8)
incq %rdi
cmpq %rdi, %rdx
jne 0x1af8
cmpl $0x1d, %ecx
je 0x218b
movl 0x8(%rax), %eax
testq %rax, %rax
je 0x1d04
leaq 0x3514(%rip), %rcx      # 0x50a8
movq (%rcx), %rcx
xorl %edx, %edx
movapd 0x16af(%rip), %xmm0     # 0x3250
movapd 0x16b7(%rip), %xmm1     # 0x3260
movl (%rcx,%rdx,4), %edi
shll $0x3, %edi
shlq $0x4, %rdi
movsd 0x28(%rsi,%rdi), %xmm2
movupd 0x40(%rsi,%rdi), %xmm3
movupd 0x60(%rsi,%rdi), %xmm5
movupd (%rsi,%rdi), %xmm6
movapd %xmm3, %xmm4
subpd %xmm5, %xmm4
addpd %xmm5, %xmm3
movapd %xmm6, %xmm5
addpd %xmm3, %xmm5
movapd %xmm2, %xmm7
subsd %xmm4, %xmm7
movupd %xmm5, (%rsi,%rdi)
movsd %xmm7, 0x28(%rsi,%rdi)
subpd %xmm3, %xmm6
addsd %xmm4, %xmm2
movupd %xmm6, 0x40(%rsi,%rdi)
movsd %xmm2, 0x68(%rsi,%rdi)
movsd 0x10(%rsi,%rdi), %xmm6
movsd 0x30(%rsi,%rdi), %xmm2
movsd 0x38(%rsi,%rdi), %xmm3
movupd 0x50(%rsi,%rdi), %xmm8
mulpd %xmm0, %xmm8
movapd %xmm8, %xmm7
unpckhpd %xmm8, %xmm7            # xmm7 = xmm7[1],xmm8[1]
movapd %xmm8, %xmm5
movupd 0x70(%rsi,%rdi), %xmm9
mulpd %xmm1, %xmm9
addsd %xmm7, %xmm5
movapd %xmm9, %xmm10
unpckhpd %xmm9, %xmm10           # xmm10 = xmm10[1],xmm9[1]
movapd %xmm9, %xmm11
subsd %xmm8, %xmm7
addsd %xmm10, %xmm11
movapd %xmm5, %xmm8
addsd %xmm11, %xmm8
subsd %xmm10, %xmm9
subsd %xmm11, %xmm5
movapd %xmm7, %xmm10
subsd %xmm9, %xmm7
addpd %xmm9, %xmm10
movapd %xmm6, %xmm9
addsd %xmm8, %xmm9
movsd %xmm9, 0x10(%rsi,%rdi)
shufpd $0x2, %xmm4, %xmm10     # xmm10 = xmm10[0],xmm4[1]
movupd 0x18(%rsi,%rdi), %xmm4
movapd %xmm4, %xmm9
movapd %xmm2, %xmm11
addpd %xmm10, %xmm9
addsd %xmm7, %xmm11
movapd %xmm3, %xmm12
subsd %xmm5, %xmm12
movupd %xmm9, 0x18(%rsi,%rdi)
movsd %xmm11, 0x30(%rsi,%rdi)
movsd %xmm12, 0x38(%rsi,%rdi)
subsd %xmm8, %xmm6
movsd %xmm6, 0x50(%rsi,%rdi)
subpd %xmm10, %xmm4
subsd %xmm7, %xmm2
addsd %xmm3, %xmm5
movupd %xmm4, 0x58(%rsi,%rdi)
movsd %xmm2, 0x70(%rsi,%rdi)
movsd %xmm5, 0x78(%rsi,%rdi)
incq %rdx
cmpq %rdx, %rax
jne 0x1ba9
cmpl $0x4, 0x4(%rsp)
jb 0x218b
movl 0x4(%rsp), %eax
movq %rax, 0x78(%rsp)
movl $0x3, %r15d
movsd 0x1549(%rip), %xmm11    # 0x3270
movsd 0x1548(%rip), %xmm12    # 0x3278
movq %rsi, 0x20(%rsp)
leal -0x1(%r15), %eax
movl $0x1, %ebp
movl %eax, %ecx
shll %cl, %ebp
leal -0x2(%r15), %ecx
movl $0x1, %r12d
shll %cl, %r12d
leaq 0x334a(%rip), %rcx      # 0x50a0
movq (%rcx), %rcx
movl (%rcx,%r15,4), %edx
movl %ebp, %ecx
movq %rcx, 0x8(%rsp)
testq %rdx, %rdx
je 0x1f0c
leaq 0x3334(%rip), %rcx      # 0x50a8
movq (%rcx), %r14
movl $0x2, %edi
movl %eax, %ecx
shll %cl, %edi
movl $0x3, %r8d
shll %cl, %r8d
movl %r12d, %eax
leal 0x1(%r15), %ecx
movq 0x8(%rsp), %r9
shlq $0x4, %r9
shlq $0x4, %rdi
shlq $0x4, %r8
shlq $0x4, %rax
xorl %r10d, %r10d
movl (%r14,%r10,4), %ebx
shll %cl, %ebx
shlq $0x4, %rbx
leaq (%rsi,%rbx), %r11
movupd (%rsi,%rbx), %xmm0
movupd (%rdi,%r11), %xmm1
movupd (%r8,%r11), %xmm2
movapd %xmm1, %xmm3
addpd %xmm2, %xmm3
movapd %xmm0, %xmm4
addpd %xmm3, %xmm4
movupd %xmm4, (%rsi,%rbx)
movupd (%r9,%r11), %xmm4
subpd %xmm2, %xmm1
shufpd $0x1, %xmm1, %xmm1      # xmm1 = xmm1[1,0]
movapd %xmm4, %xmm2
addpd %xmm1, %xmm2
subpd %xmm1, %xmm4
movapd %xmm4, %xmm1
movsd %xmm2, %xmm1            # xmm1 = xmm2[0],xmm1[1]
movupd %xmm1, (%r9,%r11)
subpd %xmm3, %xmm0
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movupd %xmm0, (%rdi,%r11)
movupd %xmm4, (%r8,%r11)
leaq (%r11,%rax), %rbx
movsd (%rax,%r11), %xmm3
movsd 0x8(%rax,%r11), %xmm0
movsd (%r9,%rbx), %xmm1
movsd 0x8(%r9,%rbx), %xmm2
movsd (%rdi,%rbx), %xmm6
mulsd %xmm11, %xmm6
movsd 0x8(%rdi,%rbx), %xmm4
mulsd %xmm11, %xmm4
movsd 0x8(%r8,%rbx), %xmm7
mulsd %xmm11, %xmm7
movapd %xmm6, %xmm5
addsd %xmm4, %xmm5
movsd (%r8,%rbx), %xmm8
subsd %xmm6, %xmm4
mulsd %xmm12, %xmm8
movapd %xmm8, %xmm6
subsd %xmm7, %xmm8
addsd %xmm7, %xmm6
movapd %xmm5, %xmm7
subsd %xmm6, %xmm5
movapd %xmm4, %xmm9
addsd %xmm6, %xmm7
addsd %xmm8, %xmm9
subsd %xmm8, %xmm4
movapd %xmm3, %xmm6
addsd %xmm7, %xmm6
movapd %xmm0, %xmm8
addsd %xmm9, %xmm8
movapd %xmm1, %xmm10
movsd %xmm6, (%rax,%r11)
addsd %xmm4, %xmm10
movapd %xmm2, %xmm6
subsd %xmm5, %xmm6
movsd %xmm8, 0x8(%rax,%r11)
movsd %xmm10, (%r9,%rbx)
subsd %xmm7, %xmm3
subsd %xmm9, %xmm0
movsd %xmm6, 0x8(%r9,%rbx)
movsd %xmm3, (%rdi,%rbx)
subsd %xmm4, %xmm1
addsd %xmm2, %xmm5
movsd %xmm0, 0x8(%rdi,%rbx)
movsd %xmm1, (%r8,%rbx)
movsd %xmm5, 0x8(%r8,%rbx)
incq %r10
cmpq %r10, %rdx
jne 0x1da8
movl %r15d, %eax
notl %eax
addl 0x4(%rsp), %eax
movl %eax, 0x14(%rsp)
leaq 0x1(%r15), %rax
movq %rax, 0x28(%rsp)
cmpl $0x3, %r12d
movl $0x2, %eax
cmovbl %eax, %r12d
movq %r12, 0x80(%rsp)
movl $0x1, %eax
shlq $0x4, 0x8(%rsp)
movq %r15, 0x88(%rsp)
movq %rax, 0x18(%rsp)
movl 0x14(%rsp), %ecx
shll %cl, %eax
leaq 0x3144(%rip), %rcx      # 0x50a0
movq (%rcx), %rcx
movl (%rcx,%r15,4), %r13d
testq %r13, %r13
je 0x2143
leaq 0x310d(%rip), %rcx      # 0x5080
movq (%rcx), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm1
movsd 0x8(%rcx,%rax), %xmm2
leaq 0x30fc(%rip), %rcx      # 0x5088
movq (%rcx), %rcx
movsd (%rcx,%rax), %xmm3
movsd 0x8(%rcx,%rax), %xmm4
movq 0x18(%rsp), %rbx
movq %rbx, %r14
negq %r14
movapd %xmm1, %xmm5
xorpd %xmm0, %xmm0
mulsd %xmm0, %xmm5
movapd %xmm2, %xmm6
mulsd %xmm0, %xmm6
movsd %xmm2, 0x40(%rsp)
subsd %xmm2, %xmm5
movsd %xmm5, 0x68(%rsp)
movsd %xmm1, 0x48(%rsp)
addsd %xmm1, %xmm6
movsd %xmm6, 0x60(%rsp)
movapd %xmm3, %xmm1
mulsd %xmm0, %xmm1
movapd %xmm4, %xmm2
mulsd %xmm0, %xmm2
movsd %xmm4, 0x30(%rsp)
subsd %xmm4, %xmm1
movsd %xmm1, 0x58(%rsp)
movsd %xmm3, 0x38(%rsp)
addsd %xmm3, %xmm2
movsd %xmm2, 0x50(%rsp)
shlq $0x4, %rbx
shlq $0x4, %r14
addq 0x8(%rsp), %r14
xorl %r15d, %r15d
leaq 0x3088(%rip), %rax      # 0x50a8
movq (%rax), %rax
movl (%rax,%r15,4), %r12d
movq 0x28(%rsp), %rcx
shll %cl, %r12d
shlq $0x4, %r12
addq 0x20(%rsp), %r12
leaq (%r12,%rbx), %rsi
movl %ebp, %edi
movsd 0x48(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movsd 0x38(%rsp), %xmm2
movsd 0x30(%rsp), %xmm3
callq 0x219d
movsd 0x68(%rsp), %xmm4
ucomisd %xmm4, %xmm4
movsd 0x60(%rsp), %xmm1
jp 0x20b1
movsd 0x58(%rsp), %xmm2
ucomisd %xmm2, %xmm2
movsd 0x50(%rsp), %xmm3
jp 0x20e9
addq %r14, %r12
movapd 0xfa6(%rip), %xmm0      # 0x3030
xorpd %xmm0, %xmm1
xorpd %xmm0, %xmm2
movl %ebp, %edi
movq %r12, %rsi
movapd %xmm4, %xmm0
callq 0x219d
incq %r15
cmpq %r15, %r13
jne 0x2019
jmp 0x2143
movsd 0x60(%rsp), %xmm0
ucomisd %xmm0, %xmm0
movsd 0x68(%rsp), %xmm4
movapd %xmm0, %xmm1
jnp 0x206d
xorps %xmm2, %xmm2
movsd 0x48(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
movsd 0x11a2(%rip), %xmm3     # 0x3280
callq 0x2b80
movapd %xmm0, %xmm4
jmp 0x206d
movsd 0x50(%rsp), %xmm3
ucomisd %xmm3, %xmm3
movsd 0x58(%rsp), %xmm2
jnp 0x207f
xorpd %xmm2, %xmm2
movsd 0x38(%rsp), %xmm0
movapd %xmm1, 0x90(%rsp)
movsd 0x30(%rsp), %xmm1
movsd 0x1164(%rip), %xmm3     # 0x3280
movsd %xmm4, 0x70(%rsp)
callq 0x2b80
movsd 0x70(%rsp), %xmm4
movapd %xmm0, %xmm2
movapd %xmm1, %xmm3
movapd 0x90(%rsp), %xmm1
jmp 0x207f
movq 0x18(%rsp), %rax
incq %rax
cmpq 0x80(%rsp), %rax
movq 0x88(%rsp), %r15
jne 0x1f4a
movq 0x28(%rsp), %rax
movq %rax, %r15
cmpq 0x78(%rsp), %rax
movq 0x20(%rsp), %rsi
movsd 0x10f4(%rip), %xmm11    # 0x3270
movsd 0x10f3(%rip), %xmm12    # 0x3278
jne 0x1d35
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq