// File: huiwenliuge[P]EmoAnaer/src/RNNet.cpp
// Function: RNNet::RNNBackward_CROSSENTROPY_Nthread(double, int)
void RNNet::RNNBackward_CROSSENTROPY_Nthread(double lnrts,int Nthread){
    lnrt=lnrts;
    int i;
    for(i=0;i<hidlayerNUM;++i){
        memset(DLDin2hid[i],'\0',sizeof(double)*featureNUM);
        memset(DLDrh2h[i],'\0',sizeof(double)*hidlayerNUM);
        memset(DLDro2h[i],'\0',sizeof(double)*EMOTIONNUM);
    }
    for(i=0;i<EMOTIONNUM;++i)
        memset(DLDk2out[i],'\0',sizeof(double)*hidlayerNUM);

    Sentence stmp = sent;
    
    flag = totnum-1;
    std::thread th[Nthread];
    int n;
    
    for(n=0;n<Nthread;++n){
       th[n]=std::thread(_Backward_CROSSENTROPY_SingleTask,\
               this,&stmp,n);
    }

    for(n=0;n<Nthread;++n){
        th[n].join();
    }
    int j;
    for(i=0;i<hidlayerNUM;++i){
        for(j=0;j<featureNUM;++j){
            in2hid[i][j]-=DLDin2hid[i][j]*lnrt;
        }
        for(j=0;j<hidlayerNUM;++j){
            rh2h[i][j]-=DLDrh2h[i][j]*lnrt;
        }
        for(j=0;j<EMOTIONNUM;++j){
            ro2h[i][j]-=DLDro2h[i][j]*lnrt;
        }
    }
    for(i=0;i<EMOTIONNUM;++i){
        for(j=0;j<hidlayerNUM;++j){
            k2out[i][j]-=DLDk2out[i][j]*lnrt;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, 0x40(%rax)
movl $0x0, -0x18(%rbp)
movq -0x68(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x34(%rcx), %eax
jge 0x4fc1
movq -0x68(%rbp), %rax
movq 0x58(%rax), %rcx
movslq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rdi
movslq 0x30(%rax), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x20a0
movq -0x68(%rbp), %rax
movq 0x68(%rax), %rcx
movslq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rdi
movslq 0x34(%rax), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x20a0
movq -0x68(%rbp), %rax
movq 0x70(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x20a0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x4f50
movl $0x0, -0x18(%rbp)
cmpl $0x7, -0x18(%rbp)
jge 0x4ff8
movq -0x68(%rbp), %rax
movq 0x60(%rax), %rcx
movslq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rdi
movslq 0x34(%rax), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x20a0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x4fc8
movq -0x68(%rbp), %rax
movq 0x78(%rax), %rcx
movq %rcx, -0x20(%rbp)
movq 0x50(%rax), %rcx
decq %rcx
movq %rcx, 0x48(%rax)
movl -0x14(%rbp), %eax
movq %rax, -0x78(%rbp)
movq %rsp, %rcx
movq %rcx, -0x28(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x70(%rbp)
movq %rcx, %rsp
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x5088
movq -0x70(%rbp), %rax
movq -0x78(%rbp), %rdx
shlq $0x3, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x88(%rbp)
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x58d0
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rcx
addq $0x8, %rax
cmpq %rcx, %rax
movq %rax, -0x80(%rbp)
jne 0x505d
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x5137
movq -0x68(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq 0x35e(%rip), %rsi       # 0x5410
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rdx
leaq -0x50(%rbp), %rcx
leaq -0x34(%rbp), %r8
callq 0x5a30
jmp 0x50c9
movq -0x70(%rbp), %rdi
movslq -0x34(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
leaq -0x40(%rbp), %rsi
callq 0x59c0
leaq -0x40(%rbp), %rdi
callq 0x5a00
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x508f
movq -0x70(%rbp), %rcx
movq %rdx, %rsi
movq -0x78(%rbp), %rdx
movq %rsi, -0xa0(%rbp)
movq %rax, %rsi
movq -0xa0(%rbp), %rax
movq %rsi, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
shlq $0x3, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0x98(%rbp)
je 0x5402
jmp 0x53d4
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x5166
movq -0x70(%rbp), %rax
movslq -0x34(%rbp), %rcx
leaq (%rax,%rcx,8), %rdi
callq 0x2210
jmp 0x5159
jmp 0x515b
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x513e
movl $0x0, -0x18(%rbp)
movq -0x68(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x34(%rcx), %eax
jge 0x52e6
movl $0x0, -0x60(%rbp)
movq -0x68(%rbp), %rcx
movl -0x60(%rbp), %eax
cmpl 0x30(%rcx), %eax
jge 0x51f2
movq -0x68(%rbp), %rax
movq 0x58(%rax), %rcx
movslq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x60(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movsd 0x40(%rax), %xmm2
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x60(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x5184
movl $0x0, -0x60(%rbp)
movq -0x68(%rbp), %rcx
movl -0x60(%rbp), %eax
cmpl 0x34(%rcx), %eax
jge 0x5267
movq -0x68(%rbp), %rax
movq 0x68(%rax), %rcx
movslq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x60(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movsd 0x40(%rax), %xmm2
movq 0x20(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x60(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x51f9
movl $0x0, -0x60(%rbp)
cmpl $0x7, -0x60(%rbp)
jge 0x52d6
movq -0x68(%rbp), %rax
movq 0x70(%rax), %rcx
movslq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x60(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movsd 0x40(%rax), %xmm2
movq 0x28(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x60(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x526e
jmp 0x52d8
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x516d
movl $0x0, -0x18(%rbp)
cmpl $0x7, -0x18(%rbp)
jge 0x537c
movl $0x0, -0x60(%rbp)
movq -0x68(%rbp), %rcx
movl -0x60(%rbp), %eax
cmpl 0x34(%rcx), %eax
jge 0x536c
movq -0x68(%rbp), %rax
movq 0x60(%rax), %rcx
movslq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x60(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movsd 0x40(%rax), %xmm2
movq 0x18(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x60(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq %xmm0, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
xorq %rsi, %rdx
movq %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x52fe
jmp 0x536e
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x52ed
movq -0x70(%rbp), %rcx
movq -0x78(%rbp), %rdx
shlq $0x3, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0xa8(%rbp)
je 0x53c8
movq -0xa8(%rbp), %rdi
addq $-0x8, %rdi
movq %rdi, -0xb0(%rbp)
callq 0x5a00
movq -0x70(%rbp), %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0xa8(%rbp)
jne 0x539a
movq -0x28(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
movq -0x98(%rbp), %rdi
addq $-0x8, %rdi
movq %rdi, -0xb8(%rbp)
callq 0x5a00
movq -0x70(%rbp), %rcx
movq -0xb8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x98(%rbp)
jne 0x53d4
jmp 0x5404
movq -0x58(%rbp), %rdi
callq 0x2230
nopl (%rax)