// File: Pyboon[P]sage/isi_sage.cpp
// Function: IsiSage::UpdateDoppler(Eigen::Matrix<std::complex<double>, 1, -1, 1, 1, -1>, int)
void IsiSage::UpdateDoppler(RowVectorXcd tau_data, const int iL){
    Util::log("updating Doppler of the " + to_string(iL) + "th path");
    MatrixX2cd C1 = getAntennaResponse(result.theta_tx(iL), result.phi_tx(iL), 1);
    MatrixX2cd C2 = getAntennaResponse(result.theta_rx(iL), result.phi_rx(iL), 2);
    // go through doppler frequecy bound to find index with max value
    double min_doppler = -config.max_doppler;
    double max_doppler = config.max_doppler;
    double step = config.doppler_step; // step of doppler is 0.1 hz
    int doppler_size = (int)(max_doppler-min_doppler)/step+1;
    VectorXd doppler_data(doppler_size);
    for(double i_step = 0; i_step < doppler_size; ++i_step){
        doppler_data(i_step) = ObjectiveFunction(tau_data, min_doppler+i_step * step, C1, C2, iL);
    }
    int max_index = 0;
    doppler_data.maxCoeff(&max_index);
    result.doppler(iL) = min_doppler+max_index * config.doppler_step;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rsi, -0x130(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x128(%rbp)
movl -0x14(%rbp), %esi
leaq -0x78(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x1fef0
movq -0x120(%rbp), %rdx
leaq 0x5167c(%rip), %rsi     # 0x6fc95
leaq -0x58(%rbp), %rdi
callq 0x1fea0
jmp 0x1e624
leaq 0x515b3(%rip), %rdx     # 0x6fbde
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x13b30
jmp 0x1e63a
leaq -0x38(%rbp), %rdi
callq 0x13b80
jmp 0x1e645
leaq -0x38(%rbp), %rdi
callq 0x9470
leaq -0x58(%rbp), %rdi
callq 0x9470
leaq -0x78(%rbp), %rdi
callq 0x9470
movq -0x128(%rbp), %rdi
addq $0x1e0, %rdi            # imm = 0x1E0
movslq -0x14(%rbp), %rsi
callq 0x14140
movq -0x128(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x140(%rbp)
addq $0x1f0, %rdi            # imm = 0x1F0
movslq -0x14(%rbp), %rsi
callq 0x14140
movsd -0x140(%rbp), %xmm0
movq -0x128(%rbp), %rsi
movsd (%rax), %xmm1
movq (%rsi), %rax
movq 0x20(%rax), %rax
leaq -0x98(%rbp), %rdi
movl $0x1, %edx
callq *%rax
movq -0x128(%rbp), %rdi
addq $0x200, %rdi            # imm = 0x200
movslq -0x14(%rbp), %rsi
callq 0x14140
movq %rax, -0x138(%rbp)
jmp 0x1e6e2
movq -0x128(%rbp), %rdi
movq -0x138(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x150(%rbp)
addq $0x210, %rdi            # imm = 0x210
movslq -0x14(%rbp), %rsi
callq 0x14140
movq %rax, -0x148(%rbp)
jmp 0x1e715
movsd -0x150(%rbp), %xmm0
movq -0x128(%rbp), %rsi
movq -0x148(%rbp), %rax
movsd (%rax), %xmm1
movq (%rsi), %rax
movq 0x20(%rax), %rax
leaq -0xa8(%rbp), %rdi
movl $0x2, %edx
callq *%rax
jmp 0x1e746
movq -0x128(%rbp), %rax
movsd 0xd8(%rax), %xmm0
movaps 0x51134(%rip), %xmm1    # 0x6f890
pxor %xmm1, %xmm0
movlpd %xmm0, -0xb0(%rbp)
movsd 0xd8(%rax), %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd 0x120(%rax), %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xb8(%rbp), %xmm0
movsd -0xb0(%rbp), %xmm1
subsd %xmm1, %xmm0
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movsd -0xc0(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd 0x4f870(%rip), %xmm1    # 0x6e028
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0xc4(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0xc4(%rbp), %rsi
callq 0x20110
jmp 0x1e7db
xorps %xmm0, %xmm0
movsd %xmm0, -0xe0(%rbp)
movsd -0xe0(%rbp), %xmm1
cvtsi2sdl -0xc4(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x1e9f7
movq -0x130(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x20010
jmp 0x1e815
movsd -0xb0(%rbp), %xmm1
movsd -0xe0(%rbp), %xmm0
movsd -0xc0(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x158(%rbp)
leaq -0x100(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x21a90
jmp 0x1e852
leaq -0x110(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x21a90
jmp 0x1e867
movsd -0x158(%rbp), %xmm0
movq -0x128(%rbp), %rdi
movl -0x14(%rbp), %r8d
leaq -0xf0(%rbp), %rsi
leaq -0x100(%rbp), %rdx
leaq -0x110(%rbp), %rcx
callq 0x1ead0
movsd %xmm0, -0x160(%rbp)
jmp 0x1e89e
cvttsd2si -0xe0(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x14140
movq %rax, -0x168(%rbp)
jmp 0x1e8bc
movq -0x168(%rbp), %rax
movsd -0x160(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x110(%rbp), %rdi
callq 0x13f10
leaq -0x100(%rbp), %rdi
callq 0x13f10
leaq -0xf0(%rbp), %rdi
callq 0x20040
movsd 0x4f72d(%rip), %xmm0    # 0x6e028
addsd -0xe0(%rbp), %xmm0
movsd %xmm0, -0xe0(%rbp)
jmp 0x1e7e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1e953
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1e94a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x9470
leaq -0x58(%rbp), %rdi
callq 0x9470
leaq -0x78(%rbp), %rdi
callq 0x9470
jmp 0x1eac2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1eab6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1eaaa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1ea9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1e9e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x1e9da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x13f10
leaq -0x100(%rbp), %rdi
callq 0x13f10
leaq -0xf0(%rbp), %rdi
callq 0x20040
jmp 0x1ea9e
movl $0x0, -0x114(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0x114(%rbp), %rsi
callq 0x20260
jmp 0x1ea16
movq -0x128(%rbp), %rdi
movsd -0xb0(%rbp), %xmm1
cvtsi2sdl -0x114(%rbp), %xmm0
movsd 0x120(%rdi), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x178(%rbp)
addq $0x1d0, %rdi            # imm = 0x1D0
movslq -0x14(%rbp), %rsi
callq 0x14140
movq %rax, -0x170(%rbp)
jmp 0x1ea5e
movq -0x170(%rbp), %rax
movsd -0x178(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0xd8(%rbp), %rdi
callq 0xfde0
leaq -0xa8(%rbp), %rdi
callq 0x13f10
leaq -0x98(%rbp), %rdi
callq 0x13f10
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
leaq -0xd8(%rbp), %rdi
callq 0xfde0
leaq -0xa8(%rbp), %rdi
callq 0x13f10
leaq -0x98(%rbp), %rdi
callq 0x13f10
movq -0x80(%rbp), %rdi
callq 0x9dc0
nopl (%rax,%rax)