// File: /workspace/github_c_makefile_star2_O2/diaxen[P]fft-garden/ct_dit_dr_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);

      unsigned k;
      for (k = 1; k < l / 4; k++)
        ct_dit_bf2(l, out + k, get_twiddle(k << s, log2_N));
      for (k++; k < l / 2; k++)
        ct_dit_bf2(l, out + k, get_twiddle(k << s, log2_N));
      for (k++; k < 3 * l / 4; k++)
        ct_dit_bf2(l, out + k, get_twiddle(k << s, log2_N));
      for (k++; k < l; k++)
        ct_dit_bf2(l, out + k, get_twiddle(k << s, log2_N));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r13d
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %rax
movl %edx, %r15d
notl %r15d
addl %ecx, %r15d
pushq $0x1
popq %r12
movl %r12d, %ebp
movl %r15d, %ecx
shll %cl, %ebp
movl %r14d, %ecx
shll %cl, %r12d
cmpl $0x2, %ebp
je 0x1a10
cmpl $0x1, %ebp
jne 0x1a78
pushq $0x1
popq %rdi
movl %r12d, %esi
movq %rbx, %rdx
movq %rax, %rcx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1cae
pushq $0x2
popq %rbp
movl %ebp, %r15d
movl %r14d, %ecx
shll %cl, %r15d
pushq $0x1
popq %r14
movl %r14d, %edi
movl %r15d, %esi
movq %rbx, %rdx
movq %rax, %rcx
movq %rax, %r13
callq 0x1cae
leaq 0x20(%rbx), %rdx
movl %r12d, %ecx
shlq $0x4, %rcx
addq %r13, %rcx
movl %r14d, %edi
movl %r15d, %esi
callq 0x1cae
movl %ebp, %edi
movl %ebp, %esi
movq %rbx, %rdx
movq %rbx, %rcx
callq 0x1cae
addq $0x10, %rbx
movl %ebp, %edi
movq %rbx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1cd9
leal 0x1(%r14), %edx
movl %edx, 0x10(%rsp)
movq %rax, %rdi
movq %rbx, %rsi
movl %r13d, %ecx
movq %rax, 0x8(%rsp)
callq 0x19ae
movl %r12d, %edi
shlq $0x4, %rdi
addq 0x8(%rsp), %rdi
movl %ebp, %eax
movq %rax, 0x20(%rsp)
shlq $0x4, %rax
movq %rax, 0x18(%rsp)
leaq (%rbx,%rax), %rsi
movl 0x10(%rsp), %edx
movl %r13d, %ecx
callq 0x19ae
movl %ebp, %edi
movl %ebp, %esi
movq %rbx, %rdx
movq %rbx, %rcx
callq 0x1cae
movl %ebp, %esi
shrl %esi
movq %rsi, 0x8(%rsp)
shlq $0x4, %rsi
addq %rbx, %rsi
movl %ebp, %edi
callq 0x1cd9
movl %ebp, %r12d
shrl $0x2, %r12d
movq %r12, %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rcx
movupd (%rbx,%rax), %xmm1
movq 0x18(%rsp), %rdx
movupd (%rdx,%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 0x1729(%rip), %xmm0     # 0x3250
mulpd %xmm0, %xmm2
movapd %xmm1, %xmm3
addpd %xmm2, %xmm3
movupd %xmm3, (%rbx,%rax)
subpd %xmm2, %xmm1
movupd %xmm1, (%rdx,%rcx)
pushq $0x3
popq %rax
movl %r15d, %ecx
shll %cl, %eax
shrl $0x2, %eax
movq %rax, 0x10(%rsp)
shlq $0x4, %rax
leaq (%rbx,%rax), %rcx
movsd (%rdx,%rcx), %xmm1
movsd 0x8(%rdx,%rcx), %xmm2
movapd 0x14c4(%rip), %xmm3     # 0x3030
xorpd %xmm2, %xmm3
movupd (%rbx,%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, (%rbx,%rax)
subpd %xmm2, %xmm4
movupd %xmm4, (%rdx,%rcx)
addq $0x40, %rbx
pushq $0x1
popq %r15
leaq 0x34d6(%rip), %r13      # 0x5080
cmpq %r12, %r15
jae 0x1bde
leaq -0x30(%rbx), %rsi
movl %r15d, %eax
movl %r14d, %ecx
shll %cl, %eax
movq (%r13), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd 0x8(%rcx,%rax), %xmm1
movl %ebp, %edi
callq 0x1d20
incq %r15
addq $0x10, %rbx
jmp 0x1baa
incq %r15
movq 0x20(%rsp), %r12
cmpq 0x8(%rsp), %r15
jae 0x1c1c
leaq -0x20(%rbx), %rsi
movl %r15d, %eax
movl %r14d, %ecx
shll %cl, %eax
movq (%r13), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd 0x8(%rcx,%rax), %xmm1
movl %ebp, %edi
callq 0x1d20
addq $0x10, %rbx
incq %r15
jmp 0x1be6
incq %r15
cmpq 0x10(%rsp), %r15
jae 0x1c55
leaq -0x10(%rbx), %rsi
movl %r15d, %eax
movl %r14d, %ecx
shll %cl, %eax
movq (%r13), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd 0x8(%rcx,%rax), %xmm1
movl %ebp, %edi
callq 0x1d20
incq %r15
addq $0x10, %rbx
jmp 0x1c1f
incq %r15
cmpq %r12, %r15
jae 0x1c8b
movl %r15d, %eax
movl %r14d, %ecx
shll %cl, %eax
movq (%r13), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd 0x8(%rcx,%rax), %xmm1
movl %ebp, %edi
movq %rbx, %rsi
callq 0x1d20
incq %r15
addq $0x10, %rbx
jmp 0x1c58
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq