// File: /workspace/github_c_makefile_star2_O1/diaxen[P]fft-garden/cp_dit_dr_S_P.c
// Function: cp_dit_dr
static void
cp_dit_dr(unsigned log2_N,
	  const complex double * restrict in,
	  complex double * restrict out,
	  unsigned l, unsigned i)
{
  unsigned is = 1 << (log2_N - l);
  unsigned os = 1 << (l - 2);
  unsigned mask = (1 << log2_N) - 1;
  unsigned i0 = i & mask;
  unsigned t = log2_N - l;

  switch (l)
    {
#if 0
    case 0:			/* size 1 base case  */
      out[0] = in[i];
      break;
#endif

    case 1: {			/* size 2 base case  */
      unsigned i1 = i0 ^ is;
      complex double a = in[i0];
      complex double b = in[i1];
      out[0] = a + b;
      out[1] = a - b;
      break;
    }

    case 2: {			/* size 4 base case  */
      //      cp_dit_dr(log2_N, in, out, 1, i);
      unsigned i1 = i0 ^ (1 << (log2_N - 1));
      complex double a = in[i0];
      complex double b = in[i1];
      out[0] = a + b;
      out[1] = a - b;

      out[2] = in[(i + is) & mask];
      out[3] = in[(i - is) & mask];
      cp_dit_bf_0(1, out);
      break;
    }

    default:
      cp_dit_dr(log2_N, in, out, l - 1, i);
      cp_dit_dr(log2_N, in, out + 2 * os, l - 2, i + is);
      cp_dit_dr(log2_N, in, out + 3 * os, l - 2, i - is);

      unsigned m = os / 2;
      if (os > 2)
	for (unsigned k = 1; k < m; k++)
	  {
	    complex double w = get_twiddle(k << t, log2_N);
	    cp_dit_bf(os, out + k, w);
	    cp_dit_bf(os, out + os - k, -I * conj(w));
	  }
      cp_dit_bf_pi4(os, out + m);
      cp_dit_bf_0(os, out);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, %r12d
movl %ecx, %eax
movl %edi, %r14d
movl %edi, %ebp
subl %ecx, %ebp
movl $0x1, %ebx
movl %ebp, %ecx
shll %cl, %ebx
movq %rsi, %r13
movl $0x1, %r15d
leal -0x2(%rax), %r8d
movl %r8d, %ecx
shll %cl, %r15d
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %r14d, %ecx
shll %cl, %esi
notl %esi
movl %esi, %ecx
andl %r12d, %ecx
cmpl $0x2, %eax
je 0x1ad4
cmpl $0x1, %eax
jne 0x1be4
xorl %ecx, %ebx
movl %ecx, %eax
shlq $0x4, %rax
movsd (%r13,%rax), %xmm0
movsd 0x8(%r13,%rax), %xmm1
shlq $0x4, %rbx
movsd (%r13,%rbx), %xmm2
movsd 0x8(%r13,%rbx), %xmm3
movapd %xmm0, %xmm4
addsd %xmm2, %xmm4
movapd %xmm1, %xmm5
addsd %xmm3, %xmm5
movsd %xmm4, (%rdx)
movsd %xmm5, 0x8(%rdx)
subsd %xmm2, %xmm0
subsd %xmm3, %xmm1
movsd %xmm0, 0x10(%rdx)
movsd %xmm1, 0x18(%rdx)
jmp 0x1f00
decb %r14b
movl %ecx, %eax
btcl %r14d, %ecx
shlq $0x4, %rax
movsd (%r13,%rax), %xmm0
movsd 0x8(%r13,%rax), %xmm1
shlq $0x4, %rcx
movsd (%r13,%rcx), %xmm4
movsd 0x8(%r13,%rcx), %xmm5
movapd %xmm0, %xmm2
addsd %xmm4, %xmm2
movapd %xmm1, %xmm3
addsd %xmm5, %xmm3
movsd %xmm2, (%rdx)
movsd %xmm3, 0x8(%rdx)
subsd %xmm4, %xmm0
subsd %xmm5, %xmm1
movsd %xmm0, 0x10(%rdx)
movsd %xmm1, 0x18(%rdx)
leal (%rbx,%r12), %eax
andl %esi, %eax
shlq $0x4, %rax
movsd (%r13,%rax), %xmm4
movsd 0x8(%r13,%rax), %xmm5
movsd %xmm4, 0x20(%rdx)
movsd %xmm5, 0x28(%rdx)
subl %ebx, %r12d
andl %esi, %r12d
shlq $0x4, %r12
movsd (%r13,%r12), %xmm6
movsd 0x8(%r13,%r12), %xmm7
movapd %xmm4, %xmm8
addsd %xmm6, %xmm8
subsd %xmm6, %xmm4
movapd %xmm7, %xmm6
addsd %xmm5, %xmm6
subsd %xmm7, %xmm5
movapd %xmm2, %xmm7
addsd %xmm8, %xmm7
movapd %xmm3, %xmm9
addsd %xmm6, %xmm9
movsd %xmm7, (%rdx)
movsd %xmm9, 0x8(%rdx)
movapd %xmm0, %xmm7
addsd %xmm5, %xmm7
movapd %xmm1, %xmm9
subsd %xmm4, %xmm9
movsd %xmm7, 0x10(%rdx)
movsd %xmm9, 0x18(%rdx)
subsd %xmm8, %xmm2
subsd %xmm6, %xmm3
movsd %xmm2, 0x20(%rdx)
movsd %xmm3, 0x28(%rdx)
subsd %xmm5, %xmm0
addsd %xmm1, %xmm4
movsd %xmm0, 0x30(%rdx)
movsd %xmm4, 0x38(%rdx)
jmp 0x1f00
decl %eax
movl %r14d, %edi
movq %r13, %rsi
movl %eax, %ecx
movq %rdx, 0x8(%rsp)
movl %r8d, (%rsp)
movl %r12d, %r8d
callq 0x1a27
movl $0x2, %edx
movl (%rsp), %ecx
shll %cl, %edx
shlq $0x4, %rdx
addq 0x8(%rsp), %rdx
leal (%rbx,%r12), %r8d
movl %r14d, %edi
movq %r13, %rsi
callq 0x1a27
movl $0x3, %edx
movl (%rsp), %ecx
shll %cl, %edx
shlq $0x4, %rdx
addq 0x8(%rsp), %rdx
subl %ebx, %r12d
movl %r14d, %edi
movq %r13, %rsi
movl %ecx, %ebx
movl %r12d, %r8d
callq 0x1a27
movl %r15d, %eax
shrl %eax
movl %eax, 0x4(%rsp)
movl %r15d, %eax
movq %rax, 0x10(%rsp)
cmpl $0x2, %ebx
jb 0x1d3e
movl 0x4(%rsp), %eax
cmpl $0x3, %eax
movl $0x2, %ebx
cmovael %eax, %ebx
movq 0x8(%rsp), %rcx
leaq 0x10(%rcx), %r12
movq 0x10(%rsp), %rax
shlq $0x4, %rax
leaq (%rax,%rcx), %r13
addq $-0x10, %r13
movl $0x1, %r14d
movl %r14d, %eax
movl %ebp, %ecx
shll %cl, %eax
leaq 0x33e2(%rip), %rcx      # 0x5080
movq (%rcx), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x8(%rcx,%rax), %xmm1
movaps %xmm1, 0x20(%rsp)
movl %r15d, %edi
movq %r12, %rsi
callq 0x1f24
movapd 0x20(%rsp), %xmm3
movsd 0x18(%rsp), %xmm2
movapd %xmm2, %xmm0
mulsd 0x1392(%rip), %xmm0     # 0x3070
movapd %xmm3, %xmm1
mulsd 0x132e(%rip), %xmm1     # 0x3018
subsd %xmm3, %xmm0
subsd %xmm2, %xmm1
ucomisd %xmm0, %xmm0
jp 0x1d19
movl %r15d, %edi
movq %r13, %rsi
callq 0x1f24
incq %r14
addq $0x10, %r12
addq $-0x10, %r13
cmpq %r14, %rbx
jne 0x1c90
jmp 0x1d3e
ucomisd %xmm1, %xmm1
jnp 0x1cf8
xorpd 0x1309(%rip), %xmm3     # 0x3030
movsd 0x1341(%rip), %xmm0     # 0x3070
movsd 0x1519(%rip), %xmm1     # 0x3250
callq 0x2860
jmp 0x1cf8
movl 0x4(%rsp), %edx
shlq $0x4, %rdx
movq 0x8(%rsp), %rsi
leaq (%rsi,%rdx), %rax
movsd (%rsi,%rdx), %xmm1
movsd 0x8(%rsi,%rdx), %xmm2
movq 0x10(%rsp), %r9
shlq $0x4, %r9
movsd (%r9,%rax), %xmm0
movsd 0x8(%r9,%rax), %xmm3
movl (%rsp), %ecx
movl $0x2, %edi
shll %cl, %edi
shlq $0x4, %rdi
movl $0x3, %r8d
shll %cl, %r8d
shlq $0x4, %r8
movsd 0x14c5(%rip), %xmm6     # 0x3258
movsd (%rdi,%rax), %xmm7
mulsd %xmm6, %xmm7
movsd (%r8,%rax), %xmm8
mulsd %xmm6, %xmm8
movsd 0x8(%rdi,%rax), %xmm4
mulsd %xmm6, %xmm4
mulsd 0x8(%r8,%rax), %xmm6
movapd %xmm7, %xmm5
addsd %xmm4, %xmm5
subsd %xmm7, %xmm4
movapd %xmm8, %xmm7
subsd %xmm6, %xmm7
addsd %xmm8, %xmm6
movapd %xmm5, %xmm8
addsd %xmm7, %xmm8
subsd %xmm7, %xmm5
movapd %xmm4, %xmm7
addsd %xmm6, %xmm7
subsd %xmm6, %xmm4
movapd %xmm1, %xmm6
addsd %xmm8, %xmm6
movapd %xmm2, %xmm9
addsd %xmm7, %xmm9
movsd %xmm6, (%rsi,%rdx)
movsd %xmm9, 0x8(%rsi,%rdx)
movapd %xmm0, %xmm6
addsd %xmm4, %xmm6
movapd %xmm3, %xmm9
subsd %xmm5, %xmm9
movsd %xmm6, (%r9,%rax)
movsd %xmm9, 0x8(%r9,%rax)
subsd %xmm8, %xmm1
subsd %xmm7, %xmm2
movsd %xmm1, (%rdi,%rax)
movsd %xmm2, 0x8(%rdi,%rax)
subsd %xmm4, %xmm0
addsd %xmm3, %xmm5
movsd %xmm0, (%r8,%rax)
movsd %xmm5, 0x8(%r8,%rax)
movsd (%rsi), %xmm3
movsd 0x8(%rsi), %xmm4
movsd (%rsi,%r9), %xmm0
movsd 0x8(%rsi,%r9), %xmm2
movsd (%rsi,%rdi), %xmm1
movsd 0x8(%rsi,%rdi), %xmm5
movsd (%rsi,%r8), %xmm6
movsd 0x8(%rsi,%r8), %xmm7
movapd %xmm1, %xmm8
addsd %xmm6, %xmm8
subsd %xmm6, %xmm1
movapd %xmm5, %xmm6
addsd %xmm7, %xmm6
subsd %xmm7, %xmm5
movapd %xmm3, %xmm7
addsd %xmm8, %xmm7
movapd %xmm4, %xmm9
addsd %xmm6, %xmm9
movsd %xmm7, (%rsi)
movsd %xmm9, 0x8(%rsi)
movapd %xmm0, %xmm7
addsd %xmm5, %xmm7
movapd %xmm2, %xmm9
subsd %xmm1, %xmm9
movsd %xmm7, (%rsi,%r9)
movsd %xmm9, 0x8(%rsi,%r9)
subsd %xmm8, %xmm3
subsd %xmm6, %xmm4
movsd %xmm3, (%rsi,%rdi)
movsd %xmm4, 0x8(%rsi,%rdi)
subsd %xmm5, %xmm0
addsd %xmm2, %xmm1
movsd %xmm0, (%rsi,%r8)
movsd %xmm1, 0x8(%rsi,%r8)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq