// File: /workspace/github_c_makefile_star2_O3/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 $0x68, %rsp
movl %r8d, %r13d
movl %ecx, %eax
movl %edi, %ebp
movl %edi, %r15d
subl %ecx, %r15d
movl $0x1, %r14d
movl %r15d, %ecx
shll %cl, %r14d
movl $0x1, %r12d
leal -0x2(%rax), %ebx
movl %ebx, %ecx
shll %cl, %r12d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl %ebp, %ecx
shll %cl, %edi
notl %edi
movl %edi, %ecx
andl %r8d, %ecx
cmpl $0x2, %eax
je 0x1aa4
cmpl $0x1, %eax
jne 0x1b39
xorl %ecx, %r14d
movl %ecx, %eax
shlq $0x4, %rax
shlq $0x4, %r14
movupd (%rsi,%rax), %xmm0
movupd (%rsi,%r14), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd %xmm2, (%rdx)
subpd %xmm1, %xmm0
movupd %xmm0, 0x10(%rdx)
jmp 0x1de2
decb %bpl
movl %ecx, %eax
btcl %ebp, %ecx
shlq $0x4, %rax
shlq $0x4, %rcx
leal (%r14,%r13), %r8d
andl %edi, %r8d
shlq $0x4, %r8
subl %r14d, %r13d
andl %edi, %r13d
shlq $0x4, %r13
movupd (%rsi,%rax), %xmm0
movupd (%rsi,%rcx), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd (%rsi,%r8), %xmm3
movupd (%rsi,%r13), %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 0x1de2
decl %eax
movl %ebp, %edi
movl %eax, %ecx
movq %rdx, 0x10(%rsp)
movq %rsi, 0x18(%rsp)
movl %r13d, %r8d
callq 0x1a1f
movl $0x2, %eax
movl %ebx, %ecx
shll %cl, %eax
movl $0x2, %ecx
movq %rcx, 0x20(%rsp)
shlq $0x4, %rax
movq %rax, 0x38(%rsp)
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax), %rdx
leal (%r14,%r13), %r8d
movl %ebp, %edi
movq 0x18(%rsp), %rsi
movq %rdx, 0x48(%rsp)
movl %ebx, %ecx
callq 0x1a1f
movl $0x3, %eax
movl %ebx, %ecx
shll %cl, %eax
shlq $0x4, %rax
movq %rax, 0x30(%rsp)
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax), %rdx
subl %r14d, %r13d
movl %ebp, %edi
movq 0x18(%rsp), %rsi
movq %rdx, 0x40(%rsp)
movl %ebx, %ecx
movl %r13d, %r8d
callq 0x1a1f
movl %r12d, %eax
shrl %eax
movl %eax, 0xc(%rsp)
movl %r12d, %eax
movq %rax, 0x28(%rsp)
cmpl $0x2, %ebx
jb 0x1cbb
movl 0xc(%rsp), %ecx
cmpl $0x3, %ecx
movq 0x20(%rsp), %rax
cmovael %ecx, %eax
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rcx
leaq 0x10(%rcx), %r14
movq 0x28(%rsp), %rax
shlq $0x4, %rax
leaq (%rax,%rcx), %r13
addq $-0x10, %r13
movl $0x1, %ebx
leaq 0x346b(%rip), %rbp      # 0x5080
movl %ebx, %eax
movl %r15d, %ecx
shll %cl, %eax
movq (%rbp), %rcx
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x8(%rcx,%rax), %xmm1
movaps %xmm1, 0x50(%rsp)
movl %r12d, %edi
movq %r14, %rsi
callq 0x1e06
movapd 0x50(%rsp), %xmm3
movsd 0x18(%rsp), %xmm2
movapd %xmm2, %xmm0
mulsd 0x1413(%rip), %xmm0     # 0x3070
movapd %xmm3, %xmm1
mulsd 0x13af(%rip), %xmm1     # 0x3018
subsd %xmm3, %xmm0
subsd %xmm2, %xmm1
ucomisd %xmm0, %xmm0
jp 0x1c96
movl %r12d, %edi
movq %r13, %rsi
callq 0x1e06
incq %rbx
addq $0x10, %r14
addq $-0x10, %r13
cmpq %rbx, 0x20(%rsp)
jne 0x1c15
jmp 0x1cbb
ucomisd %xmm1, %xmm1
jnp 0x1c77
xorpd 0x138c(%rip), %xmm3     # 0x3030
movsd 0x13c4(%rip), %xmm0     # 0x3070
movsd 0x15ac(%rip), %xmm1     # 0x3260
callq 0x2770
jmp 0x1c77
movl 0xc(%rsp), %ecx
shlq $0x4, %rcx
movq 0x10(%rsp), %rdx
leaq (%rdx,%rcx), %rax
movq 0x28(%rsp), %r8
shlq $0x4, %r8
movupd (%rdx,%rcx), %xmm0
movq 0x38(%rsp), %rsi
movsd (%rsi,%rax), %xmm1
movsd 0x8(%rsi,%rax), %xmm2
movq 0x30(%rsp), %rdi
movhpd (%rdi,%rax), %xmm1      # xmm1 = xmm1[0],mem[0]
movapd 0x1554(%rip), %xmm3     # 0x3250
mulpd %xmm3, %xmm1
movhpd 0x8(%rdi,%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
movapd %xmm0, %xmm4
addpd %xmm1, %xmm4
movupd %xmm4, (%rdx,%rcx)
movupd (%r8,%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, (%r8,%rax)
subpd %xmm1, %xmm0
movupd %xmm0, (%rsi,%rax)
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movupd %xmm4, (%rdi,%rax)
movupd (%rdx), %xmm0
movq 0x48(%rsp), %rax
movupd (%rax), %xmm1
movq 0x40(%rsp), %rcx
movupd (%rcx), %xmm2
movapd %xmm1, %xmm3
addpd %xmm2, %xmm3
movapd %xmm0, %xmm4
addpd %xmm3, %xmm4
movupd %xmm4, (%rdx)
movupd (%rdx,%r8), %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, (%rdx,%r8)
subpd %xmm3, %xmm0
movupd %xmm0, (%rax)
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movupd %xmm4, (%rcx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq