// File: /workspace/github_cpp_makefile_star2_O1/KokiKishimoto[P]cp_decomposition/testcp.cpp
// Function: TestCP::test_inv()
void test_inv() {
		double total = (double)testData.triples.size() * 2;
		double mrr = 0.0, mrr_filter = 0.0;
		double rank_1 = 0.0, rank_1_filter = 0.0;
		double rank_3 = 0.0, rank_3_filter = 0.0;
		double rank_5 = 0.0, rank_5_filter = 0.0;
		double rank_10 = 0.0, rank_10_filter = 0.0;
		int j=0;
		
		for (Triple& test_tuple : testData.triples) {
			if (test_tuple.flag) {
				total = total - 2;
				continue;
			}
			pre_score_inv(test_tuple.subj, test_tuple.relation, test_tuple.relation_rev, test_tuple.obj);
			for (int entity = 0; entity<trainData.entity_counter; ++entity) {
				RankScore& r1 = scores_subj[entity]; 
				r1.set(entity, innerProductSubj(entity, outVec2) + innerProductObj(entity, outVec3_inv));
				RankScore& r2 = scores_obj[entity];
				r2.set(entity, innerProductObj(entity, outVec3) + innerProductSubj(entity, outVec2_inv));
			}
			generate_rank(scores_subj, test_tuple.relation, test_tuple.subj, test_tuple.obj, subjSet, rank1, rank_filter_1);
			generate_rank(scores_obj, test_tuple.relation, test_tuple.obj, test_tuple.subj, objSet, rank2, rank_filter_2);

		}
		rank_1 = calculate_ranking(rank1, rank2, 1);
		rank_3 = calculate_ranking(rank1, rank2, 3);
		rank_5 = calculate_ranking(rank1, rank2, 5);
		rank_10 = calculate_ranking(rank1, rank2, 10);
		mrr = calate_mrr(rank1, rank2);

		rank_1_filter = calculate_ranking(rank_filter_1, rank_filter_2, 1);
		rank_3_filter = calculate_ranking(rank_filter_1, rank_filter_2, 3);
		rank_5_filter = calculate_ranking(rank_filter_1, rank_filter_2, 5);
		rank_10_filter = calculate_ranking(rank_filter_1, rank_filter_2, 10);
		mrr_filter = calate_mrr(rank_filter_1, rank_filter_2);

		std::cout << "Raw Rank1: " << (rank_1 / total) << "\n";
		std::cout << "Raw Rank3: " << (rank_3 / total) << "\n";
		std::cout << "Raw Rank5: " << (rank_5 / total) << "\n";
		std::cout << "Raw Rank10: " << (rank_10 / total) << "\n";
		std::cout << "Raw MRR: " << (mrr / total) << "\n";
		
		std::cout << "Filtered Rank1: " << (rank_1_filter / total) << "\n";
		std::cout << "Filtered Rank3: " << (rank_3_filter / total) << "\n";
		std::cout << "Filtered Rank5: " << (rank_5_filter / total) << "\n";
		std::cout << "Filtered Rank10: " << (rank_10_filter / total) << "\n";
		std::cout << "Filtered MRR: " << (mrr_filter / total) << "\n";
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
movq 0x148(%rdi), %r14
movq 0x150(%rdi), %rdx
movq %rdx, %rax
subq %r14, %rax
sarq $0x2, %rax
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %rcx
movq %rcx, %xmm0
punpckldq 0x5325(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x532d(%rip), %xmm0     # 0x9020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addsd %xmm1, %xmm1
movapd %xmm1, (%rsp)
cmpq %r14, %rdx
je 0x3f8a
leaq 0x318(%rbx), %rax
movq %rax, 0x60(%rsp)
leaq 0x380(%rbx), %rax
movq %rax, 0x50(%rsp)
leaq 0x3b0(%rbx), %rax
movq %rax, 0x40(%rsp)
leaq 0x18(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x348(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x398(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x3c8(%rbx), %rax
movq %rax, 0xa0(%rsp)
movq %rbx, 0x10(%rsp)
movq %rdx, 0x70(%rsp)
cmpb $0x1, 0x10(%r14)
jne 0x3d8d
movapd (%rsp), %xmm0
addsd 0x52ad(%rip), %xmm0     # 0x9030
movapd %xmm0, (%rsp)
jmp 0x3f7d
movl 0x8(%r14), %edx
movl 0xc(%r14), %ecx
movl (%r14), %esi
movq %r14, 0x80(%rsp)
movl 0x4(%r14), %r8d
movq %rbx, %rdi
callq 0x7634
movslq 0x30(%rbx), %rax
testq %rax, %rax
jle 0x3f18
movq 0x10(%rsp), %rcx
movq (%rcx), %rdx
movq %rdx, 0x90(%rsp)
movq 0x18(%rcx), %rdx
movq 0x238(%rcx), %rsi
movq 0x298(%rcx), %rdi
movq 0x250(%rcx), %r8
movq 0x2f8(%rcx), %r9
movq 0x2b0(%rcx), %r10
movq 0x2e0(%rcx), %r11
xorl %ebp, %ebp
leaq (,%rbp,2), %r15
addq %rbp, %r15
movq (%rsi,%r15,8), %r14
movq 0x8(%rsi,%r15,8), %r12
xorpd %xmm1, %xmm1
movq %r12, %rbx
xorpd %xmm0, %xmm0
subq %r14, %rbx
je 0x3e44
sarq $0x3, %rbx
cmpq $0x1, %rbx
adcq $0x0, %rbx
xorl %r13d, %r13d
movsd (%r14,%r13,8), %xmm2
mulsd (%rdi,%r13,8), %xmm2
addsd %xmm2, %xmm0
incq %r13
cmpq %r13, %rbx
jne 0x3e2c
movq (%r8,%r15,8), %rbx
movq 0x8(%r8,%r15,8), %r13
movq %r13, %r15
subq %rbx, %r15
je 0x3e7e
sarq $0x3, %r15
cmpq $0x1, %r15
adcq $0x0, %r15
xorpd %xmm1, %xmm1
xorl %ecx, %ecx
movsd (%rbx,%rcx,8), %xmm2
mulsd (%r9,%rcx,8), %xmm2
addsd %xmm2, %xmm1
incq %rcx
cmpq %rcx, %r15
jne 0x3e67
addsd %xmm1, %xmm0
movq %rbp, %r15
shlq $0x4, %r15
movq 0x90(%rsp), %rcx
addq %r15, %rcx
movl %ebp, 0x8(%rcx)
movsd %xmm0, (%rcx)
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
subq %rbx, %r13
je 0x3ecd
sarq $0x3, %r13
cmpq $0x1, %r13
adcq $0x0, %r13
xorl %ecx, %ecx
movsd (%rbx,%rcx,8), %xmm2
mulsd (%r10,%rcx,8), %xmm2
addsd %xmm2, %xmm0
incq %rcx
cmpq %rcx, %r13
jne 0x3eb6
subq %r14, %r12
je 0x3efc
sarq $0x3, %r12
cmpq $0x1, %r12
adcq $0x0, %r12
xorpd %xmm1, %xmm1
xorl %ecx, %ecx
movsd (%r14,%rcx,8), %xmm2
mulsd (%r11,%rcx,8), %xmm2
addsd %xmm2, %xmm1
incq %rcx
cmpq %rcx, %r12
jne 0x3ee4
addsd %xmm1, %xmm0
addq %rdx, %r15
movl %ebp, 0x8(%r15)
movsd %xmm0, (%r15)
incq %rbp
cmpq %rax, %rbp
jne 0x3df9
movq 0x80(%rsp), %r14
movl 0x8(%r14), %edx
movl (%r14), %ecx
movl 0x4(%r14), %r8d
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rbx, %rsi
movq 0x60(%rsp), %r9
pushq 0x40(%rsp)
pushq 0x58(%rsp)
callq 0x773a
addq $0x10, %rsp
movl 0x8(%r14), %edx
movl (%r14), %r8d
movl 0x4(%r14), %ecx
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %r9
pushq 0xa0(%rsp)
pushq 0x28(%rsp)
callq 0x773a
addq $0x10, %rsp
movq 0x70(%rsp), %rdx
addq $0x14, %r14
cmpq %rdx, %r14
jne 0x3d6f
leaq 0x398(%rbx), %rdx
movq 0x380(%rbx), %rax
movq 0x388(%rbx), %rcx
xorpd %xmm4, %xmm4
movq %rcx, %rsi
xorpd %xmm3, %xmm3
subq %rax, %rsi
je 0x400f
sarq $0x3, %rsi
cmpq $0x1, %rsi
adcq $0x0, %rsi
movq (%rdx), %rdi
xorl %r8d, %r8d
movsd 0x506f(%rip), %xmm0     # 0x9038
movsd (%rax,%r8,8), %xmm1
movapd %xmm3, %xmm2
addsd %xmm0, %xmm2
cmpltsd %xmm0, %xmm1
andpd %xmm1, %xmm2
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
movsd (%rdi,%r8,8), %xmm3
cmpltsd %xmm0, %xmm3
movapd %xmm3, %xmm2
andnpd %xmm1, %xmm2
addsd %xmm0, %xmm1
andpd %xmm1, %xmm3
orpd %xmm2, %xmm3
incq %r8
cmpq %r8, %rsi
jne 0x3fc9
movapd %xmm3, 0x80(%rsp)
movq %rcx, %rsi
subq %rax, %rsi
je 0x408c
sarq $0x3, %rsi
movq (%rdx), %rdi
cmpq $0x1, %rsi
adcq $0x0, %rsi
xorpd %xmm4, %xmm4
xorl %r8d, %r8d
movsd 0x4ffa(%rip), %xmm0     # 0x9038
movsd 0x4ffa(%rip), %xmm1     # 0x9040
movsd (%rax,%r8,8), %xmm2
movapd %xmm4, %xmm3
addsd %xmm0, %xmm3
cmpltsd %xmm1, %xmm2
andpd %xmm2, %xmm3
andnpd %xmm4, %xmm2
orpd %xmm3, %xmm2
movsd (%rdi,%r8,8), %xmm4
cmpltsd %xmm1, %xmm4
movapd %xmm4, %xmm3
andnpd %xmm2, %xmm3
addsd %xmm0, %xmm2
andpd %xmm2, %xmm4
orpd %xmm3, %xmm4
incq %r8
cmpq %r8, %rsi
jne 0x4046
xorpd %xmm5, %xmm5
movq %rcx, %rsi
xorpd %xmm6, %xmm6
subq %rax, %rsi
je 0x4104
sarq $0x3, %rsi
movq (%rdx), %rdi
cmpq $0x1, %rsi
adcq $0x0, %rsi
xorl %r8d, %r8d
movsd 0x4f82(%rip), %xmm0     # 0x9038
movsd 0x4f8a(%rip), %xmm1     # 0x9048
movsd (%rax,%r8,8), %xmm2
movapd %xmm6, %xmm3
addsd %xmm0, %xmm3
cmpltsd %xmm1, %xmm2
andpd %xmm2, %xmm3
andnpd %xmm6, %xmm2
orpd %xmm3, %xmm2
movsd (%rdi,%r8,8), %xmm6
cmpltsd %xmm1, %xmm6
movapd %xmm6, %xmm3
andnpd %xmm2, %xmm3
addsd %xmm0, %xmm2
andpd %xmm2, %xmm6
orpd %xmm3, %xmm6
incq %r8
cmpq %r8, %rsi
jne 0x40be
movapd %xmm6, 0x60(%rsp)
movapd %xmm4, 0x90(%rsp)
leaq 0x380(%rbx), %rsi
subq %rax, %rcx
je 0x418b
sarq $0x3, %rcx
movq (%rdx), %rdi
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorpd %xmm5, %xmm5
xorl %r8d, %r8d
movsd 0x4efb(%rip), %xmm0     # 0x9038
movsd 0x4f0b(%rip), %xmm1     # 0x9050
movsd (%rax,%r8,8), %xmm2
movapd %xmm5, %xmm3
addsd %xmm0, %xmm3
cmpltsd %xmm1, %xmm2
andpd %xmm2, %xmm3
andnpd %xmm5, %xmm2
orpd %xmm3, %xmm2
movsd (%rdi,%r8,8), %xmm5
cmpltsd %xmm1, %xmm5
movapd %xmm5, %xmm3
andnpd %xmm2, %xmm3
addsd %xmm0, %xmm2
andpd %xmm2, %xmm5
orpd %xmm3, %xmm5
incq %r8
cmpq %r8, %rcx
jne 0x4145
movapd %xmm5, 0x70(%rsp)
movq %rbx, %rdi
callq 0x7932
movsd %xmm0, 0x18(%rsp)
leaq 0x3c8(%rbx), %rdx
movq 0x3b0(%rbx), %rax
movq 0x3b8(%rbx), %rcx
xorpd %xmm4, %xmm4
movq %rcx, %rsi
xorpd %xmm3, %xmm3
subq %rax, %rsi
je 0x4224
sarq $0x3, %rsi
cmpq $0x1, %rsi
adcq $0x0, %rsi
movq (%rdx), %rdi
xorl %r8d, %r8d
movsd 0x4e5a(%rip), %xmm0     # 0x9038
movsd (%rax,%r8,8), %xmm1
movapd %xmm3, %xmm2
addsd %xmm0, %xmm2
cmpltsd %xmm0, %xmm1
andpd %xmm1, %xmm2
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
movsd (%rdi,%r8,8), %xmm3
cmpltsd %xmm0, %xmm3
movapd %xmm3, %xmm2
andnpd %xmm1, %xmm2
addsd %xmm0, %xmm1
andpd %xmm1, %xmm3
orpd %xmm2, %xmm3
incq %r8
cmpq %r8, %rsi
jne 0x41de
movapd %xmm3, 0x40(%rsp)
movq %rcx, %rsi
subq %rax, %rsi
je 0x429e
sarq $0x3, %rsi
movq (%rdx), %rdi
cmpq $0x1, %rsi
adcq $0x0, %rsi
xorpd %xmm4, %xmm4
xorl %r8d, %r8d
movsd 0x4de8(%rip), %xmm0     # 0x9038
movsd 0x4de8(%rip), %xmm1     # 0x9040
movsd (%rax,%r8,8), %xmm2
movapd %xmm4, %xmm3
addsd %xmm0, %xmm3
cmpltsd %xmm1, %xmm2
andpd %xmm2, %xmm3
andnpd %xmm4, %xmm2
orpd %xmm3, %xmm2
movsd (%rdi,%r8,8), %xmm4
cmpltsd %xmm1, %xmm4
movapd %xmm4, %xmm3
andnpd %xmm2, %xmm3
addsd %xmm0, %xmm2
andpd %xmm2, %xmm4
orpd %xmm3, %xmm4
incq %r8
cmpq %r8, %rsi
jne 0x4258
xorpd %xmm5, %xmm5
movq %rcx, %rsi
xorpd %xmm6, %xmm6
subq %rax, %rsi
je 0x4316
sarq $0x3, %rsi
movq (%rdx), %rdi
cmpq $0x1, %rsi
adcq $0x0, %rsi
xorl %r8d, %r8d
movsd 0x4d70(%rip), %xmm0     # 0x9038
movsd 0x4d78(%rip), %xmm1     # 0x9048
movsd (%rax,%r8,8), %xmm2
movapd %xmm6, %xmm3
addsd %xmm0, %xmm3
cmpltsd %xmm1, %xmm2
andpd %xmm2, %xmm3
andnpd %xmm6, %xmm2
orpd %xmm3, %xmm2
movsd (%rdi,%r8,8), %xmm6
cmpltsd %xmm1, %xmm6
movapd %xmm6, %xmm3
andnpd %xmm2, %xmm3
addsd %xmm0, %xmm2
andpd %xmm2, %xmm6
orpd %xmm3, %xmm6
incq %r8
cmpq %r8, %rsi
jne 0x42d0
movapd %xmm6, 0x30(%rsp)
movapd %xmm4, 0x50(%rsp)
leaq 0x3b0(%rbx), %rsi
subq %rax, %rcx
je 0x439a
sarq $0x3, %rcx
movq (%rdx), %rdi
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorpd %xmm5, %xmm5
xorl %r8d, %r8d
movsd 0x4cec(%rip), %xmm0     # 0x9038
movsd 0x4cfc(%rip), %xmm1     # 0x9050
movsd (%rax,%r8,8), %xmm2
movapd %xmm5, %xmm3
addsd %xmm0, %xmm3
cmpltsd %xmm1, %xmm2
andpd %xmm2, %xmm3
andnpd %xmm5, %xmm2
orpd %xmm3, %xmm2
movsd (%rdi,%r8,8), %xmm5
cmpltsd %xmm1, %xmm5
movapd %xmm5, %xmm3
andnpd %xmm2, %xmm3
addsd %xmm0, %xmm2
andpd %xmm2, %xmm5
orpd %xmm3, %xmm5
incq %r8
cmpq %r8, %rcx
jne 0x4354
movapd %xmm5, 0x20(%rsp)
movq %rbx, %rdi
callq 0x7932
movsd %xmm0, 0x10(%rsp)
movq 0x7c23(%rip), %rbx      # 0xbfd8
leaq 0x4d40(%rip), %rsi      # 0x90fc
movl $0xb, %edx
movq %rbx, %rdi
callq 0x2230
movapd 0x80(%rsp), %xmm0
divsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x22b0
leaq 0x4d22(%rip), %r14      # 0x9108
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2230
leaq 0x4d0d(%rip), %rsi      # 0x910a
movl $0xb, %edx
movq %rbx, %rdi
callq 0x2230
movapd 0x90(%rsp), %xmm0
divsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x22b0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2230
leaq 0x4cdf(%rip), %rsi      # 0x9116
movl $0xb, %edx
movq %rbx, %rdi
callq 0x2230
movapd 0x60(%rsp), %xmm0
divsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x22b0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2230
leaq 0x4cb4(%rip), %rsi      # 0x9122
movl $0xc, %edx
movq %rbx, %rdi
callq 0x2230
movapd 0x70(%rsp), %xmm0
divsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x22b0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2230
leaq 0x4c8a(%rip), %rsi      # 0x912f
movl $0x9, %edx
movq %rbx, %rdi
callq 0x2230
movsd 0x18(%rsp), %xmm0
divsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x22b0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2230
leaq 0x4c5d(%rip), %rsi      # 0x9139
movl $0x10, %edx
movq %rbx, %rdi
callq 0x2230
movapd 0x40(%rsp), %xmm0
divsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x22b0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2230
leaq 0x4c37(%rip), %rsi      # 0x914a
movl $0x10, %edx
movq %rbx, %rdi
callq 0x2230
movapd 0x50(%rsp), %xmm0
divsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x22b0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2230
leaq 0x4c11(%rip), %rsi      # 0x915b
movl $0x10, %edx
movq %rbx, %rdi
callq 0x2230
movapd 0x30(%rsp), %xmm0
divsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x22b0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2230
leaq 0x4beb(%rip), %rsi      # 0x916c
movl $0x11, %edx
movq %rbx, %rdi
callq 0x2230
movapd 0x20(%rsp), %xmm0
divsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x22b0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2230
leaq 0x4bc6(%rip), %rsi      # 0x917e
movl $0xe, %edx
movq %rbx, %rdi
callq 0x2230
movsd 0x10(%rsp), %xmm0
divsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x22b0
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2230
nop