// File: /workspace/github_cpp_makefile_star2_O2/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 0xc(%rsp), %rsi
movl %ecx, (%rsi)
leaq 0x74d6(%rip), %rdi      # 0xc3c8
callq 0x31b6
movslq (%rax), %r15
xorpd %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movslq 0x725d(%rip), %rsi      # 0xc170
callq 0x4e66
leaq 0x10(%rsp), %rdi
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movslq 0x723f(%rip), %rsi      # 0xc170
callq 0x4e66
movl 0x7233(%rip), %r9d      # 0xc170
movl 0x7229(%rip), %edx      # 0xc16c
xorl %esi, %esi
testl %edx, %edx
cmovlel %esi, %edx
movslq %r14d, %rdi
testl %r9d, %r9d
cmovlel %esi, %r9d
movslq %ebp, %r8
imulq $0x18, %r15, %rcx
imulq $0x18, %rdi, %rax
movq %rax, (%rsp)
imulq $0x18, %r8, %r8
cmpq %r9, %rsi
je 0x4ff0
movq %r9, %rdi
movq 0x48(%rbx), %r9
addq %rcx, %r9
movq 0x18(%rbx), %r10
movq (%rsp), %rax
leaq (%r10,%rax), %r11
movq 0x30(%rsp), %r14
addq %r8, %r10
movq 0x10(%rsp), %r15
xorl %r12d, %r12d
xorl %r13d, %r13d
cmpq %r13, %rdx
je 0x4fe5
movq (%r9), %rbp
movq (%rbp,%r12), %rbp
movsd (%rbp,%rsi,8), %xmm0
movq (%r11), %rax
mulsd (%rax,%r13,8), %xmm0
addsd (%r14,%rsi,8), %xmm0
movsd %xmm0, (%r14,%rsi,8)
movsd (%rbp,%rsi,8), %xmm0
movq (%r10), %rax
mulsd (%rax,%r13,8), %xmm0
addsd (%r15,%rsi,8), %xmm0
movsd %xmm0, (%r15,%rsi,8)
incq %r13
addq $0x18, %r12
jmp 0x4f99
incq %rsi
movq %rdi, %r9
jmp 0x4f67
movq 0x10(%rsp), %rdx
movq 0x30(%rsp), %rsi
movslq 0xc(%rsp), %rdi
imulq $0x18, %rdi, %rdi
addq (%rbx), %rdi
addq 0x30(%rbx), %rcx
cmpb $0x0, 0x7157(%rip)      # 0xc168
je 0x5062
xorpd %xmm4, %xmm4
xorl %r8d, %r8d
movsd 0x3046(%rip), %xmm0     # 0x8068
movapd 0x3026(%rip), %xmm1     # 0x8050
cmpq %r8, %r9
je 0x50a9
movsd (%rdx,%r8,8), %xmm2
subsd (%rsi,%r8,8), %xmm2
movq (%rdi), %rax
subsd (%rax,%r8,8), %xmm2
movq (%rcx), %rax
movsd (%rax,%r8,8), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm2, %xmm3
andpd %xmm1, %xmm3
subsd %xmm3, %xmm4
incq %r8
jmp 0x502a
xorpd %xmm3, %xmm3
xorl %r8d, %r8d
movsd 0x2ff7(%rip), %xmm0     # 0x8068
cmpq %r8, %r9
je 0x50b0
movsd (%rdx,%r8,8), %xmm1
subsd (%rsi,%r8,8), %xmm1
movq (%rdi), %rax
subsd (%rax,%r8,8), %xmm1
movq (%rcx), %rax
movsd (%rax,%r8,8), %xmm2
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
mulsd %xmm2, %xmm2
subsd %xmm2, %xmm3
incq %r8
jmp 0x5071
movsd %xmm4, (%rsp)
jmp 0x50b5
movsd %xmm3, (%rsp)
leaq 0x10(%rsp), %rdi
callq 0x49ca
leaq 0x30(%rsp), %rdi
callq 0x49ca
movsd (%rsp), %xmm0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x49ca
jmp 0x50ef
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x49ca
movq %rbx, %rdi
callq 0x2250
nop