// File: btbujiangjun[P]abcdl/include/utils/RNNHelper.h
// Function: abcdl::utils::RNNHelper::read_data(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, abcdl::algebra::MatrixSet<float>&, int)
bool RNNHelper::read_data(const std::string& data_file,
                          abcdl::algebra::MatSet& matset,
                          int limit){
	std::ifstream in_file(data_file.c_str());
	if(!in_file.is_open()){
		LOG(FATAL) << "Open file failed:" << data_file.c_str();
		return false;
	}
		
	std::string data;
    abcdl::utils::StringHelper helper;
	while(getline(in_file, data)){
		auto line_data = helper.split(data, "\t");
        size_t rows = line_data.size();
        abcdl::algebra::Mat mat(rows, _feature_dim);
        for(size_t i = 0; i != rows ; i++){
            mat.set_data(1, i, helper.str2int(line_data[i]));
        }
        matset.push_back(mat);
        if(limit > 0 && (int)matset.size() >= limit){
            break;
        }
	}
	in_file.close();
	return true;
}

// Assembly:
subq $0x4f8, %rsp            # imm = 0x4F8
movq %rdi, 0x4e8(%rsp)
movq %rsi, 0x4e0(%rsp)
movq %rdx, 0x4d8(%rsp)
movl %ecx, 0x4d4(%rsp)
movq 0x4e8(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x4e0(%rsp), %rdi
callq 0xb1f0
movq %rax, %rsi
leaq 0x2c8(%rsp), %rdi
movq %rdi, 0x40(%rsp)
movl $0x8, %edx
callq 0xba00
movq 0x40(%rsp), %rdi
callq 0xb870
movb %al, 0x4f(%rsp)
jmp 0xcdca
movb 0x4f(%rsp), %al
testb $0x1, %al
jne 0xcea0
jmp 0xcdd8
leaq 0xa846d(%rip), %rsi     # 0xb524c
leaq 0x130(%rsp), %rdi
movl $0x56, %edx
movl $0x3, %ecx
callq 0xb0f80
jmp 0xcdf8
leaq 0xa847c(%rip), %rsi     # 0xb527b
leaq 0x130(%rsp), %rdi
callq 0x191a0
movq %rax, 0x30(%rsp)
jmp 0xce13
movq 0x4e0(%rsp), %rdi
callq 0xb1f0
movq 0x30(%rsp), %rdi
movq %rax, 0x128(%rsp)
leaq 0x128(%rsp), %rsi
callq 0x19000
jmp 0xce3c
leaq 0x130(%rsp), %rdi
callq 0xb1340
movb $0x0, 0x4f7(%rsp)
movl $0x1, 0x124(%rsp)
jmp 0xd1d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0xd1f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
leaq 0x130(%rsp), %rdi
callq 0xb1340
jmp 0xd1f7
leaq 0x100(%rsp), %rdi
callq 0xb780
leaq 0x2c8(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0xb0d0
movq %rax, 0x28(%rsp)
jmp 0xcec9
movq 0x28(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0xb6d0
movb %al, 0x27(%rsp)
jmp 0xcee3
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0xcef0
jmp 0xd199
leaq 0xbf(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xb990
movq 0x18(%rsp), %rdx
leaq 0xa836b(%rip), %rsi     # 0xb5279
leaq 0xc0(%rsp), %rdi
callq 0xb760
jmp 0xcf1d
leaq 0xe0(%rsp), %rdi
leaq 0xff(%rsp), %rsi
leaq 0x100(%rsp), %rdx
leaq 0xc0(%rsp), %rcx
callq 0xc1d0
jmp 0xcf44
leaq 0xc0(%rsp), %rdi
callq 0xb330
leaq 0xbf(%rsp), %rdi
callq 0xb5f0
leaq 0xe0(%rsp), %rdi
callq 0x19060
movq %rax, %rcx
movq 0x38(%rsp), %rax
movq %rcx, 0xb0(%rsp)
movq 0xb0(%rsp), %rsi
movq (%rax), %rdx
leaq 0x88(%rsp), %rdi
callq 0x5b810
jmp 0xcf95
movq $0x0, 0x80(%rsp)
movq 0x80(%rsp), %rax
cmpq 0xb0(%rsp), %rax
je 0xd0b1
movl $0x3f800000, 0x7c(%rsp) # imm = 0x3F800000
movq 0x80(%rsp), %rsi
movq %rsi, 0x10(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x19080
movq %rax, %rsi
leaq 0xff(%rsp), %rdi
callq 0xc5a0
movq 0x10(%rsp), %rdx
movslq %eax, %rcx
leaq 0x88(%rsp), %rdi
leaq 0x7c(%rsp), %rsi
callq 0x191d0
jmp 0xd005
jmp 0xd007
movq 0x80(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x80(%rsp)
jmp 0xcfa1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0xd1ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0xd06d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0xb330
leaq 0xbf(%rsp), %rdi
callq 0xb5f0
jmp 0xd1ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0xd18a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
jmp 0xd17d
movq 0x4d8(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x19300
jmp 0xd0d2
movq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x192e0
jmp 0xd0e3
leaq 0x50(%rsp), %rdi
callq 0x5bc10
cmpl $0x0, 0x4d4(%rsp)
jle 0xd144
movq 0x4d8(%rsp), %rdi
callq 0x193c0
movq %rax, (%rsp)
jmp 0xd10a
movq (%rsp), %rax
cmpl 0x4d4(%rsp), %eax
jl 0xd144
movl $0x3, 0x124(%rsp)
jmp 0xd14f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c0(%rsp)
movl %eax, 0x2bc(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x5bc10
jmp 0xd17d
movl $0x0, 0x124(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x5bc10
leaq 0xe0(%rsp), %rdi
callq 0x19140
movl 0x124(%rsp), %eax
testl %eax, %eax
je 0xd178
jmp 0xd176
jmp 0xd199
jmp 0xcead
leaq 0x88(%rsp), %rdi
callq 0x5bc10
leaq 0xe0(%rsp), %rdi
callq 0x19140
jmp 0xd1ca
leaq 0x2c8(%rsp), %rdi
callq 0xb100
jmp 0xd1a8
movb $0x1, 0x4f7(%rsp)
movl $0x1, 0x124(%rsp)
leaq 0x100(%rsp), %rdi
callq 0xb330
jmp 0xd1d9
leaq 0x100(%rsp), %rdi
callq 0xb330
jmp 0xd1f7
leaq 0x2c8(%rsp), %rdi
callq 0xb140
movb 0x4f7(%rsp), %al
andb $0x1, %al
addq $0x4f8, %rsp            # imm = 0x4F8
retq
leaq 0x2c8(%rsp), %rdi
callq 0xb140
movq 0x2c0(%rsp), %rdi
callq 0xb980
nopw %cs:(%rax,%rax)