// File: 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
movq %rsp, %rbp
subq $0x480, %rsp            # imm = 0x480
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x3420
movl 0x10(%rbp), %esi
leaq -0x290(%rbp), %rdi
callq 0xed80
jmp 0xcb53
leaq 0x35bd(%rip), %rsi      # 0x10117
leaq -0x270(%rbp), %rdi
leaq -0x290(%rbp), %rdx
callq 0xed30
jmp 0xcb6f
leaq 0x35aa(%rip), %rdx      # 0x10120
leaq -0x250(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0xece0
jmp 0xcb8b
leaq -0x230(%rbp), %rdi
leaq -0x250(%rbp), %rsi
movl $0x10, %edx
callq 0x3140
jmp 0xcba5
leaq -0x250(%rbp), %rdi
callq 0x31a0
leaq -0x270(%rbp), %rdi
callq 0x31a0
leaq -0x290(%rbp), %rdi
callq 0x31a0
movq -0x30(%rbp), %rax
movl (%rax), %esi
leaq -0x230(%rbp), %rdi
callq 0x3430
movq %rax, -0x3c0(%rbp)
jmp 0xcbe4
movq -0x3c0(%rbp), %rdi
leaq 0x3523(%rip), %rsi      # 0x10115
callq 0x3280
movq %rax, -0x3c8(%rbp)
jmp 0xcc00
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x9a00
movq %rax, %rdi
callq 0xaad0
movq -0x3c8(%rbp), %rdi
movq %rax, %rsi
callq 0x3090
movq %rax, -0x3d0(%rbp)
jmp 0xcc2d
movq -0x3d0(%rbp), %rdi
leaq 0x34f2(%rip), %rsi      # 0x1012d
callq 0x3280
jmp 0xcc42
movl $0x0, -0x2a0(%rbp)
movl -0x2a0(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xce3e
movq -0x10(%rbp), %rdi
movslq -0x2a0(%rbp), %rsi
callq 0x9a00
movq %rax, -0x2a8(%rbp)
movq -0x28(%rbp), %rdi
movq -0x2a8(%rbp), %rsi
callq 0xe6b0
movsd %xmm0, -0x3d8(%rbp)
jmp 0xcc8f
movsd -0x3d8(%rbp), %xmm0
movsd %xmm0, -0x2b0(%rbp)
movq -0x30(%rbp), %rdi
addq $0x68, %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x6770
movq %rax, -0x3e0(%rbp)
jmp 0xccbc
movq -0x3e0(%rbp), %rsi
leaq -0x230(%rbp), %rdi
callq 0x3270
movq %rax, -0x3e8(%rbp)
jmp 0xccd8
movq -0x3e8(%rbp), %rdi
leaq 0x342f(%rip), %rsi      # 0x10115
callq 0x3280
jmp 0xcced
movl $0x0, -0x2b4(%rbp)
movslq -0x2b4(%rbp), %rax
movq %rax, -0x3f0(%rbp)
movq -0x2a8(%rbp), %rdi
callq 0xaad0
movq %rax, %rcx
movq -0x3f0(%rbp), %rax
cmpq %rcx, %rax
jae 0xce13
cmpl $0x0, -0x2b4(%rbp)
jle 0xcdc2
leaq 0x33dd(%rip), %rsi      # 0x10115
leaq -0x230(%rbp), %rdi
callq 0x3280
jmp 0xcd46
jmp 0xcdc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
jmp 0xd444
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
jmp 0xcdb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
jmp 0xcda5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x31a0
leaq -0x270(%rbp), %rdi
callq 0x31a0
leaq -0x290(%rbp), %rdi
callq 0x31a0
jmp 0xd444
movq -0x28(%rbp), %rax
movq %rax, -0x3f8(%rbp)
movq -0x2a8(%rbp), %rdi
movslq -0x2b4(%rbp), %rsi
callq 0xe720
movq -0x3f8(%rbp), %rdi
movq %rax, %rsi
callq 0xe6e0
leaq -0x230(%rbp), %rdi
callq 0x3480
jmp 0xcdfd
jmp 0xcdff
movl -0x2b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2b4(%rbp)
jmp 0xccf7
leaq 0x3313(%rip), %rsi      # 0x1012d
leaq -0x230(%rbp), %rdi
callq 0x3280
jmp 0xce28
jmp 0xce2a
movl -0x2a0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2a0(%rbp)
jmp 0xcc4c
leaq -0x230(%rbp), %rdi
callq 0x3390
jmp 0xce4c
movl 0x10(%rbp), %esi
leaq -0x318(%rbp), %rdi
callq 0xed80
jmp 0xce5d
leaq 0x32b3(%rip), %rsi      # 0x10117
leaq -0x2f8(%rbp), %rdi
leaq -0x318(%rbp), %rdx
callq 0xed30
jmp 0xce79
leaq 0x32af(%rip), %rdx      # 0x1012f
leaq -0x2d8(%rbp), %rdi
leaq -0x2f8(%rbp), %rsi
callq 0xece0
jmp 0xce95
leaq -0x230(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
movl $0x10, %edx
callq 0x3140
jmp 0xceaf
leaq -0x2d8(%rbp), %rdi
callq 0x31a0
leaq -0x2f8(%rbp), %rdi
callq 0x31a0
leaq -0x318(%rbp), %rdi
callq 0x31a0
movq -0x30(%rbp), %rax
movl (%rax), %esi
leaq -0x230(%rbp), %rdi
callq 0x3430
movq %rax, -0x400(%rbp)
jmp 0xceee
movq -0x400(%rbp), %rdi
leaq 0x3219(%rip), %rsi      # 0x10115
callq 0x3280
movq %rax, -0x408(%rbp)
jmp 0xcf0a
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x9a00
movq %rax, %rdi
callq 0xaad0
movq -0x408(%rbp), %rdi
movq %rax, %rsi
callq 0x3090
movq %rax, -0x410(%rbp)
jmp 0xcf37
movq -0x410(%rbp), %rdi
leaq 0x31e8(%rip), %rsi      # 0x1012d
callq 0x3280
jmp 0xcf4c
movl $0x0, -0x31c(%rbp)
movl -0x31c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xd12d
movq -0x18(%rbp), %rdi
movslq -0x31c(%rbp), %rsi
callq 0x9a00
movq %rax, -0x328(%rbp)
movq -0x28(%rbp), %rdi
movq -0x328(%rbp), %rsi
callq 0xe6b0
movsd %xmm0, -0x418(%rbp)
jmp 0xcf99
movsd -0x418(%rbp), %xmm0
movsd %xmm0, -0x330(%rbp)
movq -0x30(%rbp), %rdi
addq $0x68, %rdi
leaq -0x31c(%rbp), %rsi
callq 0x6770
movq %rax, -0x420(%rbp)
jmp 0xcfc6
movq -0x420(%rbp), %rsi
leaq -0x230(%rbp), %rdi
callq 0x3270
movq %rax, -0x428(%rbp)
jmp 0xcfe2
movq -0x428(%rbp), %rdi
leaq 0x3125(%rip), %rsi      # 0x10115
callq 0x3280
jmp 0xcff7
movl $0x0, -0x334(%rbp)
movslq -0x334(%rbp), %rax
movq %rax, -0x430(%rbp)
movq -0x328(%rbp), %rdi
callq 0xaad0
movq %rax, %rcx
movq -0x430(%rbp), %rax
cmpq %rcx, %rax
jae 0xd102
cmpl $0x0, -0x334(%rbp)
jle 0xd0b1
leaq 0x30d7(%rip), %rsi      # 0x10115
leaq -0x230(%rbp), %rdi
callq 0x3280
jmp 0xd04c
jmp 0xd0b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
jmp 0xd0a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
jmp 0xd094
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x31a0
leaq -0x2f8(%rbp), %rdi
callq 0x31a0
leaq -0x318(%rbp), %rdi
callq 0x31a0
jmp 0xd444
movq -0x28(%rbp), %rax
movq %rax, -0x438(%rbp)
movq -0x328(%rbp), %rdi
movslq -0x334(%rbp), %rsi
callq 0xe720
movq -0x438(%rbp), %rdi
movq %rax, %rsi
callq 0xe6e0
leaq -0x230(%rbp), %rdi
callq 0x3480
jmp 0xd0ec
jmp 0xd0ee
movl -0x334(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x334(%rbp)
jmp 0xd001
leaq 0x3024(%rip), %rsi      # 0x1012d
leaq -0x230(%rbp), %rdi
callq 0x3280
jmp 0xd117
jmp 0xd119
movl -0x31c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x31c(%rbp)
jmp 0xcf56
leaq -0x230(%rbp), %rdi
callq 0x3390
jmp 0xd13b
movl 0x10(%rbp), %esi
leaq -0x398(%rbp), %rdi
callq 0xed80
jmp 0xd14c
leaq 0x2fc4(%rip), %rsi      # 0x10117
leaq -0x378(%rbp), %rdi
leaq -0x398(%rbp), %rdx
callq 0xed30
jmp 0xd168
leaq 0x2fcc(%rip), %rdx      # 0x1013b
leaq -0x358(%rbp), %rdi
leaq -0x378(%rbp), %rsi
callq 0xece0
jmp 0xd184
leaq -0x230(%rbp), %rdi
leaq -0x358(%rbp), %rsi
movl $0x10, %edx
callq 0x3140
jmp 0xd19e
leaq -0x358(%rbp), %rdi
callq 0x31a0
leaq -0x378(%rbp), %rdi
callq 0x31a0
leaq -0x398(%rbp), %rdi
callq 0x31a0
movq -0x30(%rbp), %rax
movl 0x4(%rax), %esi
leaq -0x230(%rbp), %rdi
callq 0x3430
movq %rax, -0x440(%rbp)
jmp 0xd1de
movq -0x440(%rbp), %rdi
leaq 0x2f29(%rip), %rsi      # 0x10115
callq 0x3280
movq %rax, -0x448(%rbp)
jmp 0xd1fa
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x9a00
movq %rax, %rdi
callq 0xaad0
movq -0x448(%rbp), %rdi
movq %rax, %rsi
callq 0x3090
movq %rax, -0x450(%rbp)
jmp 0xd227
movq -0x450(%rbp), %rdi
leaq 0x2ef8(%rip), %rsi      # 0x1012d
callq 0x3280
jmp 0xd23c
movl $0x0, -0x39c(%rbp)
movl -0x39c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0xd421
movq -0x20(%rbp), %rdi
movslq -0x39c(%rbp), %rsi
callq 0x9a00
movq %rax, -0x3a8(%rbp)
movq -0x28(%rbp), %rdi
movq -0x3a8(%rbp), %rsi
callq 0xe6b0
movsd %xmm0, -0x458(%rbp)
jmp 0xd28a
movsd -0x458(%rbp), %xmm0
movsd %xmm0, -0x3b0(%rbp)
movq -0x30(%rbp), %rdi
addq $0x98, %rdi
leaq -0x39c(%rbp), %rsi
callq 0x6770
movq %rax, -0x460(%rbp)
jmp 0xd2ba
movq -0x460(%rbp), %rsi
leaq -0x230(%rbp), %rdi
callq 0x3270
movq %rax, -0x468(%rbp)
jmp 0xd2d6
movq -0x468(%rbp), %rdi
leaq 0x2e31(%rip), %rsi      # 0x10115
callq 0x3280
jmp 0xd2eb
movl $0x0, -0x3b4(%rbp)
movslq -0x3b4(%rbp), %rax
movq %rax, -0x470(%rbp)
movq -0x3a8(%rbp), %rdi
callq 0xaad0
movq %rax, %rcx
movq -0x470(%rbp), %rax
cmpq %rcx, %rax
jae 0xd3f6
cmpl $0x0, -0x3b4(%rbp)
jle 0xd3a5
leaq 0x2de3(%rip), %rsi      # 0x10115
leaq -0x230(%rbp), %rdi
callq 0x3280
jmp 0xd340
jmp 0xd3a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
jmp 0xd394
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
jmp 0xd388
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x298(%rbp)
movl %eax, -0x29c(%rbp)
leaq -0x358(%rbp), %rdi
callq 0x31a0
leaq -0x378(%rbp), %rdi
callq 0x31a0
leaq -0x398(%rbp), %rdi
callq 0x31a0
jmp 0xd444
movq -0x28(%rbp), %rax
movq %rax, -0x478(%rbp)
movq -0x3a8(%rbp), %rdi
movslq -0x3b4(%rbp), %rsi
callq 0xe720
movq -0x478(%rbp), %rdi
movq %rax, %rsi
callq 0xe6e0
leaq -0x230(%rbp), %rdi
callq 0x3480
jmp 0xd3e0
jmp 0xd3e2
movl -0x3b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3b4(%rbp)
jmp 0xd2f5
leaq 0x2d30(%rip), %rsi      # 0x1012d
leaq -0x230(%rbp), %rdi
callq 0x3280
jmp 0xd40b
jmp 0xd40d
movl -0x39c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x39c(%rbp)
jmp 0xd246
leaq -0x230(%rbp), %rdi
callq 0x3390
jmp 0xd42f
leaq -0x230(%rbp), %rdi
callq 0x33c0
addq $0x480, %rsp            # imm = 0x480
popq %rbp
retq
leaq -0x230(%rbp), %rdi
callq 0x33c0
movq -0x298(%rbp), %rdi
callq 0x3440
nopl (%rax)