// File: /workspace/github_c_makefile_star2_O3/diaxen[P]fft-garden/sr_dit_bi_G_L_P.c
// Function: fft
void
fft(unsigned N, complex double * restrict out,
    const complex double * restrict in)
{
  unsigned log2_N = 31 - clz32(N);

  /* stage 0 */
  for (unsigned j = 0, is = 0; is < N; is += 2)
    {
      unsigned i0 = sr_input_lut[is / 2];

      if (sr_sched_off[j] * 2 > is)
        {
          out[is    ] = in[i0];
          out[is + 1] = in[i0 + N / 2];
        }
      else
        {
          ct_dit_bf2_0(1, N / 2, out + is, in + i0);
          j++;
        }
    }

  /* stage 1 */
  if (log2_N > 1)
    {
      unsigned c = sr_sched_cnt[1];
      for (unsigned i = 0; i < c; i++)
        {
          unsigned o = sr_sched_off[i] << 2;
          sr_dit_bf4_0(1, out + o);
        }
    }

  /* stage 2 */
  if (log2_N > 2)
    {
      unsigned c = sr_sched_cnt[2];
      for (unsigned i = 0; i < c; i++)
        {
          unsigned o = sr_sched_off[i] << 3;

          sr_dit_bf4_0(2, out + o);
          sr_dit_bf4_pi4(2, out + o + 1);
        }
    }

  /* stage >= 3 */
  if (log2_N > 3)
    for (unsigned k = 3; k < log2_N; k++)
      {
        unsigned t = log2_N - k - 1;
        unsigned n2 = 1 << (k - 1);
        unsigned n4 = 1 << (k - 2);

        unsigned c = sr_sched_cnt[k];
        for (unsigned i = 0; i < c; i++)
          {
            unsigned o = sr_sched_off[i] << (k + 1);

            sr_dit_bf4_0(n2, out + o);
            sr_dit_bf4_pi4(n2, out + o + n4);
          }

        for (unsigned j0 = 1; j0 < n4; j0++)
          {
            complex double w1 = get_twiddle(j0 << t, log2_N);
            complex double w3 = get_twiddle_sr(j0 << t, log2_N);
            unsigned c = sr_sched_cnt[k];

            for (unsigned i = 0; i < c; i++)
              {
                unsigned o = sr_sched_off[i] << (k + 1);
                sr_dit_bf4(n2, out + o + j0, w1, w3);
              }

            unsigned j1 = j0 + n4;
            w1 = get_twiddle(j1 << t, log2_N);
	    w3 = get_twiddle_sr(j1 << t, log2_N);

            for (unsigned i = 0; i < c; i++)
              {
                unsigned o = sr_sched_off[i] << (k + 1);
                sr_dit_bf4(n2, out + o + j1, w1, w3);
              }
	  }
      }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
bsrl %edi, %eax
movl %eax, 0x4(%rsp)
je 0x19a0
leaq 0x378b(%rip), %rax      # 0x5098
movq (%rax), %rax
leaq 0x3791(%rip), %rcx      # 0x50a8
movq (%rcx), %rcx
movl %edi, %r15d
shrl %edi
leaq 0x10(%rsi), %r8
xorl %r9d, %r9d
movq %rdi, %r10
shlq $0x4, %r10
xorl %r11d, %r11d
movl (%rax,%r9,2), %ebx
movl %r11d, %r14d
movl (%rcx,%r14,4), %r14d
addl %r14d, %r14d
cmpq %r14, %r9
jae 0x1966
movq %rbx, %r14
shlq $0x4, %r14
movups (%rdx,%r14), %xmm0
movups %xmm0, -0x10(%r8)
addl %edi, %ebx
shlq $0x4, %rbx
movupd (%rdx,%rbx), %xmm0
movupd %xmm0, (%r8)
jmp 0x1993
shlq $0x4, %rbx
leaq (%rdx,%rbx), %r14
movupd (%rdx,%rbx), %xmm0
movupd (%r10,%r14), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd %xmm2, -0x10(%r8)
subpd %xmm1, %xmm0
movupd %xmm0, (%r8)
incl %r11d
addq $0x2, %r9
addq $0x20, %r8
cmpq %r15, %r9
jb 0x1930
cmpl $0x1, 0x4(%rsp)
jbe 0x20f3
movl 0x4(%rsp), %eax
xorl $0x1f, %eax
leaq 0x36e7(%rip), %rcx      # 0x50a0
movq (%rcx), %rcx
movl 0x4(%rcx), %edx
testq %rdx, %rdx
je 0x1a54
leaq 0x36d9(%rip), %rdi      # 0x50a8
movq (%rdi), %r9
xorl %edi, %edi
movl (%r9,%rdi,4), %r8d
shll $0x2, %r8d
shlq $0x4, %r8
movupd (%rsi,%r8), %xmm0
movupd 0x10(%rsi,%r8), %xmm1
movupd 0x20(%rsi,%r8), %xmm2
movupd 0x30(%rsi,%r8), %xmm3
movapd %xmm2, %xmm4
addpd %xmm3, %xmm4
movapd %xmm0, %xmm5
addpd %xmm4, %xmm5
movupd %xmm5, (%rsi,%r8)
subpd %xmm3, %xmm2
shufpd $0x1, %xmm2, %xmm2      # xmm2 = xmm2[1,0]
movapd %xmm1, %xmm3
addpd %xmm2, %xmm3
subpd %xmm2, %xmm1
movapd %xmm1, %xmm2
movsd %xmm3, %xmm2            # xmm2 = xmm3[0],xmm2[1]
movupd %xmm2, 0x10(%rsi,%r8)
subpd %xmm4, %xmm0
movupd %xmm0, 0x20(%rsi,%r8)
shufpd $0x2, %xmm3, %xmm1      # xmm1 = xmm1[0],xmm3[1]
movupd %xmm1, 0x30(%rsi,%r8)
incq %rdi
cmpq %rdi, %rdx
jne 0x19d4
cmpl $0x1d, %eax
je 0x20f3
movl 0x8(%rcx), %ecx
testq %rcx, %rcx
je 0x1be2
leaq 0x3638(%rip), %rdx      # 0x50a8
movq (%rdx), %rdx
xorl %r8d, %r8d
movapd 0x17a2(%rip), %xmm0     # 0x3220
movapd 0x17aa(%rip), %xmm1     # 0x3230
movl (%rdx,%r8,4), %edi
shll $0x3, %edi
shlq $0x4, %rdi
movsd 0x28(%rsi,%rdi), %xmm2
movupd 0x40(%rsi,%rdi), %xmm3
movupd 0x60(%rsi,%rdi), %xmm5
movupd (%rsi,%rdi), %xmm6
movapd %xmm3, %xmm4
subpd %xmm5, %xmm4
addpd %xmm5, %xmm3
movapd %xmm6, %xmm5
addpd %xmm3, %xmm5
movapd %xmm2, %xmm7
subsd %xmm4, %xmm7
movupd %xmm5, (%rsi,%rdi)
movsd %xmm7, 0x28(%rsi,%rdi)
subpd %xmm3, %xmm6
addsd %xmm4, %xmm2
movupd %xmm6, 0x40(%rsi,%rdi)
movsd %xmm2, 0x68(%rsi,%rdi)
movsd 0x10(%rsi,%rdi), %xmm6
movsd 0x30(%rsi,%rdi), %xmm2
movsd 0x38(%rsi,%rdi), %xmm3
movupd 0x50(%rsi,%rdi), %xmm8
mulpd %xmm0, %xmm8
movapd %xmm8, %xmm7
unpckhpd %xmm8, %xmm7            # xmm7 = xmm7[1],xmm8[1]
movapd %xmm8, %xmm5
movupd 0x70(%rsi,%rdi), %xmm9
mulpd %xmm1, %xmm9
addsd %xmm7, %xmm5
movapd %xmm9, %xmm10
unpckhpd %xmm9, %xmm10           # xmm10 = xmm10[1],xmm9[1]
movapd %xmm9, %xmm11
subsd %xmm8, %xmm7
addsd %xmm10, %xmm11
movapd %xmm5, %xmm8
addsd %xmm11, %xmm8
subsd %xmm10, %xmm9
subsd %xmm11, %xmm5
movapd %xmm7, %xmm10
subsd %xmm9, %xmm7
addpd %xmm9, %xmm10
movapd %xmm6, %xmm9
addsd %xmm8, %xmm9
movsd %xmm9, 0x10(%rsi,%rdi)
shufpd $0x2, %xmm4, %xmm10     # xmm10 = xmm10[0],xmm4[1]
movupd 0x18(%rsi,%rdi), %xmm4
movapd %xmm4, %xmm9
movapd %xmm2, %xmm11
addpd %xmm10, %xmm9
addsd %xmm7, %xmm11
movapd %xmm3, %xmm12
subsd %xmm5, %xmm12
movupd %xmm9, 0x18(%rsi,%rdi)
movsd %xmm11, 0x30(%rsi,%rdi)
movsd %xmm12, 0x38(%rsi,%rdi)
subsd %xmm8, %xmm6
movsd %xmm6, 0x50(%rsi,%rdi)
subpd %xmm10, %xmm4
subsd %xmm7, %xmm2
addsd %xmm3, %xmm5
movupd %xmm4, 0x58(%rsi,%rdi)
movsd %xmm2, 0x70(%rsi,%rdi)
movsd %xmm5, 0x78(%rsi,%rdi)
incq %r8
cmpq %r8, %rcx
jne 0x1a86
cmpl $0x4, 0x4(%rsp)
jb 0x20f3
movl $0x1c, %ecx
subl %eax, %ecx
movl $0x1, %edx
movl %ecx, 0x10(%rsp)
shll %cl, %edx
movq %rdx, 0x40(%rsp)
leal -0x1(%rdx), %ecx
movl %ecx, 0xc(%rsp)
movl $0x1e, %ecx
subl %eax, %ecx
movl %ecx, 0x8(%rsp)
movl 0x4(%rsp), %eax
movq %rax, 0x78(%rsp)
movl $0x3, %ebp
leaq 0x347d(%rip), %r12      # 0x50a8
movsd 0x160c(%rip), %xmm11    # 0x3240
movsd 0x160b(%rip), %xmm12    # 0x3248
movq %rsi, 0x20(%rsp)
leal -0x1(%rbp), %eax
movl $0x1, %r15d
movl %eax, %ecx
shll %cl, %r15d
leal -0x2(%rbp), %ecx
movl $0x1, %edi
shll %cl, %edi
leaq 0x343f(%rip), %rcx      # 0x50a0
movq (%rcx), %rcx
movl (%rcx,%rbp,4), %edx
movq %rdi, 0x18(%rsp)
movl %edi, %ecx
movq %rcx, 0x38(%rsp)
testq %rdx, %rdx
je 0x1e11
movq (%r12), %r14
movl $0x2, %edi
movl %eax, %ecx
shll %cl, %edi
movl $0x3, %r8d
shll %cl, %r8d
movl %r15d, %eax
leal 0x1(%rbp), %ecx
shlq $0x4, %rax
shlq $0x4, %rdi
shlq $0x4, %r8
movq 0x38(%rsp), %r9
shlq $0x4, %r9
xorl %r10d, %r10d
movl (%r14,%r10,4), %ebx
shll %cl, %ebx
shlq $0x4, %rbx
leaq (%rsi,%rbx), %r11
movupd (%rsi,%rbx), %xmm0
movupd (%rdi,%r11), %xmm1
movupd (%r8,%r11), %xmm2
movapd %xmm1, %xmm3
addpd %xmm2, %xmm3
movapd %xmm0, %xmm4
addpd %xmm3, %xmm4
movupd %xmm4, (%rsi,%rbx)
movupd (%rax,%r11), %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, (%rax,%r11)
subpd %xmm3, %xmm0
shufpd $0x2, %xmm2, %xmm4      # xmm4 = xmm4[0],xmm2[1]
movupd %xmm0, (%rdi,%r11)
movupd %xmm4, (%r8,%r11)
leaq (%r11,%r9), %rbx
movsd (%r9,%r11), %xmm3
movsd 0x8(%r9,%r11), %xmm0
movsd (%rax,%rbx), %xmm1
movsd 0x8(%rax,%rbx), %xmm2
movsd (%rdi,%rbx), %xmm6
mulsd %xmm11, %xmm6
movsd 0x8(%rdi,%rbx), %xmm4
mulsd %xmm11, %xmm4
movsd 0x8(%r8,%rbx), %xmm7
mulsd %xmm11, %xmm7
movapd %xmm6, %xmm5
addsd %xmm4, %xmm5
movsd (%r8,%rbx), %xmm8
subsd %xmm6, %xmm4
mulsd %xmm12, %xmm8
movapd %xmm8, %xmm6
subsd %xmm7, %xmm8
addsd %xmm7, %xmm6
movapd %xmm5, %xmm7
subsd %xmm6, %xmm5
movapd %xmm4, %xmm9
addsd %xmm6, %xmm7
addsd %xmm8, %xmm9
subsd %xmm8, %xmm4
movapd %xmm3, %xmm6
addsd %xmm7, %xmm6
movapd %xmm0, %xmm8
addsd %xmm9, %xmm8
movapd %xmm1, %xmm10
movsd %xmm6, (%r9,%r11)
addsd %xmm4, %xmm10
movapd %xmm2, %xmm6
subsd %xmm5, %xmm6
movsd %xmm8, 0x8(%r9,%r11)
movsd %xmm10, (%rax,%rbx)
subsd %xmm7, %xmm3
subsd %xmm9, %xmm0
movsd %xmm6, 0x8(%rax,%rbx)
movsd %xmm3, (%rdi,%rbx)
subsd %xmm4, %xmm1
addsd %xmm2, %xmm5
movsd %xmm0, 0x8(%rdi,%rbx)
movsd %xmm1, (%r8,%rbx)
movsd %xmm5, 0x8(%r8,%rbx)
incq %r10
cmpq %r10, %rdx
jne 0x1cb0
movl %ebp, %eax
notl %eax
addl 0x4(%rsp), %eax
movl %eax, 0x14(%rsp)
leaq 0x1(%rbp), %r13
movq 0x18(%rsp), %rcx
cmpl $0x3, %ecx
movl $0x2, %eax
cmovbl %eax, %ecx
movq %rcx, 0x18(%rsp)
movl $0x1, %ebx
movq %rbp, 0x80(%rsp)
movl %ebx, %edi
movl 0x14(%rsp), %ecx
shll %cl, %edi
movl %edi, %edx
movl 0x10(%rsp), %ecx
shrl %cl, %edx
movl %edi, %eax
movl 0xc(%rsp), %r10d
andl %r10d, %eax
movq 0x40(%rsp), %r11
movl %r11d, %r9d
subl %eax, %r9d
btl %ecx, %edi
cmovael %eax, %r9d
movl %edx, %esi
shrl %esi
xorl %edx, %esi
movl %esi, %r8d
andl $0x1, %r8d
leaq 0x31fd(%rip), %rax      # 0x5080
movq (%rax), %rax
shlq $0x4, %r9
addq %rax, %r9
shlq $0x3f, %rdx
xorq (%r9,%r8,8), %rdx
xorl $0x1, %r8d
shlq $0x3f, %rsi
xorq (%r9,%r8,8), %rsi
leal (%rdi,%rdi,2), %edi
movl %edi, %r9d
andl %r10d, %r9d
movl %edi, %r8d
shrl %cl, %r8d
subl %r9d, %r11d
btl %ecx, %edi
cmovael %r9d, %r11d
movl %r8d, %r9d
shrl %r9d
xorl %r8d, %r9d
movl %r9d, %r10d
andl $0x1, %r10d
shlq $0x4, %r11
addq %rax, %r11
shlq $0x3f, %r8
xorq (%r11,%r10,8), %r8
xorl $0x1, %r10d
shlq $0x3f, %r9
xorq (%r11,%r10,8), %r9
movq %r9, %xmm1
movq %r8, %xmm2
movl 0x8(%rsp), %ecx
shrl %cl, %edi
testl %edi, %edi
je 0x1f09
movdqa 0x112f(%rip), %xmm0     # 0x3030
pxor %xmm0, %xmm2
pxor %xmm0, %xmm1
leaq 0x3190(%rip), %rcx      # 0x50a0
movq (%rcx), %rcx
movl (%rcx,%rbp,4), %r14d
testq %r14, %r14
movq %rbx, 0x48(%rsp)
je 0x1f8f
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq %rbx, %rbp
shlq $0x4, %rbp
addq 0x20(%rsp), %rbp
xorl %ebx, %ebx
movdqa %xmm1, 0x60(%rsp)
movdqa %xmm2, 0x50(%rsp)
movq (%r12), %rax
movl (%rax,%rbx,4), %esi
movl %r13d, %ecx
shll %cl, %esi
shlq $0x4, %rsi
addq %rbp, %rsi
movl %r15d, %edi
movq 0x28(%rsp), %xmm0
movq 0x30(%rsp), %xmm1
movdqa 0x50(%rsp), %xmm2
movapd 0x60(%rsp), %xmm3
callq 0x2105
incq %rbx
cmpq %rbx, %r14
jne 0x1f45
leaq 0x30f9(%rip), %rax      # 0x5080
movq (%rax), %rax
movq 0x48(%rsp), %rbx
movq 0x38(%rsp), %rcx
leaq (%rbx,%rcx), %rbp
movl %ebp, %edi
movl 0x14(%rsp), %ecx
shll %cl, %edi
movl %edi, %esi
movl 0xc(%rsp), %r11d
andl %r11d, %esi
movl %edi, %edx
movl 0x10(%rsp), %ecx
shrl %cl, %edx
movq 0x40(%rsp), %r10
movl %r10d, %r9d
subl %esi, %r9d
btl %ecx, %edi
cmovael %esi, %r9d
movl %edx, %esi
shrl %esi
xorl %edx, %esi
movl %esi, %r8d
andl $0x1, %r8d
shlq $0x4, %r9
addq %rax, %r9
shlq $0x3f, %rdx
xorq (%r9,%r8,8), %rdx
xorl $0x1, %r8d
shlq $0x3f, %rsi
xorq (%r9,%r8,8), %rsi
leal (%rdi,%rdi,2), %edi
movl %edi, %r9d
andl %r11d, %r9d
movl %edi, %r8d
shrl %cl, %r8d
subl %r9d, %r10d
btl %ecx, %edi
cmovael %r9d, %r10d
movl %r8d, %r9d
shrl %r9d
xorl %r8d, %r9d
shlq $0x4, %r10
addq %rax, %r10
movl %r9d, %eax
andl $0x1, %eax
shlq $0x3f, %r8
xorq (%r10,%rax,8), %r8
xorl $0x1, %eax
shlq $0x3f, %r9
xorq (%r10,%rax,8), %r9
movq %r9, %xmm1
movq %r8, %xmm2
movl 0x8(%rsp), %ecx
shrl %cl, %edi
testl %edi, %edi
je 0x2052
movdqa 0xfe6(%rip), %xmm0      # 0x3030
pxor %xmm0, %xmm2
pxor %xmm0, %xmm1
testq %r14, %r14
je 0x20b3
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
shlq $0x4, %rbp
addq 0x20(%rsp), %rbp
xorl %ebx, %ebx
movdqa %xmm1, 0x60(%rsp)
movdqa %xmm2, 0x50(%rsp)
movq (%r12), %rax
movl (%rax,%rbx,4), %esi
movl %r13d, %ecx
shll %cl, %esi
shlq $0x4, %rsi
addq %rbp, %rsi
movl %r15d, %edi
movq 0x28(%rsp), %xmm0
movq 0x30(%rsp), %xmm1
movdqa 0x50(%rsp), %xmm2
movapd 0x60(%rsp), %xmm3
callq 0x2105
incq %rbx
cmpq %rbx, %r14
jne 0x2078
movq 0x48(%rsp), %rbx
incq %rbx
cmpq 0x18(%rsp), %rbx
movq 0x80(%rsp), %rbp
movsd 0x116f(%rip), %xmm11    # 0x3240
movsd 0x116e(%rip), %xmm12    # 0x3248
jne 0x1e43
movq %r13, %rbp
cmpq 0x78(%rsp), %r13
movq 0x20(%rsp), %rsi
jne 0x1c42
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq