// File: /workspace/github_cpp_makefile_star2_O3/Pyboon[P]sage/isi_sage.cpp
// Function: IsiSage::ObjectiveFunction(Eigen::Matrix<std::complex<double>, 1, -1, 1, 1, -1>, double, Eigen::Matrix<std::complex<double>, -1, 2, 0, -1, 2>, Eigen::Matrix<std::complex<double>, -1, 2, 0, -1, 2>, int)
double IsiSage::ObjectiveFunction(RowVectorXcd tau_data, double doppler, MatrixX2cd C1, MatrixX2cd C2, const int iL){
    // X 
    MatrixXcd X(config.Rx, config.Tx);
    complex<double> cycle_data = 0;
    complex<double> temp = 0;
    for(int i_tx = 0; i_tx < config.Tx; ++i_tx){
        for(int i_rx = 0; i_rx < config.Rx; ++i_rx){
            cycle_data = 0;
            temp = 0;
            for(int i_cyc = 0; i_cyc < config.cycle_num; ++i_cyc){
                double t = (i_cyc * config.Tcy + i_tx * config.Tt + i_rx * config.Tr) * config.T; 
                temp.real(cos(2*PI* doppler *t));
                temp.imag(-sin(2*PI* doppler *t));
                cycle_data += temp * tau_data(i_cyc * config.subchannel_num + i_tx * config.Rx + i_rx);
            }
            X(i_rx, i_tx) = cycle_data;
        }
    }
    // f 
    RowVectorXcd c_2_1_H = C2.col(0).adjoint();
    RowVectorXcd c_2_2_H = C2.col(1).adjoint();
    VectorXcd c_1_1_conj = C1.col(0).conjugate();
    VectorXcd c_1_2_conj = C1.col(1).conjugate();
    Vector4cd f;
    f(0) = c_2_1_H * X * c_1_1_conj;
    f(1) = c_2_1_H * X * c_1_2_conj;
    f(2) = c_2_2_H * X * c_1_1_conj;
    f(3) = c_2_2_H * X * c_1_2_conj;
    // D
    Matrix2cd part1 = C2.adjoint() * C2;
    Matrix2cd part2 = C1.adjoint() * C1;
    MatrixXcd D = kroneckerProduct(part1, part2);
    complex<double> z = f.adjoint() * D.inverse() * f;
    return sqrt(norm(z));

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rcx, 0x68(%rsp)
movq %rdx, 0x70(%rsp)
movsd %xmm0, 0x78(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movslq 0x8(%rdi), %r8
movslq 0xc(%rdi), %rcx
movq %rcx, %rax
orq %r8, %rax
js 0xe6d5
movq %rsi, %r12
movq %rdi, %r13
testl %r8d, %r8d
sete %al
testl %ecx, %ecx
sete %dl
orb %al, %dl
jne 0xdcbb
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
xorl %edx, %edx
idivq %rcx
cmpq %r8, %rax
jl 0xe74c
movq %rcx, %rsi
imulq %r8, %rsi
leaq 0x10(%rsp), %rdi
movq %r8, %rdx
callq 0x62ee
movl 0xc(%r13), %ecx
testl %ecx, %ecx
jle 0xde4b
movsd 0x78(%rsp), %xmm0
mulsd 0xf717(%rip), %xmm0     # 0x1d400
movsd %xmm0, 0x78(%rsp)
movl 0x8(%r13), %eax
xorl %r15d, %r15d
leaq 0x80(%rsp), %rbp
testl %eax, %eax
jle 0xde3c
xorl %ebx, %ebx
cmpl $0x0, 0x10(%r13)
jle 0xddf2
xorpd %xmm0, %xmm0
xorl %r14d, %r14d
movapd %xmm0, 0x30(%rsp)
movl 0xbc(%r13), %eax
imull %r14d, %eax
movl 0xb4(%r13), %ecx
imull %r15d, %ecx
addl %eax, %ecx
movl 0xb8(%r13), %eax
imull %ebx, %eax
addl %ecx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0xa8(%r13), %xmm0
mulsd 0x78(%rsp), %xmm0
movsd %xmm0, (%rsp)
callq 0x3490
movsd %xmm0, 0x198(%rsp)
movsd (%rsp), %xmm0
callq 0x3090
movl 0xa0(%r13), %eax
imull %r14d, %eax
movl 0x8(%r13), %ecx
imull %r15d, %ecx
addl %ebx, %eax
addl %ecx, %eax
js 0xe623
movslq %eax, %rsi
cmpq %rsi, 0x8(%r12)
jle 0xe623
xorps 0xf6a7(%rip), %xmm0     # 0x1d450
shlq $0x4, %rsi
addq (%r12), %rsi
movsd 0x198(%rsp), %xmm1
movsd %xmm1, 0x80(%rsp)
movsd %xmm0, 0x88(%rsp)
movq %rbp, %rdi
callq 0xff34
movapd 0x30(%rsp), %xmm0
addpd 0x80(%rsp), %xmm0
incl %r14d
cmpl 0x10(%r13), %r14d
jl 0xdd1a
jmp 0xddf6
xorpd %xmm0, %xmm0
movq 0x18(%rsp), %rax
cmpq %rbx, %rax
jle 0xe642
cmpq %r15, 0x20(%rsp)
jle 0xe642
imulq %r15, %rax
shlq $0x4, %rax
addq 0x10(%rsp), %rax
movq %rbx, %rcx
shlq $0x4, %rcx
movupd %xmm0, (%rcx,%rax)
incq %rbx
movslq 0x8(%r13), %rax
cmpq %rax, %rbx
jl 0xdd08
movl 0xc(%r13), %ecx
incq %r15
movslq %ecx, %rdx
cmpq %rdx, %r15
jl 0xdcfe
movq 0x68(%rsp), %rbx
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
testq %rcx, %rcx
sete %dl
testq %rax, %rax
setns %sil
orb %dl, %sil
je 0xe661
leaq 0x80(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, 0x8(%rsi)
movq %rbx, 0x18(%rsi)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rsi)
movq %rax, 0x30(%rsi)
leaq 0x120(%rsp), %r12
movq %r12, %rdi
callq 0x1a4a0
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
testq %rcx, %rcx
sete %dl
testq %rax, %rax
setns %sil
orb %dl, %sil
je 0xe661
movq %rax, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
leaq 0x80(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, 0x8(%rsi)
movq %rbx, 0x18(%rsi)
movq $0x0, 0x20(%rsi)
movq $0x1, 0x28(%rsi)
movq %rax, 0x30(%rsi)
leaq 0x110(%rsp), %r14
movq %r14, %rdi
callq 0x1a4a0
movq 0x70(%rsp), %rax
movq (%rax), %rbx
movq 0x8(%rax), %r15
testq %rbx, %rbx
sete %al
testq %r15, %r15
setns %cl
orb %al, %cl
je 0xe661
xorpd %xmm0, %xmm0
leaq 0x50(%rsp), %rbp
movapd %xmm0, (%rbp)
movl $0x1, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x1024a
cmpq %r15, 0x58(%rsp)
je 0xdf5d
leaq 0x50(%rsp), %rdi
movl $0x1, %edx
movq %r15, %rsi
callq 0x1024a
cmpq %r15, 0x58(%rsp)
jne 0xe6f4
testq %r15, %r15
jle 0xdf88
movq 0x50(%rsp), %rax
xorl %ecx, %ecx
movapd 0xf4ff(%rip), %xmm0     # 0x1d470
movupd (%rbx,%rcx), %xmm1
xorpd %xmm0, %xmm1
movapd %xmm1, (%rax,%rcx)
addq $0x10, %rcx
decq %r15
jne 0xdf71
movq 0x70(%rsp), %rax
movq (%rax), %rbx
movq 0x8(%rax), %r15
testq %rbx, %rbx
sete %al
testq %r15, %r15
setns %cl
orb %al, %cl
je 0xe661
xorpd %xmm0, %xmm0
leaq 0x40(%rsp), %r13
movapd %xmm0, (%r13)
movl $0x1, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x1024a
cmpq %r15, 0x48(%rsp)
je 0xdfeb
leaq 0x40(%rsp), %rdi
movl $0x1, %edx
movq %r15, %rsi
callq 0x1024a
cmpq %r15, 0x48(%rsp)
jne 0xe6f4
testq %r15, %r15
jle 0xe020
movq %r15, %rax
shlq $0x4, %rax
addq %rax, %rbx
movq 0x40(%rsp), %rax
xorl %ecx, %ecx
movapd 0xf467(%rip), %xmm0     # 0x1d470
movupd (%rbx,%rcx), %xmm1
xorpd %xmm0, %xmm1
movapd %xmm1, (%rax,%rcx)
addq $0x10, %rcx
decq %r15
jne 0xe009
xorpd %xmm0, %xmm0
movapd %xmm0, 0x1d0(%rsp)
movapd %xmm0, 0x1c0(%rsp)
movapd %xmm0, 0x1b0(%rsp)
movq 0x128(%rsp), %rax
cmpq 0x18(%rsp), %rax
jne 0xe680
movq 0x20(%rsp), %rdx
cmpq 0x58(%rsp), %rdx
jne 0xe697
leaq 0x160(%rsp), %rcx
movapd %xmm0, (%rcx)
movq %rcx, -0x10(%rcx)
movq %r12, 0xd0(%rsp)
leaq 0x10(%rsp), %rsi
movq %rsi, 0xd8(%rsp)
movq %rbp, 0xe0(%rsp)
testq %rdx, %rdx
je 0xe118
jle 0xe6b6
leaq 0x90(%rsp), %rdi
leaq 0xd0(%rsp), %r15
movq %r15, %rsi
callq 0x1a75c
movq 0xe0(%rsp), %rax
movq (%rax), %rax
leaq 0x80(%rsp), %rdi
movq %rax, 0x30(%rdi)
movq %r15, 0x40(%rdi)
leaq 0x208(%rsp), %rsi
callq 0x1a5c6
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, (%rsp)
movq 0xa0(%rsp), %rdi
callq 0x3310
movq 0x150(%rsp), %rcx
movq 0x128(%rsp), %rdx
movq 0x18(%rsp), %rax
movsd (%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
jmp 0xe123
xorpd %xmm0, %xmm0
movq %rax, %rdx
xorpd %xmm1, %xmm1
movsd %xmm1, 0x160(%rsp)
movsd %xmm0, 0x168(%rsp)
movupd (%rcx), %xmm0
movapd %xmm0, 0x1a0(%rsp)
cmpq %rax, %rdx
jne 0xe680
movq 0x20(%rsp), %rdx
cmpq 0x48(%rsp), %rdx
jne 0xe697
leaq 0x160(%rsp), %rcx
xorpd %xmm0, %xmm0
movapd %xmm0, (%rcx)
movq %rcx, -0x10(%rcx)
movq %r12, 0xd0(%rsp)
leaq 0x10(%rsp), %rbx
movq %rbx, 0xd8(%rsp)
movq %r13, 0xe0(%rsp)
testq %rdx, %rdx
je 0xe209
jle 0xe6b6
leaq 0x90(%rsp), %rdi
leaq 0xd0(%rsp), %r15
movq %r15, %rsi
callq 0x1a75c
movq 0xe0(%rsp), %rax
movq (%rax), %rax
leaq 0x80(%rsp), %rdi
movq %rax, 0x30(%rdi)
movq %r15, 0x40(%rdi)
leaq 0x208(%rsp), %rsi
callq 0x1a5c6
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, (%rsp)
movq 0xa0(%rsp), %rdi
callq 0x3310
movq 0x150(%rsp), %rcx
movq 0x18(%rsp), %rax
movsd (%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
jmp 0xe211
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movsd %xmm1, 0x160(%rsp)
movsd %xmm0, 0x168(%rsp)
movupd (%rcx), %xmm0
movapd %xmm0, 0x1b0(%rsp)
cmpq %rax, 0x118(%rsp)
jne 0xe680
movq 0x20(%rsp), %rdx
cmpq 0x58(%rsp), %rdx
jne 0xe697
leaq 0x160(%rsp), %rcx
xorpd %xmm0, %xmm0
movapd %xmm0, (%rcx)
movq %rcx, -0x10(%rcx)
movq %r14, 0xd0(%rsp)
movq %rbx, 0xd8(%rsp)
movq %rbp, 0xe0(%rsp)
testq %rdx, %rdx
je 0xe303
jle 0xe6b6
leaq 0x90(%rsp), %rdi
leaq 0xd0(%rsp), %r15
movq %r15, %rsi
callq 0x1a75c
movq 0xe0(%rsp), %rax
movq (%rax), %rax
leaq 0x80(%rsp), %rdi
movq %rax, 0x30(%rdi)
movq %r15, 0x40(%rdi)
leaq 0x208(%rsp), %rsi
callq 0x1a5c6
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, (%rsp)
movq 0xa0(%rsp), %rdi
callq 0x3310
movq 0x150(%rsp), %rcx
movq 0x118(%rsp), %rdx
movq 0x18(%rsp), %rax
movsd (%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
jmp 0xe30e
xorpd %xmm0, %xmm0
movq %rax, %rdx
xorpd %xmm1, %xmm1
movsd %xmm1, 0x160(%rsp)
movsd %xmm0, 0x168(%rsp)
movupd (%rcx), %xmm0
movapd %xmm0, 0x1c0(%rsp)
cmpq %rax, %rdx
jne 0xe680
movq 0x20(%rsp), %rcx
cmpq 0x48(%rsp), %rcx
jne 0xe697
leaq 0x160(%rsp), %rax
xorpd %xmm1, %xmm1
movapd %xmm1, (%rax)
movq %rax, -0x10(%rax)
movq %r14, 0xd0(%rsp)
movq %rbx, 0xd8(%rsp)
movq %r13, 0xe0(%rsp)
testq %rcx, %rcx
je 0xe3f3
movq 0x68(%rsp), %rbx
jle 0xe6b6
leaq 0x90(%rsp), %rdi
leaq 0xd0(%rsp), %r15
movq %r15, %rsi
callq 0x1a75c
movq 0xe0(%rsp), %rax
movq (%rax), %rax
leaq 0x80(%rsp), %rdi
movq %rax, 0x30(%rdi)
movq %r15, 0x40(%rdi)
leaq 0x208(%rsp), %rsi
callq 0x1a5c6
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, (%rsp)
movq 0xa0(%rsp), %rdi
callq 0x3310
movq 0x150(%rsp), %rax
xorpd %xmm1, %xmm1
movsd (%rsp), %xmm0
movsd 0x30(%rsp), %xmm2
jmp 0xe3ff
xorpd %xmm0, %xmm0
xorps %xmm2, %xmm2
movq 0x68(%rsp), %rbx
movsd %xmm2, 0x160(%rsp)
movsd %xmm0, 0x168(%rsp)
movupd (%rax), %xmm0
movapd %xmm0, 0x1d0(%rsp)
leaq 0x80(%rsp), %rsi
movq %rbx, (%rsi)
movq %rbx, 0x10(%rsi)
leaq 0xd0(%rsp), %r15
movapd %xmm1, (%r15)
movapd %xmm1, 0x10(%r15)
movapd %xmm1, 0x20(%r15)
movapd %xmm1, 0x30(%r15)
movq %r15, %rdi
movq %rbx, %rdx
callq 0x117c8
leaq 0x80(%rsp), %rsi
movq 0x70(%rsp), %rdx
movq %rdx, (%rsi)
movq %rdx, 0x10(%rsi)
xorpd %xmm0, %xmm0
leaq 0x150(%rsp), %r14
movapd %xmm0, (%r14)
movapd %xmm0, 0x10(%r14)
movapd %xmm0, 0x20(%r14)
movapd %xmm0, 0x30(%r14)
movq %r14, %rdi
callq 0x117c8
movq %r15, 0x80(%rsp)
movq %r14, 0x88(%rsp)
leaq 0x130(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl $0x10, %esi
movl $0x4, %edx
movl $0x4, %ecx
callq 0x62ee
leaq 0x80(%rsp), %rdi
leaq 0x130(%rsp), %rbx
movq %rbx, %rsi
callq 0x1388a
movq 0x138(%rsp), %rax
cmpq 0x140(%rsp), %rax
jne 0xe713
cmpq $0x4, %rax
jne 0xe732
leaq 0x1f0(%rsp), %rax
xorpd %xmm0, %xmm0
movapd %xmm0, (%rax)
movq %rax, -0x10(%rax)
leaq 0x210(%rsp), %rsi
leaq 0x1a0(%rsp), %rax
movq %rax, (%rsi)
movq %rbx, 0x10(%rsi)
movq %rax, 0x18(%rsi)
leaq 0x90(%rsp), %rdi
callq 0x13a9c
leaq 0x208(%rsp), %rax
movq 0x20(%rax), %rcx
leaq 0x80(%rsp), %rdi
movq %rcx, 0x30(%rdi)
movq %rax, 0x40(%rdi)
leaq 0xf(%rsp), %rsi
callq 0x139c4
movsd %xmm0, (%rsp)
movsd %xmm1, 0x30(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x3310
movsd (%rsp), %xmm0
movsd %xmm0, 0x1f0(%rsp)
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x1f8(%rsp)
movq 0x1e0(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movq 0x130(%rsp), %rdi
callq 0x3310
movq 0x40(%rsp), %rdi
callq 0x3310
movq 0x50(%rsp), %rdi
callq 0x3310
movq 0x110(%rsp), %rdi
callq 0x3310
movq 0x120(%rsp), %rdi
callq 0x3310
movq 0x10(%rsp), %rdi
callq 0x3310
movsd (%rsp), %xmm0
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xec8c(%rip), %rdi      # 0x1d2b6
leaq 0xe40b(%rip), %rsi      # 0x1ca3c
leaq 0x1ac07(%rip), %rcx     # 0x2923f
movl $0x1a9, %edx            # imm = 0x1A9
callq 0x31b0
leaq 0xe3be(%rip), %rdi      # 0x1ca07
leaq 0xe3ec(%rip), %rsi      # 0x1ca3c
leaq 0xe408(%rip), %rcx      # 0x1ca5f
movl $0x16d, %edx            # imm = 0x16D
callq 0x31b0
leaq 0xfaaa(%rip), %rdi      # 0x1e112
leaq 0xfb4d(%rip), %rsi      # 0x1e1bc
leaq 0x10821(%rip), %rcx     # 0x1ee97
movl $0xaf, %edx
callq 0x31b0
leaq 0x11507(%rip), %rdi     # 0x1fb8e
leaq 0x1158c(%rip), %rsi     # 0x1fc1a
leaq 0x1b16f(%rip), %rcx     # 0x29804
jmp 0xe6ac
leaq 0x114f0(%rip), %rdi     # 0x1fb8e
leaq 0x11575(%rip), %rsi     # 0x1fc1a
leaq 0x1b255(%rip), %rcx     # 0x29901
movl $0x61, %edx
callq 0x31b0
leaq 0x100ac(%rip), %rdi     # 0x1e769
leaq 0x100e9(%rip), %rsi     # 0x1e7ad
leaq 0x1b3ab(%rip), %rcx     # 0x29a76
movl $0x19d, %edx            # imm = 0x19D
callq 0x31b0
leaq 0xdfd6(%rip), %rdi      # 0x1c6b2
leaq 0xe15e(%rip), %rsi      # 0x1c841
leaq 0xe17a(%rip), %rcx      # 0x1c864
movl $0x11d, %edx            # imm = 0x11D
callq 0x31b0
leaq 0xddf9(%rip), %rdi      # 0x1c4f4
leaq 0xde21(%rip), %rsi      # 0x1c523
leaq 0x1306c(%rip), %rcx     # 0x21775
movl $0x2d1, %edx            # imm = 0x2D1
callq 0x31b0
leaq 0x14907(%rip), %rdi     # 0x23021
leaq 0x14911(%rip), %rsi     # 0x23032
leaq 0x14927(%rip), %rcx     # 0x2304f
movl $0x152, %edx            # imm = 0x152
callq 0x31b0
leaq 0x11455(%rip), %rdi     # 0x1fb8e
leaq 0x114da(%rip), %rsi     # 0x1fc1a
leaq 0x149a7(%rip), %rcx     # 0x230ee
jmp 0xe6ac
movl $0x8, %edi
callq 0x3130
movq 0x20863(%rip), %rcx     # 0x2efc0
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x20865(%rip), %rsi     # 0x2efd0
movq 0x20836(%rip), %rdx     # 0x2efa8
movq %rax, %rdi
callq 0x3430
jmp 0xe786
jmp 0xe7b4
jmp 0xe786
jmp 0xe7b4
jmp 0xe786
jmp 0xe7b4
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
jmp 0xe7ce
jmp 0xe7b4
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
callq 0x3310
jmp 0xe7c6
jmp 0xe7c3
jmp 0xe7b4
jmp 0xe7b4
movq %rax, %rbx
jmp 0xe7f4
jmp 0xe7be
movq %rax, %rbx
jmp 0xe7d3
movq %rax, %rbx
jmp 0xe7dd
movq %rax, %rbx
jmp 0xe801
movq %rax, %rbx
movq 0x130(%rsp), %rdi
callq 0x3310
movq 0x40(%rsp), %rdi
callq 0x3310
movq 0x50(%rsp), %rdi
callq 0x3310
movq 0x110(%rsp), %rdi
callq 0x3310
movq 0x120(%rsp), %rdi
callq 0x3310
movq 0x10(%rsp), %rdi
callq 0x3310
movq %rbx, %rdi
callq 0x3450
nop