// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %r12d
movq %rdi, %r14
movsd %xmm0, 0x40(%rdi)
cmpl $0x0, 0x34(%rdi)
jle 0x4580
xorl %ebx, %ebx
movq 0x58(%r14), %rax
movq (%rax,%rbx,8), %rdi
movslq 0x30(%r14), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x20b0
movq 0x68(%r14), %rax
movq (%rax,%rbx,8), %rdi
movslq 0x34(%r14), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x20b0
movq 0x70(%r14), %rax
movq (%rax,%rbx,8), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rax)
movupd %xmm0, 0x10(%rax)
movupd %xmm0, (%rax)
movq $0x0, 0x30(%rax)
incq %rbx
movslq 0x34(%r14), %rax
cmpq %rax, %rbx
jl 0x4524
xorl %ebx, %ebx
movq 0x60(%r14), %rax
movq (%rax,%rbx,8), %rdi
movslq 0x34(%r14), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x20b0
incq %rbx
cmpq $0x7, %rbx
jne 0x4582
movq %rsp, -0x38(%rbp)
movq 0x78(%r14), %rax
movq %rax, -0x60(%rbp)
movq 0x50(%r14), %rax
decq %rax
movq %rax, 0x48(%r14)
movl %r12d, %ebx
movq %rsp, %r15
leaq 0xf(,%rbx,8), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
testl %r12d, %r12d
je 0x45e8
leaq (,%rbx,8), %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x20b0
movl $0x0, -0x2c(%rbp)
movl %r12d, -0x30(%rbp)
testl %r12d, %r12d
jle 0x4647
leaq -0x48(%rbp), %r12
leaq -0x2c(%rbp), %r13
movq %r14, -0x50(%rbp)
leaq -0x60(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x58(%rbp), %rdi
leaq 0x1cd(%rip), %rsi       # 0x47e4
leaq -0x50(%rbp), %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x4ba8
movslq -0x2c(%rbp), %rax
cmpq $0x0, (%r15,%rax,8)
jne 0x47de
movq -0x58(%rbp), %rcx
movq %rcx, (%r15,%rax,8)
incl %eax
movl %eax, -0x2c(%rbp)
cmpl -0x30(%rbp), %eax
jl 0x4600
movl $0x0, -0x2c(%rbp)
movl -0x30(%rbp), %r12d
testl %r12d, %r12d
jle 0x4671
xorl %eax, %eax
cltq
leaq (%r15,%rax,8), %rdi
callq 0x2250
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
cmpl %r12d, %eax
jl 0x4659
movslq 0x34(%r14), %rax
testq %rax, %rax
jle 0x4746
movl 0x30(%r14), %ecx
movq 0x58(%r14), %rdx
movq %rdx, -0x40(%rbp)
movq 0x10(%r14), %rsi
movq 0x20(%r14), %rdi
movq 0x68(%r14), %r8
movq 0x70(%r14), %r9
movq 0x28(%r14), %r10
xorl %r11d, %r11d
testl %ecx, %ecx
jle 0x46d9
movq -0x40(%rbp), %rdx
movq (%rdx,%r11,8), %r12
movq (%rsi,%r11,8), %r13
xorl %edx, %edx
movsd (%r12,%rdx,8), %xmm0
movsd (%r13,%rdx,8), %xmm1
mulsd 0x40(%r14), %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, (%r13,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x46b3
movq (%r8,%r11,8), %r12
movq (%rdi,%r11,8), %r13
xorl %edx, %edx
movsd (%r12,%rdx,8), %xmm0
movsd (%r13,%rdx,8), %xmm1
mulsd 0x40(%r14), %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, (%r13,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x46e3
movq (%r9,%r11,8), %r12
movq (%r10,%r11,8), %r13
xorl %edx, %edx
movsd (%r12,%rdx,8), %xmm0
movsd (%r13,%rdx,8), %xmm1
mulsd 0x40(%r14), %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, (%r13,%rdx,8)
incq %rdx
cmpq $0x7, %rdx
jne 0x4713
incq %r11
cmpq %rax, %r11
jne 0x46a1
movq 0x18(%r14), %rcx
movq 0x60(%r14), %rdx
movl %eax, %esi
xorl %edi, %edi
movl -0x30(%rbp), %r11d
testl %eax, %eax
jle 0x4789
movq (%rdx,%rdi,8), %r8
movq (%rcx,%rdi,8), %r9
xorl %r10d, %r10d
movsd (%r8,%r10,8), %xmm0
movsd (%r9,%r10,8), %xmm1
mulsd 0x40(%r14), %xmm0
subsd %xmm0, %xmm1
movsd %xmm1, (%r9,%r10,8)
incq %r10
cmpq %r10, %rsi
jne 0x4765
incq %rdi
cmpq $0x7, %rdi
jne 0x4756
testl %r11d, %r11d
je 0x47a9
shlq $0x3, %rbx
cmpq $0x0, -0x8(%r15,%rbx)
jne 0x47de
addq $-0x8, %rbx
jne 0x479b
movq -0x38(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x47be
cmpl $0x0, -0x30(%rbp)
je 0x47d6
shlq $0x3, %rbx
cmpq $0x0, -0x8(%r15,%rbx)
jne 0x47de
addq $-0x8, %rbx
jne 0x47c8
movq %rax, %rdi
callq 0x2260
callq 0x2060
nop