// File: /workspace/github_cpp_makefile_star2_O3/thunlp[P]KB2E/CTransR/Test_CTransR.cpp
// Function: Test::calc_sum(int, int, int)
double calc_sum(int e1,int e2,int rel)
    {
        double cluster_rate = 1;
    	int fb_rel = cluster2fb[rel];
    	vector<double> e1_vec;
        e1_vec.resize(m);
        vector<double> e2_vec;
        e2_vec.resize(m);
        for (int ii=0; ii<m; ii++)
        {
            for (int jj=0; jj<n; jj++)
            {
                e1_vec[ii]+=A[fb_rel][jj][ii]*entity_vec[e1][jj];
                e2_vec[ii]+=A[fb_rel][jj][ii]*entity_vec[e2][jj];
            }
        }
        double sum=0;
        if (L1_flag)
        	for (int ii=0; ii<m; ii++)
            	sum+=-fabs(e2_vec[ii]-e1_vec[ii]-cluster_rate*relation_vec[rel][ii]-(1-cluster_rate)*fb_relation_vec[fb_rel][ii]);
        else
        	for (int ii=0; ii<m; ii++)
            	sum+=-sqr(e2_vec[ii]-e1_vec[ii]-cluster_rate*relation_vec[rel][ii]-(1-cluster_rate)*fb_relation_vec[fb_rel][ii]);
        return sum;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x4(%rsp), %rsi
movl %ecx, (%rsi)
leaq 0x6ad2(%rip), %rdi      # 0xc3c8
callq 0x366c
movslq (%rax), %r15
xorpd %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movapd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movslq 0x6856(%rip), %rsi      # 0xc170
callq 0x5824
leaq 0x30(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movslq 0x6835(%rip), %rsi      # 0xc170
callq 0x5824
movslq 0x6829(%rip), %rax      # 0xc170
testq %rax, %rax
jle 0x5a62
movl 0x6816(%rip), %edx      # 0xc16c
leaq (%r15,%r15,2), %rcx
leaq (,%rcx,8), %rsi
addq 0x48(%rbx), %rsi
movslq %r14d, %rdi
movq 0x18(%rbx), %r9
leaq (%rdi,%rdi,2), %rdi
leaq (%r9,%rdi,8), %rdi
movq 0x10(%rsp), %r8
movslq %ebp, %r10
leaq (%r10,%r10,2), %r10
leaq (%r9,%r10,8), %r9
movq 0x30(%rsp), %r10
xorl %r11d, %r11d
testl %edx, %edx
jle 0x59de
movq (%rsi), %r14
movq (%rdi), %r15
movq (%r9), %r12
xorl %r13d, %r13d
movq (%r14), %rbp
movsd (%rbp,%r11,8), %xmm0
mulsd (%r15,%r13,8), %xmm0
addsd (%r8,%r11,8), %xmm0
movsd %xmm0, (%r8,%r11,8)
movsd (%rbp,%r11,8), %xmm0
mulsd (%r12,%r13,8), %xmm0
addsd (%r10,%r11,8), %xmm0
movsd %xmm0, (%r10,%r11,8)
incq %r13
addq $0x18, %r14
cmpq %r13, %rdx
jne 0x599d
incq %r11
cmpq %rax, %r11
jne 0x598d
movq 0x30(%rsp), %rdi
cmpb $0x0, 0x6776(%rip)      # 0xc168
je 0x5a69
testl %eax, %eax
jle 0x5acb
movq 0x10(%rsp), %rdx
movslq 0x4(%rsp), %rsi
leaq (%rsi,%rsi,2), %rsi
movq (%rbx), %r8
movq 0x30(%rbx), %r9
movq (%r8,%rsi,8), %rsi
movq (%r9,%rcx,8), %rcx
xorpd %xmm0, %xmm0
xorl %r8d, %r8d
movsd 0x2640(%rip), %xmm4     # 0x8068
movapd 0x2620(%rip), %xmm1     # 0x8050
movsd (%rdi,%r8,8), %xmm2
subsd (%rdx,%r8,8), %xmm2
subsd (%rsi,%r8,8), %xmm2
movsd (%rcx,%r8,8), %xmm3
mulsd %xmm4, %xmm3
addsd %xmm2, %xmm3
andpd %xmm1, %xmm3
subsd %xmm3, %xmm0
incq %r8
cmpq %r8, %rax
jne 0x5a30
jmp 0x5ad4
movq 0x30(%rsp), %rdi
jmp 0x5acb
testl %eax, %eax
jle 0x5acb
movq 0x10(%rsp), %rdx
movslq 0x4(%rsp), %rsi
leaq (%rsi,%rsi,2), %rsi
movq (%rbx), %r8
movq 0x30(%rbx), %r9
movq (%r8,%rsi,8), %rsi
movq (%r9,%rcx,8), %rcx
xorpd %xmm0, %xmm0
xorl %r8d, %r8d
movsd 0x25cf(%rip), %xmm3     # 0x8068
movsd (%rdi,%r8,8), %xmm1
subsd (%rdx,%r8,8), %xmm1
subsd (%rsi,%r8,8), %xmm1
movsd (%rcx,%r8,8), %xmm2
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
mulsd %xmm2, %xmm2
subsd %xmm2, %xmm0
incq %r8
cmpq %r8, %rax
jne 0x5a99
jmp 0x5ad4
xorpd %xmm0, %xmm0
testq %rdi, %rdi
je 0x5aed
movsd %xmm0, 0x8(%rsp)
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movsd 0x8(%rsp), %xmm0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5b10
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
movsd %xmm0, 0x8(%rsp)
callq 0x21a0
movsd 0x8(%rsp), %xmm0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5b3e
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
jmp 0x5b3e
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5b55
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x2270
nop