// File: /workspace/github_c_makefile_star2_O2/diaxen[P]fft-garden/ct_dit_dr_S_P.c
// Function: ct_fft_dr
static inline void
ct_fft_dr(const complex double * restrict in,
           complex double * restrict out,
           int s, int log2_N)
{
  unsigned l = 1 << (log2_N - s - 1);
  unsigned stride = 1 << s;

  switch (l)
    {
    case 1:                     /* size 2 base case  */
      ct_dit_bf2_0(1, stride, out, in);
      break;

    case 2:                     /* size 4 base case  */
      // ct_fft_dr(in, out, s + 1, log2_N);
      ct_dit_bf2_0(1, stride * 2, out, in);
      // ct_fft_dr(in + stride, out + l, s + 1, log2_N);
      ct_dit_bf2_0(1, stride * 2, out + 2, in + stride);

      ct_dit_bf2_0(2, 2, out, out);
      ct_dit_bf2_pi2(2, out + 1);
      break;

    default:
      ct_fft_dr(in, out, s + 1, log2_N);
      ct_fft_dr(in + stride, out + l, s + 1, log2_N);

      ct_dit_bf2_0(l, l, out, out);
      ct_dit_bf2_pi2(l, out + l / 2);
      ct_dit_bf2_pi4(l, out + l / 4);
      ct_dit_bf2_3pi4(l, out + 3 * l / 4);

      for (unsigned k = 1; k < l / 4; k++)
        {
          complex double t = get_twiddle(k << s, log2_N);

          ct_dit_bf2(l, out + k, t);
          ct_dit_bf2(l, out + k + l / 2, t * -I);
          ct_dit_bf2(l, out + l / 2 - k, conj(t * I));
          ct_dit_bf2(l, out + l - k, conj(-t));
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %r13d
movq %rsi, %r14
movq %rdi, %r8
movl %edx, %r15d
notl %r15d
addl %ecx, %r15d
pushq $0x1
popq %r12
movl %r12d, %ebp
movl %r15d, %ecx
shll %cl, %ebp
movq %rdx, 0x8(%rsp)
movl %edx, %ecx
shll %cl, %r12d
cmpl $0x2, %ebp
je 0x1a11
cmpl $0x1, %ebp
jne 0x1a78
pushq $0x1
popq %rdi
movl %r12d, %esi
movq %r14, %rdx
movq %r8, %rcx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1d1f
pushq $0x2
popq %rbp
movl %ebp, %r15d
movq 0x8(%rsp), %rcx
shll %cl, %r15d
pushq $0x1
popq %rbx
movl %ebx, %edi
movl %r15d, %esi
movq %r14, %rdx
movq %r8, %rcx
movq %r8, %r13
callq 0x1d1f
leaq 0x20(%r14), %rdx
movl %r12d, %ecx
shlq $0x4, %rcx
addq %r13, %rcx
movl %ebx, %edi
movl %r15d, %esi
callq 0x1d1f
movl %ebp, %edi
movl %ebp, %esi
movq %r14, %rdx
movq %r14, %rcx
callq 0x1d1f
addq $0x10, %r14
movl %ebp, %edi
movq %r14, %rsi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1d4a
movq 0x8(%rsp), %rax
leal 0x1(%rax), %edx
movl %edx, (%rsp)
movq %r8, %rdi
movq %r14, %rsi
movl %r13d, %ecx
movq %r8, %rbx
callq 0x19ae
movl %r12d, %edi
shlq $0x4, %rdi
addq %rbx, %rdi
movl %ebp, %ebx
shlq $0x4, %rbx
leaq (%rbx,%r14), %rsi
movl (%rsp), %edx
movl %r13d, %ecx
callq 0x19ae
movl %ebp, %edi
movl %ebp, %esi
movq %r14, %rdx
movq %r14, %rcx
callq 0x1d1f
movl %ebp, %eax
shrl %eax
shlq $0x4, %rax
leaq (%rax,%r14), %rsi
movq %rax, %r12
movl %ebp, %edi
callq 0x1d4a
movl %ebp, %eax
shrl $0x2, %eax
movq %rax, 0x28(%rsp)
shlq $0x4, %rax
leaq (%r14,%rax), %rcx
movupd (%r14,%rax), %xmm1
movupd (%rbx,%rcx), %xmm2
movapd %xmm2, %xmm0
shufpd $0x1, %xmm2, %xmm0      # xmm0 = xmm0[1],xmm2[0]
movapd %xmm2, %xmm3
addpd %xmm0, %xmm3
subpd %xmm0, %xmm2
movsd %xmm3, %xmm2            # xmm2 = xmm3[0],xmm2[1]
movapd 0x173a(%rip), %xmm0     # 0x3250
mulpd %xmm0, %xmm2
movapd %xmm1, %xmm3
addpd %xmm2, %xmm3
movupd %xmm3, (%r14,%rax)
subpd %xmm2, %xmm1
movupd %xmm1, (%rbx,%rcx)
pushq $0x3
popq %rax
movl %r15d, %ecx
shll %cl, %eax
shrl $0x2, %eax
shlq $0x4, %rax
leaq (%r14,%rax), %rcx
movsd (%rbx,%rcx), %xmm1
movsd 0x8(%rbx,%rcx), %xmm2
movapd 0x14d9(%rip), %xmm3     # 0x3030
xorpd %xmm2, %xmm3
movupd (%r14,%rax), %xmm4
unpcklpd %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0]
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
subpd %xmm1, %xmm2
mulpd %xmm0, %xmm2
movapd %xmm4, %xmm0
addpd %xmm2, %xmm0
movupd %xmm0, (%r14,%rax)
subpd %xmm2, %xmm4
movupd %xmm4, (%rbx,%rcx)
movq %r12, %rax
leaq 0x10(%r12,%r14), %r15
leaq 0x10(%r14), %r12
leaq -0x10(%rbx,%r14), %r13
leaq -0x10(%rax,%r14), %r14
pushq $0x1
popq %rbx
cmpq 0x28(%rsp), %rbx
jae 0x1cfb
movl %ebx, %eax
movq 0x8(%rsp), %rcx
shll %cl, %eax
leaq 0x34c4(%rip), %rcx      # 0x5080
movq (%rcx), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movaps %xmm0, 0x10(%rsp)
movsd 0x8(%rcx,%rax), %xmm1
movsd %xmm1, (%rsp)
movl %ebp, %edi
movq %r12, %rsi
callq 0x1d91
movapd 0x10(%rsp), %xmm3
movapd %xmm3, %xmm2
mulsd 0x1424(%rip), %xmm2     # 0x3018
movsd (%rsp), %xmm0
movapd %xmm0, %xmm1
mulsd 0x146b(%rip), %xmm1     # 0x3070
subsd %xmm2, %xmm0
subsd %xmm3, %xmm1
ucomisd %xmm0, %xmm0
movapd %xmm2, 0x30(%rsp)
jp 0x1c9d
movl %ebp, %edi
movq %r15, %rsi
callq 0x1d91
movsd (%rsp), %xmm0
movapd %xmm0, %xmm1
mulsd 0x13e0(%rip), %xmm1     # 0x3018
movapd 0x30(%rsp), %xmm2
subsd %xmm0, %xmm2
addsd 0x10(%rsp), %xmm1
ucomisd %xmm2, %xmm2
jp 0x1ccc
movapd 0x13da(%rip), %xmm0     # 0x3030
xorpd %xmm0, %xmm1
movl %ebp, %edi
movq %r14, %rsi
movapd %xmm2, %xmm0
callq 0x1d91
movapd 0x10(%rsp), %xmm0
xorpd 0x13ba(%rip), %xmm0     # 0x3030
movl %ebp, %edi
movq %r13, %rsi
movsd (%rsp), %xmm1
callq 0x1d91
incq %rbx
addq $0x10, %r15
addq $0x10, %r12
addq $-0x10, %r13
addq $-0x10, %r14
jmp 0x1ba1
ucomisd %xmm1, %xmm1
jnp 0x1c1d
movapd 0x10(%rsp), %xmm0
movsd (%rsp), %xmm1
movsd 0x13b6(%rip), %xmm2     # 0x3070
movsd 0x159e(%rip), %xmm3     # 0x3260
callq 0x1e60
jmp 0x1c1d
ucomisd %xmm1, %xmm1
jnp 0x1c4e
xorpd %xmm2, %xmm2
movapd 0x10(%rsp), %xmm0
movsd (%rsp), %xmm1
movsd 0x157b(%rip), %xmm3     # 0x3268
callq 0x1e60
movapd %xmm0, %xmm2
jmp 0x1c4e
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq