// File: /workspace/github_c_makefile_star2_O3/diaxen[P]fft-garden/cp_dit_bi_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 = cp_input_lut[i / 2];
      unsigned i1 = i0 ^ (N >> 1);

      if (sr_sched_off[j] * 2 > i)
        {
          out[i    ] = in[i0];
          out[i + 1] = in[i1];
        }
      else
        {
          complex double a = in[i0];
          complex double b = in[i1];
          out[i    ] = a + b;
          out[i + 1] = a - b;
          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;
          cp_dit_bf_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;

          cp_dit_bf_pi4(2, out + o + 1);
          cp_dit_bf_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++)
          {
            unsigned o = sr_sched_off[i] << (s + 1);
            unsigned t = log2_N - s - 1;
            unsigned os = 1 << (s - 1);
            unsigned k;

            cp_dit_bf_0(os, out + o);
            for (k = 1; k < os / 2; k++)
              cp_dit_bf(os, out + o + k, get_twiddle(k << t, log2_N));
            cp_dit_bf_pi4(os, out + o + k);
            for (k += 1; k < os; k++)
              cp_dit_bf(os, out + o + k, get_twiddle(k << t, log2_N));
          }
      }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
bsrl %edi, %eax
movl %eax, 0x4(%rsp)
je 0x1996
leaq 0x3783(%rip), %rax      # 0x5090
movq (%rax), %rax
leaq 0x3791(%rip), %rcx      # 0x50a8
movq (%rcx), %rcx
movl %edi, %r15d
shrl %edi
leaq 0x10(%rsi), %r8
xorl %r9d, %r9d
xorl %r10d, %r10d
movl (%rax,%r9,2), %r11d
movl %r11d, %ebx
xorl %edi, %ebx
movl %r10d, %r14d
movl (%rcx,%r14,4), %r14d
addl %r14d, %r14d
shlq $0x4, %r11
movupd (%rdx,%r11), %xmm0
movl %ebx, %r11d
cmpq %r14, %r9
jae 0x1965
movupd %xmm0, -0x10(%r8)
shlq $0x4, %r11
movupd (%rdx,%r11), %xmm0
movupd %xmm0, (%r8)
jmp 0x1989
shlq $0x4, %r11
movupd (%rdx,%r11), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd %xmm2, -0x10(%r8)
subpd %xmm1, %xmm0
movupd %xmm0, (%r8)
incl %r10d
addq $0x2, %r9
addq $0x20, %r8
cmpq %r15, %r9
jb 0x1929
movq %rsi, 0x10(%rsp)
cmpl $0x1, 0x4(%rsp)
jbe 0x1f57
movl 0x4(%rsp), %eax
xorl $0x1f, %eax
leaq 0x36ec(%rip), %rcx      # 0x50a0
movq (%rcx), %rcx
movl 0x4(%rcx), %edx
testq %rdx, %rdx
movq 0x10(%rsp), %r9
je 0x1a54
leaq 0x36d9(%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 0x19d4
cmpl $0x1d, %eax
je 0x1f57
movl 0x8(%rcx), %ecx
testq %rcx, %rcx
movq 0x10(%rsp), %r8
je 0x1bb0
leaq 0x3633(%rip), %rdx      # 0x50a8
movq (%rdx), %rdx
xorl %esi, %esi
movapd 0x179e(%rip), %xmm0     # 0x3220
movl (%rdx,%rsi,4), %edi
shll $0x3, %edi
shlq $0x4, %rdi
movsd 0x50(%r8,%rdi), %xmm1
movhpd 0x70(%r8,%rdi), %xmm1   # xmm1 = xmm1[0],mem[0]
movsd 0x58(%r8,%rdi), %xmm3
movhpd 0x78(%r8,%rdi), %xmm3   # xmm3 = xmm3[0],mem[0]
mulpd %xmm0, %xmm1
mulpd %xmm0, %xmm3
movapd %xmm1, %xmm4
shufpd $0x1, %xmm3, %xmm4      # xmm4 = xmm4[1],xmm3[0]
movapd %xmm3, %xmm2
shufpd $0x1, %xmm1, %xmm2      # xmm2 = xmm2[1],xmm1[0]
subpd %xmm2, %xmm4
addpd %xmm1, %xmm3
movapd %xmm3, %xmm5
movupd (%r8,%rdi), %xmm1
movupd 0x10(%r8,%rdi), %xmm6
addpd %xmm4, %xmm5
movupd 0x20(%r8,%rdi), %xmm2
movupd 0x30(%r8,%rdi), %xmm7
movapd %xmm4, %xmm8
shufpd $0x1, %xmm3, %xmm8      # xmm8 = xmm8[1],xmm3[0]
shufpd $0x1, %xmm4, %xmm3      # xmm3 = xmm3[1],xmm4[0]
movapd %xmm6, %xmm4
subpd %xmm3, %xmm8
addpd %xmm5, %xmm4
movapd %xmm7, %xmm3
addpd %xmm8, %xmm3
subpd %xmm8, %xmm7
movupd %xmm4, 0x10(%r8,%rdi)
movapd %xmm7, %xmm4
movsd %xmm3, %xmm4            # xmm4 = xmm3[0],xmm4[1]
subpd %xmm5, %xmm6
movupd %xmm4, 0x30(%r8,%rdi)
movupd %xmm6, 0x50(%r8,%rdi)
shufpd $0x2, %xmm3, %xmm7      # xmm7 = xmm7[0],xmm3[1]
movupd %xmm7, 0x70(%r8,%rdi)
movupd 0x40(%r8,%rdi), %xmm3
movupd 0x60(%r8,%rdi), %xmm4
movapd %xmm3, %xmm5
movapd %xmm1, %xmm6
addpd %xmm4, %xmm5
addpd %xmm5, %xmm6
subpd %xmm4, %xmm3
shufpd $0x1, %xmm3, %xmm3      # xmm3 = xmm3[1,0]
movupd %xmm6, (%r8,%rdi)
movapd %xmm2, %xmm4
addpd %xmm3, %xmm4
subpd %xmm3, %xmm2
movapd %xmm2, %xmm3
movsd %xmm4, %xmm3            # xmm3 = xmm4[0],xmm3[1]
movupd %xmm3, 0x20(%r8,%rdi)
subpd %xmm5, %xmm1
movupd %xmm1, 0x40(%r8,%rdi)
shufpd $0x2, %xmm4, %xmm2      # xmm2 = xmm2[0],xmm4[1]
movupd %xmm2, 0x60(%r8,%rdi)
incq %rsi
cmpq %rsi, %rcx
jne 0x1a82
cmpl $0x4, 0x4(%rsp)
jb 0x1f57
movl $0x1c, %ebp
subl %eax, %ebp
movl $0x1, %r14d
movl %ebp, %ecx
shll %cl, %r14d
leal -0x1(%r14), %r9d
movl 0x4(%rsp), %eax
movq %rax, 0x48(%rsp)
movq 0x10(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x28(%rsp)
movl $0x3, %ecx
movl %r9d, 0x8(%rsp)
movq %r14, 0x40(%rsp)
leaq 0x34a2(%rip), %rax      # 0x50a0
movq (%rax), %rax
movl (%rax,%rcx,4), %edx
leaq 0x1(%rcx), %rax
movq %rax, 0x30(%rsp)
movq %rdx, 0x78(%rsp)
testq %rdx, %rdx
je 0x1f44
movl %ecx, %esi
decb %cl
movl $0x1, %edx
shll %cl, %edx
movl $0x2, %eax
shll %cl, %eax
movq %rax, 0x70(%rsp)
movl $0x3, %eax
shll %cl, %eax
movq %rax, 0x68(%rsp)
notl %esi
addl 0x4(%rsp), %esi
movl %edx, %ecx
shrl %ecx
cmpl $0x3, %ecx
movl $0x2, %eax
cmovbl %eax, %ecx
movl %ecx, %eax
incl %eax
movl %eax, 0x24(%rsp)
leaq 0x1(%rcx), %rax
movq %rax, 0x58(%rsp)
movq %rcx, 0x90(%rsp)
shlq $0x4, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x60(%rsp)
addq %rcx, %rax
movq %rax, 0x50(%rsp)
movq %rdx, %rax
shlq $0x4, %rax
movq %rax, 0x38(%rsp)
xorl %ecx, %ecx
movl %esi, 0xc(%rsp)
movq %rdx, 0x18(%rsp)
leaq 0x3408(%rip), %rax      # 0x50a8
movq (%rax), %rax
movq %rcx, 0x88(%rsp)
movl (%rax,%rcx,4), %r13d
movq 0x30(%rsp), %rcx
shll %cl, %r13d
shlq $0x4, %r13
movq 0x10(%rsp), %rax
leaq (%rax,%r13), %rcx
movq 0x70(%rsp), %r12
shlq $0x4, %r12
movq 0x68(%rsp), %r15
shlq $0x4, %r15
movupd (%rax,%r13), %xmm0
movupd (%r12,%rcx), %xmm1
movupd (%r15,%rcx), %xmm2
movapd %xmm1, %xmm3
addpd %xmm2, %xmm3
movapd %xmm0, %xmm4
addpd %xmm3, %xmm4
movupd %xmm4, (%rax,%r13)
movq 0x38(%rsp), %rax
movupd (%rax,%rcx), %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, (%rax,%rcx)
subpd %xmm3, %xmm0
movupd %xmm0, (%r12,%rcx)
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movq %rcx, 0x80(%rsp)
movupd %xmm4, (%r15,%rcx)
movq 0x28(%rsp), %rax
leaq (%rax,%r13), %r14
movl $0x1, %ebx
movl %ebx, %edx
movl %esi, %ecx
shll %cl, %edx
movl %edx, %esi
andl 0x8(%rsp), %esi
movl %edx, %eax
movl %ebp, %ecx
shrl %cl, %eax
movq 0x40(%rsp), %rcx
subl %esi, %ecx
btl %ebp, %edx
cmovael %esi, %ecx
movl %eax, %edx
shrl %edx
xorl %eax, %edx
movl %edx, %esi
shlq $0x4, %rcx
leaq 0x32f9(%rip), %rdi      # 0x5080
addq (%rdi), %rcx
andl $0x1, %esi
shlq $0x3f, %rax
xorq (%rcx,%rsi,8), %rax
xorl $0x1, %esi
shlq $0x3f, %rdx
xorq (%rcx,%rsi,8), %rdx
movq %rdx, %xmm1
movq %rax, %xmm0
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x1f69
movq 0x18(%rsp), %rdx
movl 0xc(%rsp), %esi
incq %rbx
addq $0x10, %r14
cmpq %rbx, 0x90(%rsp)
jne 0x1d55
movq 0x60(%rsp), %rcx
movq 0x80(%rsp), %rdi
leaq (%rdi,%rcx), %rax
movupd (%rdi,%rcx), %xmm0
movsd (%r12,%rax), %xmm1
movhpd (%r15,%rax), %xmm1      # xmm1 = xmm1[0],mem[0]
movsd 0x8(%r12,%rax), %xmm2
movapd 0x141e(%rip), %xmm3     # 0x3220
mulpd %xmm3, %xmm1
movhpd 0x8(%r15,%rax), %xmm2   # xmm2 = xmm2[0],mem[0]
mulpd %xmm3, %xmm2
movapd %xmm1, %xmm3
shufpd $0x1, %xmm2, %xmm3      # xmm3 = xmm3[1],xmm2[0]
movapd %xmm2, %xmm4
shufpd $0x1, %xmm1, %xmm4      # xmm4 = xmm4[1],xmm1[0]
subpd %xmm4, %xmm3
addpd %xmm1, %xmm2
movapd %xmm2, %xmm1
addpd %xmm3, %xmm1
movapd %xmm0, %xmm4
addpd %xmm1, %xmm4
movupd %xmm4, (%rdi,%rcx)
movq 0x38(%rsp), %rcx
movupd (%rcx,%rax), %xmm4
movapd %xmm3, %xmm5
shufpd $0x1, %xmm2, %xmm5      # xmm5 = xmm5[1],xmm2[0]
shufpd $0x1, %xmm3, %xmm2      # xmm2 = xmm2[1],xmm3[0]
subpd %xmm2, %xmm5
movapd %xmm4, %xmm2
addpd %xmm5, %xmm2
subpd %xmm5, %xmm4
movapd %xmm4, %xmm3
movsd %xmm2, %xmm3            # xmm3 = xmm2[0],xmm3[1]
movupd %xmm3, (%rcx,%rax)
subpd %xmm1, %xmm0
movupd %xmm0, (%r12,%rax)
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movupd %xmm4, (%r15,%rax)
cmpl %edx, 0x24(%rsp)
movq 0x40(%rsp), %r14
movl 0x8(%rsp), %r9d
leaq 0x31e1(%rip), %r15      # 0x5080
jae 0x1f2e
addq 0x50(%rsp), %r13
movq 0x58(%rsp), %rbx
movl %ebx, %edx
movl %esi, %ecx
shll %cl, %edx
movl %edx, %esi
andl %r9d, %esi
movl %edx, %eax
movl %ebp, %ecx
shrl %cl, %eax
movl %r14d, %ecx
subl %esi, %ecx
btl %ebp, %edx
cmovael %esi, %ecx
movl %eax, %edx
shrl %edx
xorl %eax, %edx
movl %edx, %esi
shlq $0x4, %rcx
addq (%r15), %rcx
andl $0x1, %esi
shlq $0x3f, %rax
xorq (%rcx,%rsi,8), %rax
xorl $0x1, %esi
shlq $0x3f, %rdx
xorq (%rcx,%rsi,8), %rdx
movq %rdx, %xmm1
movq %rax, %xmm0
movq 0x18(%rsp), %rdi
movq %r13, %rsi
movq %r13, %r12
movl %ebp, %r13d
movl %r9d, %ebp
callq 0x1f69
movl %ebp, %r9d
movl %r13d, %ebp
movq %r12, %r13
movq 0x18(%rsp), %rdx
movl 0xc(%rsp), %esi
incq %rbx
addq $0x10, %r13
cmpq %rbx, %rdx
jne 0x1eaf
movq 0x88(%rsp), %rcx
incq %rcx
cmpq 0x78(%rsp), %rcx
jne 0x1c99
movq 0x30(%rsp), %rax
movq %rax, %rcx
cmpq 0x48(%rsp), %rax
jne 0x1bf7
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq