// File: btbujiangjun[P]abcdl/include/utils/LibsvmHelper.h
// Function: abcdl::utils::LibsvmHelper<float>::read_data_append_mat(abcdl::algebra::Matrix<float>*, abcdl::algebra::Matrix<float>*, std::vector<abcdl::utils::LibsvmHelper<float>::libsvm_sample, std::allocator<abcdl::utils::LibsvmHelper<float>::libsvm_sample>> const&, unsigned long, unsigned long)
void read_data_append_mat(abcdl::algebra::Matrix<T>* out_data_mat,
                              abcdl::algebra::Matrix<T>* out_label_mat,
                              const std::vector<libsvm_sample>& samples,
                              const size_t dim,
                              const size_t label_dim){
        if(samples.size() == 0){
            return;
        }

        abcdl::algebra::Matrix<T> data_mat(samples.size(), dim);
        abcdl::algebra::Matrix<T> label_mat(samples.size(), label_dim);
        for(size_t i = 0; i < samples.size(); i++){
            auto& sample = samples[i];
            label_mat.set_data(1, i, (size_t)sample.label);
            for(auto& pair : sample.data){
                if (pair.first >= dim){
                    continue;
                }
                data_mat.set_data(pair.second, i, pair.first);
            }
        }
        out_data_mat->insert_row(data_mat);
        out_label_mat->insert_row(label_mat);

        LOG(INFO) << "Loading:" << samples.size() << "/" << out_label_mat->rows() << "/" << out_data_mat->rows() ;
    }

// Assembly:
subq $0x298, %rsp            # imm = 0x298
movq %rdi, 0x290(%rsp)
movq %rsi, 0x288(%rsp)
movq %rdx, 0x280(%rsp)
movq %rcx, 0x278(%rsp)
movq %r8, 0x270(%rsp)
movq %r9, 0x268(%rsp)
movq 0x278(%rsp), %rdi
callq 0x55220
cmpq $0x0, %rax
jne 0x5528f
jmp 0x555c2
movq 0x278(%rsp), %rdi
callq 0x55220
movq %rax, %rsi
movq 0x270(%rsp), %rdx
leaq 0x240(%rsp), %rdi
callq 0x63430
movq 0x278(%rsp), %rdi
callq 0x55220
movq %rax, %rsi
movq 0x268(%rsp), %rdx
leaq 0x218(%rsp), %rdi
callq 0x63430
jmp 0x552db
movq $0x0, 0x200(%rsp)
movq 0x200(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x278(%rsp), %rdi
callq 0x55220
movq %rax, %rcx
movq 0x28(%rsp), %rax
cmpq %rcx, %rax
jae 0x5549d
movq 0x278(%rsp), %rdi
movq 0x200(%rsp), %rsi
callq 0x57200
movq %rax, 0x1f8(%rsp)
movl $0x3f800000, 0x1f4(%rsp) # imm = 0x3F800000
movq 0x200(%rsp), %rdx
movq 0x1f8(%rsp), %rax
movss (%rax), %xmm0
movss 0x67cba(%rip), %xmm2    # 0xbd010
movaps %xmm0, %xmm1
subss %xmm2, %xmm1
cvttss2si %xmm1, %rax
cvttss2si %xmm0, %rcx
movq %rcx, %rsi
sarq $0x3f, %rsi
andq %rsi, %rax
orq %rax, %rcx
leaq 0x218(%rsp), %rdi
leaq 0x1f4(%rsp), %rsi
callq 0x57220
jmp 0x5538b
movq 0x1f8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x1e8(%rsp)
movq 0x1e8(%rsp), %rdi
callq 0x56600
movq %rax, 0x1e0(%rsp)
movq 0x1e8(%rsp), %rdi
callq 0x56630
movq %rax, 0x1d8(%rsp)
leaq 0x1e0(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x568e0
testb $0x1, %al
jne 0x553e7
jmp 0x55482
leaq 0x1e0(%rsp), %rdi
callq 0x56950
movq %rax, 0x1d0(%rsp)
movq 0x1d0(%rsp), %rax
movq (%rax), %rax
cmpq 0x270(%rsp), %rax
jb 0x55445
jmp 0x55470
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x555f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
jmp 0x555e8
movq 0x1d0(%rsp), %rax
movq %rax, %rsi
addq $0x8, %rsi
movq 0x200(%rsp), %rdx
movq (%rax), %rcx
leaq 0x240(%rsp), %rdi
callq 0x57220
jmp 0x5546e
jmp 0x55470
leaq 0x1e0(%rsp), %rdi
callq 0x56960
jmp 0x553c9
jmp 0x55484
movq 0x200(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x200(%rsp)
jmp 0x552e7
movq 0x288(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x64010
jmp 0x554b4
movq 0x280(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x64010
jmp 0x554cb
leaq 0x688e5(%rip), %rsi     # 0xbddb7
leaq 0x48(%rsp), %rdi
movl $0x46, %edx
xorl %ecx, %ecx
callq 0xb8d70
jmp 0x554e5
leaq 0x68900(%rip), %rsi     # 0xbddec
leaq 0x48(%rsp), %rdi
callq 0x57390
movq %rax, 0x20(%rsp)
jmp 0x554fd
movq 0x278(%rsp), %rdi
callq 0x55220
movq 0x20(%rsp), %rdi
movq %rax, 0x40(%rsp)
leaq 0x40(%rsp), %rsi
callq 0x57330
movq %rax, 0x18(%rsp)
jmp 0x55525
movq 0x18(%rsp), %rdi
leaq 0x688c4(%rip), %rsi     # 0xbddf5
callq 0x57360
movq %rax, 0x10(%rsp)
jmp 0x5553d
movq 0x280(%rsp), %rdi
callq 0x29310
movq 0x10(%rsp), %rdi
movq %rax, 0x38(%rsp)
leaq 0x38(%rsp), %rsi
callq 0x57330
movq %rax, 0x8(%rsp)
jmp 0x55565
movq 0x8(%rsp), %rdi
leaq 0x68884(%rip), %rsi     # 0xbddf5
callq 0x57360
movq %rax, (%rsp)
jmp 0x5557c
movq 0x288(%rsp), %rdi
callq 0x29310
movq (%rsp), %rdi
movq %rax, 0x30(%rsp)
leaq 0x30(%rsp), %rsi
callq 0x57330
jmp 0x5559e
leaq 0x48(%rsp), %rdi
callq 0xb9130
leaq 0x218(%rsp), %rdi
callq 0x63830
leaq 0x240(%rsp), %rdi
callq 0x63830
addq $0x298, %rsp            # imm = 0x298
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x210(%rsp)
movl %eax, 0x20c(%rsp)
leaq 0x48(%rsp), %rdi
callq 0xb9130
leaq 0x218(%rsp), %rdi
callq 0x63830
leaq 0x240(%rsp), %rdi
callq 0x63830
movq 0x210(%rsp), %rdi
callq 0xc980
nop