// File: /workspace/github_cpp_makefile_star2_O2/Pyboon[P]sage/isi_sage.cpp
// Function: IsiSage::UpdateAlpha(Eigen::Matrix<std::complex<double>, 1, -1, 1, 1, -1>, int)
void IsiSage::UpdateAlpha(const RowVectorXcd tau_data, const int iL){
    Util::log("updating Alpha of the " + to_string(iL) + "th path");
    MatrixX2cd C2 = getAntennaResponse(result.theta_rx(iL), result.phi_rx(iL), 2);
    MatrixX2cd C1 = getAntennaResponse(result.theta_tx(iL), result.phi_tx(iL), 1);
    Matrix2cd part1 = C2.adjoint() * C2;
    Matrix2cd part2 = C1.adjoint() * C1;
    MatrixXcd D = kroneckerProduct(part1, part2);
    // X_l 
    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* result.doppler(iL) *t));
                temp.imag(sin(2*PI* result.doppler(iL) *t));
                cycle_data += temp * tau_data(i_cyc * config.subchannel_num + i_tx * config.Rx + i_rx);
            }
            X(i_rx, i_tx) = cycle_data;
        }
    }
    VectorXcd c_2_1 = C2.col(0);
    VectorXcd c_2_2 = C2.col(1);
    Vector4cd f;
    VectorXcd c_1_1_conj = C1.col(0).conjugate();
    VectorXcd c_1_2_conj = C1.col(1).conjugate();
    f(0) = c_2_1.adjoint() * X * c_1_1_conj;
    f(1) = c_2_1.adjoint() * X * c_1_2_conj;
    f(2) = c_2_2.adjoint() * X * c_1_1_conj;
    f(3) = c_2_2.adjoint() * X * c_1_2_conj;
    result.alpha.col(iL) = D.inverse() * f / config.cycle_num;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movl %edx, %ebp
