// File: /workspace/github_cpp_makefile_star2_O1/Pyboon[P]sage/isi_sage.cpp
// Function: IsiSage::ParamsIterationUpdate()
void IsiSage::ParamsIterationUpdate(){
    Util::log("SAGE iteration step for updating params");
    int n_step = 1;
    SageResult last_update_result; 
    while(n_step <= max_iter_num){
        Util::log("====== Starting the " + to_string(n_step) + "th iteration step ======");
        // save init result of all path
        last_update_result = result;
        complex_mat y;
        for(int i_path = 0; i_path < max_path_num; ++i_path){
            y = CIR;
            //========== Expectation Step ==================
            for(int j = 0; j<max_path_num; ++j){
                if(j!=i_path){
                    y.row(result.tau(j)-1) -= SignalConstruct(j);
                }
            }
            //========== Maximization Step =================
            // update tau 
            RowVectorXcd tau_data = UpdateTau(y, i_path);
            // update AoA
            UpdateAoA(tau_data, i_path);
            // update AoD
            UpdateAoD(tau_data, i_path);
            // update doppler
            UpdateDoppler(tau_data, i_path);
            // update alpha 
            UpdateAlpha(tau_data, i_path);

        }
        // judge coverage
        if(IterConvergence(last_update_result, result)){
            Util::log("Iteration has coveraged !");
            break;
        }

        ++n_step;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rdi, %rbx
leaq 0xf0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x12159(%rip), %rsi     # 0x1d7a6
leaq 0x12179(%rip), %rdx     # 0x1d7cd
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
callq 0x43da
movq %r14, %rdi
callq 0x60e8
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0xb689
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x32b0
xorpd %xmm0, %xmm0
leaq 0x100(%rsp), %rdi
movapd %xmm0, 0x60(%rdi)
movapd %xmm0, 0x50(%rdi)
movapd %xmm0, 0x40(%rdi)
movapd %xmm0, 0x30(%rdi)
movapd %xmm0, 0x20(%rdi)
movapd %xmm0, 0x10(%rdi)
movapd %xmm0, (%rdi)
movq $0x0, 0x70(%rdi)
leaq 0x1c0(%rbx), %r15
leaq 0x138(%rbx), %rax
movq %rax, 0x98(%rsp)
movl $0x1, %edx
leaq 0x38(%rsp), %r13
movl $0xd1b71759, %esi       # imm = 0xD1B71759
cmpl 0x158(%rbx), %edx
jg 0xbc38
movl %edx, %r14d
negl %r14d
cmovsl %edx, %r14d
movl $0x1, %r12d
cmpl $0xa, %r14d
jb 0xb748
movl $0x4, %r12d
movl %r14d, %eax
cmpl $0x63, %eax
jbe 0xb73f
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0xb745
cmpl $0x2710, %eax           # imm = 0x2710
jb 0xb748
movl %eax, %ecx
imulq %rsi, %rcx
shrq $0x2d, %rcx
addl $0x4, %r12d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0xb70f
addl $-0x3, %r12d
jmp 0xb748
addl $-0x2, %r12d
jmp 0xb748
decl %r12d
movl %edx, 0xc(%rsp)
movl %edx, %ebp
shrl $0x1f, %ebp
leal (%r12,%rbp), %esi
leaq 0x48(%rsp), %rax
movq %rax, 0x38(%rsp)
movq %r13, %rdi
movl $0x2d, %edx
callq 0x3300
movl %ebp, %edi
addq 0x38(%rsp), %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0xf91b
movl $0x14, %r8d
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x1203c(%rip), %rcx     # 0x1d7ce
callq 0x32c0
leaq 0x20(%rsp), %r14
movq %r14, 0x10(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq 0x100(%rsp), %rbp
je 0xb7c7
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0xb7d0
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x10(%rsp), %rdi
leaq 0x11fef(%rip), %rsi     # 0x1d7e3
callq 0x34b0
leaq 0x68(%rsp), %rsi
movq %rsi, 0x58(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xb821
movq %rdx, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0xb829
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x60(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x58(%rsp), %rdi
callq 0x60e8
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xb867
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xb87e
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xb89a
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbp, %rdi
movq %r15, %rsi
callq 0xf418
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x0, 0x15c(%rbx)
jle 0xbacf
xorl %r12d, %r12d
leaq 0x10(%rsp), %rdi
movq 0x98(%rsp), %rsi
movq %r13, %rdx
callq 0x1a8d5
cmpl $0x0, 0x15c(%rbx)
jle 0xb9bf
xorl %r14d, %r14d
cmpq %r12, %r14
je 0xb9ac
movq %r13, %rdi
movq %rbx, %rsi
movl %r14d, %edx
callq 0xb154
cmpq %r14, 0x1c8(%rbx)
jle 0xbd02
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rax
testq %rdx, %rdx
sete %cl
testq %rax, %rax
setns %sil
orb %cl, %sil
je 0xbca5
movq (%r15), %rcx
movl (%rcx,%r14,4), %ecx
testl %ecx, %ecx
jle 0xbce3
decl %ecx
movslq %ecx, %rdi
movq 0x18(%rsp), %rcx
cmpq %rdi, %rcx
jle 0xbce3
cmpq 0x40(%rsp), %rax
jne 0xbcc4
testq %rax, %rax
jle 0xb9a2
movq 0x38(%rsp), %rsi
addq $0x8, %rsi
shlq $0x4, %rdi
addq %rdi, %rdx
addq $0x8, %rdx
shlq $0x4, %rcx
movsd -0x8(%rdx), %xmm0
subsd -0x8(%rsi), %xmm0
movsd (%rdx), %xmm1
subsd (%rsi), %xmm1
movsd %xmm0, -0x8(%rdx)
movsd %xmm1, (%rdx)
addq $0x10, %rsi
addq %rcx, %rdx
decq %rax
jne 0xb97b
movq 0x38(%rsp), %rdi
callq 0x3320
incq %r14
movslq 0x15c(%rbx), %rax
cmpq %rax, %r14
jl 0xb8ed
leaq 0x180(%rsp), %r14
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
callq 0xfaf8
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movl %r12d, %ecx
callq 0xbee0
movq 0x180(%rsp), %rdi
callq 0x3320
leaq 0xd0(%rsp), %rdi
movq %r13, %rsi
callq 0xfbc4
movq %rbx, %rdi
leaq 0xd0(%rsp), %rsi
movl %r12d, %edx
callq 0xc5c6
movq 0xd0(%rsp), %rdi
callq 0x3320
leaq 0xc0(%rsp), %rdi
movq %r13, %rsi
callq 0xfbc4
movq %rbx, %rdi
leaq 0xc0(%rsp), %rsi
movl %r12d, %edx
callq 0xce06
movq 0xc0(%rsp), %rdi
callq 0x3320
leaq 0xb0(%rsp), %rdi
movq %r13, %rsi
callq 0xfbc4
movq %rbx, %rdi
leaq 0xb0(%rsp), %rsi
movl %r12d, %edx
callq 0xd646
movq 0xb0(%rsp), %rdi
callq 0x3320
leaq 0xa0(%rsp), %rdi
movq %r13, %rsi
callq 0xfbc4
movq %rbx, %rdi
leaq 0xa0(%rsp), %rsi
movl %r12d, %edx
callq 0xa138
movq 0xa0(%rsp), %rdi
callq 0x3320
movq 0x38(%rsp), %rdi
callq 0x3320
incq %r12
movslq 0x15c(%rbx), %rax
cmpq %rax, %r12
jl 0xb8c8
leaq 0x198(%rsp), %rdi
movq %rbp, %rsi
callq 0xf7b0
leaq 0x210(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0xf7b0
movq (%rbx), %rax
movq %rbx, %rdi
leaq 0x198(%rsp), %rsi
movq %r14, %rdx
callq *0x28(%rax)
movl %eax, %r12d
movq 0x270(%rsp), %rdi
callq 0x3320
movq 0x260(%rsp), %rdi
callq 0x3320
movq 0x250(%rsp), %rdi
callq 0x3320
movq 0x240(%rsp), %rdi
callq 0x3320
movq 0x230(%rsp), %rdi
callq 0x3320
movq 0x220(%rsp), %rdi
callq 0x3320
movq 0x210(%rsp), %rdi
callq 0x3320
movq 0x1f8(%rsp), %rdi
callq 0x3320
movq 0x1e8(%rsp), %rdi
callq 0x3320
movq 0x1d8(%rsp), %rdi
callq 0x3320
movq 0x1c8(%rsp), %rdi
callq 0x3320
movq 0x1b8(%rsp), %rdi
callq 0x3320
movq 0x1a8(%rsp), %rdi
callq 0x3320
movq 0x198(%rsp), %rdi
callq 0x3320
testb %r12b, %r12b
leaq 0x78(%rsp), %r14
je 0xbc18
leaq 0x88(%rsp), %rax
movq %rax, 0x78(%rsp)
movq %r14, %rdi
leaq 0x11c1c(%rip), %rsi     # 0x1d7fc
leaq 0x11c2e(%rip), %rdx     # 0x1d815
callq 0x43da
movq %r14, %rdi
callq 0x60e8
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xbc1c
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0xbc1c
incl 0xc(%rsp)
movq 0x10(%rsp), %rdi
callq 0x3320
testb %r12b, %r12b
movl 0xc(%rsp), %edx
movl $0xd1b71759, %esi       # imm = 0xD1B71759
je 0xb6e4
movq 0x160(%rsp), %rdi
callq 0x3320
movq 0x150(%rsp), %rdi
callq 0x3320
movq 0x140(%rsp), %rdi
callq 0x3320
movq 0x130(%rsp), %rdi
callq 0x3320
movq 0x120(%rsp), %rdi
callq 0x3320
movq 0x110(%rsp), %rdi
callq 0x3320
movq 0x100(%rsp), %rdi
callq 0x3320
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x123d6(%rip), %rdi     # 0x1e082
leaq 0x12479(%rip), %rsi     # 0x1e12c
leaq 0x1248d(%rip), %rcx     # 0x1e147
movl $0xaf, %edx
callq 0x31b0
leaq 0x12544(%rip), %rdi     # 0x1e20f
leaq 0x10831(%rip), %rsi     # 0x1c503
leaq 0x1256b(%rip), %rcx     # 0x1e244
movl $0x2c6, %edx            # imm = 0x2C6
callq 0x31b0
leaq 0x12217(%rip), %rdi     # 0x1df01
leaq 0x122b7(%rip), %rsi     # 0x1dfa8
leaq 0x122c9(%rip), %rcx     # 0x1dfc1
movl $0x7a, %edx
callq 0x31b0
leaq 0x1158d(%rip), %rdi     # 0x1d296
leaq 0x10d0c(%rip), %rsi     # 0x1ca1c
leaq 0x1159c(%rip), %rcx     # 0x1d2b3
movl $0x1a9, %edx            # imm = 0x1A9
callq 0x31b0
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
cmpq %r15, %rdi
je 0xbed7
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0xbed7
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xbe72
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0xbe72
jmp 0xbe6f
movq %rax, %rbx
jmp 0xbd97
jmp 0xbe6f
movq %rax, %rbx
leaq 0x210(%rsp), %rdi
callq 0x4274
leaq 0x198(%rsp), %rdi
callq 0x4274
jmp 0xbe72
jmp 0xbdb0
movq %rax, %rbx
jmp 0xbddc
movq %rax, %rbx
jmp 0xbe7c
movq %rax, %rbx
jmp 0xbdf8
movq %rax, %rbx
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xbddc
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbdf8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xbe7c
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0xbe7c
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
jmp 0xbe57
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
jmp 0xbe57
movq %rax, %rbx
movq 0x180(%rsp), %rdi
jmp 0xbe68
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
jmp 0xbe57
jmp 0xbe6f
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
callq 0x3320
jmp 0xbe63
jmp 0xbe6f
movq %rax, %rbx
movq 0x38(%rsp), %rdi
callq 0x3320
jmp 0xbe72
movq %rax, %rbx
movq 0x10(%rsp), %rdi
callq 0x3320
movq 0x160(%rsp), %rdi
callq 0x3320
movq 0x150(%rsp), %rdi
callq 0x3320
movq 0x140(%rsp), %rdi
callq 0x3320
movq 0x130(%rsp), %rdi
callq 0x3320
movq 0x120(%rsp), %rdi
callq 0x3320
movq 0x110(%rsp), %rdi
callq 0x3320
movq 0x100(%rsp), %rdi
callq 0x3320
movq %rbx, %rdi
callq 0x3460
nop