// File: /workspace/github_cpp_makefile_star2_O3/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 0xf0cc(%rip), %rsi      # 0x1d8fe
leaq 0x38(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
callq 0xf961
movq %r15, %rdi
callq 0x60be
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe865
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x58(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0x34b0
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x78(%rsp,%rax)
jne 0xebcb
leaq 0x150(%rbx), %rsi
leaq 0x58(%rsp), %rdi
movl $0x4, %edx
callq 0x3350
leaq 0x154(%rbx), %rsi
leaq 0x58(%rsp), %rdi
movl $0x4, %edx
callq 0x3350
leaq 0x15c(%rbx), %rsi
leaq 0x58(%rsp), %rdi
movl $0x4, %edx
movq %rsi, 0x18(%rsp)
callq 0x3350
leaq 0x158(%rbx), %rsi
leaq 0x58(%rsp), %rdi
movl $0x4, %edx
callq 0x3350
movq 0x18(%rsp), %rax
cmpl $0x0, (%rax)
jle 0xeb32
xorl %ebp, %ebp
leaq 0x58(%rsp), %r15
leaq 0x8(%rsp), %r14
movq %rsp, %r13
xorl %r12d, %r12d
cmpq %r12, 0x1c8(%rbx)
jle 0xebb4
movq 0x1c0(%rbx), %rax
movl (%rax,%r12,4), %eax
movl %eax, 0x14(%rsp)
movl $0x4, %edx
movq %r15, %rdi
leaq 0x14(%rsp), %rsi
callq 0x3350
cmpq %r12, 0x1d8(%rbx)
jle 0xeb95
movq 0x1d0(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movl $0x8, %edx
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
callq 0x3350
cmpq %r12, 0x208(%rbx)
jle 0xeb95
movq 0x200(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpq %r12, 0x218(%rbx)
jle 0xeb95
movq 0x210(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rsp)
movl $0x8, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3350
movl $0x8, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x3350
cmpq %r12, 0x1e8(%rbx)
jle 0xeb95
movq 0x1e0(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, 0x8(%rsp)
cmpq %r12, 0x1f8(%rbx)
jle 0xeb95
movq 0x1f0(%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rsp)
movl $0x8, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3350
movl $0x8, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x3350
movq 0x228(%rbx), %rax
testq %rax, %rax
jle 0xeb76
cmpq %r12, 0x230(%rbx)
jle 0xeb76
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 0xeb76
cmpq %r12, 0x230(%rbx)
jle 0xeb76
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 0x3350
movq 0x228(%rbx), %rax
cmpq %r14, %rax
jle 0xeb76
cmpq %r12, 0x230(%rbx)
jle 0xeb76
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 0x3350
incq %r14
addq $0x10, %r13
cmpq $0x4, %r14
jne 0xea73
incq %r12
movq 0x18(%rsp), %rax
movslq (%rax), %rax
addq $0x10, %rbp
cmpq %rax, %r12
leaq 0x8(%rsp), %r14
movq %rsp, %r13
jl 0xe909
movq 0x2047f(%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 0x3230
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 0xde8a(%rip), %rdi      # 0x1ca07
leaq 0xdeb8(%rip), %rsi      # 0x1ca3c
leaq 0xded4(%rip), %rcx      # 0x1ca5f
movl $0x16d, %edx            # imm = 0x16D
callq 0x31b0
leaq 0xe71a(%rip), %rdi      # 0x1d2b6
leaq 0xde99(%rip), %rsi      # 0x1ca3c
leaq 0xe7aa(%rip), %rcx      # 0x1d354
movl $0x1a9, %edx            # imm = 0x1A9
callq 0x31b0
leaq 0xe6fb(%rip), %rdi      # 0x1d2b6
leaq 0xde7a(%rip), %rsi      # 0x1ca3c
leaq 0xe70a(%rip), %rcx      # 0x1d2d3
jmp 0xebaa
movq 0x2041e(%rip), %rdi     # 0x2eff0
leaq 0xed3c(%rip), %rsi      # 0x1d915
callq 0x3280
callq 0x3170
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xec18
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x32a0
jmp 0xec18
jmp 0xec0b
jmp 0xec0b
jmp 0xec0b
jmp 0xec0b
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x33a0
movq %rbx, %rdi
callq 0x3450