// File: /workspace/github_cpp_makefile_star2_O1/thunlp[P]KB2E/CTransR/Train_CTransR.cpp
// Function: Train::gradient_one(int, int, int, int)
void gradient_one(int e1, int e2, int rel, int belta)
    {
        int fb_rel = cluster2fb[rel];
    	for (int ii=0; ii<m; ii++)
        {
            double tmp1 = 0, tmp2 = 0;
            for (int jj=0; jj<n; jj++)
            {
                tmp1+=A[fb_rel][jj][ii]*entity_vec[e1][jj];
                tmp2+=A[fb_rel][jj][ii]*entity_vec[e2][jj];
            }
            double x = 2*(tmp2-tmp1-relation_vec[rel][ii]*cluster_rate-(1-cluster_rate)*fb_relation_vec[fb_rel][ii]);
            if (L1_flag)
            	if (x>0)
            		x=1;
            	else
            		x=-1;
            for (int jj=0; jj<n; jj++)
            {
                A_tmp[fb_rel][jj][ii]-=belta*rate*x*(entity_vec[e1][jj]-entity_vec[e2][jj]);
                entity_tmp[e1][jj]-=belta*rate*x*A[fb_rel][jj][ii];
                entity_tmp[e2][jj]+=belta*rate*x*A[fb_rel][jj][ii];
            }
            relation_tmp[rel][ii]-=belta*rate*x*cluster_rate;
            fb_relation_tmp[fb_rel][ii]-=belta*rate*x*(1-cluster_rate);
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, %ebp
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
leaq 0xc(%rsp), %rsi
movl %ecx, (%rsi)
leaq 0x36382(%rip), %rdi     # 0x3cf50
callq 0x3cc8
movslq 0x6c(%rbx), %rcx
movq %rcx, 0x40(%rsp)
testq %rcx, %rcx
jle 0x6e79
movslq (%rax), %rcx
movl 0x68(%rbx), %eax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x168(%rbx), %rdx
addq %rcx, %rdx
movslq %r15d, %rdi
movq 0xf0(%rbx), %rsi
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %r8
leaq (%rsi,%r8), %rdi
movq %rdi, 0x10(%rsp)
movslq %r14d, %rdi
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %rdi
addq %rdi, %rsi
movslq 0xc(%rsp), %r9
movq 0xd8(%rbx), %r10
shlq $0x3, %r9
leaq (%r9,%r9,2), %r9
movq (%r10,%r9), %r10
movq %r10, 0x38(%rsp)
movq 0x108(%rbx), %r10
movq (%r10,%rcx), %r10
movq %r10, 0x30(%rsp)
movb 0x554e(%rip), %r10b     # 0xc1a8
movb %r10b, 0xb(%rsp)
cvtsi2sd %ebp, %xmm0
movq 0x180(%rbx), %r10
addq %rcx, %r10
movq %r10, 0x20(%rsp)
movq 0x138(%rbx), %r10
addq %r10, %r8
movq %r8, 0x28(%rsp)
addq %rdi, %r10
movq %r10, 0x18(%rsp)
movq 0x120(%rbx), %rdi
movq (%rdi,%r9), %r12
movq 0x150(%rbx), %rdi
movq (%rdi,%rcx), %r13
xorl %ebp, %ebp
movsd 0x1377(%rip), %xmm1     # 0x8020
xorpd %xmm2, %xmm2
xorpd %xmm3, %xmm3
testl %eax, %eax
jle 0x6d03
movq (%rdx), %rcx
movq 0x10(%rsp), %rdi
movq (%rdi), %rdi
movq (%rsi), %r9
xorpd %xmm3, %xmm3
xorl %r10d, %r10d
movq (%rcx), %r11
movsd (%r11,%rbp,8), %xmm4
unpcklpd %xmm4, %xmm4            # xmm4 = xmm4[0,0]
movsd (%r9,%r10,8), %xmm5
movhpd (%rdi,%r10,8), %xmm5    # xmm5 = xmm5[0],mem[0]
mulpd %xmm4, %xmm5
addpd %xmm5, %xmm3
incq %r10
addq $0x18, %rcx
cmpq %r10, %rax
jne 0x6cca
movapd %xmm3, %xmm4
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
subsd %xmm4, %xmm3
movsd 0x60(%rbx), %xmm4
movq 0x38(%rsp), %rcx
movsd (%rcx,%rbp,8), %xmm5
mulsd %xmm4, %xmm5
subsd %xmm5, %xmm3
movapd %xmm1, %xmm5
subsd %xmm4, %xmm5
movq 0x30(%rsp), %rcx
mulsd (%rcx,%rbp,8), %xmm5
subsd %xmm5, %xmm3
addsd %xmm3, %xmm3
xorl %ecx, %ecx
ucomisd %xmm2, %xmm3
seta %dil
cmpb $0x0, 0xb(%rsp)
je 0x6d54
movb %dil, %cl
leaq 0x1351(%rip), %rdi      # 0x80a0
movsd (%rdi,%rcx,8), %xmm3
testl %eax, %eax
jle 0x6e17
movq 0x10(%rsp), %rcx
movq (%rcx), %rdi
movq (%rsi), %r14
movq 0x20(%rsp), %rcx
movq (%rcx), %r15
movq (%rdx), %rcx
movq 0x28(%rsp), %r8
movq (%r8), %r9
movq 0x18(%rsp), %r8
movq (%r8), %r10
xorl %r11d, %r11d
movsd (%rdi,%r11,8), %xmm4
subsd (%r14,%r11,8), %xmm4
movq (%r15), %r8
movsd (%r8,%rbp,8), %xmm5
movsd 0x80(%rbx), %xmm6
mulsd %xmm0, %xmm6
mulsd %xmm3, %xmm6
mulsd %xmm4, %xmm6
subsd %xmm6, %xmm5
movsd %xmm5, (%r8,%rbp,8)
movq (%rcx), %r8
movsd 0x80(%rbx), %xmm4
mulsd %xmm0, %xmm4
mulsd %xmm3, %xmm4
mulsd (%r8,%rbp,8), %xmm4
movsd (%r9,%r11,8), %xmm5
subsd %xmm4, %xmm5
movsd %xmm5, (%r9,%r11,8)
movsd 0x80(%rbx), %xmm4
mulsd %xmm0, %xmm4
mulsd %xmm3, %xmm4
mulsd (%r8,%rbp,8), %xmm4
addsd (%r10,%r11,8), %xmm4
movsd %xmm4, (%r10,%r11,8)
incq %r11
addq $0x18, %r15
addq $0x18, %rcx
cmpq %r11, %rax
jne 0x6d85
movsd (%r12,%rbp,8), %xmm4
movsd 0x80(%rbx), %xmm5
mulsd %xmm0, %xmm5
mulsd %xmm3, %xmm5
mulsd 0x60(%rbx), %xmm5
subsd %xmm5, %xmm4
movsd %xmm4, (%r12,%rbp,8)
movapd %xmm1, %xmm4
subsd 0x60(%rbx), %xmm4
movsd (%r13,%rbp,8), %xmm5
movsd 0x80(%rbx), %xmm6
mulsd %xmm0, %xmm6
mulsd %xmm3, %xmm6
mulsd %xmm4, %xmm6
subsd %xmm6, %xmm5
movsd %xmm5, (%r13,%rbp,8)
incq %rbp
cmpq 0x40(%rsp), %rbp
jne 0x6cad
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq