// File: /workspace/github_cpp_makefile_star2_O1/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 0x45a30
movl %ebp, %edi
movq %rbx, %rsi
callq 0x455dc
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 0x3b5a3(%rip), %rsi     # 0x47211
leaq 0x3b5b3(%rip), %rdx     # 0x47228
leaq 0x50(%rsp), %rdi
callq 0x14914
leaq 0x1e8(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x3b597(%rip), %rsi     # 0x47229
leaq 0x3b5a8(%rip), %rdx     # 0x47241
leaq 0x1d8(%rsp), %rdi
callq 0x14914
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movl $0x3e8, %ecx            # imm = 0x3E8
callq 0xb802
testb %al, %al
je 0xbce3
leaq 0x8(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movl $0x3e8, %ecx            # imm = 0x3E8
callq 0xb802
movl %eax, %ebx
jmp 0xbce5
xorl %ebx, %ebx
movq 0x1d8(%rsp), %rdi
cmpq %r15, %rdi
je 0xbcf7
callq 0xa440
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0xbd06
callq 0xa440
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %bl, %bl
je 0xbe2e
leaq 0x3b528(%rip), %rsi     # 0x47242
leaq 0x50(%rsp), %rdi
movl $0x38, %edx
xorl %ecx, %ecx
callq 0x45a82
leaq 0x3b520(%rip), %rsi     # 0x47252
leaq 0x50(%rsp), %rdi
movl $0x16, %edx
callq 0xa4d0
leaq 0x50(%rsp), %rdi
callq 0x45caa
leaq 0x1d8(%rsp), %rdi
movl $0x1f40, %esi           # imm = 0x1F40
movl $0x64, %edx
callq 0x125fe
movq $0x32, 0x1f0(%rsp)
leaq 0x50(%rsp), %rdi
movq %r14, (%rdi)
leaq 0x3b4ec(%rip), %rsi     # 0x47269
leaq 0x3b4f9(%rip), %rdx     # 0x4727d
callq 0x14914
leaq 0x1d8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x2434c
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0xbdaa
callq 0xa440
leaq 0x3b491(%rip), %rsi     # 0x47242
leaq 0x50(%rsp), %rdi
movl $0x3e, %edx
xorl %ecx, %ecx
callq 0x45a82
leaq 0x3b4b5(%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 0x45caa
leaq 0x1d8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x23828
leaq 0x1d8(%rsp), %rdi
callq 0x12a58
xorl %ebp, %ebp
leaq 0x30(%rsp), %rdi
callq 0x12b5a
leaq 0x10(%rsp), %rdi
callq 0x12b5a
movl %ebp, %eax
addq $0x2f8, %rsp            # imm = 0x2F8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0xbe7b
jmp 0xbe56
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x45caa
jmp 0xbe7e
jmp 0xbe7b
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0xbe7e
callq 0xa440
jmp 0xbe7e
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x12a58
jmp 0xbece
jmp 0xbea5
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x45caa
jmp 0xbece
jmp 0xbea5
movq %rax, %rbx
jmp 0xbebf
movq %rax, %rbx
jmp 0xbece
movq %rax, %rbx
movq 0x1d8(%rsp), %rdi
cmpq %r15, %rdi
je 0xbebf
callq 0xa440
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0xbece
callq 0xa440
leaq 0x30(%rsp), %rdi
callq 0x12b5a
leaq 0x10(%rsp), %rdi
callq 0x12b5a
movq %rbx, %rdi
callq 0xa780