// File: /workspace/github_c_makefile_star2_O3/diaxen[P]fft-garden/cp_dit_dr_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 k;
      cp_dit_bf_0(os, out);

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

      cp_dit_bf_pi4(os, out + k);

      for (k += 1; k < os; k++)
	cp_dit_bf(os, out + k, get_twiddle(k << t, log2_N));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r15d
movl %ecx, %eax
movl %edi, %ebx
movl %edi, %ebp
subl %ecx, %ebp
movl $0x1, %r13d
movl %ebp, %ecx
shll %cl, %r13d
movl $0x1, %r14d
leal -0x2(%rax), %r12d
movl %r12d, %ecx
shll %cl, %r14d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl %ebx, %ecx
shll %cl, %edi
notl %edi
movl %edi, %ecx
andl %r8d, %ecx
cmpl $0x2, %eax
je 0x1aa3
cmpl $0x1, %eax
jne 0x1b37
xorl %ecx, %r13d
movl %ecx, %eax
shlq $0x4, %rax
shlq $0x4, %r13
movupd (%rsi,%rax), %xmm0
movupd (%rsi,%r13), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd %xmm2, (%rdx)
subpd %xmm1, %xmm0
movupd %xmm0, 0x10(%rdx)
jmp 0x1d93
decb %bl
movl %ecx, %eax
btcl %ebx, %ecx
shlq $0x4, %rax
shlq $0x4, %rcx
leal (%r15,%r13), %r8d
andl %edi, %r8d
shlq $0x4, %r8
subl %r13d, %r15d
andl %edi, %r15d
shlq $0x4, %r15
movupd (%rsi,%rax), %xmm0
movupd (%rsi,%rcx), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd (%rsi,%r8), %xmm3
movupd (%rsi,%r15), %xmm4
movapd %xmm4, %xmm5
addpd %xmm3, %xmm5
movapd %xmm2, %xmm6
addpd %xmm5, %xmm6
movupd %xmm6, (%rdx)
subpd %xmm1, %xmm0
subpd %xmm4, %xmm3
shufpd $0x1, %xmm3, %xmm3      # xmm3 = xmm3[1,0]
movapd %xmm0, %xmm1
addpd %xmm3, %xmm1
subpd %xmm3, %xmm0
movapd %xmm0, %xmm3
movsd %xmm1, %xmm3            # xmm3 = xmm1[0],xmm3[1]
movupd %xmm3, 0x10(%rdx)
subpd %xmm5, %xmm2
movupd %xmm2, 0x20(%rdx)
shufpd $0x2, %xmm1, %xmm0      # xmm0 = xmm0[0],xmm1[1]
movupd %xmm0, 0x30(%rdx)
jmp 0x1d93
decl %eax
movl %ebx, %edi
movl %eax, %ecx
movq %rdx, 0x8(%rsp)
movq %rsi, (%rsp)
movl %r15d, %r8d
callq 0x1a1f
movl $0x2, %edx
movl %r12d, %ecx
shll %cl, %edx
movl %r12d, %ecx
movl %r12d, 0x14(%rsp)
movl $0x2, %r12d
shlq $0x4, %rdx
movq %rdx, 0x20(%rsp)
movq 0x8(%rsp), %rax
addq %rax, %rdx
leal (%r15,%r13), %r8d
movl %ebx, %edi
movq (%rsp), %rsi
callq 0x1a1f
movl $0x3, %edx
movl 0x14(%rsp), %ecx
shll %cl, %edx
shlq $0x4, %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rsp), %rax
addq %rax, %rdx
subl %r13d, %r15d
movl %ebx, %edi
movq (%rsp), %rsi
movl %ecx, %ebx
movl %r15d, %r8d
callq 0x1a1f
movq 0x8(%rsp), %rsi
movq %r14, %r9
shlq $0x4, %r9
movupd (%rsi), %xmm0
movq 0x20(%rsp), %rax
movupd (%rsi,%rax), %xmm1
movq 0x18(%rsp), %rcx
movupd (%rsi,%rcx), %xmm2
movapd %xmm1, %xmm3
addpd %xmm2, %xmm3
movapd %xmm0, %xmm4
addpd %xmm3, %xmm4
movupd %xmm4, (%rsi)
movupd (%rsi,%r9), %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, (%rsi,%r9)
subpd %xmm3, %xmm0
movupd %xmm0, (%rsi,%rax)
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movupd %xmm4, (%rsi,%rcx)
movl $0x1, %eax
cmpl $0x2, %ebx
jb 0x1c90
movq %r9, (%rsp)
movl %r14d, %eax
shrl %eax
cmpl $0x3, %eax
cmovael %eax, %r12d
leaq 0x10(%rsi), %rbx
movl $0x1, %r13d
leaq 0x342c(%rip), %r15      # 0x5080
movl %r13d, %eax
movl %ebp, %ecx
shll %cl, %eax
movq (%r15), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd 0x8(%rcx,%rax), %xmm1
movl %r14d, %edi
movq %rbx, %rsi
callq 0x1db7
incq %r13
addq $0x10, %rbx
cmpq %r13, %r12
jne 0x1c54
movl %r12d, %eax
movq 0x8(%rsp), %rsi
movq (%rsp), %r9
movl %eax, %r12d
movq %r12, %rcx
shlq $0x4, %rcx
leaq (%rsi,%rcx), %rdx
movupd (%rsi,%rcx), %xmm0
movq 0x20(%rsp), %rdi
movsd (%rdi,%rdx), %xmm1
movsd 0x8(%rdi,%rdx), %xmm2
movq 0x18(%rsp), %r8
movhpd (%r8,%rdx), %xmm1       # xmm1 = xmm1[0],mem[0]
movapd 0x158a(%rip), %xmm3     # 0x3250
mulpd %xmm3, %xmm1
movhpd 0x8(%r8,%rdx), %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, (%rsi,%rcx)
movupd (%r9,%rdx), %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, (%r9,%rdx)
subpd %xmm1, %xmm0
movupd %xmm0, (%rdi,%rdx)
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movupd %xmm4, (%r8,%rdx)
incl %eax
cmpl %r14d, %eax
jae 0x1d93
incq %r12
leaq (%rcx,%rsi), %rbx
addq $0x10, %rbx
leaq 0x331d(%rip), %r15      # 0x5080
movl %r12d, %eax
movl %ebp, %ecx
shll %cl, %eax
movq (%r15), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd 0x8(%rcx,%rax), %xmm1
movl %r14d, %edi
movq %rbx, %rsi
callq 0x1db7
incq %r12
addq $0x10, %rbx
cmpq %r12, %r14
jne 0x1d63
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq