// File: /workspace/github_cpp_makefile_star2_O3/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 0x75bf(%rip), %cl       # 0xf1c8
movl 0x75bd(%rip), %eax      # 0xf1cc
testb %cl, %cl
je 0x7c7d
testl %eax, %eax
jle 0x7d4d
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 0x33f7(%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, %rax
jne 0x7c59
jmp 0x7cdd
testl %eax, %eax
jle 0x7d4d
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, %rax
jne 0x7cbb
testb %cl, %cl
je 0x7d53
testl %eax, %eax
jle 0x7db1
movslq %ebp, %rcx
movq 0x10(%rsp), %rdx
movq (%rdx), %rsi
movq 0x18(%rdx), %rdx
leaq (%rcx,%rcx,2), %rcx
movq (%rdx,%rcx,8), %rcx
movslq %r14d, %rdi
leaq (%rdi,%rdi,2), %rdi
movq (%rdx,%rdi,8), %rdx
movslq 0x7756(%rip), %rdi      # 0xf468
movslq 0xc(%rsp), %r8
addq %rdi, %r8
leaq (%r8,%r8,2), %rdi
movq (%rsi,%rdi,8), %rsi
xorl %edi, %edi
movapd 0x3324(%rip), %xmm0     # 0xb050
movsd (%rcx,%rdi,8), %xmm1
subsd (%rdx,%rdi,8), %xmm1
subsd (%rsi,%rdi,8), %xmm1
andpd %xmm0, %xmm1
subsd %xmm1, %xmm2
incq %rdi
cmpq %rdi, %rax
jne 0x7d2c
jmp 0x7db1
xorpd %xmm2, %xmm2
jmp 0x7db1
testl %eax, %eax
jle 0x7db1
movslq %ebp, %rcx
movq 0x10(%rsp), %rdx
movq (%rdx), %rsi
movq 0x18(%rdx), %rdx
leaq (%rcx,%rcx,2), %rcx
movq (%rdx,%rcx,8), %rcx
movslq %r14d, %rdi
leaq (%rdi,%rdi,2), %rdi
movq (%rdx,%rdi,8), %rdx
movslq 0x76e8(%rip), %rdi      # 0xf468
movslq 0xc(%rsp), %r8
addq %rdi, %r8
leaq (%r8,%r8,2), %rdi
movq (%rsi,%rdi,8), %rsi
xorl %edi, %edi
movsd (%rcx,%rdi,8), %xmm0
subsd (%rdx,%rdi,8), %xmm0
subsd (%rsi,%rdi,8), %xmm0
mulsd %xmm0, %xmm0
subsd %xmm0, %xmm2
incq %rdi
cmpq %rdi, %rax
jne 0x7d92
movsd %xmm2, 0x68(%rsp)
leaq 0x743a(%rip), %rdi      # 0xf1f8
leaq 0x32cb(%rip), %rsi      # 0xb090
callq 0x20a0
testl %eax, %eax
jne 0x8351
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 0x6fd2
leaq 0x98(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x4542
movq (%r14), %rsi
cmpq %rsi, 0x8(%r14)
je 0x8082
xorl %ebx, %ebx
leaq 0xf0(%rsp), %rbp
leaq 0x18(%rsp), %r12
leaq 0xd8(%rsp), %r15
leaq 0x336b(%rip), %r13      # 0xb1b0
movq %rbx, %r14
shlq $0x5, %r14
addq %r14, %rsi
leaq 0x70(%rsp), %rdi
callq 0x6eac
movq 0x98(%rsp), %rax
movsd 0x18(%rax,%r14), %xmm0
movsd %xmm0, 0x90(%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 0x7ed5
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 0x7ea0
movq %r12, %rdi
leaq 0xf8(%rsp), %rsi
callq 0x22b0
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x2230
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x7f06
callq 0x21b0
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x799a
movl 0xc(%rsp), %eax
movl %eax, 0x38(%rsp)
leaq 0x72e4(%rip), %rdi      # 0xf218
movq %r12, %rsi
callq 0x8958
movq %rax, %r14
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x7f53
callq 0x21b0
leaq 0x72c6(%rip), %rax      # 0xf220
cmpq %rax, %r14
je 0x7fb5
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x799a
movl 0xc(%rsp), %eax
movl %eax, 0x38(%rsp)
leaq 0x728b(%rip), %rdi      # 0xf218
movq %r12, %rsi
callq 0x47cc
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x7fbf
callq 0x21b0
jmp 0x7fbf
xorpd %xmm0, %xmm0
movsd %xmm0, 0x60(%rsp)
movq %r15, %rdi
leaq 0x70(%rsp), %rsi
callq 0x6eac
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
movq %r15, %rdx
callq 0x88b4
movsd %xmm0, 0x88(%rsp)
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x7ff8
callq 0x21b0
movq %rbp, %rdi
movq 0x6fce(%rip), %rsi      # 0xefd0
callq 0x2110
leaq 0x160(%rsp), %rdi
callq 0x20c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x8028
callq 0x21b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x8037
callq 0x21b0
movsd 0x90(%rsp), %xmm1
mulsd 0x88(%rsp), %xmm1
mulsd 0x60(%rsp), %xmm1
movsd 0x68(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x68(%rsp)
incq %rbx
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rbx, %rax
ja 0x7e45
movq 0xb0(%rsp), %rax
rolq $0x20, %rax
leaq 0xf0(%rsp), %rsi
movq %rax, (%rsi)
movq 0xb8(%rsp), %rdi
callq 0x6fd2
leaq 0x98(%rsp), %rdi
movq %rax, %rsi
callq 0x705c
movq 0x98(%rsp), %rsi
cmpq %rsi, 0xa0(%rsp)
je 0x8344
xorl %ebx, %ebx
leaq 0xf0(%rsp), %rbp
leaq 0x18(%rsp), %r15
leaq 0xc0(%rsp), %r12
leaq 0x30c6(%rip), %r14      # 0xb1b0
movq %rbx, %r13
shlq $0x5, %r13
addq %r13, %rsi
leaq 0x70(%rsp), %rdi
callq 0x6eac
movq 0x98(%rsp), %rax
movsd 0x18(%rax,%r13), %xmm0
movsd %xmm0, 0x90(%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 0x817a
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 0x8145
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 0x81ab
callq 0x21b0
movl 0x72b6(%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 0x799a
addl 0xc(%rsp), %r13d
movl %r13d, 0x38(%rsp)
leaq 0x7036(%rip), %rdi      # 0xf218
movq %r15, %rsi
callq 0x8958
movq %rax, %r13
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x8201
callq 0x21b0
leaq 0x7018(%rip), %rax      # 0xf220
cmpq %rax, %r13
je 0x826c
movl 0x7254(%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 0x799a
addl 0xc(%rsp), %r13d
movl %r13d, 0x38(%rsp)
leaq 0x6fd4(%rip), %rdi      # 0xf218
movq %r15, %rsi
callq 0x47cc
movsd (%rax), %xmm0
movsd %xmm0, 0x60(%rsp)
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x8276
callq 0x21b0
jmp 0x8276
xorpd %xmm0, %xmm0
movsd %xmm0, 0x60(%rsp)
movl 0x71eb(%rip), %r13d     # 0xf468
movq %r12, %rdi
leaq 0x70(%rsp), %rsi
callq 0x6eac
addl 0xc(%rsp), %r13d
movq 0x10(%rsp), %rdi
movl %r13d, %esi
movq %r12, %rdx
callq 0x88b4
movsd %xmm0, 0x88(%rsp)
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x82ba
callq 0x21b0
movq %rbp, %rdi
movq 0x6d0c(%rip), %rsi      # 0xefd0
callq 0x2110
leaq 0x160(%rsp), %rdi
callq 0x20c0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x82ea
callq 0x21b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x82f9
callq 0x21b0
movsd 0x90(%rsp), %xmm1
mulsd 0x88(%rsp), %xmm1
mulsd 0x60(%rsp), %xmm1
movsd 0x68(%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x68(%rsp)
incq %rbx
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rbx, %rax
ja 0x80ea
leaq 0x98(%rsp), %rdi
callq 0x45c6
movsd 0x68(%rsp), %xmm0
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x839e
jmp 0x83aa
jmp 0x8383
jmp 0x83aa
jmp 0x8383
jmp 0x83aa
jmp 0x83aa
jmp 0x8383
jmp 0x83aa
jmp 0x839e
jmp 0x83a3
jmp 0x83aa
jmp 0x83aa
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x83ad
callq 0x21b0
jmp 0x83ad
jmp 0x83aa
movq %rax, %rbx
jmp 0x83f1
movq %rax, %rbx
jmp 0x83ce
jmp 0x83aa
movq %rax, %rbx
movq 0x6c1c(%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 0x83e2
callq 0x21b0
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x83f1
callq 0x21b0
leaq 0x98(%rsp), %rdi
callq 0x45c6
movq %rbx, %rdi
callq 0x2300