// File: /workspace/github_cpp_makefile_star2_O3/btbujiangjun[P]abcdl/include/utils/LibsvmHelper.h
// Function: abcdl::utils::LibsvmHelper<float>::write_data(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, abcdl::algebra::Matrix<float> const&, abcdl::algebra::Matrix<float> const&)
bool LibsvmHelper<T>::write_data(const std::string& file,
                                 const abcdl::algebra::Matrix<T>& data_mat,
                                 const abcdl::algebra::Matrix<T>& label_mat){
    if(data_mat.rows() != label_mat.rows()){
        return false;
    }

    std::ofstream out_file(file);

    int row = data_mat.rows();
    int col = data_mat.cols();
    for(int i = 0; i < row; i++){
        out_file << label_mat.get_data(i, 0);
        for(int j = 0; j < col; j++){
            T value = data_mat.get_data(i, j);
            if(value!= 0){
                out_file << " " << j << ":" << value; 
            }
        }
        out_file << "\n";
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3b8, %rsp            # imm = 0x3B8
movq %rcx, %rbp
movq (%rdx), %rax
movq (%rcx), %rcx
cmpq %rcx, %rax
jne 0x11fb4
movq %rdx, %r14
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
leaq 0x1b8(%rsp), %rdi
movl $0x10, %edx
callq 0xa7a0
movq (%r14), %rax
movq %rax, 0x8(%rsp)
testl %eax, %eax
jle 0x11f72
movq 0x8(%r14), %r12
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andq %rax, 0x8(%rsp)
movq %r12, 0x28(%rsp)
andq %rax, %r12
xorl %r13d, %r13d
leaq 0x1b8(%rsp), %r15
movq %rbp, 0x20(%rsp)
movq 0x8(%rbp), %rax
movq %rax, %rbx
imulq %r13, %rbx
imulq (%rbp), %rax
cmpq %rax, %rbx
jae 0x11f32
movq 0x10(%rbp), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax,%rbx,4), %xmm0
movq %r15, %rdi
callq 0xa620
cmpl $0x0, 0x28(%rsp)
jle 0x11f09
xorl %ebp, %ebp
movq 0x8(%r14), %rax
movq %r13, %rbx
imulq %rax, %rbx
addq %rbp, %rbx
imulq (%r14), %rax
cmpq %rax, %rbx
jae 0x11ec9
movq 0x10(%r14), %rax
movss (%rax,%rbx,4), %xmm0
movss %xmm0, 0x4(%rsp)
ucomiss 0x321cb(%rip), %xmm0    # 0x44040
jne 0x11e79
jnp 0x11ebf
movl $0x1, %edx
movq %r15, %rdi
leaq 0x32c90(%rip), %rsi     # 0x44b18
callq 0xa460
movq %r15, %rdi
movl %ebp, %esi
callq 0xa6a0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x32c2b(%rip), %rsi     # 0x44ad4
callq 0xa460
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq %rbx, %rdi
callq 0xa620
incq %rbp
cmpq %rbp, %r12
jne 0x11e48
jmp 0x11f09
leaq 0x30(%rsp), %rdi
leaq 0x32c0c(%rip), %rsi     # 0x44ae1
movl $0x44, %edx
movl $0x3, %ecx
callq 0x429d6
movl $0x1f, %edx
leaq 0x30(%rsp), %rdi
leaq 0x32c05(%rip), %rsi     # 0x44afa
callq 0xa460
leaq 0x30(%rsp), %rdi
callq 0x42bfe
jmp 0x11e5f
movl $0x1, %edx
movq %r15, %rdi
leaq 0x32355(%rip), %rsi     # 0x4426d
callq 0xa460
movq 0x20(%rsp), %rbp
incq %r13
cmpq 0x8(%rsp), %r13
jne 0x11e0e
jmp 0x11f72
leaq 0x30(%rsp), %rdi
leaq 0x32ba3(%rip), %rsi     # 0x44ae1
movl $0x44, %edx
movl $0x3, %ecx
callq 0x429d6
movl $0x1f, %edx
leaq 0x30(%rsp), %rdi
leaq 0x32b9c(%rip), %rsi     # 0x44afa
callq 0xa460
leaq 0x30(%rsp), %rdi
callq 0x42bfe
jmp 0x11e27
movq 0x54027(%rip), %rax     # 0x65fa0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x1c0(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x1b8(%rsp,%rcx)
callq 0xa360
leaq 0x2b0(%rsp), %rdi
callq 0xa100
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
cmpq %rcx, %rax
sete %al
addq $0x3b8, %rsp            # imm = 0x3B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x11fce
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x42bfe
jmp 0x11fe2
jmp 0x11fdf
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
callq 0xa5b0
movq %rbx, %rdi
callq 0xa6c0