// File: /workspace/github_cpp_makefile_star2_O1/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 0x122aa
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 0x12268
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 0x12228
movq 0x10(%rbp), %rax
xorps %xmm0, %xmm0
cvtss2sd (%rax,%rbx,4), %xmm0
movq %r15, %rdi
callq 0xa620
cmpl $0x0, 0x28(%rsp)
jle 0x121ff
xorl %ebp, %ebp
movq 0x8(%r14), %rax
movq %r13, %rbx
imulq %rax, %rbx
addq %rbp, %rbx
imulq (%r14), %rax
cmpq %rax, %rbx
jae 0x121bf
movq 0x10(%r14), %rax
movss (%rax,%rbx,4), %xmm0
movss %xmm0, 0x4(%rsp)
ucomiss 0x31ed5(%rip), %xmm0    # 0x44040
jne 0x1216f
jnp 0x121b5
movl $0x1, %edx
movq %r15, %rdi
leaq 0x3299a(%rip), %rsi     # 0x44b18
callq 0xa460
movq %r15, %rdi
movl %ebp, %esi
callq 0xa6a0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x32935(%rip), %rsi     # 0x44ad4
callq 0xa460
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rsp), %xmm0
movq %rbx, %rdi
callq 0xa620
incq %rbp
cmpq %rbp, %r12
jne 0x1213e
jmp 0x121ff
leaq 0x30(%rsp), %rdi
leaq 0x32916(%rip), %rsi     # 0x44ae1
movl $0x44, %edx
movl $0x3, %ecx
callq 0x42bd2
movl $0x1f, %edx
leaq 0x30(%rsp), %rdi
leaq 0x3290f(%rip), %rsi     # 0x44afa
callq 0xa460
leaq 0x30(%rsp), %rdi
callq 0x42dfa
jmp 0x12155
movl $0x1, %edx
movq %r15, %rdi
leaq 0x3205f(%rip), %rsi     # 0x4426d
callq 0xa460
movq 0x20(%rsp), %rbp
incq %r13
cmpq 0x8(%rsp), %r13
jne 0x12104
jmp 0x12268
leaq 0x30(%rsp), %rdi
leaq 0x328ad(%rip), %rsi     # 0x44ae1
movl $0x44, %edx
movl $0x3, %ecx
callq 0x42bd2
movl $0x1f, %edx
leaq 0x30(%rsp), %rdi
leaq 0x328a6(%rip), %rsi     # 0x44afa
callq 0xa460
leaq 0x30(%rsp), %rdi
callq 0x42dfa
jmp 0x1211d
movq 0x54d31(%rip), %rax     # 0x66fa0
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 0x122c4
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x42dfa
jmp 0x122d8
jmp 0x122d5
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
callq 0xa5b0
movq %rbx, %rdi
callq 0xa6c0