// File: markondej[P]phase_correl/phase_correl.cpp
// Function: PhaseCorrelation::Sum2FFT(std::complex<double> const*, std::complex<double>*, unsigned long, bool)
static void Sum2FFT(const std::complex<double> *input, std::complex<double> *output, std::size_t size, bool inverse) {
        double dfi = (inverse ? 2.0 : -2.0) * M_PI / static_cast<double>(size << 1),
            kfi = 0.0;

        for (std::size_t k = 0; k < size; k++) {
            double cosfi = cos(kfi), sinfi = sin(kfi);
            std::complex<double> temp[] = { input[k], input[k + size] };

            output[k].real(temp[0].real() + cosfi * temp[1].real() - sinfi * temp[1].imag());
            output[k].imag(temp[0].imag() + sinfi * temp[1].real() + cosfi * temp[1].imag());
            output[k + size].real(temp[0].real() - cosfi * temp[1].real() + sinfi * temp[1].imag());
            output[k + size].imag(temp[0].imag() - sinfi * temp[1].real() - cosfi * temp[1].imag());
            kfi += dfi;
        }
    }

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movb %cl, %al
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movq %rdx, 0x100(%rsp)
andb $0x1, %al
movb %al, 0xff(%rsp)
movb 0xff(%rsp), %al
testb $0x1, %al
movsd 0x1925(%rip), %xmm0     # 0x5010
movsd 0x1925(%rip), %xmm1     # 0x5018
movsd %xmm1, 0xa0(%rsp)
movsd %xmm0, 0xa8(%rsp)
jne 0x3719
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0xa8(%rsp)
movsd 0xa8(%rsp), %xmm0
movq 0x100(%rsp), %rax
addq %rax, %rax
movq %rax, %xmm1
movaps 0x1907(%rip), %xmm2     # 0x5040
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x190b(%rip), %xmm2     # 0x5050
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0xf0(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0xe8(%rsp)
movq $0x0, 0xe0(%rsp)
movq 0xe0(%rsp), %rax
cmpq 0x100(%rsp), %rax
jae 0x3b8b
movsd 0xe8(%rsp), %xmm0
callq 0x11d0
movsd %xmm0, 0xd8(%rsp)
movsd 0xe8(%rsp), %xmm0
callq 0x1040
movsd %xmm0, 0xd0(%rsp)
movq 0x110(%rsp), %rax
movq 0xe0(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, 0xb0(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0xb8(%rsp)
movq 0x110(%rsp), %rax
movq 0xe0(%rsp), %rcx
addq 0x100(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, 0xc0(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0xc8(%rsp)
movq 0x108(%rsp), %rax
movq 0xe0(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x2130
movsd %xmm0, (%rsp)
movsd 0xd8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0xb0(%rsp), %rdi
addq $0x10, %rdi
callq 0x2130
movsd (%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x8(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0xd0(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0xb0(%rsp), %rdi
addq $0x10, %rdi
callq 0x2140
movsd 0x10(%rsp), %xmm1
movq 0x18(%rsp), %rdi
movaps %xmm0, %xmm2
movsd 0x20(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4820
movq 0x108(%rsp), %rax
movq 0xe0(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x2140
movsd %xmm0, 0x28(%rsp)
movsd 0xd0(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
leaq 0xb0(%rsp), %rdi
addq $0x10, %rdi
callq 0x2130
movsd 0x28(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x30(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0xd8(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
leaq 0xb0(%rsp), %rdi
addq $0x10, %rdi
callq 0x2140
movsd 0x38(%rsp), %xmm1
movq 0x40(%rsp), %rdi
movaps %xmm0, %xmm2
movsd 0x48(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4840
movq 0x108(%rsp), %rax
movq 0xe0(%rsp), %rcx
addq 0x100(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0x68(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x2130
movsd %xmm0, 0x50(%rsp)
movsd 0xd8(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
leaq 0xb0(%rsp), %rdi
addq $0x10, %rdi
callq 0x2130
movsd 0x50(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x58(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
movsd 0xd0(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
leaq 0xb0(%rsp), %rdi
addq $0x10, %rdi
callq 0x2140
movsd 0x60(%rsp), %xmm1
movq 0x68(%rsp), %rdi
movaps %xmm0, %xmm2
movsd 0x70(%rsp), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4820
movq 0x108(%rsp), %rax
movq 0xe0(%rsp), %rcx
addq 0x100(%rsp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, 0x90(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x2140
movsd %xmm0, 0x78(%rsp)
movsd 0xd0(%rsp), %xmm0
movsd %xmm0, 0x80(%rsp)
leaq 0xb0(%rsp), %rdi
addq $0x10, %rdi
callq 0x2130
movsd 0x78(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x80(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x88(%rsp)
movsd 0xd8(%rsp), %xmm0
movsd %xmm0, 0x98(%rsp)
leaq 0xb0(%rsp), %rdi
addq $0x10, %rdi
callq 0x2140
movsd 0x88(%rsp), %xmm1
movq 0x90(%rsp), %rdi
movaps %xmm0, %xmm2
movsd 0x98(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x4840
movsd 0xf0(%rsp), %xmm0
addsd 0xe8(%rsp), %xmm0
movsd %xmm0, 0xe8(%rsp)
movq 0xe0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xe0(%rsp)
jmp 0x3779
addq $0x118, %rsp            # imm = 0x118
retq
nopw %cs:(%rax,%rax)
nopl (%rax)