// File: /workspace/github_cpp_makefile_star2_O1/Pyboon[P]sage/isi_sage.cpp
// Function: IsiSage::SaveResult(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void IsiSage::SaveResult(const string save_path){
    Util::log("Saving Sage Result at " + save_path);
    ofstream f_result(save_path, ios::binary);
    if(!f_result){
        cerr<<"sage result save Error!!!";
        abort();
    }
    //save sage metainfo 
    f_result.write((char*)&spot, sizeof(int));
    f_result.write((char*)&cycle_idx, sizeof(int));
    f_result.write((char*)&max_path_num, sizeof(int));
    f_result.write((char*)&max_iter_num, sizeof(int));
    // save sage result data
    for(int iL = 0; iL < max_path_num; ++iL){
        //save tau of the iL path
        int tau = result.tau(iL);
        f_result.write((char*)&tau, sizeof(int));
        //save doppler of the iL path
        double doppler = result.doppler(iL);
        f_result.write((char*)&doppler, sizeof(double));
        //save AOA of the iL path
        double theta = result.theta_rx(iL);
        double phi = result.phi_rx(iL);
        f_result.write((char*)&theta, sizeof(double));
        f_result.write((char*)&phi, sizeof(double));
        //save AoD of the iL path
        theta = result.theta_tx(iL);
        phi = result.phi_tx(iL);
        f_result.write((char*)&theta, sizeof(double));
        f_result.write((char*)&phi, sizeof(double));
        //save alpha of the iL path
        double alpha_real = result.alpha(0, iL).real();
        double alpha_imag = result.alpha(0, iL).imag();
        for(int i = 0; i < 4; ++i){
            alpha_real = result.alpha(i, iL).real();
            f_result.write((char*)&alpha_real, sizeof(double));
            alpha_imag = result.alpha(i, iL).imag();
            f_result.write((char*)&alpha_imag, sizeof(double));
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xf13c(%rip), %rsi      # 0x1d86e
leaq 0x38(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
callq 0xf893
movq %r15, %rdi
callq 0x60e8
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe765
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x58(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x34c0
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x78(%rsp,%rax)
jne 0xeacb
leaq 0x150(%rbx), %rsi
leaq 0x58(%rsp), %rdi
movl $0x4, %edx
callq 0x3360
leaq 0x154(%rbx), %rsi
leaq 0x58(%rsp), %rdi
movl $0x4, %edx
callq 0x3360
leaq 0x15c(%rbx), %rsi
leaq 0x58(%rsp), %rdi
movl $0x4, %edx
movq %rsi, 0x18(%rsp)
callq 0x3360
leaq 0x158(%rbx), %rsi
leaq 0x58(%rsp), %rdi
movl $0x4, %edx
callq 0x3360
movq 0x18(%rsp), %rax
cmpl $0x0, (%rax)
jle 0xea32
xorl %ebp, %ebp
leaq 0x58(%rsp), %r15
leaq 0x8(%rsp), %r14
movq %rsp, %r13
xorl %r12d, %r12d
cmpq %r12, 0x1c8(%rbx)
jle 0xeab4
movq 0x1c0(%rbx), %rax
movl (%rax,%r12,4), %eax
movl %eax, 0x14(%rsp)
movl $0x4, %edx
movq %r15, %rdi
leaq 0x14(%rsp), %rsi
callq 0x3360
cmpq %r12, 0x1d8(%rbx)
jle 0xea95
movq 0x1d0(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movl $0x8, %edx
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
callq 0x3360
cmpq %r12, 0x208(%rbx)
jle 0xea95
movq 0x200(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpq %r12, 0x218(%rbx)
jle 0xea95
movq 0x210(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rsp)
movl $0x8, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3360
movl $0x8, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x3360
cmpq %r12, 0x1e8(%rbx)
jle 0xea95
movq 0x1e0(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpq %r12, 0x1f8(%rbx)
jle 0xea95
movq 0x1f0(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rsp)
movl $0x8, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3360
movl $0x8, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x3360
movq 0x228(%rbx), %rax
testq %rax, %rax
jle 0xea76
cmpq %r12, 0x230(%rbx)
jle 0xea76
movq 0x220(%rbx), %rcx
imulq %r12, %rax
shlq $0x4, %rax
movsd (%rcx,%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x8(%rcx,%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movl $0x8, %r13d
xorl %r14d, %r14d
movq 0x228(%rbx), %rax
cmpq %r14, %rax
jle 0xea76
cmpq %r12, 0x230(%rbx)
jle 0xea76
imulq %rbp, %rax
addq 0x220(%rbx), %rax
movsd -0x8(%r13,%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movl $0x8, %edx
movq %r15, %rdi
leaq 0x28(%rsp), %rsi
callq 0x3360
movq 0x228(%rbx), %rax
cmpq %r14, %rax
jle 0xea76
cmpq %r12, 0x230(%rbx)
jle 0xea76
imulq %rbp, %rax
addq 0x220(%rbx), %rax
movsd (%r13,%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movl $0x8, %edx
movq %r15, %rdi
leaq 0x20(%rsp), %rsi
callq 0x3360
incq %r14
addq $0x10, %r13
cmpq $0x4, %r14
jne 0xe973
incq %r12
movq 0x18(%rsp), %rax
movslq (%rax), %rax
addq $0x10, %rbp
cmpq %rax, %r12
leaq 0x8(%rsp), %r14
movq %rsp, %r13
jl 0xe809
movq 0x2057f(%rip), %rax     # 0x2efb8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x60(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x58(%rsp,%rcx)
callq 0x3240
leaq 0x150(%rsp), %rdi
callq 0x30e0
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xdf6a(%rip), %rdi      # 0x1c9e7
leaq 0xdf98(%rip), %rsi      # 0x1ca1c
leaq 0xdfb4(%rip), %rcx      # 0x1ca3f
movl $0x16d, %edx            # imm = 0x16D
callq 0x31b0
leaq 0xe7fa(%rip), %rdi      # 0x1d296
leaq 0xdf79(%rip), %rsi      # 0x1ca1c
leaq 0xe88a(%rip), %rcx      # 0x1d334
movl $0x1a9, %edx            # imm = 0x1A9
callq 0x31b0
leaq 0xe7db(%rip), %rdi      # 0x1d296
leaq 0xdf5a(%rip), %rsi      # 0x1ca1c
leaq 0xe7ea(%rip), %rcx      # 0x1d2b3
jmp 0xeaaa
movq 0x2051e(%rip), %rdi     # 0x2eff0
leaq 0xedac(%rip), %rsi      # 0x1d885
callq 0x3290
callq 0x3170
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xeb18
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0xeb18
jmp 0xeb0b
jmp 0xeb0b
jmp 0xeb0b
jmp 0xeb0b
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x33b0
movq %rbx, %rdi
callq 0x3460