// File: /workspace/github_cpp_makefile_star2_O3/btbujiangjun[P]abcdl/src/rnn/RNN.cpp
// Function: abcdl::rnn::RNN::load_model(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool RNN::load_model(const std::string& path){
    std::vector<abcdl::algebra::Mat*> models;
    if(!loader.read<real>(path, &models,"RNNMODEL") || models.size() != 3){
        for(auto&& model : models){
            delete model;
        }
        return false;
    }
    
    _U = *(models[0]);
    _W = *(models[1]);
    _U = *(models[2]);

    _feature_dim    = _U.cols();
    _hidden_dim     = _U.rows();
    _path           = path;

    if(_layer != nullptr){
        delete _layer;
    }
    _layer = new abcdl::rnn::Layer(_hidden_dim, _bptt_truncate, new abcdl::framework::CrossEntropyCost(), new abcdl::framework::TanhActivateFunc());

    for(auto&& mat : models){
        delete mat;
    }
    models.clear();

    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r15
movq %rdi, %rbx
pxor %xmm0, %xmm0
movdqa %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x25cb7(%rip), %rsi     # 0x49ca1
leaq 0x25cb8(%rip), %rdx     # 0x49ca9
leaq 0x20(%rsp), %rdi
callq 0x1453a
leaq 0x50(%rbx), %rdi
movq %rsp, %rdx
leaq 0x20(%rsp), %rcx
movq %r15, %rsi
callq 0x24342
testb %al, %al
je 0x241bc
movq (%rsp), %r14
movq 0x8(%rsp), %r13
subq %r14, %r13
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x24036
callq 0xa440
movq (%rsp), %r14
cmpq $0x18, %r13
jne 0x241cf
movq (%r14), %rsi
leaq 0x70(%rbx), %r14
movq %r14, %rdi
callq 0x2470e
movq (%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0xa8(%rbx), %rdi
callq 0x2470e
movq (%rsp), %rax
movq 0x10(%rax), %rsi
movq %r14, %rdi
callq 0x2470e
movdqu 0x70(%rbx), %xmm0
pshufd $0x4e, %xmm0, %xmm0     # xmm0 = xmm0[2,3,0,1]
movdqu %xmm0, (%rbx)
leaq 0x30(%rbx), %rdi
movq %r15, %rsi
callq 0xa230
movq 0x118(%rbx), %r14
testq %r14, %r14
je 0x240bf
movq 0x10(%r14), %rdi
testq %rdi, %rdi
je 0x240a8
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x240b7
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
callq 0xa440
movl $0x30, %edi
callq 0xa460
movq %rax, %r14
movdqu 0x8(%rbx), %xmm0
movdqa %xmm0, 0x40(%rsp)
movl $0x18, %edi
callq 0xa460
movq %rax, %r15
pxor %xmm0, %xmm0
movdqa %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x44e05(%rip), %rax     # 0x68f00
movq %rax, (%r15)
movq %r15, %rdi
addq $0x8, %rdi
callq 0xd788
leaq 0x44d9f(%rip), %rax     # 0x68eb0
movq %rax, (%r15)
movl $0x18, %edi
callq 0xa460
movq %rax, %r12
pxor %xmm0, %xmm0
movdqa %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x44e48(%rip), %rax     # 0x68f80
movq %rax, (%r12)
movq %r12, %rdi
addq $0x8, %rdi
callq 0xd788
leaq 0x44dd9(%rip), %rax     # 0x68f28
movq %rax, (%r12)
movq %r14, %rdi
addq $0x20, %rdi
callq 0xd788
movdqa 0x40(%rsp), %xmm0
movdqu %xmm0, (%r14)
movq %r15, 0x10(%r14)
movq %r12, 0x18(%r14)
movq %r14, 0x118(%rbx)
movq (%rsp), %r14
movq 0x8(%rsp), %r12
movb $0x1, %bl
cmpq %r12, %r14
je 0x24200
movq (%r14), %r15
testq %r15, %r15
je 0x24199
movq %r15, %rdi
callq 0x26a2e
movq %r15, %rdi
callq 0xa440
addq $0x8, %r14
cmpq %r12, %r14
jne 0x24189
movq (%rsp), %r14
cmpq %r14, 0x8(%rsp)
je 0x24200
movq %r14, 0x8(%rsp)
jmp 0x24200
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x241cb
callq 0xa440
movq (%rsp), %r14
movq 0x8(%rsp), %r15
cmpq %r15, %r14
je 0x241fe
movq (%r14), %rbx
testq %rbx, %rbx
je 0x241e9
movq %rbx, %rdi
callq 0x26a2e
movq %rbx, %rdi
callq 0xa440
addq $0x8, %r14
cmpq %r15, %r14
jne 0x241d9
movq (%rsp), %r14
xorl %ebx, %ebx
testq %r14, %r14
je 0x2420d
movq %r14, %rdi
callq 0xa440
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
movq %r12, %rdi
jmp 0x2422b
movq %rax, %rbx
movq %r15, %rdi
callq 0xa440
jmp 0x24235
movq %rax, %rbx
movq %r14, %rdi
jmp 0x24247
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x24253
callq 0xa440
jmp 0x24253
jmp 0x24250
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x24261
callq 0xa440
movq %rbx, %rdi
callq 0xa780
nop