// File: 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:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x110(%rsp)
movl %esi, 0x10c(%rsp)
movl %edx, 0x108(%rsp)
movl %ecx, 0x104(%rsp)
movq 0x110(%rsp), %rax
movq %rax, 0x88(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0xf8(%rsp)
leaq 0x1614b(%rip), %rdi     # 0x20448
leaq 0x104(%rsp), %rsi
callq 0x4060
movl (%rax), %eax
movl %eax, 0xf4(%rsp)
leaq 0xd8(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0xb3f0
movq 0x90(%rsp), %rdi
movslq 0x15eb9(%rip), %rsi     # 0x201f0
callq 0xa0f0
jmp 0xa33e
leaq 0xb0(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0xb3f0
movq 0x80(%rsp), %rdi
movslq 0x15e8e(%rip), %rsi     # 0x201f0
callq 0xa0f0
jmp 0xa369
movl $0x0, 0xac(%rsp)
movl 0xac(%rsp), %eax
cmpl 0x15e6f(%rip), %eax     # 0x201f0
jge 0xa560
movl $0x0, 0xa8(%rsp)
movl 0xa8(%rsp), %eax
cmpl 0x15e4d(%rip), %eax     # 0x201ec
jge 0xa548
movq 0x88(%rsp), %rdi
addq $0x48, %rdi
movslq 0xf4(%rsp), %rsi
callq 0xa230
movq %rax, %rdi
movslq 0xa8(%rsp), %rsi
callq 0xa0d0
movq %rax, %rdi
movslq 0xac(%rsp), %rsi
callq 0x3b70
movq 0x88(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
addq $0x18, %rdi
movslq 0x10c(%rsp), %rsi
callq 0xa0d0
movq %rax, %rdi
movslq 0xa8(%rsp), %rsi
callq 0x3b70
movsd (%rax), %xmm0
movsd %xmm0, 0x68(%rsp)
movslq 0xac(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
callq 0x3b70
movsd 0x60(%rsp), %xmm0
movsd 0x68(%rsp), %xmm2
movq 0x88(%rsp), %rdi
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
addq $0x48, %rdi
movslq 0xf4(%rsp), %rsi
callq 0xa230
movq %rax, %rdi
movslq 0xa8(%rsp), %rsi
callq 0xa0d0
movq %rax, %rdi
movslq 0xac(%rsp), %rsi
callq 0x3b70
movq 0x88(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x70(%rsp)
addq $0x18, %rdi
movslq 0x108(%rsp), %rsi
callq 0xa0d0
movq %rax, %rdi
movslq 0xa8(%rsp), %rsi
callq 0x3b70
movsd (%rax), %xmm0
movsd %xmm0, 0x78(%rsp)
movslq 0xac(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x3b70
movsd 0x70(%rsp), %xmm0
movsd 0x78(%rsp), %xmm2
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl 0xa8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa8(%rsp)
jmp 0xa392
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
jmp 0xa8b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x8a50
jmp 0xa8b9
jmp 0xa54a
movl 0xac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xac(%rsp)
jmp 0xa374
xorps %xmm0, %xmm0
movsd %xmm0, 0xa0(%rsp)
testb $0x1, 0x15c75(%rip)     # 0x201e8
je 0xa702
movl $0x0, 0x9c(%rsp)
movl 0x9c(%rsp), %eax
cmpl 0x15c5f(%rip), %eax     # 0x201f0
jge 0xa6fd
movslq 0x9c(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x3b70
movsd (%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
movslq 0x9c(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
callq 0x3b70
movsd 0x38(%rsp), %xmm0
movq 0x88(%rsp), %rdi
subsd (%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0x40(%rsp)
movslq 0x104(%rsp), %rsi
callq 0xa0d0
movq %rax, %rdi
movslq 0x9c(%rsp), %rsi
callq 0x3b70
movsd 0x40(%rsp), %xmm0
movsd 0x48(%rsp), %xmm1
movq 0x88(%rsp), %rdi
movsd (%rax), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
movsd 0xb9b4(%rip), %xmm0     # 0x16008
subsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
addq $0x30, %rdi
movslq 0xf4(%rsp), %rsi
callq 0xa0d0
movq %rax, %rdi
movslq 0x9c(%rsp), %rsi
callq 0x3b70
movsd 0x50(%rsp), %xmm0
movsd 0x58(%rsp), %xmm1
movsd (%rax), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movaps 0xb976(%rip), %xmm1     # 0x16030
pand %xmm1, %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
addsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0xa0(%rsp)
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
jmp 0xa584
jmp 0xa882
movl $0x0, 0x98(%rsp)
movl 0x98(%rsp), %eax
cmpl 0x15ad6(%rip), %eax     # 0x201f0
jge 0xa880
movslq 0x98(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x3b70
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movslq 0x98(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
callq 0x3b70
movsd 0x10(%rsp), %xmm0
movq 0x88(%rsp), %rdi
subsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movslq 0x104(%rsp), %rsi
callq 0xa0d0
movq %rax, %rdi
movslq 0x98(%rsp), %rsi
callq 0x3b70
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movq 0x88(%rsp), %rdi
movsd (%rax), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0xb82b(%rip), %xmm0     # 0x16008
subsd 0xf8(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
addq $0x30, %rdi
movslq 0xf4(%rsp), %rsi
callq 0xa0d0
movq %rax, %rdi
movslq 0x98(%rsp), %rsi
callq 0x3b70
movsd 0x28(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
movsd (%rax), %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x2a30
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
addsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0xa0(%rsp)
movl 0x98(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x98(%rsp)
jmp 0xa70d
jmp 0xa882
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x8a50
leaq 0xd8(%rsp), %rdi
callq 0x8a50
movsd 0x8(%rsp), %xmm0
addq $0x118, %rsp            # imm = 0x118
retq
leaq 0xd8(%rsp), %rdi
callq 0x8a50
movq 0xd0(%rsp), %rdi
callq 0x2330
nopw %cs:(%rax,%rax)
nopl (%rax)