// File: /workspace/github_c_makefile_star2_O2/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 $0x48, %rsp
movl %r8d, %r15d
movl %ecx, %eax
movl %edi, %r13d
movl %edi, %r14d
subl %ecx, %r14d
pushq $0x1
popq %rbp
movl %ebp, %r12d
movl %r14d, %ecx
shll %cl, %r12d
movq %rdx, 0x8(%rsp)
movq %rsi, %r8
leal -0x2(%rax), %ebx
movl %ebx, %ecx
shll %cl, %ebp
pushq $-0x1
popq %rdx
movl %r13d, %ecx
shll %cl, %edx
notl %edx
movl %edx, %ecx
andl %r15d, %ecx
cmpl $0x2, %eax
je 0x1a4d
cmpl $0x1, %eax
jne 0x1ab4
xorl %ecx, %r12d
movl %ecx, %eax
shlq $0x4, %rax
shlq $0x4, %r12
movupd (%r8,%rax), %xmm0
movupd (%r8,%r12), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movq 0x8(%rsp), %rax
movupd %xmm2, (%rax)
subpd %xmm1, %xmm0
movupd %xmm0, 0x10(%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decb %r13b
movl %ecx, %eax
btcl %r13d, %ecx
shlq $0x4, %rax
shlq $0x4, %rcx
movupd (%r8,%rax), %xmm0
movupd (%r8,%rcx), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movq 0x8(%rsp), %rsi
movupd %xmm2, (%rsi)
subpd %xmm1, %xmm0
movupd %xmm0, 0x10(%rsi)
leal (%r12,%r15), %eax
andl %edx, %eax
shlq $0x4, %rax
movups (%r8,%rax), %xmm0
movups %xmm0, 0x20(%rsi)
subl %r12d, %r15d
andl %edx, %r15d
shlq $0x4, %r15
movupd (%r8,%r15), %xmm0
movupd %xmm0, 0x30(%rsi)
pushq $0x1
popq %rdi
jmp 0x1cd8
decl %eax
movl %r13d, %edi
movq %r8, %rsi
movq 0x8(%rsp), %rdx
movl %eax, %ecx
movq %r8, 0x10(%rsp)
movl %r15d, %r8d
callq 0x19b7
pushq $0x2
popq %rax
movl %ebx, %ecx
shll %cl, %eax
shlq $0x4, %rax
movq %rax, 0x28(%rsp)
movq 0x8(%rsp), %rcx
leaq (%rcx,%rax), %rdx
leal (%r12,%r15), %r8d
movl %r13d, %edi
movq 0x10(%rsp), %rsi
movl %ebx, %ecx
callq 0x19b7
pushq $0x3
popq %rax
movl %ebx, %ecx
shll %cl, %eax
shlq $0x4, %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rcx
leaq (%rcx,%rax), %rdx
subl %r12d, %r15d
movl %r13d, %edi
movq 0x10(%rsp), %rsi
movl %ebx, %ecx
movl %r15d, %r8d
callq 0x19b7
movl %ebp, %eax
shrl %eax
cmpl $0x1, %ebx
jbe 0x1c17
movl %ebp, %ecx
movl %eax, %r13d
movq 0x8(%rsp), %rdx
leaq 0x10(%rdx), %r15
movq %rcx, 0x18(%rsp)
movq %rcx, %rax
shlq $0x4, %rax
leaq (%rax,%rdx), %r12
addq $-0x10, %r12
pushq $0x1
popq %rbx
cmpq %r13, %rbx
jae 0x1c0b
movl %ebx, %eax
movl %r14d, %ecx
shll %cl, %eax
leaq 0x350d(%rip), %rcx      # 0x5080
movq (%rcx), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x8(%rcx,%rax), %xmm1
movaps %xmm1, 0x30(%rsp)
movl %ebp, %edi
movq %r15, %rsi
callq 0x1d6e
movapd 0x30(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movapd %xmm2, %xmm0
mulsd 0x14be(%rip), %xmm0     # 0x3070
movapd %xmm3, %xmm1
mulsd 0x145a(%rip), %xmm1     # 0x3018
subsd %xmm3, %xmm0
subsd %xmm2, %xmm1
ucomisd %xmm0, %xmm0
jp 0x1be6
movl %ebp, %edi
movq %r12, %rsi
callq 0x1d6e
incq %rbx
addq $0x10, %r15
addq $-0x10, %r12
jmp 0x1b5c
ucomisd %xmm1, %xmm1
jnp 0x1bcc
xorpd 0x143c(%rip), %xmm3     # 0x3030
movsd 0x1474(%rip), %xmm0     # 0x3070
movsd 0x165c(%rip), %xmm1     # 0x3260
callq 0x2710
jmp 0x1bcc
movq 0x8(%rsp), %rsi
movq 0x18(%rsp), %rdi
jmp 0x1c21
movl %eax, %r13d
movl %ebp, %edi
movq 0x8(%rsp), %rsi
shlq $0x4, %r13
leaq (%rsi,%r13), %rax
shlq $0x4, %rdi
movupd (%rsi,%r13), %xmm0
movq 0x28(%rsp), %rcx
movsd (%rcx,%rax), %xmm1
movsd 0x8(%rcx,%rax), %xmm2
movq 0x20(%rsp), %rdx
movhpd (%rdx,%rax), %xmm1      # xmm1 = xmm1[0],mem[0]
movapd 0x15fb(%rip), %xmm3     # 0x3250
mulpd %xmm3, %xmm1
movhpd 0x8(%rdx,%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
movupd (%rdi,%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 %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd %xmm2, (%rsi,%r13)
movapd %xmm4, %xmm2
addpd %xmm5, %xmm2
subpd %xmm5, %xmm4
movapd %xmm4, %xmm3
movsd %xmm2, %xmm3            # xmm3 = xmm2[0],xmm3[1]
movupd %xmm3, (%rdi,%rax)
subpd %xmm1, %xmm0
movupd %xmm0, (%rcx,%rax)
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movupd %xmm4, (%rdx,%rax)
movl %ebp, %edi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1cfd