// File: Pyboon[P]sage/isi_sage.cpp
// Function: IsiSage::ParamsInit()
void IsiSage::ParamsInit(){
    Util::log("sage params init");
    //init result array and CT and CR array
    result.tau = VectorXi::Zero(max_path_num);
    result.doppler = VectorXd::Zero(max_path_num);
    result.theta_rx = VectorXd::Zero(max_path_num);
    result.phi_rx = VectorXd::Zero(max_path_num);
    result.theta_tx = VectorXd::Zero(max_path_num);
    result.phi_tx = VectorXd::Zero(max_path_num);
    result.alpha = complex_mat::Zero(4, max_path_num);

    // init sage
    int iL = 0;
    complex_mat data = CIR;
    while(iL<max_path_num){
        Util::log("============ Initing the " + to_string(iL) + " path =============");
        //init tau
        RowVectorXcd tau_data = InitTau(data, iL);
        // init doppler frequency
        InitDoppler(tau_data, iL);
        // init angle of arrival 
        InitAoA(tau_data, iL);
        // init angle of departure
        InitAoD(tau_data, iL);
        //init alpha
        UpdateAlpha(tau_data, iL);
        //  construct signal 
        data.row(result.tau(iL)-1) -= SignalConstruct(iL);
        cout<<"the path "<<iL+1<<" init result:"<<" tau="<<result.tau(iL)<<" doppler="
        <<result.doppler(iL)<<" phi_rx="<<result.phi_rx(iL)<<" theta_rx="<<result.theta_rx(iL)
        <<" phi_tx="<<result.phi_tx(iL)<<" theta_tx="<<result.theta_tx(iL)<<" alpha="<<result.alpha(0, iL)<<endl;
        ++iL;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2f0, %rsp            # imm = 0x2F0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x228(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x9dd0
movq -0x220(%rbp), %rdx
leaq 0x56c28(%rip), %rsi     # 0x6fad0
leaq -0x28(%rbp), %rdi
callq 0xb320
jmp 0x18eb3
leaq -0x28(%rbp), %rdi
callq 0x13b80
jmp 0x18ebe
leaq -0x28(%rbp), %rdi
callq 0x9470
leaq -0x29(%rbp), %rdi
callq 0x9840
movq -0x228(%rbp), %rax
movslq 0x15c(%rax), %rsi
leaq -0x50(%rbp), %rdi
callq 0x1fd90
movq -0x228(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
leaq -0x50(%rbp), %rsi
callq 0x1fdd0
movq -0x228(%rbp), %rax
movslq 0x15c(%rax), %rsi
leaq -0x68(%rbp), %rdi
callq 0x1fe00
movq -0x228(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
addq $0x10, %rdi
leaq -0x68(%rbp), %rsi
callq 0x1fe40
movq -0x228(%rbp), %rax
movslq 0x15c(%rax), %rsi
leaq -0x80(%rbp), %rdi
callq 0x1fe00
movq -0x228(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
addq $0x40, %rdi
leaq -0x80(%rbp), %rsi
callq 0x1fe40
movq -0x228(%rbp), %rax
movslq 0x15c(%rax), %rsi
leaq -0x98(%rbp), %rdi
callq 0x1fe00
movq -0x228(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
addq $0x50, %rdi
leaq -0x98(%rbp), %rsi
callq 0x1fe40
movq -0x228(%rbp), %rax
movslq 0x15c(%rax), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x1fe00
movq -0x228(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
addq $0x20, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x1fe40
movq -0x228(%rbp), %rax
movslq 0x15c(%rax), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x1fe00
movq -0x228(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
addq $0x30, %rdi
leaq -0xc8(%rbp), %rsi
callq 0x1fe40
movq -0x228(%rbp), %rax
movslq 0x15c(%rax), %rdx
leaq -0xe8(%rbp), %rdi
movl $0x4, %esi
callq 0x13a60
movq -0x228(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
addq $0x60, %rdi
leaq -0xe8(%rbp), %rsi
callq 0x13ac0
movq -0x228(%rbp), %rsi
movl $0x0, -0xec(%rbp)
addq $0x138, %rsi            # imm = 0x138
leaq -0x108(%rbp), %rdi
callq 0x1fe70
movq -0x228(%rbp), %rcx
movl -0xec(%rbp), %eax
cmpl 0x15c(%rcx), %eax
jge 0x19727
movl -0xec(%rbp), %esi
leaq -0x168(%rbp), %rdi
callq 0x1fef0
jmp 0x19098
leaq 0x56a42(%rip), %rsi     # 0x6fae1
leaq -0x148(%rbp), %rdi
leaq -0x168(%rbp), %rdx
callq 0x1fea0
jmp 0x190b4
leaq 0x56a40(%rip), %rdx     # 0x6fafb
leaq -0x128(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x13b30
jmp 0x190d0
leaq -0x128(%rbp), %rdi
callq 0x13b80
jmp 0x190de
leaq -0x128(%rbp), %rdi
callq 0x9470
leaq -0x148(%rbp), %rdi
callq 0x9470
leaq -0x168(%rbp), %rdi
callq 0x9470
leaq -0x190(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x1fe70
jmp 0x19117
movq -0x228(%rbp), %rsi
movl -0xec(%rbp), %ecx
leaq -0x178(%rbp), %rdi
leaq -0x190(%rbp), %rdx
callq 0x19760
jmp 0x19139
leaq -0x190(%rbp), %rdi
callq 0xfac0
leaq -0x1a0(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x20010
jmp 0x1915a
movq -0x228(%rbp), %rdi
movl -0xec(%rbp), %edx
leaq -0x1a0(%rbp), %rsi
callq 0x199c0
jmp 0x19175
leaq -0x1a0(%rbp), %rdi
callq 0x20040
leaq -0x1b0(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x20010
jmp 0x19196
movq -0x228(%rbp), %rdi
movl -0xec(%rbp), %edx
leaq -0x1b0(%rbp), %rsi
callq 0x19e90
jmp 0x191b1
leaq -0x1b0(%rbp), %rdi
callq 0x20040
leaq -0x1c0(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x20010
jmp 0x191d2
movq -0x228(%rbp), %rdi
movl -0xec(%rbp), %edx
leaq -0x1c0(%rbp), %rsi
callq 0x1ab30
jmp 0x191ed
leaq -0x1c0(%rbp), %rdi
callq 0x20040
leaq -0x1d0(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x20010
jmp 0x1920e
movq -0x228(%rbp), %rdi
movl -0xec(%rbp), %edx
leaq -0x1d0(%rbp), %rsi
callq 0x1b930
jmp 0x19229
leaq -0x1d0(%rbp), %rdi
callq 0x20040
movq -0x228(%rbp), %rsi
movl -0xec(%rbp), %edx
leaq -0x1e0(%rbp), %rdi
callq 0x1c4a0
jmp 0x19250
movq -0x228(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movslq -0xec(%rbp), %rsi
callq 0x14090
movq %rax, -0x230(%rbp)
jmp 0x19273
movq -0x230(%rbp), %rax
movl (%rax), %eax
decl %eax
movslq %eax, %rdx
leaq -0x218(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x20060
jmp 0x19296
leaq -0x218(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x200b0
jmp 0x192ab
leaq -0x1e0(%rbp), %rdi
callq 0x20040
movq 0x9bd0a(%rip), %rdi     # 0xb4fc8
leaq 0x5684a(%rip), %rsi     # 0x6fb0f
callq 0x9790
movq %rax, -0x238(%rbp)
jmp 0x192d3
movq -0x238(%rbp), %rdi
movl -0xec(%rbp), %esi
incl %esi
callq 0x9d90
movq %rax, -0x240(%rbp)
jmp 0x192f0
movq -0x240(%rbp), %rdi
leaq 0x5681b(%rip), %rsi     # 0x6fb19
callq 0x9790
movq %rax, -0x248(%rbp)
jmp 0x1930c
movq -0x248(%rbp), %rdi
leaq 0x5680d(%rip), %rsi     # 0x6fb27
callq 0x9790
movq %rax, -0x250(%rbp)
jmp 0x19328
movq -0x228(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
movslq -0xec(%rbp), %rsi
callq 0x14090
movq %rax, -0x258(%rbp)
jmp 0x1934b
movq -0x250(%rbp), %rdi
movq -0x258(%rbp), %rax
movl (%rax), %esi
callq 0x9d90
movq %rax, -0x260(%rbp)
jmp 0x19369
movq -0x260(%rbp), %rdi
leaq 0x567b6(%rip), %rsi     # 0x6fb2d
callq 0x9790
movq %rax, -0x268(%rbp)
jmp 0x19385
movq -0x228(%rbp), %rdi
addq $0x1d0, %rdi            # imm = 0x1D0
movslq -0xec(%rbp), %rsi
callq 0x14140
movq %rax, -0x270(%rbp)
jmp 0x193a8
movq -0x268(%rbp), %rdi
movq -0x270(%rbp), %rax
movsd (%rax), %xmm0
callq 0x9ed0
movq %rax, -0x278(%rbp)
jmp 0x193c8
movq -0x278(%rbp), %rdi
leaq 0x56761(%rip), %rsi     # 0x6fb37
callq 0x9790
movq %rax, -0x280(%rbp)
jmp 0x193e4
movq -0x228(%rbp), %rdi
addq $0x210, %rdi            # imm = 0x210
movslq -0xec(%rbp), %rsi
callq 0x14140
movq %rax, -0x288(%rbp)
jmp 0x19407
movq -0x280(%rbp), %rdi
movq -0x288(%rbp), %rax
movsd (%rax), %xmm0
callq 0x9ed0
movq %rax, -0x290(%rbp)
jmp 0x19427
movq -0x290(%rbp), %rdi
leaq 0x5670b(%rip), %rsi     # 0x6fb40
callq 0x9790
movq %rax, -0x298(%rbp)
jmp 0x19443
movq -0x228(%rbp), %rdi
addq $0x200, %rdi            # imm = 0x200
movslq -0xec(%rbp), %rsi
callq 0x14140
movq %rax, -0x2a0(%rbp)
jmp 0x19466
movq -0x298(%rbp), %rdi
movq -0x2a0(%rbp), %rax
movsd (%rax), %xmm0
callq 0x9ed0
movq %rax, -0x2a8(%rbp)
jmp 0x19486
movq -0x2a8(%rbp), %rdi
leaq 0x566b7(%rip), %rsi     # 0x6fb4b
callq 0x9790
movq %rax, -0x2b0(%rbp)
jmp 0x194a2
movq -0x228(%rbp), %rdi
addq $0x1f0, %rdi            # imm = 0x1F0
movslq -0xec(%rbp), %rsi
callq 0x14140
movq %rax, -0x2b8(%rbp)
jmp 0x194c5
movq -0x2b0(%rbp), %rdi
movq -0x2b8(%rbp), %rax
movsd (%rax), %xmm0
callq 0x9ed0
movq %rax, -0x2c0(%rbp)
jmp 0x194e5
movq -0x2c0(%rbp), %rdi
leaq 0x56661(%rip), %rsi     # 0x6fb54
callq 0x9790
movq %rax, -0x2c8(%rbp)
jmp 0x19501
movq -0x228(%rbp), %rdi
addq $0x1e0, %rdi            # imm = 0x1E0
movslq -0xec(%rbp), %rsi
callq 0x14140
movq %rax, -0x2d0(%rbp)
jmp 0x19524
movq -0x2c8(%rbp), %rdi
movq -0x2d0(%rbp), %rax
movsd (%rax), %xmm0
callq 0x9ed0
movq %rax, -0x2d8(%rbp)
jmp 0x19544
movq -0x2d8(%rbp), %rdi
leaq 0x5660d(%rip), %rsi     # 0x6fb5f
callq 0x9790
movq %rax, -0x2e0(%rbp)
jmp 0x19560
movq -0x228(%rbp), %rdi
addq $0x220, %rdi            # imm = 0x220
movslq -0xec(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x13c40
movq %rax, -0x2e8(%rbp)
jmp 0x19587
movq -0x2e8(%rbp), %rsi
movq -0x2e0(%rbp), %rdi
callq 0x98e0
movq %rax, -0x2f0(%rbp)
jmp 0x195a3
movq -0x2f0(%rbp), %rdi
movq 0x9b9df(%rip), %rsi     # 0xb4f90
callq 0x97d0
jmp 0x195b8
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x20040
jmp 0x1906b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x195fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x9470
leaq -0x29(%rbp), %rdi
callq 0x9840
jmp 0x19748
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x1973c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x1965a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x1964e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x9470
leaq -0x148(%rbp), %rdi
callq 0x9470
leaq -0x168(%rbp), %rdi
callq 0x9470
jmp 0x1973c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0xfac0
jmp 0x1973c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x19719
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x20040
jmp 0x19719
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x20040
jmp 0x19719
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x20040
jmp 0x19719
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x20040
jmp 0x19719
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x20040
leaq -0x178(%rbp), %rdi
callq 0x20040
jmp 0x1973c
leaq -0x108(%rbp), %rdi
callq 0xfac0
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbp
retq
leaq -0x108(%rbp), %rdi
callq 0xfac0
movq -0x38(%rbp), %rdi
callq 0x9dc0
nopw %cs:(%rax,%rax)