// File: /workspace/github_cpp_makefile_star2_O3/markondej[P]phase_correl/phase_correl.cpp
// Function: PhaseCorrelation::Dit2FFT(std::vector<std::complex<double>, std::allocator<std::complex<double>>> const&, std::vector<std::complex<double>, std::allocator<std::complex<double>>>&, bool)
static void Dit2FFT(const std::vector<std::complex<double>> &input, std::vector<std::complex<double>> &output, bool inverse = false) {
        std::size_t stride = 1, size = input.size();
        auto offset = GenInputOrder(size >> 1);
        output.resize(size);

        while (size > 2) {
            stride <<= 1;
            size >>= 1;
        }

        for (std::size_t i = 0; i < stride; i++) {
            Radix2FFT(&input[offset[i]], &output[i * 2], stride);
        }

        while (stride > 1) {
            stride >>= 1;
            size <<= 1;
            for (std::size_t i = 0; i < stride; i++) {
                Sum2FFT(&output[i * size], &output[i * size], size >> 1, inverse);
            }
        }

        if (inverse) {
            for (std::size_t i = 0; i < size; i++) {
                output[i] /= static_cast<double>(size);
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, 0x4(%rsp)
movq %rdi, %r15
movq 0x8(%rdi), %r12
subq (%rdi), %r12
movq %rsi, %rbx
sarq $0x4, %r12
movq %r12, %rsi
shrq %rsi
leaq 0x20(%rsp), %rdi
callq 0x1f30
movq %rbx, %rbp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1758
movl $0x1, %r13d
movq %rbp, %r10
cmpq $0x3, %r12
jb 0x1dc4
movq %r12, %rax
addq %r13, %r13
shrq %r12
cmpq $0x5, %rax
ja 0x1dac
testq %r13, %r13
je 0x1ea8
movq 0x20(%rsp), %rax
movq (%r15), %rcx
movq (%r10), %rdx
addq $0x18, %rdx
xorl %esi, %esi
movq %r13, %rdi
shlq $0x4, %rdi
movq (%rax,%rsi,8), %r8
shlq $0x4, %r8
leaq (%rcx,%r8), %r9
movsd (%rcx,%r8), %xmm0
addsd (%rdi,%r9), %xmm0
movsd %xmm0, -0x18(%rdx)
movsd 0x8(%rcx,%r8), %xmm0
addsd 0x8(%rdi,%r9), %xmm0
movsd %xmm0, -0x10(%rdx)
movsd (%rcx,%r8), %xmm0
subsd (%rdi,%r9), %xmm0
movsd %xmm0, -0x8(%rdx)
movsd 0x8(%rcx,%r8), %xmm0
subsd 0x8(%rdi,%r9), %xmm0
movsd %xmm0, (%rdx)
incq %rsi
addq $0x20, %rdx
cmpq %rsi, %r13
jne 0x1ddc
cmpq $0x2, %r13
jb 0x1ea8
movzbl 0x4(%rsp), %r15d
movq %r12, %r14
leaq (%r14,%r14), %r12
cmpq $0x2, %r13
jb 0x1ea8
movq %r12, 0x18(%rsp)
movq %r13, 0x10(%rsp)
shrq %r13
movq %r14, %r12
btrq $0x3f, %r12
shlq $0x5, %r14
xorl %ebx, %ebx
movq %r13, 0x8(%rsp)
movq (%r10), %rdi
addq %rbx, %rdi
movq %rdi, %rsi
movq %r12, %rdx
movl %r15d, %ecx
callq 0x1fd4
addq %r14, %rbx
decq %r13
movq %rbp, %r10
jne 0x1e74
movq 0x18(%rsp), %r12
movq %r12, %r14
cmpq $0x4, 0x10(%rsp)
movq 0x8(%rsp), %r13
jae 0x1e4a
cmpb $0x0, 0x4(%rsp)
je 0x1ef5
testq %r12, %r12
je 0x1ef5
movq %r12, %xmm0
punpckldq 0x116f(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1177(%rip), %xmm0     # 0x3040
movapd %xmm0, %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addpd %xmm1, %xmm0
xorl %eax, %eax
movq (%r10), %rcx
movupd (%rcx,%rax), %xmm1
divpd %xmm0, %xmm1
movupd %xmm1, (%rcx,%rax)
addq $0x10, %rax
decq %r12
jne 0x1edb
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1f04
callq 0x1100
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1f15
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1f27
callq 0x1100
movq %rbx, %rdi
callq 0x1180
nop