// File: /workspace/github_cpp_makefile_star2_O1/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, %r12d
movq %rdi, %r14
movq 0x8(%rdi), %r15
subq (%rdi), %r15
movq %rsi, %rbp
sarq $0x4, %r15
movq %r15, %rsi
shrq %rsi
leaq 0x20(%rsp), %rdi
callq 0x1f4a
movq %rbp, %rdi
movq %r15, %rsi
callq 0x178c
movl $0x1, %r11d
cmpq $0x3, %r15
jb 0x1dcd
movq %r15, %r10
addq %r11, %r11
shrq %r10
cmpq $0x5, %r15
movq %r10, %r15
ja 0x1dbc
jmp 0x1dd0
movq %r15, %r10
testq %r11, %r11
je 0x1e4d
movq 0x20(%rsp), %rax
movq (%r14), %rcx
movq (%rbp), %rdx
addq $0x18, %rdx
xorl %esi, %esi
movq %r11, %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, %r11
jne 0x1dee
cmpq $0x2, %r11
movl %r12d, 0x4(%rsp)
jb 0x1ec2
movzbl %r12b, %r14d
movq %r10, 0x10(%rsp)
movq %r11, %rax
shrq %r11
movq %r11, 0x8(%rsp)
movq %rax, 0x18(%rsp)
cmpq $0x2, %rax
jb 0x1ead
movq 0x10(%rsp), %r12
movq %r12, %r15
btrq $0x3f, %r15
shlq $0x5, %r12
xorl %r13d, %r13d
movq 0x8(%rsp), %rbx
movq (%rbp), %rdi
addq %r13, %rdi
movq %rdi, %rsi
movq %r15, %rdx
movl %r14d, %ecx
callq 0x1fee
addq %r12, %r13
decq %rbx
jne 0x1e90
movq 0x10(%rsp), %r10
addq %r10, %r10
cmpq $0x4, 0x18(%rsp)
movq 0x8(%rsp), %r11
jae 0x1e5c
cmpb $0x0, 0x4(%rsp)
je 0x1f10
testq %r10, %r10
je 0x1f10
movq %r10, %xmm0
punpckldq 0x1155(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x115d(%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 (%rbp), %rcx
movupd (%rcx,%rax), %xmm1
divpd %xmm0, %xmm1
movupd %xmm1, (%rcx,%rax)
addq $0x10, %rax
decq %r10
jne 0x1ef5
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1f1f
callq 0x1110
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1f30
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1f42
callq 0x1110
movq %rbx, %rdi
callq 0x1190