// File: /workspace/github_cpp_makefile_star2_O1/IdelCoder[P]PTransE-ag/Test_TransE_path.cpp
// Function: Test::calc_sum(int, int, int)
double calc_sum(int e1,int e2,int rel)
    {
        double sum=0;
        if (L1_flag)
        	for (int ii=0; ii<n; ii++)
            sum+=-fabs(entity_vec[e2][ii]-entity_vec[e1][ii]-relation_vec[rel][ii]);
        else
        for (int ii=0; ii<n; ii++)
            sum+=-sqr(entity_vec[e2][ii]-entity_vec[e1][ii]-relation_vec[rel][ii]);
        if (L1_flag)
        	for (int ii=0; ii<n; ii++)
            sum+=-fabs(entity_vec[e1][ii]-entity_vec[e2][ii]-relation_vec[rel+relation_num][ii]);
        else
        for (int ii=0; ii<n; ii++)
            sum+=-sqr(entity_vec[e1][ii]-entity_vec[e2][ii]-relation_vec[rel+relation_num][ii]);
		int h = e1;
		int l = e2;
		//used = "0";
		if (used=="1")
		{
			//cout<<"Here"<<endl;
			vector<pair<vector<int>,double> > path_list = fb_path[make_pair(h,l)];
			if (path_list.size()>0)
			{
				for (int path_id = 0; path_id<path_list.size(); path_id++)
				{
					vector<int> rel_path = path_list[path_id].first;

					double pr_path = 0;
					double pr = path_list[path_id].second;
					string  s;
				    ostringstream oss;//创建一个流
					for (int ii=0; ii<rel_path.size(); ii++)
					{
						oss<<rel_path[ii]<<" ";
					}
				    s=oss.str();//
					if (path_confidence.count(make_pair(s,rel))>0)
						pr_path = path_confidence[make_pair(s,rel)];
					//pr_path = 1;
					sum+=calc_path(rel,rel_path)*pr*pr_path;
				}
			}
			path_list = fb_path[make_pair(l,h)];
			if (path_list.size()>0)
			{
				for (int path_id = 0; path_id<path_list.size(); path_id++)
				{
					vector<int> rel_path = path_list[path_id].first;
					double pr = path_list[path_id].second;
					double pr_path = 0;
					string  s;
				    ostringstream oss;//创建一个流
					for (int ii=0; ii<rel_path.size(); ii++)
					{
						oss<<rel_path[ii]<<" ";
					}
				    s=oss.str();//
					if (path_confidence.count(make_pair(s,rel+relation_num))>0)
						pr_path = path_confidence[make_pair(s,rel+relation_num)];
					//pr_path = 1;
					sum+=calc_path(rel+relation_num,rel_path)*pr*pr_path;
				}
			}
		}
        return sum;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movl %ecx, 0xc(%rsp)
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, 0x10(%rsp)
movb 0x75ab(%rip), %al       # 0xf1c8
movl 0x75a9(%rip), %ecx      # 0xf1cc
testb %al, %al
je 0x7c91
testl %ecx, %ecx
jle 0x7cef
movslq %r14d, %rdx
movq 0x10(%rsp), %rsi
movq (%rsi), %rdi
movq 0x18(%rsi), %rsi
leaq (%rdx,%rdx,2), %rdx
movq (%rsi,%rdx,8), %rdx
movslq %ebp, %r8
leaq (%r8,%r8,2), %r8
movq (%rsi,%r8,8), %rsi
movslq 0xc(%rsp), %r8
leaq (%r8,%r8,2), %r8
movq (%rdi,%r8,8), %rdi
xorpd %xmm2, %xmm2
xorl %r8d, %r8d
movapd 0x33e3(%rip), %xmm0     # 0xb050
movsd (%rdx,%r8,8), %xmm1
subsd (%rsi,%r8,8), %xmm1
subsd (%rdi,%r8,8), %xmm1
andpd %xmm0, %xmm1
subsd %xmm1, %xmm2
incq %r8
cmpq %r8, %rcx
jne 0x7c6d
jmp 0x7cf3
testl %ecx, %ecx
jle 0x7cef
movslq %r14d, %rdx
movq 0x10(%rsp), %rsi
movq (%rsi), %rdi
movq 0x18(%rsi), %rsi
leaq (%rdx,%rdx,2), %rdx
movq (%rsi,%rdx,8), %rdx
movslq %ebp, %r8
leaq (%r8,%r8,2), %r8
movq (%rsi,%r8,8), %rsi
movslq 0xc(%rsp), %r8
leaq (%r8,%r8,2), %r8
movq (%rdi,%r8,8), %rdi
xorpd %xmm2, %xmm2
xorl %r8d, %r8d
movsd (%rdx,%r8,8), %xmm0
subsd (%rsi,%r8,8), %xmm0
subsd (%rdi,%r8,8), %xmm0
mulsd %xmm0, %xmm0
subsd %xmm0, %xmm2
incq %r8
cmpq %r8, %rcx
jne 0x7ccb
jmp 0x7cf3
xorpd %xmm2, %xmm2
movl 0x74d3(%rip), %ecx      # 0xf1cc
testb %al, %al
je 0x7d69
testl %ecx, %ecx
jle 0x7dc7
movslq %ebp, %rax
movq 0x10(%rsp), %rdx
movq (%rdx), %rsi
movq 0x18(%rdx), %rdx
leaq (%rax,%rax,2), %rax
movq (%rdx,%rax,8), %rax
movslq %r14d, %rdi
leaq (%rdi,%rdi,2), %rdi
movq (%rdx,%rdi,8), %rdx
movslq 0x773a(%rip), %rdi      # 0xf468
movslq 0xc(%rsp), %r8
addq %rdi, %r8
leaq (%r8,%r8,2), %rdi
movq (%rsi,%rdi,8), %rsi
xorl %edi, %edi
movapd 0x3308(%rip), %xmm0     # 0xb050
movsd (%rax,%rdi,8), %xmm1
subsd (%rdx,%rdi,8), %xmm1
subsd (%rsi,%rdi,8), %xmm1
andpd %xmm0, %xmm1
subsd %xmm1, %xmm2
incq %rdi
cmpq %rdi, %rcx
jne 0x7d48
jmp 0x7dc7
testl %ecx, %ecx
jle 0x7dc7
movslq %ebp, %rax
movq 0x10(%rsp), %rdx
movq (%rdx), %rsi
movq 0x18(%rdx), %rdx
leaq (%rax,%rax,2), %rax
movq (%rdx,%rax,8), %rax
movslq %r14d, %rdi
leaq (%rdi,%rdi,2), %rdi
movq (%rdx,%rdi,8), %rdx
movslq 0x76d2(%rip), %rdi      # 0xf468
movslq 0xc(%rsp), %r8
addq %rdi, %r8
leaq (%r8,%r8,2), %rdi
movq (%rsi,%rdi,8), %rsi
xorl %edi, %edi
movsd (%rax,%rdi,8), %xmm0
subsd (%rdx,%rdi,8), %xmm0
subsd (%rsi,%rdi,8), %xmm0
mulsd %xmm0, %xmm0
subsd %xmm0, %xmm2
incq %rdi
cmpq %rdi, %rcx
jne 0x7da8
movsd %xmm2, 0x68(%rsp)
leaq 0x7424(%rip), %rdi      # 0xf1f8
leaq 0x32b5(%rip), %rsi      # 0xb090
callq 0x20a0
testl %eax, %eax
jne 0x8393
movq 0x10(%rsp), %rax
leaq 0xc0(%rax), %rdi
shlq $0x20, %r14
movl %ebp, %eax
orq %r14, %rax
leaq 0xf0(%rsp), %rsi
movq %rax, 0xb0(%rsp)
movq %rax, (%rsi)
movq %rdi, 0xb8(%rsp)
callq 0x6fda
leaq 0x88(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x45b2
movq 0x8(%r14), %rax
cmpq (%r14), %rax
je 0x80ae
movq 0x88(%rsp), %rsi
cmpq %rsi, 0x90(%rsp)
je 0x80ae
xorl %ebx, %ebx
leaq 0xf0(%rsp), %rbp
leaq 0x18(%rsp), %r15
leaq 0xd8(%rsp), %r12
leaq 0x333f(%rip), %r13      # 0xb1b0
movq %rbx, %r14
shlq $0x5, %r14
addq %r14, %rsi
leaq 0x70(%rsp), %rdi
callq 0x6eb0
movq 0x88(%rsp), %rax
movsd 0x18(%rax,%r14), %xmm0
movsd %xmm0, 0xa8(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq $0x0, 0x48(%rsp)
movb $0x0, 0x50(%rsp)
movq %rbp, %rdi
callq 0x2240
movq 0x70(%rsp), %rax
cmpq %rax, 0x78(%rsp)
je 0x7f01
xorl %r14d, %r14d
movl (%rax,%r14,4), %esi
movq %rbp, %rdi
callq 0x22f0
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x2210
incq %r14
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r14, %rcx
ja 0x7ecc
movq %r15, %rdi
leaq 0xf8(%rsp), %rsi
callq 0x22b0
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x2230
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x7f32
callq 0x21b0
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x79b2
movl 0xc(%rsp), %eax
movl %eax, 0x38(%rsp)
leaq 0x72b8(%rip), %rdi      # 0xf218
movq %r15, %rsi
callq 0x899a
movq %rax, %r14
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x7f7f
callq 0x21b0
leaq 0x729a(%rip), %rax      # 0xf220
cmpq %rax, %r14
je 0x7fe1
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x79b2
movl 0xc(%rsp), %eax
movl %eax, 0x38(%rsp)
leaq 0x725f(%rip), %rdi      # 0xf218
movq %r15, %rsi
callq 0x4832
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x7feb
callq 0x21b0
jmp 0x7feb
xorpd %xmm0, %xmm0
movsd %xmm0, 0x60(%rsp)
movq %r12, %rdi
leaq 0x70(%rsp), %rsi
callq 0x6eb0
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
movq %r12, %rdx
callq 0x88f6
movsd %xmm0, 0xa0(%rsp)
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x8024
callq 0x21b0
movq %rbp, %rdi
movq 0x6fa2(%rip), %rsi      # 0xefd0
callq 0x2110
leaq 0x160(%rsp), %rdi
callq 0x20c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x8054
callq 0x21b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x8063
callq 0x21b0
movsd 0xa8(%rsp), %xmm1
mulsd 0xa0(%rsp), %xmm1
mulsd 0x60(%rsp), %xmm1
movsd 0x68(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x68(%rsp)
incq %rbx
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rbx, %rax
ja 0x7e71
movq 0xb0(%rsp), %rax
rolq $0x20, %rax
leaq 0xf0(%rsp), %rsi
movq %rax, (%rsi)
movq 0xb8(%rsp), %rdi
callq 0x6fda
leaq 0x88(%rsp), %rdi
movq %rax, %rsi
callq 0x7068
movq 0x90(%rsp), %rax
cmpq 0x88(%rsp), %rax
je 0x8386
movq 0x88(%rsp), %rsi
cmpq %rsi, 0x90(%rsp)
je 0x8386
xorl %ebx, %ebx
leaq 0xf0(%rsp), %rbp
leaq 0x18(%rsp), %r15
leaq 0xc0(%rsp), %r12
leaq 0x3084(%rip), %r14      # 0xb1b0
movq %rbx, %r13
shlq $0x5, %r13
addq %r13, %rsi
leaq 0x70(%rsp), %rdi
callq 0x6eb0
movq 0x88(%rsp), %rax
movsd 0x18(%rax,%r13), %xmm0
movsd %xmm0, 0xa8(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq $0x0, 0x48(%rsp)
movb $0x0, 0x50(%rsp)
movq %rbp, %rdi
callq 0x2240
movq 0x70(%rsp), %rax
cmpq %rax, 0x78(%rsp)
je 0x81bc
xorl %r13d, %r13d
movl (%rax,%r13,4), %esi
movq %rbp, %rdi
callq 0x22f0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2210
incq %r13
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r13, %rcx
ja 0x8187
movq %r15, %rdi
leaq 0xf8(%rsp), %rsi
callq 0x22b0
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x2230
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x81ed
callq 0x21b0
movl 0x7274(%rip), %r13d     # 0xf468
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x79b2
addl 0xc(%rsp), %r13d
movl %r13d, 0x38(%rsp)
leaq 0x6ff4(%rip), %rdi      # 0xf218
movq %r15, %rsi
callq 0x899a
movq %rax, %r13
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x8243
callq 0x21b0
leaq 0x6fd6(%rip), %rax      # 0xf220
cmpq %rax, %r13
je 0x82ae
movl 0x7212(%rip), %r13d     # 0xf468
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x79b2
addl 0xc(%rsp), %r13d
movl %r13d, 0x38(%rsp)
leaq 0x6f92(%rip), %rdi      # 0xf218
movq %r15, %rsi
callq 0x4832
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x82b8
callq 0x21b0
jmp 0x82b8
xorpd %xmm0, %xmm0
movsd %xmm0, 0x60(%rsp)
movl 0x71a9(%rip), %r13d     # 0xf468
movq %r12, %rdi
leaq 0x70(%rsp), %rsi
callq 0x6eb0
addl 0xc(%rsp), %r13d
movq 0x10(%rsp), %rdi
movl %r13d, %esi
movq %r12, %rdx
callq 0x88f6
movsd %xmm0, 0xa0(%rsp)
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x82fc
callq 0x21b0
movq %rbp, %rdi
movq 0x6cca(%rip), %rsi      # 0xefd0
callq 0x2110
leaq 0x160(%rsp), %rdi
callq 0x20c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x832c
callq 0x21b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x833b
callq 0x21b0
movsd 0xa8(%rsp), %xmm1
mulsd 0xa0(%rsp), %xmm1
mulsd 0x60(%rsp), %xmm1
movsd 0x68(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x68(%rsp)
incq %rbx
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rbx, %rax
ja 0x812c
leaq 0x88(%rsp), %rdi
callq 0x4636
movsd 0x68(%rsp), %xmm0
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x83e0
jmp 0x83ec
jmp 0x83c5
jmp 0x83ec
jmp 0x83c5
jmp 0x83ec
jmp 0x83ec
jmp 0x83c5
jmp 0x83ec
jmp 0x83e0
jmp 0x83e5
jmp 0x83ec
jmp 0x83ec
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x83ef
callq 0x21b0
jmp 0x83ef
jmp 0x83ec
movq %rax, %rbx
jmp 0x8433
movq %rax, %rbx
jmp 0x8410
jmp 0x83ec
movq %rax, %rbx
movq 0x6bda(%rip), %rsi      # 0xefd0
leaq 0xf0(%rsp), %rdi
callq 0x2110
leaq 0x160(%rsp), %rdi
callq 0x20c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x8424
callq 0x21b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x8433
callq 0x21b0
leaq 0x88(%rsp), %rdi
callq 0x4636
movq %rbx, %rdi
callq 0x2300