// File: /workspace/github_cpp_makefile_star2_O2/KokiKishimoto[P]cp_decomposition/./model_file_writer.hpp
// Function: ModelFileWriter::saveQ(std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, SignalOperation&, Data&, int)
void saveQ(std::vector< std::vector<double> >& subjVec, std::vector< std::vector<double> >& objVec, std::vector< std::vector<double> >& relationVec, SignalOperation& op, Data& data, int iter) {
		std::ofstream fout;
		fout.open("./model/" + std::to_string(iter) + "_subject.txt");

		fout << data.entity_counter << " " << subjVec[0].size() << "\n";
		for (int i = 0; i < data.entity_counter; i++) {
			const std::vector<double>& vec = subjVec[i];
			const double norm = op.norm(vec);
			fout << data.entity_dict_rev[i] << " ";

			for (int j = 0; j < vec.size(); j++) {
				if (j > 0) fout << " ";
				fout << op.quantize(vec[j]);
			}
			fout << "\n";
		}

		fout.close();


		fout.open("./model/" + std::to_string(iter) + "_object.txt");

		fout << data.entity_counter << " " << objVec[0].size() << "\n";
		for (int i = 0; i < data.entity_counter; i++) {
			const std::vector<double>& vec = objVec[i];
			const double norm = op.norm(vec);
			fout << data.entity_dict_rev[i] << " ";

			for (int j = 0; j < vec.size(); j++) {
				if (j > 0) fout << " ";
				fout << op.quantize(vec[j]);
			}
			fout << "\n";
		}

		fout.close();


		fout.open("./model/" + std::to_string(iter) + "_relation.txt");

		fout << data.relation_counter << " " << relationVec[0].size() << "\n";
		for (int i = 0; i < data.relation_counter; i++) {
			const std::vector<double>& vec = relationVec[i];
			const double norm = op.norm(vec);
			fout << data.relation_dict_rev[i] << " ";

			for (int j = 0; j < vec.size(); j++) {
				if (j > 0) fout << " ";
				fout << op.quantize(vec[j]);
			}
			fout << "\n";
		}

		fout.close();
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %r9, (%rsp)
movq %r8, 0x28(%rsp)
movq %rcx, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
movq %rsi, 0x40(%rsp)
movl 0x2c0(%rsp), %ebx
leaq 0x88(%rsp), %rdi
callq 0x2330
leaq 0x48(%rsp), %rdi
movl %ebx, %esi
callq 0x5d09
leaq 0xf1b(%rip), %rsi       # 0x612b
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x5ce5
leaq 0xf0e(%rip), %rdx       # 0x6134
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x5cc6
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rsi
pushq $0x10
popq %rdx
callq 0x20f0
leaq 0x8(%rsp), %rdi
callq 0x20e0
leaq 0x68(%rsp), %rdi
callq 0x20e0
leaq 0x48(%rsp), %rdi
callq 0x20e0
movq (%rsp), %rax
movl (%rax), %esi
leaq 0x88(%rsp), %rdi
callq 0x2340
leaq 0xea7(%rip), %rsi       # 0x6129
movq %rax, %rdi
callq 0x2200
movq 0x40(%rsp), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rsi
subq (%rcx), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x2150
leaq 0xe95(%rip), %rsi       # 0x6141
movq %rax, %rdi
callq 0x2200
movq (%rsp), %rax
leaq 0x68(%rax), %r13
xorl %eax, %eax
leaq 0x88(%rsp), %r12
leaq 0xe5c(%rip), %r15       # 0x6129
leaq 0xd9c(%rip), %r14       # 0x6070
movl %eax, 0x8(%rsp)
movq (%rsp), %rcx
cmpl (%rcx), %eax
jge 0x5387
cltq
imulq $0x18, %rax, %rbp
movq 0x40(%rsp), %rax
addq (%rax), %rbp
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x5b18
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x3928
movq %r12, %rdi
movq %rax, %rsi
callq 0x21f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x2200
xorl %ebx, %ebx
movq (%rbp), %rax
movq 0x8(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
jbe 0x536d
testq %rbx, %rbx
je 0x534c
movq %r12, %rdi
movq %r15, %rsi
callq 0x2200
movq (%rbp), %rax
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
ucomisd (%rax,%rbx,8), %xmm0
seta %cl
movsd (%r14,%rcx,8), %xmm0
movq %r12, %rdi
callq 0x2300
incq %rbx
jmp 0x5324
movq %r12, %rdi
leaq 0xdca(%rip), %rsi       # 0x6141
callq 0x2200
movl 0x8(%rsp), %eax
incl %eax
jmp 0x52d4
leaq 0x88(%rsp), %rdi
callq 0x22a0
leaq 0x48(%rsp), %rdi
movl 0x2c0(%rsp), %esi
callq 0x5d09
leaq 0xd7f(%rip), %rsi       # 0x612b
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x5ce5
leaq 0xd81(%rip), %rdx       # 0x6143
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x5cc6
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rsi
pushq $0x10
popq %rdx
callq 0x20f0
leaq 0x8(%rsp), %rdi
callq 0x20e0
leaq 0x68(%rsp), %rdi
callq 0x20e0
leaq 0x48(%rsp), %rdi
callq 0x20e0
movq (%rsp), %rax
movl (%rax), %esi
leaq 0x88(%rsp), %rdi
callq 0x2340
leaq 0xd0b(%rip), %rsi       # 0x6129
movq %rax, %rdi
callq 0x2200
movq 0x38(%rsp), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rsi
subq (%rcx), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x2150
leaq 0xcf9(%rip), %rsi       # 0x6141
movq %rax, %rdi
callq 0x2200
xorl %eax, %eax
leaq 0x88(%rsp), %r12
leaq 0xcc8(%rip), %rbp       # 0x6129
movl %eax, 0x8(%rsp)
movq (%rsp), %rcx
cmpl (%rcx), %eax
jge 0x5512
cltq
imulq $0x18, %rax, %r15
movq 0x38(%rsp), %rax
addq (%rax), %r15
movq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x5b18
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x3928
movq %r12, %rdi
movq %rax, %rsi
callq 0x21f0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2200
xorl %ebx, %ebx
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
jbe 0x54f8
testq %rbx, %rbx
je 0x54d7
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2200
movq (%r15), %rax
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
ucomisd (%rax,%rbx,8), %xmm0
seta %cl
movsd (%r14,%rcx,8), %xmm0
movq %r12, %rdi
callq 0x2300
incq %rbx
jmp 0x54b1
movq %r12, %rdi
leaq 0xc3f(%rip), %rsi       # 0x6141
callq 0x2200
movl 0x8(%rsp), %eax
incl %eax
jmp 0x5461
leaq 0x88(%rsp), %rdi
callq 0x22a0
leaq 0x48(%rsp), %rdi
movl 0x2c0(%rsp), %esi
callq 0x5d09
leaq 0xbf4(%rip), %rsi       # 0x612b
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x5ce5
leaq 0xc02(%rip), %rdx       # 0x614f
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x5cc6
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rsi
pushq $0x10
popq %rdx
callq 0x20f0
leaq 0x8(%rsp), %rdi
callq 0x20e0
leaq 0x68(%rsp), %rdi
callq 0x20e0
leaq 0x48(%rsp), %rdi
callq 0x20e0
movq (%rsp), %rax
movl 0x4(%rax), %esi
leaq 0x88(%rsp), %rdi
callq 0x2340
leaq 0xb7f(%rip), %rsi       # 0x6129
movq %rax, %rdi
callq 0x2200
movq 0x30(%rsp), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rsi
subq (%rcx), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x2150
leaq 0xb6d(%rip), %rsi       # 0x6141
movq %rax, %rdi
callq 0x2200
movq (%rsp), %rax
leaq 0x98(%rax), %r12
xorl %eax, %eax
leaq 0x88(%rsp), %r13
leaq 0xb31(%rip), %rbp       # 0x6129
movl %eax, 0x8(%rsp)
movq (%rsp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x56aa
cltq
imulq $0x18, %rax, %r15
movq 0x30(%rsp), %rax
addq (%rax), %r15
movq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x5b18
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0x3928
movq %r13, %rdi
movq %rax, %rsi
callq 0x21f0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2200
xorl %ebx, %ebx
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
jbe 0x5690
testq %rbx, %rbx
je 0x566f
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2200
movq (%r15), %rax
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
ucomisd (%rax,%rbx,8), %xmm0
seta %cl
movsd (%r14,%rcx,8), %xmm0
movq %r13, %rdi
callq 0x2300
incq %rbx
jmp 0x5649
movq %r13, %rdi
leaq 0xaa7(%rip), %rsi       # 0x6141
callq 0x2200
movl 0x8(%rsp), %eax
incl %eax
jmp 0x55f8
leaq 0x88(%rsp), %rdi
callq 0x22a0
leaq 0x88(%rsp), %rdi
callq 0x22d0
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x56e6
jmp 0x56f5
jmp 0x5704
jmp 0x5721
jmp 0x56e6
jmp 0x56f5
jmp 0x5704
jmp 0x5721
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x20e0
jmp 0x56f8
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x20e0
jmp 0x5707
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x20e0
jmp 0x5724
jmp 0x5721
jmp 0x5721
jmp 0x5721
jmp 0x5721
jmp 0x5721
jmp 0x5721
jmp 0x5721
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x22d0
movq %rbx, %rdi
callq 0x2350
nop