movq %rsi, 0x138(%rsp)
movq %rdi, %rbx
leaq 0x1e0(%rsp), %r14
movq %r14, %rdi
movl %edx, %esi
callq 0xaa69
leaq 0x1588a(%rip), %rsi     # 0x1d7c7
leaq 0x220(%rsp), %rdi
movq %r14, %rdx
callq 0xaa45
leaq 0x1588a(%rip), %rdx     # 0x1d7de
leaq 0x1c0(%rsp), %rdi
leaq 0x220(%rsp), %rsi
callq 0x545f
leaq 0x1c0(%rsp), %rdi
callq 0x547e
leaq 0x1c0(%rsp), %rdi
callq 0x3100
leaq 0x220(%rsp), %rdi
callq 0x3100
leaq 0x1e0(%rsp), %rdi
callq 0x3100
leaq 0x200(%rbx), %rdi
movslq %ebp, %r14
movq %r14, %rsi
callq 0x564e
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x210(%rbx), %rdi
movq %r14, %rsi
callq 0x564e
movsd (%rax), %xmm1
movq (%rbx), %rax
leaq 0x100(%rsp), %r15
pushq $0x2
popq %rdx
movq %r15, %rdi
movq %rbx, %rsi
movsd 0x8(%rsp), %xmm0
callq *0x20(%rax)
leaq 0x1e0(%rbx), %rdi
movq %r14, %rsi
callq 0x564e
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x1f0(%rbx), %rdi
movq %r14, %rsi
callq 0x564e
movsd (%rax), %xmm1
movq (%rbx), %rax
leaq 0xf0(%rsp), %r12
pushq $0x1
popq %rdx
movq %r12, %rdi
movq %rbx, %rsi
movsd 0x8(%rsp), %xmm0
callq *0x20(%rax)
leaq 0x30(%rsp), %rsi
movq %r15, (%rsi)
leaq 0x1e0(%rsp), %rdi
movq %r15, %rdx
callq 0xede8
leaq 0x220(%rsp), %r15
leaq 0x1e0(%rsp), %rsi
movq %r15, %rdi
callq 0xee1e
leaq 0x140(%rsp), %rsi
movq %r12, (%rsi)
leaq 0x30(%rsp), %rdi
movq %r12, %rdx
callq 0xede8
leaq 0x1e0(%rsp), %r12
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
callq 0xee1e
leaq 0x30(%rsp), %rsi
movq %r15, (%rsi)
movq %r12, 0x8(%rsi)
leaq 0x1a0(%rsp), %rdi
callq 0x116c6
leaq 0x8(%rbx), %rsi
leaq 0xc(%rbx), %rdx
leaq 0x18(%rsp), %rdi
movq %rsi, 0x130(%rsp)
movq %rdx, 0x128(%rsp)
callq 0xabc2
leaq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
leaq 0x1d0(%rbx), %rbp
xorpd %xmm0, %xmm0
leaq 0xb0(%rsp), %rax
movapd %xmm0, (%rax)
xorl %r15d, %r15d
movq 0x128(%rsp), %rax
movslq (%rax), %rax
cmpq %rax, %r15
jge 0x825a
xorl %r12d, %r12d
movq 0x130(%rsp), %rax
movslq (%rax), %rax
cmpq %rax, %r12
jge 0x8252
xorpd %xmm0, %xmm0
movapd %xmm0, 0xb0(%rsp)
movapd %xmm0, 0x110(%rsp)
xorl %r13d, %r13d
movq 0x10(%rsp), %rax
cmpl (%rax), %r13d
jge 0x822d
movl 0xbc(%rbx), %eax
imull %r13d, %eax
movl 0xb4(%rbx), %ecx
imull %r15d, %ecx
addl %eax, %ecx
movl 0xb8(%rbx), %eax
imull %r12d, %eax
addl %ecx, %eax
cvtsi2sd %eax, %xmm0
mulsd 0xa8(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x564e
movsd 0x15262(%rip), %xmm1    # 0x1d3e8
movsd (%rax), %xmm0
mulsd %xmm1, %xmm0
mulsd 0x8(%rsp), %xmm0
callq 0x3470
movsd %xmm0, 0xb0(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x564e
movsd 0x15233(%rip), %xmm0    # 0x1d3e8
movsd (%rax), %xmm1
mulsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
mulsd %xmm1, %xmm0
callq 0x3080
movsd %xmm0, 0xb8(%rsp)
movl 0xa0(%rbx), %eax
imull %r13d, %eax
movl 0x8(%rbx), %ecx
imull %r15d, %ecx
addl %r12d, %eax
addl %ecx, %eax
movslq %eax, %rsi
movq 0x138(%rsp), %rdi
callq 0xab8c
leaq 0xb0(%rsp), %rdi
movq %rax, %rsi
callq 0xab66
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd 0x110(%rsp), %xmm1
addpd %xmm0, %xmm1
movapd %xmm1, 0x110(%rsp)
incl %r13d
jmp 0x8131
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x54d6
movapd 0x110(%rsp), %xmm0
movupd %xmm0, (%rax)
incq %r12
jmp 0x8104
incq %r15
jmp 0x80ed
leaq 0x30(%rsp), %rdi
leaq 0x100(%rsp), %rsi
xorl %edx, %edx
callq 0xc424
leaq 0x190(%rsp), %r15
leaq 0x30(%rsp), %rsi
movq %r15, %rdi
callq 0xd570
leaq 0x30(%rsp), %rdi
leaq 0x100(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0xc424
leaq 0x180(%rsp), %r12
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
callq 0xd570
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
movapd %xmm0, 0x50(%rsp)
movapd %xmm0, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
leaq 0x78(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
xorl %edx, %edx
callq 0xc424
movupd 0x78(%rsp), %xmm0
movupd 0x90(%rsp), %xmm1
movups 0xa0(%rsp), %xmm2
leaq 0x140(%rsp), %rsi
movapd %xmm0, (%rsi)
movupd %xmm1, 0x18(%rsi)
movups %xmm2, 0x28(%rsi)
leaq 0xe0(%rsp), %rdi
callq 0xe92c
leaq 0x78(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0xc424
movupd 0x78(%rsp), %xmm0
movupd 0x90(%rsp), %xmm1
movups 0xa0(%rsp), %xmm2
leaq 0x140(%rsp), %rsi
movapd %xmm0, (%rsi)
movupd %xmm1, 0x18(%rsi)
movups %xmm2, 0x28(%rsi)
leaq 0xd0(%rsp), %rdi
callq 0xe92c
leaq 0xc0(%rsp), %rsi
movq %r15, (%rsi)
leaq 0x78(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0xd81e
leaq 0x140(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x18df4
leaq 0x140(%rsp), %rdi
callq 0xaf18
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, 0x38(%rsp)
leaq 0xc0(%rsp), %rsi
movq %r15, (%rsi)
leaq 0x78(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0xd81e
leaq 0x140(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0x18df4
leaq 0x140(%rsp), %rdi
callq 0xaf18
movsd %xmm0, 0x40(%rsp)
movsd %xmm1, 0x48(%rsp)
leaq 0xc0(%rsp), %rsi
movq %r12, (%rsi)
leaq 0x78(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0xd81e
leaq 0x140(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x18df4
leaq 0x140(%rsp), %rdi
callq 0xaf18
movsd %xmm0, 0x50(%rsp)
movsd %xmm1, 0x58(%rsp)
leaq 0xc0(%rsp), %rsi
movq %r12, (%rsi)
leaq 0x78(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0xd81e
leaq 0x140(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0x18df4
leaq 0x140(%rsp), %rdi
callq 0xaf18
movsd %xmm0, 0x60(%rsp)
movsd %xmm1, 0x68(%rsp)
leaq 0x1a0(%rsp), %rdi
callq 0xaec4
leaq 0x1b8(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x30(%rsp), %rsi
callq 0xaf3e
leaq 0xc0(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
leaq 0x78(%rsp), %rdi
movq 0x10(%rsp), %rdx
callq 0xaf62
addq $0x220, %rbx            # imm = 0x220
leaq 0x140(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xcae6
leaq 0x140(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x19245
movq 0xd0(%rsp), %rdi
callq 0x32c0
movq 0xe0(%rsp), %rdi
callq 0x32c0
movq 0x180(%rsp), %rdi
callq 0x32c0
movq 0x190(%rsp), %rdi
callq 0x32c0
movq 0x18(%rsp), %rdi
callq 0x32c0
movq 0x1a0(%rsp), %rdi
callq 0x32c0
movq 0xf0(%rsp), %rdi
callq 0x32c0
movq 0x100(%rsp), %rdi
callq 0x32c0
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x862f
jmp 0x85d3
movq %rax, %rbx
leaq 0x1c0(%rsp), %rdi
callq 0x3100
jmp 0x859a
movq %rax, %rbx
leaq 0x220(%rsp), %rdi
callq 0x3100
jmp 0x85ac
movq %rax, %rbx
leaq 0x1e0(%rsp), %rdi
callq 0x3100
jmp 0x8656
jmp 0x85e0
movq %rax, %rbx
jmp 0x85f0
movq %rax, %rbx
jmp 0x85fd
movq %rax, %rbx
jmp 0x860a
jmp 0x8622
jmp 0x85d3
movq %rax, %rbx
jmp 0x863c
jmp 0x85e0
jmp 0x85e0
jmp 0x85e0
jmp 0x85e0
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
callq 0x32c0
movq 0xe0(%rsp), %rdi
callq 0x32c0
movq 0x180(%rsp), %rdi
callq 0x32c0
movq 0x190(%rsp), %rdi
callq 0x32c0
jmp 0x8625
movq %rax, %rbx
jmp 0x8649
jmp 0x8622
jmp 0x8622
movq %rax, %rbx
movq 0x18(%rsp), %rdi
callq 0x32c0
movq 0x1a0(%rsp), %rdi
callq 0x32c0
movq 0xf0(%rsp), %rdi
callq 0x32c0
movq 0x100(%rsp), %rdi
callq 0x32c0
movq %rbx, %rdi
callq 0x3430