// File: huiwenliuge[P]EmoAnaer/src/RNNet.cpp
// Function: RNNet::RNNet(int, int, char const*)
RNNet::RNNet(int featurenum,int hidlayernum,const char* pathRoot){

    featureNUM=featurenum;
    hidlayerNUM=hidlayernum;
    ccdict=NULL;
    tdict=NULL;
    sent=NULL;
    
    DLDin2hid=(double**)malloc(sizeof(double*)*hidlayerNUM);
    DLDk2out =(double**)malloc(sizeof(double*)*EMOTIONNUM);
    DLDrh2h  =(double**)malloc(sizeof(double*)*hidlayerNUM);
    DLDro2h  =(double**)malloc(sizeof(double*)*hidlayerNUM);

    int i;
    for(i=0;i<hidlayerNUM;++i){
        DLDin2hid[i]=(double*)calloc(sizeof(double),featureNUM);
        DLDrh2h[i]=(double*)calloc(sizeof(double),hidlayerNUM);
        DLDro2h[i]=(double*)calloc(sizeof(double),EMOTIONNUM);
    }
    for(i=0;i<EMOTIONNUM;++i)
        DLDk2out[i] =(double*)calloc(sizeof(double),hidlayerNUM);

    EMOLIST=(char**)malloc(sizeof(char*)*EMOTIONNUM);
    for(i=0;i<EMOTIONNUM;++i)
        EMOLIST[i]=(char*)calloc(sizeof(char),11);
    strcpy(EMOLIST[0],"ANGRY");
    strcpy(EMOLIST[1],"ANXIOUS");
    strcpy(EMOLIST[2],"AWKWARD");
    strcpy(EMOLIST[3],"HAPPY");
    strcpy(EMOLIST[4],"MOVE");
    strcpy(EMOLIST[5],"NOVEL");
    strcpy(EMOLIST[6],"SAD");
    
    char* pdic=(char*)calloc(sizeof(char),41);
    int pathrootlen=strlen(pathRoot);
    strcpy(pdic,pathRoot);
    strcpy(pdic+pathrootlen,"Dictionary/CROSS");
    FetchDict(pdic);
    FetchPara(pdic);
    //
    //RNNForward_CROSSENTROPY_Nthread("../",2);
    //
    
    char* path=(char*)calloc(sizeof(char),41);
    strcpy(path,"tmp/CROSS");
    _save_var(path);
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0xc(%rbp), %ecx
movl %ecx, 0x30(%rax)
movl -0x10(%rbp), %ecx
movl %ecx, 0x34(%rax)
movq $0x0, (%rax)
movq $0x0, 0x8(%rax)
movq $0x0, 0x78(%rax)
movslq 0x34(%rax), %rdi
shlq $0x3, %rdi
callq 0x21c0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x58(%rax)
movl $0x38, %edi
callq 0x21c0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x60(%rax)
movslq 0x34(%rax), %rdi
shlq $0x3, %rdi
callq 0x21c0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x68(%rax)
movslq 0x34(%rax), %rdi
shlq $0x3, %rdi
callq 0x21c0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x70(%rax)
movl $0x0, -0x1c(%rbp)
movq -0x40(%rbp), %rcx
movl -0x1c(%rbp), %eax
cmpl 0x34(%rcx), %eax
jge 0x2554
movq -0x40(%rbp), %rax
movslq 0x30(%rax), %rsi
movl $0x8, %edi
callq 0x20b0
movq %rax, %rsi
movq -0x40(%rbp), %rax
movq 0x58(%rax), %rcx
movslq -0x1c(%rbp), %rdx
movq %rsi, (%rcx,%rdx,8)
movslq 0x34(%rax), %rsi
movl $0x8, %edi
callq 0x20b0
movq %rax, %rdx
movq -0x40(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x8, %edi
movl $0x7, %esi
callq 0x20b0
movq %rax, %rdx
movq -0x40(%rbp), %rax
movq 0x70(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x24d5
movl $0x0, -0x1c(%rbp)
cmpl $0x7, -0x1c(%rbp)
jge 0x2591
movq -0x40(%rbp), %rax
movslq 0x34(%rax), %rsi
movl $0x8, %edi
callq 0x20b0
movq %rax, %rdx
movq -0x40(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x255b
movl $0x38, %edi
callq 0x21c0
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x80(%rax)
movl $0x0, -0x1c(%rbp)
cmpl $0x7, -0x1c(%rbp)
jge 0x25e6
movl $0x1, %edi
movl $0xb, %esi
callq 0x20b0
movq %rax, %rdx
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x25b0
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rax
movq (%rax), %rdi
leaq 0x5a15(%rip), %rsi      # 0x8010
callq 0x2120
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x5a00(%rip), %rsi      # 0x8016
callq 0x2120
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rax
movq 0x10(%rax), %rdi
leaq 0x59ed(%rip), %rsi      # 0x801e
callq 0x2120
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rax
movq 0x18(%rax), %rdi
leaq 0x59da(%rip), %rsi      # 0x8026
callq 0x2120
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rax
movq 0x20(%rax), %rdi
leaq 0x59c5(%rip), %rsi      # 0x802c
callq 0x2120
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rax
movq 0x28(%rax), %rdi
leaq 0x59af(%rip), %rsi      # 0x8031
callq 0x2120
movq -0x40(%rbp), %rax
movq 0x80(%rax), %rax
movq 0x30(%rax), %rdi
leaq 0x599a(%rip), %rsi      # 0x8037
callq 0x2120
movl $0x1, %edi
movl $0x29, %esi
callq 0x20b0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2070
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2120
movq -0x28(%rbp), %rdi
movslq -0x2c(%rbp), %rax
addq %rax, %rdi
leaq 0x595b(%rip), %rsi      # 0x803b
callq 0x2120
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x2740
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x2840
movl $0x1, %edi
movl $0x29, %esi
callq 0x20b0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x592f(%rip), %rsi      # 0x804c
callq 0x2120
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x2c70
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)