// File: Pyboon[P]sage/sage.cpp
// Function: Sage::IterConvergence(SageResult, SageResult)
bool Sage::IterConvergence(SageResult last_result, SageResult cur_result){
    VectorXi tau_diff = last_result.tau - cur_result.tau;
    VectorXd doppler_diff = last_result.doppler - cur_result.doppler;
    VectorXd theta_rx_diff = last_result.theta_rx - cur_result.theta_rx;
    VectorXd phi_rx_diff = last_result.phi_rx - cur_result.phi_rx;
    VectorXd theta_tx_diff = last_result.theta_tx - cur_result.theta_tx;
    VectorXd phi_tx_diff = last_result.phi_tx - cur_result.phi_tx;
    bool is_convergence = true;
    for(int iL = 0; iL < max_path_num; ++iL){
        if(abs(tau_diff(iL)) > tol.tau || abs(doppler_diff(iL)) > tol.doppler || 
        abs(theta_rx_diff(iL)) > tol.theta_rx || abs(phi_rx_diff(iL)) > tol.phi_rx ||
        abs(theta_tx_diff(iL)) > tol.theta_tx || abs(phi_tx_diff(iL)) > tol.phi_tx){
            is_convergence = false;
            break;
        }
    }
    return is_convergence;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rsi, -0x130(%rbp)
movq %rdx, -0x128(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x13f30
movq -0x138(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x13fa0
movq -0x130(%rbp), %rsi
movq -0x128(%rbp), %rdx
addq $0x10, %rsi
addq $0x10, %rdx
leaq -0x68(%rbp), %rdi
callq 0x13fe0
jmp 0x13641
leaq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x14050
jmp 0x13650
movq -0x128(%rbp), %rdx
movq -0x130(%rbp), %rsi
addq $0x40, %rsi
addq $0x40, %rdx
leaq -0xa0(%rbp), %rdi
callq 0x13fe0
jmp 0x13674
leaq -0x88(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x14050
jmp 0x13689
movq -0x128(%rbp), %rdx
movq -0x130(%rbp), %rsi
addq $0x50, %rsi
addq $0x50, %rdx
leaq -0xc8(%rbp), %rdi
callq 0x13fe0
jmp 0x136ad
leaq -0xb0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x14050
jmp 0x136c2
movq -0x128(%rbp), %rdx
movq -0x130(%rbp), %rsi
addq $0x20, %rsi
addq $0x20, %rdx
leaq -0xf0(%rbp), %rdi
callq 0x13fe0
jmp 0x136e6
leaq -0xd8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x14050
jmp 0x136fb
movq -0x128(%rbp), %rdx
movq -0x130(%rbp), %rsi
addq $0x30, %rsi
addq $0x30, %rdx
leaq -0x118(%rbp), %rdi
callq 0x13fe0
jmp 0x1371f
leaq -0x100(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x14050
jmp 0x13734
movb $0x1, -0x119(%rbp)
movl $0x0, -0x120(%rbp)
movq -0x140(%rbp), %rcx
movl -0x120(%rbp), %eax
cmpl 0x15c(%rcx), %eax
jge 0x139bf
movslq -0x120(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x14090
movq %rax, -0x148(%rbp)
jmp 0x13777
movq -0x140(%rbp), %rcx
movq -0x148(%rbp), %rax
movl (%rax), %eax
movl %eax, %edx
negl %edx
cmovnsl %edx, %eax
cmpl 0x238(%rcx), %eax
jg 0x1392e
movslq -0x120(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x14140
movq %rax, -0x150(%rbp)
jmp 0x137b3
movq -0x150(%rbp), %rax
movsd (%rax), %xmm0
callq 0x14120
movsd %xmm0, -0x158(%rbp)
jmp 0x137cd
movsd -0x158(%rbp), %xmm0
movq -0x140(%rbp), %rax
ucomisd 0x240(%rax), %xmm0
ja 0x1392e
movslq -0x120(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x14140
movq %rax, -0x160(%rbp)
jmp 0x13806
movq -0x160(%rbp), %rax
movsd (%rax), %xmm0
callq 0x14120
movsd %xmm0, -0x168(%rbp)
jmp 0x13820
movsd -0x168(%rbp), %xmm0
movq -0x140(%rbp), %rax
ucomisd 0x248(%rax), %xmm0
ja 0x1392e
movslq -0x120(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x14140
movq %rax, -0x170(%rbp)
jmp 0x13859
movq -0x170(%rbp), %rax
movsd (%rax), %xmm0
callq 0x14120
movsd %xmm0, -0x178(%rbp)
jmp 0x13873
movsd -0x178(%rbp), %xmm0
movq -0x140(%rbp), %rax
ucomisd 0x250(%rax), %xmm0
ja 0x1392e
movslq -0x120(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x14140
movq %rax, -0x180(%rbp)
jmp 0x138ac
movq -0x180(%rbp), %rax
movsd (%rax), %xmm0
callq 0x14120
movsd %xmm0, -0x188(%rbp)
jmp 0x138c6
movsd -0x188(%rbp), %xmm0
movq -0x140(%rbp), %rax
ucomisd 0x258(%rax), %xmm0
ja 0x1392e
movslq -0x120(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x14140
movq %rax, -0x190(%rbp)
jmp 0x138fb
movq -0x190(%rbp), %rax
movsd (%rax), %xmm0
callq 0x14120
movsd %xmm0, -0x198(%rbp)
jmp 0x13915
movsd -0x198(%rbp), %xmm0
movq -0x140(%rbp), %rax
ucomisd 0x260(%rax), %xmm0
jbe 0x139a9
movb $0x0, -0x119(%rbp)
jmp 0x139bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x13a4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x13a42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x13a36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x13a2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x13a1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xfde0
jmp 0x13a1e
jmp 0x139ab
movl -0x120(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
jmp 0x13745
movb -0x119(%rbp), %al
movb %al, -0x199(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xfde0
leaq -0xd8(%rbp), %rdi
callq 0xfde0
leaq -0xb0(%rbp), %rdi
callq 0xfde0
leaq -0x88(%rbp), %rdi
callq 0xfde0
leaq -0x50(%rbp), %rdi
callq 0xfde0
leaq -0x28(%rbp), %rdi
callq 0xfe00
movb -0x199(%rbp), %al
andb $0x1, %al
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
leaq -0xd8(%rbp), %rdi
callq 0xfde0
leaq -0xb0(%rbp), %rdi
callq 0xfde0
leaq -0x88(%rbp), %rdi
callq 0xfde0
leaq -0x50(%rbp), %rdi
callq 0xfde0
leaq -0x28(%rbp), %rdi
callq 0xfe00
movq -0x70(%rbp), %rdi
callq 0x9dc0
nopl (%rax)