// File: /workspace/github_c_makefile_star2_O2/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, %r13d
movl %edi, %ebp
subl %ecx, %ebp
pushq $0x1
popq %r14
movl %r14d, %r12d
movl %ebp, %ecx
shll %cl, %r12d
movq %rdx, %rbx
leal -0x2(%rax), %edi
movl %edi, %ecx
shll %cl, %r14d
pushq $-0x1
popq %rdx
movl %r13d, %ecx
shll %cl, %edx
notl %edx
movl %edx, %ecx
andl %r8d, %ecx
cmpl $0x2, %eax
je 0x1a41
cmpl $0x1, %eax
jne 0x1aaf
xorl %ecx, %r12d
movl %ecx, %eax
shlq $0x4, %rax
shlq $0x4, %r12
movupd (%rsi,%rax), %xmm0
movupd (%rsi,%r12), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd %xmm2, (%rbx)
subpd %xmm1, %xmm0
movupd %xmm0, 0x10(%rbx)
addq $0x28, %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 (%rsi,%rax), %xmm0
movupd (%rsi,%rcx), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd %xmm2, (%rbx)
subpd %xmm1, %xmm0
movupd %xmm0, 0x10(%rbx)
leal (%r12,%r15), %eax
andl %edx, %eax
shlq $0x4, %rax
movups (%rsi,%rax), %xmm0
movups %xmm0, 0x20(%rbx)
subl %r12d, %r15d
andl %edx, %r15d
shlq $0x4, %r15
movups (%rsi,%r15), %xmm0
movups %xmm0, 0x30(%rbx)
pushq $0x1
popq %rdi
movq %rbx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1c74
decl %eax
movl %edi, 0xc(%rsp)
movl %r13d, %edi
movq %rsi, 0x10(%rsp)
movq %rbx, %rdx
movl %eax, %ecx
movl %r15d, %r8d
callq 0x19b7
pushq $0x2
popq %rax
movl 0xc(%rsp), %ecx
shll %cl, %eax
shlq $0x4, %rax
movq %rax, 0x20(%rsp)
leaq (%rbx,%rax), %rdx
leal (%r12,%r15), %r8d
movl %r13d, %edi
movq 0x10(%rsp), %rsi
callq 0x19b7
pushq $0x3
popq %rax
movl 0xc(%rsp), %ecx
shll %cl, %eax
shlq $0x4, %rax
movq %rax, 0x18(%rsp)
leaq (%rbx,%rax), %rdx
subl %r12d, %r15d
movl %r13d, %edi
movq 0x10(%rsp), %rsi
movl %r15d, %r8d
callq 0x19b7
movl %r14d, %edi
movq %rbx, %rsi
callq 0x1c74
movl %r14d, %r13d
shrl %r13d
addq $0x20, %rbx
pushq $0x1
popq %r15
leaq 0x3546(%rip), %r12      # 0x5080
cmpq %r13, %r15
jae 0x1b6e
leaq -0x10(%rbx), %rsi
movl %r15d, %eax
movl %ebp, %ecx
shll %cl, %eax
movq (%r12), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd 0x8(%rcx,%rax), %xmm1
movl %r14d, %edi
callq 0x1ce5
incq %r15
addq $0x10, %rbx
jmp 0x1b3a
movl %r14d, %r13d
movq %r13, %rax
shlq $0x4, %rax
movupd -0x10(%rbx), %xmm0
movq 0x20(%rsp), %rcx
movsd -0x10(%rbx,%rcx), %xmm1
movsd -0x8(%rbx,%rcx), %xmm2
movq 0x18(%rsp), %rdx
movhpd -0x10(%rbx,%rdx), %xmm1 # xmm1 = xmm1[0],mem[0]
movapd 0x16af(%rip), %xmm3     # 0x3250
mulpd %xmm3, %xmm1
movhpd -0x8(%rbx,%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, -0x10(%rbx)
movupd -0x10(%rbx,%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 %xmm4, %xmm2
addpd %xmm5, %xmm2
subpd %xmm5, %xmm4
movapd %xmm4, %xmm3
movsd %xmm2, %xmm3            # xmm3 = xmm2[0],xmm3[1]
movupd %xmm3, -0x10(%rbx,%rax)
subpd %xmm1, %xmm0
movupd %xmm0, -0x10(%rbx,%rcx)
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movupd %xmm4, -0x10(%rbx,%rdx)
incq %r15
cmpq %r13, %r15
jae 0x1a32
movl %r15d, %eax
movl %ebp, %ecx
shll %cl, %eax
movq (%r12), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd 0x8(%rcx,%rax), %xmm1
movl %r14d, %edi
movq %rbx, %rsi
callq 0x1ce5
incq %r15
addq $0x10, %rbx
jmp 0x1c28