// File: /workspace/github_c_makefile_star2_O0/diaxen[P]fft-garden/cp_dit_di.c
// Function: fft
void
fft(unsigned N, complex double * restrict out,
    const complex double * restrict in)
{
  unsigned log2_N = 31 - clz32(N);
  unsigned r = 32 - log2_N;
  uint32_t p = 0, q = 0;

  for (uint32_t hn, h = 0; h < N; h = hn) {

    /* eval binary carry sequence */
    hn = h + 2;
    unsigned c = 30 - clz32(h ^ hn);

    /* input indices */
    unsigned i0 = (p - q) >> r;
    unsigned i1 = i0 ^ (N >> 1);

    if (c & 1) {                /* stage 1 */
      out[h    ] = in[i0];
      out[h + 1] = in[i1];

    } else {			/* stage 0 */
      complex double a = in[i0];
      complex double b = in[i1];
      out[h    ] = a + b;
      out[h + 1] = a - b;
    }

    /* higher stages */
    for (unsigned j = 1 - (c & 1); j < c; j += 2)
      {
        unsigned s = 1 << j;
        unsigned r = h + 2 - 4 * s;
        unsigned t = log2_N - j - 2;
	unsigned b;

	for (b = 0; b < s; b++)
	  cp_dit_bf(s, out + r + b, get_twiddle(b << t, log2_N));
      }

    /* advance to next input index */
    uint32_t m2 = 0x20000000 >> c;
    uint32_t m1 = m2 - 1;
    uint32_t m  = p & m2;
    q = (q & m1) | m;
    p = (p & m1) | ((m ^ m2) << 1);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl -0x4(%rbp), %eax
bsrl %eax, %ecx
xorl $0x1f, %ecx
movl $0x1f, %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl $0x20, %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x4(%rbp), %eax
jae 0x2138
movl -0x30(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
xorl -0x2c(%rbp), %eax
bsrl %eax, %ecx
xorl $0x1f, %ecx
movl $0x1e, %eax
subl %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x24(%rbp), %eax
subl -0x28(%rbp), %eax
movl -0x20(%rbp), %ecx
shrl %cl, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl -0x4(%rbp), %ecx
shrl %ecx
xorl %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x34(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1f50
movq -0x18(%rbp), %rax
movl -0x38(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movsd (%rax), %xmm1
movsd 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm1, (%rax)
movsd %xmm0, 0x8(%rax)
movq -0x18(%rbp), %rax
movl -0x3c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movsd (%rax), %xmm1
movsd 0x8(%rax), %xmm0
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm1, (%rax)
movsd %xmm0, 0x8(%rax)
jmp 0x1ffd
movq -0x18(%rbp), %rax
movl -0x38(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movsd (%rax), %xmm1
movsd 0x8(%rax), %xmm0
movsd %xmm1, -0x50(%rbp)
movsd %xmm0, -0x48(%rbp)
movq -0x18(%rbp), %rax
movl -0x3c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movsd (%rax), %xmm1
movsd 0x8(%rax), %xmm0
movsd %xmm1, -0x60(%rbp)
movsd %xmm0, -0x58(%rbp)
movsd -0x50(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
movsd -0x60(%rbp), %xmm3
movsd -0x58(%rbp), %xmm2
addsd %xmm3, %xmm1
addsd %xmm2, %xmm0
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm1, (%rax)
movsd %xmm0, 0x8(%rax)
movsd -0x50(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
movsd -0x60(%rbp), %xmm3
movsd -0x58(%rbp), %xmm2
subsd %xmm3, %xmm1
subsd %xmm2, %xmm0
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm1, (%rax)
movsd %xmm0, 0x8(%rax)
movl -0x34(%rbp), %ecx
andl $0x1, %ecx
movl $0x1, %eax
subl %ecx, %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x34(%rbp), %eax
jae 0x20d1
movl -0x64(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x68(%rbp)
movl -0x30(%rbp), %eax
addl $0x2, %eax
movl -0x68(%rbp), %ecx
shll $0x2, %ecx
subl %ecx, %eax
movl %eax, -0x6c(%rbp)
movl -0x1c(%rbp), %eax
subl -0x64(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x68(%rbp), %eax
jae 0x20c1
movl -0x68(%rbp), %eax
movl %eax, -0xa4(%rbp)
movq -0x10(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl -0x74(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movl -0x74(%rbp), %edi
movl -0x70(%rbp), %ecx
shll %cl, %edi
movl -0x1c(%rbp), %esi
callq 0x2ca0
movl -0xa4(%rbp), %edi
movq -0xa0(%rbp), %rsi
movsd %xmm0, -0x88(%rbp)
movsd %xmm1, -0x80(%rbp)
movsd -0x88(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
callq 0x2150
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x204a
jmp 0x20c3
movl -0x64(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x64(%rbp)
jmp 0x200d
movl -0x34(%rbp), %ecx
movl $0x20000000, %eax       # imm = 0x20000000
sarl %cl, %eax
movl %eax, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x90(%rbp)
movl -0x24(%rbp), %eax
andl -0x8c(%rbp), %eax
movl %eax, -0x94(%rbp)
movl -0x28(%rbp), %eax
andl -0x90(%rbp), %eax
orl -0x94(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
andl -0x90(%rbp), %eax
movl -0x94(%rbp), %ecx
xorl -0x8c(%rbp), %ecx
shll %ecx
orl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
jmp 0x1e99
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)