// File: /workspace/github_c_makefile_star2_O3/diaxen[P]fft-garden/sr_dit_bi_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, 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++)
              {
                complex double w1 = get_twiddle(k << t, log2_N);
                complex double w3 = get_twiddle_sr(k << t, log2_N);
                sr_dit_bf4(os, o + k, w1, w3);
                sr_dit_bf4(os, o + os - k, conj(w1 * I), -conj(w3 * I));
              }
          }

      }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
bsrl %edi, %eax
movl %eax, 0x4(%rsp)
je 0x19a0
leaq 0x378b(%rip), %rax      # 0x5098
movq (%rax), %rax
leaq 0x3791(%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 0x1966
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 0x1993
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 0x1930
movq %rsi, 0x8(%rsp)
cmpl $0x1, 0x4(%rsp)
jbe 0x20c0
movl 0x4(%rsp), %eax
xorl $0x1f, %eax
leaq 0x36e2(%rip), %rcx      # 0x50a0
movq (%rcx), %rcx
movl 0x4(%rcx), %edx
testq %rdx, %rdx
movq 0x8(%rsp), %r9
je 0x1a5e
leaq 0x36cf(%rip), %rsi      # 0x50a8
movq (%rsi), %rsi
xorl %edi, %edi
movl (%rsi,%rdi,4), %r8d
shll $0x2, %r8d
shlq $0x4, %r8
movupd (%r9,%r8), %xmm0
movupd 0x10(%r9,%r8), %xmm1
movupd 0x20(%r9,%r8), %xmm2
movupd 0x30(%r9,%r8), %xmm3
movapd %xmm2, %xmm4
addpd %xmm3, %xmm4
movapd %xmm0, %xmm5
addpd %xmm4, %xmm5
movupd %xmm5, (%r9,%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(%r9,%r8)
subpd %xmm4, %xmm0
movupd %xmm0, 0x20(%r9,%r8)
shufpd $0x2, %xmm3, %xmm1      # xmm1 = xmm1[0],xmm3[1]
movupd %xmm1, 0x30(%r9,%r8)
incq %rdi
cmpq %rdi, %rdx
jne 0x19de
cmpl $0x1d, %eax
je 0x20c0
movl 0x8(%rcx), %ecx
testq %rcx, %rcx
movq 0x8(%rsp), %r8
je 0x1c01
leaq 0x3629(%rip), %rdx      # 0x50a8
movq (%rdx), %rdx
xorl %esi, %esi
movapd 0x1794(%rip), %xmm0     # 0x3220
movapd 0x179c(%rip), %xmm1     # 0x3230
movl (%rdx,%rsi,4), %edi
shll $0x3, %edi
shlq $0x4, %rdi
movsd 0x10(%r8,%rdi), %xmm6
movsd 0x30(%r8,%rdi), %xmm4
movupd 0x50(%r8,%rdi), %xmm8
movsd 0x38(%r8,%rdi), %xmm5
mulpd %xmm0, %xmm8
movapd %xmm8, %xmm3
movapd %xmm8, %xmm7
unpckhpd %xmm8, %xmm3            # xmm3 = xmm3[1],xmm8[1]
addsd %xmm3, %xmm7
movupd 0x70(%r8,%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(%r8,%rdi)
subsd %xmm7, %xmm12
movsd %xmm11, 0x30(%r8,%rdi)
subsd %xmm8, %xmm6
movsd %xmm12, 0x38(%r8,%rdi)
movsd %xmm6, 0x50(%r8,%rdi)
subsd %xmm9, %xmm4
addsd %xmm5, %xmm7
movsd %xmm4, 0x70(%r8,%rdi)
movsd %xmm7, 0x78(%r8,%rdi)
movsd 0x28(%r8,%rdi), %xmm4
movupd (%r8,%rdi), %xmm5
movupd 0x40(%r8,%rdi), %xmm6
movupd 0x60(%r8,%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, (%r8,%rdi)
movapd %xmm4, %xmm3
movupd 0x18(%r8,%rdi), %xmm7
subsd %xmm8, %xmm3
movapd %xmm7, %xmm9
addpd %xmm2, %xmm9
movupd %xmm9, 0x18(%r8,%rdi)
movsd %xmm3, 0x28(%r8,%rdi)
subpd %xmm6, %xmm5
addsd %xmm4, %xmm8
subpd %xmm2, %xmm7
movupd %xmm5, 0x40(%r8,%rdi)
movupd %xmm7, 0x58(%r8,%rdi)
movsd %xmm8, 0x68(%r8,%rdi)
incq %rsi
cmpq %rsi, %rcx
jne 0x1a94
cmpl $0x4, 0x4(%rsp)
jb 0x20c0
movl $0x1c, %ebp
subl %eax, %ebp
movl $0x1, %edx
movl %ebp, %ecx
shll %cl, %edx
movq %rdx, 0x98(%rsp)
leal -0x1(%rdx), %r12d
movl $0x1e, %ecx
subl %eax, %ecx
movl %ecx, 0x10(%rsp)
movl 0x4(%rsp), %eax
movq %rax, 0x50(%rsp)
movq 0x8(%rsp), %rax
leaq 0x10(%rax), %rcx
movq %rcx, 0x58(%rsp)
addq $-0x10, %rax
movq %rax, 0x48(%rsp)
movl $0x3, %ecx
leaq 0x3441(%rip), %rax      # 0x50a0
movq (%rax), %rax
movl (%rax,%rcx,4), %edx
leaq 0x1(%rcx), %rax
movq %rax, 0x18(%rsp)
movq %rdx, 0x88(%rsp)
testq %rdx, %rdx
je 0x20ad
movl %ecx, %eax
decb %cl
movl $0x1, %r13d
shll %cl, %r13d
movl $0x2, %edx
shll %cl, %edx
movl $0x3, %esi
shll %cl, %esi
notl %eax
addl 0x4(%rsp), %eax
movl %eax, 0x14(%rsp)
movl %r13d, %ecx
shrl %ecx
cmpl $0x3, %ecx
movl %ecx, %edi
movl $0x2, %eax
cmovbl %eax, %edi
movq %rdi, 0xa0(%rsp)
movq %r13, %rdi
shlq $0x4, %rdi
movq 0x48(%rsp), %rax
movq %rdi, 0x68(%rsp)
addq %rdi, %rax
movq %rax, 0x60(%rsp)
shlq $0x4, %rdx
movq %rdx, 0x80(%rsp)
shlq $0x4, %rsi
movq %rsi, 0x78(%rsp)
shlq $0x4, %rcx
movq %rcx, 0x70(%rsp)
xorl %ecx, %ecx
leaq 0x33aa(%rip), %rax      # 0x50a8
movq (%rax), %rax
movq %rcx, 0x90(%rsp)
movl (%rax,%rcx,4), %r15d
movq 0x18(%rsp), %rcx
shll %cl, %r15d
shlq $0x4, %r15
movq 0x8(%rsp), %rcx
leaq (%rcx,%r15), %rax
movupd (%rcx,%r15), %xmm0
movq 0x80(%rsp), %rdx
movupd (%rdx,%rax), %xmm1
movq 0x78(%rsp), %rsi
movupd (%rsi,%rax), %xmm2
movapd %xmm1, %xmm3
addpd %xmm2, %xmm3
movapd %xmm0, %xmm4
addpd %xmm3, %xmm4
movupd %xmm4, (%rcx,%r15)
movq 0x68(%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, (%rsi,%rax)
movq 0x70(%rsp), %rdi
leaq (%rax,%rdi), %rcx
movsd (%rdi,%rax), %xmm2
movsd 0x8(%rdi,%rax), %xmm3
movsd (%r8,%rcx), %xmm0
movsd 0x8(%r8,%rcx), %xmm1
movsd (%rdx,%rcx), %xmm6
movsd 0x147c(%rip), %xmm5     # 0x3240
mulsd %xmm5, %xmm6
movsd 0x8(%rdx,%rcx), %xmm4
mulsd %xmm5, %xmm4
movsd 0x8(%rsi,%rcx), %xmm7
mulsd %xmm5, %xmm7
movapd %xmm6, %xmm5
addsd %xmm4, %xmm5
subsd %xmm6, %xmm4
movsd (%rsi,%rcx), %xmm6
mulsd 0x1453(%rip), %xmm6     # 0x3248
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, (%rdi,%rax)
movsd %xmm9, 0x8(%rdi,%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, (%rsi,%rcx)
movsd %xmm5, 0x8(%rsi,%rcx)
movq 0x58(%rsp), %rax
leaq (%rax,%r15), %rbx
addq 0x60(%rsp), %r15
movl $0x1, %r14d
movl %r14d, %edi
movl 0x14(%rsp), %ecx
shll %cl, %edi
movl %edi, %eax
movl %ebp, %ecx
shrl %cl, %eax
movl %edi, %edx
andl %r12d, %edx
movq 0x98(%rsp), %r10
movl %r10d, %ecx
subl %edx, %ecx
btl %ebp, %edi
cmovael %edx, %ecx
movl %eax, %edx
shrl %edx
xorl %eax, %edx
movl %edx, %r8d
andl $0x1, %r8d
leaq 0x31ae(%rip), %rsi      # 0x5080
movq (%rsi), %rsi
shlq $0x4, %rcx
addq %rsi, %rcx
shlq $0x3f, %rax
xorq (%rcx,%r8,8), %rax
xorl $0x1, %r8d
shlq $0x3f, %rdx
xorq (%rcx,%r8,8), %rdx
leal (%rdi,%rdi,2), %edi
movl %edi, %r9d
andl %r12d, %r9d
movl %edi, %r8d
movl %ebp, %ecx
shrl %cl, %r8d
movl %r10d, %ecx
subl %r9d, %ecx
btl %ebp, %edi
cmovael %r9d, %ecx
movl %r8d, %r9d
shrl %r9d
xorl %r8d, %r9d
movl %r9d, %r10d
andl $0x1, %r10d
shlq $0x4, %rcx
addq %rsi, %rcx
shlq $0x3f, %r8
xorq (%rcx,%r10,8), %r8
xorl $0x1, %r10d
shlq $0x3f, %r9
xorq (%rcx,%r10,8), %r9
movq %r9, %xmm3
movq %r8, %xmm2
movl 0x10(%rsp), %ecx
shrl %cl, %edi
testl %edi, %edi
je 0x1f5d
movdqa 0x10db(%rip), %xmm0     # 0x3030
pxor %xmm0, %xmm2
pxor %xmm0, %xmm3
movq %rdx, %xmm1
movq %xmm1, 0xa8(%rsp)
movq %rax, %xmm0
movq %xmm0, 0xb0(%rsp)
movl %r13d, %edi
movq %rbx, %rsi
movdqa %xmm2, 0x20(%rsp)
movdqa %xmm3, 0x30(%rsp)
callq 0x20d2
movsd 0xa8(%rsp), %xmm1
movsd 0xb0(%rsp), %xmm2
movapd %xmm2, %xmm5
pxor %xmm0, %xmm0
mulsd %xmm0, %xmm5
movapd %xmm1, %xmm6
mulsd %xmm0, %xmm6
subsd %xmm1, %xmm5
addsd %xmm2, %xmm6
ucomisd %xmm5, %xmm5
jp 0x2030
movapd 0x20(%rsp), %xmm0
movapd %xmm0, %xmm2
xorpd %xmm4, %xmm4
mulsd %xmm4, %xmm2
movapd 0x30(%rsp), %xmm1
movapd %xmm1, %xmm3
mulsd %xmm4, %xmm3
subsd %xmm1, %xmm2
addsd %xmm0, %xmm3
ucomisd %xmm2, %xmm2
jp 0x2058
movapd 0x1036(%rip), %xmm0     # 0x3030
xorpd %xmm0, %xmm6
xorpd %xmm0, %xmm2
movl %r13d, %edi
movq %r15, %rsi
movapd %xmm5, %xmm0
movapd %xmm6, %xmm1
callq 0x20d2
incq %r14
addq $0x10, %rbx
addq $-0x10, %r15
cmpq %r14, 0xa0(%rsp)
jne 0x1e97
jmp 0x2094
ucomisd %xmm6, %xmm6
jnp 0x1fc4
movapd %xmm2, %xmm0
xorpd %xmm2, %xmm2
movq 0x120a(%rip), %xmm3     # 0x3250
callq 0x2ab0
movapd %xmm0, %xmm5
movapd %xmm1, %xmm6
jmp 0x1fc4
ucomisd %xmm3, %xmm3
jnp 0x1ff2
xorpd %xmm2, %xmm2
movsd 0x11e6(%rip), %xmm3     # 0x3250
movsd %xmm5, 0x30(%rsp)
movapd %xmm6, 0x20(%rsp)
callq 0x2ab0
movapd 0x20(%rsp), %xmm6
movsd 0x30(%rsp), %xmm5
movapd %xmm0, %xmm2
movapd %xmm1, %xmm3
jmp 0x1ff2
movq 0x90(%rsp), %rcx
incq %rcx
cmpq 0x88(%rsp), %rcx
jne 0x1cf7
movq 0x18(%rsp), %rax
movq %rax, %rcx
cmpq 0x50(%rsp), %rax
jne 0x1c58
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq