// File: /workspace/github_cpp_makefile_star2_O3/btbujiangjun[P]abcdl/example/rnn.cpp
// Function: main
int main(int argc, char** argv){
    abcdl::utils::log::set_min_log_level(abcdl::utils::log::INFO);
    abcdl::utils::log::initialize_log(argc, argv);

/*
    abcdl::rnn::RNN rnn(28, 100);
    rnn.set_epoch(50);
   
    const int train_size = 100;
    const int test_size = 10;
    abcdl::utils::FashionMnistReader<real> helper("data");
    std::vector<abcdl::algebra::Mat*> train_data;
    std::vector<abcdl::algebra::Mat*> train_label;
    helper.read_train_images(&train_data, train_size);
    helper.read_train_vec_labels(&train_label, train_size);

    LOG(INFO) << "RNN Start training....";
    LOG(INFO) << "training size:" << train_data.size();
    rnn.train(train_data, train_label);
	
    for(auto&& d : train_data){
		delete d;
	}
	train_data.clear();
	
	for(auto&& d : train_label){
		delete d;
	}
	train_label.clear();
*/
	abcdl::utils::RNNHelper helper(8000);
	
	//std::map<std::string, size_t> map;
	//helper.read_word2index("data/rnn/word_to_index", map);

    const size_t sample_size = 1000;
	abcdl::algebra::MatSet data_seq_data;
	abcdl::algebra::MatSet data_seq_label;
	if(!helper.read_seq_data("data/rnn/train_seq_data", data_seq_data, "data/rnn/train_seq_label", data_seq_label, sample_size)){
		return -1;
	}

    LOG(INFO) << "RNN Start training....";

    abcdl::rnn::RNN rnn(8000, 100);
    rnn.set_epoch(50);
    rnn.load_model("./data/rnn_seq.model");

    LOG(INFO) << "training size:" << data_seq_data.size();
    rnn.train(data_seq_data, data_seq_label);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x2f8, %rsp            # imm = 0x2F8
movq %rsi, %rbx
movl %edi, %ebp
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x4575c
movl %ebp, %edi
movq %rbx, %rsi
callq 0x452f8
movq $0x1f40, 0x8(%rsp)      # imm = 0x1F40
movq %r14, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq %r14, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
leaq 0x60(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x3b5d3(%rip), %rsi     # 0x47211
leaq 0x3b5e3(%rip), %rdx     # 0x47228
leaq 0x50(%rsp), %rdi
callq 0x1453a
leaq 0x1e8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x3b5c7(%rip), %rsi     # 0x47229
leaq 0x3b5d8(%rip), %rdx     # 0x47241
leaq 0x1d8(%rsp), %rdi
callq 0x1453a
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movl $0x3e8, %ecx            # imm = 0x3E8
callq 0xb7d2
testb %al, %al
je 0xbcb3
leaq 0x8(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movl $0x3e8, %ecx            # imm = 0x3E8
callq 0xb7d2
movl %eax, %ebx
jmp 0xbcb5
xorl %ebx, %ebx
movq 0x1d8(%rsp), %rdi
cmpq %r15, %rdi
je 0xbcc7
callq 0xa440
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0xbcd6
callq 0xa440
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %bl, %bl
je 0xbdfe
leaq 0x3b558(%rip), %rsi     # 0x47242
leaq 0x50(%rsp), %rdi
movl $0x38, %edx
xorl %ecx, %ecx
callq 0x457ae
leaq 0x3b550(%rip), %rsi     # 0x47252
leaq 0x50(%rsp), %rdi
movl $0x16, %edx
callq 0xa4d0
leaq 0x50(%rsp), %rdi
callq 0x459d6
leaq 0x1d8(%rsp), %rdi
movl $0x1f40, %esi           # imm = 0x1F40
movl $0x64, %edx
callq 0x122fe
movq $0x32, 0x1f0(%rsp)
leaq 0x50(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x3b51c(%rip), %rsi     # 0x47269
leaq 0x3b529(%rip), %rdx     # 0x4727d
callq 0x1453a
leaq 0x1d8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x23fb4
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0xbd7a
callq 0xa440
leaq 0x3b4c1(%rip), %rsi     # 0x47242
leaq 0x50(%rsp), %rdi
movl $0x3e, %edx
xorl %ecx, %ecx
callq 0x457ae
leaq 0x3b4e5(%rip), %rsi     # 0x4727e
leaq 0x50(%rsp), %rdi
movl $0xe, %edx
callq 0xa4d0
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %rsi # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rsi
leaq 0x50(%rsp), %rdi
callq 0xa2b0
leaq 0x50(%rsp), %rdi
callq 0x459d6
leaq 0x1d8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x234a0
leaq 0x1d8(%rsp), %rdi
callq 0x12662
xorl %ebp, %ebp
leaq 0x30(%rsp), %rdi
callq 0x12764
leaq 0x10(%rsp), %rdi
callq 0x12764
movl %ebp, %eax
addq $0x2f8, %rsp            # imm = 0x2F8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0xbe4b
jmp 0xbe26
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x459d6
jmp 0xbe4e
jmp 0xbe4b
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0xbe4e
callq 0xa440
jmp 0xbe4e
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x12662
jmp 0xbe9e
jmp 0xbe75
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x459d6
jmp 0xbe9e
jmp 0xbe75
movq %rax, %rbx
jmp 0xbe8f
movq %rax, %rbx
jmp 0xbe9e
movq %rax, %rbx
movq 0x1d8(%rsp), %rdi
cmpq %r15, %rdi
je 0xbe8f
callq 0xa440
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0xbe9e
callq 0xa440
leaq 0x30(%rsp), %rdi
callq 0x12764
leaq 0x10(%rsp), %rdi
callq 0x12764
movq %rbx, %rdi
callq 0xa780