// File: /workspace/github_c_makefile_star2_O3/diaxen[P]fft-garden/sr_dit_bi_L_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, i = 0; i < N; i += 2)
    {
      unsigned i0 = sr_input_lut[i / 2];

      if (sr_sched_off[j] * 2 > i)
        {
          out[i    ] = in[i0];
          out[i + 1] = in[i0 + N / 2];
        }
      else
        {
          ct_dit_bf2_0(1, N / 2, out + i, 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_pi4(2, out + o + 1);
          sr_dit_bf4_0(2, out + o);
        }
    }

  /* stage >= 3 */
  if (log2_N > 3)
    for (unsigned s = 3; s < log2_N; s++)
      {
        unsigned c = sr_sched_cnt[s];
        for (unsigned i = 0; i < c; i++)
          {
            complex double *o = out + (sr_sched_off[i] << (s + 1));
            unsigned t = log2_N - s - 1;
            unsigned os = 1 << (s - 1);
            unsigned k;

            sr_dit_bf4_0(os, o);
            sr_dit_bf4_pi4(os, o + os / 2);

            for (k = 1; k < os / 2; k++)
              sr_dit_bf4(os, o + k,
                     get_twiddle(k << t, log2_N),
                     get_twiddle_sr(k << t, log2_N));

            for (k++; k < os; k++)
              sr_dit_bf4(os, o + k,
                     get_twiddle(k << t, log2_N),
                     get_twiddle_sr(k << t, log2_N));
          }

      }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
bsrl %edi, %eax
movl %eax, 0x8(%rsp)
je 0x1ac1
leaq 0x366a(%rip), %rax      # 0x5098
movq (%rax), %rax
leaq 0x3670(%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 0x1a87
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 0x1ab4
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 0x1a51
cmpl $0x1, 0x8(%rsp)
jbe 0x203a
movl 0x8(%rsp), %ecx
xorl $0x1f, %ecx
leaq 0x35c6(%rip), %rax      # 0x50a0
movq (%rax), %rax
movl 0x4(%rax), %edx
testq %rdx, %rdx
je 0x1b75
leaq 0x35b8(%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 0x1af5
cmpl $0x1d, %ecx
je 0x203a
movl 0x8(%rax), %eax
testq %rax, %rax
je 0x1d03
leaq 0x3517(%rip), %rcx      # 0x50a8
movq (%rcx), %rcx
xorl %edx, %edx
movapd 0x16b2(%rip), %xmm0     # 0x3250
movapd 0x16ba(%rip), %xmm1     # 0x3260
movl (%rcx,%rdx,4), %edi
shll $0x3, %edi
shlq $0x4, %rdi
movsd 0x10(%rsi,%rdi), %xmm6
movsd 0x30(%rsi,%rdi), %xmm4
movupd 0x50(%rsi,%rdi), %xmm8
movsd 0x38(%rsi,%rdi), %xmm5
mulpd %xmm0, %xmm8
movapd %xmm8, %xmm3
movapd %xmm8, %xmm7
unpckhpd %xmm8, %xmm3            # xmm3 = xmm3[1],xmm8[1]
addsd %xmm3, %xmm7
movupd 0x70(%rsi,%rdi), %xmm2
mulpd %xmm1, %xmm2
subsd %xmm8, %xmm3
movapd %xmm2, %xmm8
unpckhpd %xmm2, %xmm8            # xmm8 = xmm8[1],xmm2[1]
movapd %xmm2, %xmm9
addsd %xmm8, %xmm9
subsd %xmm8, %xmm2
movapd %xmm7, %xmm8
subsd %xmm9, %xmm7
addsd %xmm9, %xmm8
movapd %xmm3, %xmm9
subsd %xmm2, %xmm9
movapd %xmm6, %xmm10
addsd %xmm8, %xmm10
movapd %xmm4, %xmm11
addsd %xmm9, %xmm11
movapd %xmm5, %xmm12
movsd %xmm10, 0x10(%rsi,%rdi)
subsd %xmm7, %xmm12
movsd %xmm11, 0x30(%rsi,%rdi)
subsd %xmm8, %xmm6
movsd %xmm12, 0x38(%rsi,%rdi)
movsd %xmm6, 0x50(%rsi,%rdi)
subsd %xmm9, %xmm4
addsd %xmm5, %xmm7
movsd %xmm4, 0x70(%rsi,%rdi)
movsd %xmm7, 0x78(%rsi,%rdi)
movsd 0x28(%rsi,%rdi), %xmm4
movupd (%rsi,%rdi), %xmm5
movupd 0x40(%rsi,%rdi), %xmm6
movupd 0x60(%rsi,%rdi), %xmm7
movapd %xmm6, %xmm8
addpd %xmm7, %xmm6
subpd %xmm7, %xmm8
addpd %xmm3, %xmm2
movapd %xmm5, %xmm3
addpd %xmm6, %xmm3
shufpd $0x2, %xmm8, %xmm2      # xmm2 = xmm2[0],xmm8[1]
movupd %xmm3, (%rsi,%rdi)
movapd %xmm4, %xmm3
movupd 0x18(%rsi,%rdi), %xmm7
subsd %xmm8, %xmm3
movapd %xmm7, %xmm9
addpd %xmm2, %xmm9
movupd %xmm9, 0x18(%rsi,%rdi)
movsd %xmm3, 0x28(%rsi,%rdi)
subpd %xmm6, %xmm5
addsd %xmm4, %xmm8
subpd %xmm2, %xmm7
movupd %xmm5, 0x40(%rsi,%rdi)
movupd %xmm7, 0x58(%rsi,%rdi)
movsd %xmm8, 0x68(%rsi,%rdi)
incq %rdx
cmpq %rdx, %rax
jne 0x1ba6
cmpl $0x4, 0x8(%rsp)
jb 0x203a
movl 0x8(%rsp), %eax
movq %rax, 0x28(%rsp)
leaq 0x10(%rsi), %rax
movq %rax, 0x10(%rsp)
movl $0x3, %ecx
leaq 0x335c(%rip), %r14      # 0x5088
movq %rsi, 0x38(%rsp)
leaq 0x3368(%rip), %rax      # 0x50a0
movq (%rax), %rax
movl (%rax,%rcx,4), %edx
leaq 0x1(%rcx), %rax
movq %rax, 0x18(%rsp)
movq %rdx, 0x68(%rsp)
testq %rdx, %rdx
je 0x2027
movl %ecx, %ebp
decb %cl
movl $0x1, %r15d
shll %cl, %r15d
movl $0x2, %edx
shll %cl, %edx
movl $0x3, %edi
shll %cl, %edi
notl %ebp
addl 0x8(%rsp), %ebp
movl %r15d, %ecx
shrl %ecx
cmpl $0x3, %ecx
movl %ecx, %r8d
movl $0x2, %eax
cmovbl %eax, %r8d
movl %r8d, %eax
incl %eax
movq %rax, 0x20(%rsp)
movq %r8, 0x48(%rsp)
shlq $0x4, %r8
addq 0x10(%rsp), %r8
movq %r8, 0x30(%rsp)
movq %r15, %rax
shlq $0x4, %rax
movq %rax, 0x40(%rsp)
shlq $0x4, %rdx
movq %rdx, 0x60(%rsp)
shlq $0x4, %rdi
movq %rdi, 0x58(%rsp)
shlq $0x4, %rcx
movq %rcx, 0x50(%rsp)
xorl %ecx, %ecx
movl %ebp, 0xc(%rsp)
leaq 0x32cd(%rip), %rax      # 0x50a8
movq (%rax), %rax
movq %rcx, 0x70(%rsp)
movl (%rax,%rcx,4), %r12d
movq 0x18(%rsp), %rcx
shll %cl, %r12d
shlq $0x4, %r12
leaq (%rsi,%r12), %rax
movupd (%rsi,%r12), %xmm0
movq 0x60(%rsp), %rdx
movupd (%rdx,%rax), %xmm1
movq 0x58(%rsp), %rdi
movupd (%rdi,%rax), %xmm2
movapd %xmm1, %xmm3
addpd %xmm2, %xmm3
movapd %xmm0, %xmm4
addpd %xmm3, %xmm4
movupd %xmm4, (%rsi,%r12)
movq 0x40(%rsp), %r8
movupd (%r8,%rax), %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, (%r8,%rax)
subpd %xmm3, %xmm0
movupd %xmm0, (%rdx,%rax)
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movupd %xmm4, (%rdi,%rax)
movq 0x50(%rsp), %rsi
leaq (%rax,%rsi), %rcx
movsd (%rsi,%rax), %xmm2
movsd 0x8(%rsi,%rax), %xmm3
movsd (%r8,%rcx), %xmm0
movsd 0x8(%r8,%rcx), %xmm1
movsd (%rdx,%rcx), %xmm6
movsd 0x13da(%rip), %xmm5     # 0x3270
mulsd %xmm5, %xmm6
movsd 0x8(%rdx,%rcx), %xmm4
mulsd %xmm5, %xmm4
movsd 0x8(%rdi,%rcx), %xmm7
mulsd %xmm5, %xmm7
movapd %xmm6, %xmm5
addsd %xmm4, %xmm5
subsd %xmm6, %xmm4
movsd (%rdi,%rcx), %xmm6
mulsd 0x13b1(%rip), %xmm6     # 0x3278
movapd %xmm6, %xmm8
addsd %xmm7, %xmm8
subsd %xmm7, %xmm6
movapd %xmm5, %xmm7
addsd %xmm8, %xmm7
subsd %xmm8, %xmm5
movapd %xmm4, %xmm8
addsd %xmm6, %xmm8
subsd %xmm6, %xmm4
movapd %xmm2, %xmm6
addsd %xmm7, %xmm6
movapd %xmm3, %xmm9
addsd %xmm8, %xmm9
movsd %xmm6, (%rsi,%rax)
movsd %xmm9, 0x8(%rsi,%rax)
movapd %xmm0, %xmm6
addsd %xmm4, %xmm6
movapd %xmm1, %xmm9
subsd %xmm5, %xmm9
movsd %xmm6, (%r8,%rcx)
movsd %xmm9, 0x8(%r8,%rcx)
subsd %xmm7, %xmm2
subsd %xmm8, %xmm3
movsd %xmm2, (%rdx,%rcx)
movsd %xmm3, 0x8(%rdx,%rcx)
subsd %xmm4, %xmm0
addsd %xmm1, %xmm5
movsd %xmm0, (%rdi,%rcx)
movsd %xmm5, 0x8(%rdi,%rcx)
movq 0x10(%rsp), %rax
movq %r14, %rbp
leaq (%rax,%r12), %r13
movl $0x1, %ebx
movq 0x48(%rsp), %r14
movl %ebx, %eax
movl 0xc(%rsp), %ecx
shll %cl, %eax
leaq 0x3106(%rip), %rcx      # 0x5080
movq (%rcx), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd 0x8(%rcx,%rax), %xmm1
movq (%rbp), %rcx
movsd (%rcx,%rax), %xmm2
movsd 0x8(%rcx,%rax), %xmm3
movl %r15d, %edi
movq %r13, %rsi
callq 0x2049
incq %rbx
addq $0x10, %r13
cmpq %rbx, %r14
jne 0x1f6b
cmpl %r15d, 0x20(%rsp)
leaq 0x30c2(%rip), %r13      # 0x5080
movq %rbp, %r14
movl 0xc(%rsp), %ebp
jae 0x200f
addq 0x30(%rsp), %r12
movq 0x20(%rsp), %rbx
movl %ebx, %eax
movl %ebp, %ecx
shll %cl, %eax
movq (%r13), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd 0x8(%rcx,%rax), %xmm1
movq (%r14), %rcx
movsd (%rcx,%rax), %xmm2
movsd 0x8(%rcx,%rax), %xmm3
movl %r15d, %edi
movq %r12, %rsi
callq 0x2049
incq %rbx
addq $0x10, %r12
cmpq %rbx, %r15
jne 0x1fd1
movq 0x70(%rsp), %rcx
incq %rcx
cmpq 0x68(%rsp), %rcx
movq 0x38(%rsp), %rsi
jne 0x1dd4
movq 0x18(%rsp), %rax
movq %rax, %rcx
cmpq 0x28(%rsp), %rax
jne 0x1d31
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq