// File: /workspace/github_cpp_makefile_star2_O2/CK7[P]abawaca/src/ClusterWriter.cpp
// Function: ClusterWriter::write_scaffold_stats(ClusterData const&, std::set<unsigned long, std::less<unsigned long>, std::allocator<unsigned long>> const&, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>> const&, char const*) const
void ClusterWriter::write_scaffold_stats(const ClusterData& clustering_db, const set<size_t>& scafs, const unordered_set<size_t>& raw_dps, const char* out_file) const
{
	map<size_t, size_t>	scafs_in2ndps, scafs_out2ndps;

	for(auto vit=scafs.begin(); vit != scafs.end(); vit++)
		scafs_in2ndps.insert(pair<size_t, size_t>(*vit, 0));

	for(auto vit=raw_dps.begin(); vit != raw_dps.end(); vit++) {
		size_t scaf = scaf_db.dp2scaf(*vit);
		if(scafs_in2ndps.find(scaf) != scafs_in2ndps.end())
			scafs_in2ndps[scaf]++;
		else if(scafs_out2ndps.find(scaf) != scafs_out2ndps.end())
			scafs_out2ndps[scaf]++;
		else
			scafs_out2ndps.insert(pair<size_t, size_t>(scaf, 1));
	}

        FILE* fp = fopen(out_file, "w");
	if(fp == NULL) {
		cerr << "Fatal error, " << __FILE__ << " (" << __LINE__ << "): could write to file " << out_file << endl << endl;
		exit(-1);
	}

	fprintf(fp, "SCAF      \tRAW\tTOTAL\tIN/OUT_CLUSTER\n\n");

	for(map<size_t, size_t>::const_iterator mit = scafs_in2ndps.begin(); mit != scafs_in2ndps.end(); mit++)
		fprintf(fp, "%s\t%lu\t%lu\tin\n", scaf_db.scaf_id2name(mit->first).c_str(), mit->second, scaf_db.ndps(mit->first));
	for(map<size_t, size_t>::const_iterator mit = scafs_out2ndps.begin(); mit != scafs_out2ndps.end(); mit++)
		fprintf(fp, "%s\t%lu\t%lu\tout\n", scaf_db.scaf_id2name(mit->first).c_str(), mit->second, scaf_db.ndps(mit->first));
	fclose(fp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r8, -0x30(%rbp)
movq %rcx, %r15
movq %rdx, %r14
movq %rdi, %rbx
leaq -0x88(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0xb8(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq 0x18(%rdx), %r13
addq $0x8, %r14
leaq -0x50(%rbp), %r12
cmpq %r14, %r13
je 0xe279
movq 0x20(%r13), %rax
movq %rax, -0x50(%rbp)
andq $0x0, -0x48(%rbp)
leaq -0x90(%rbp), %rdi
movq %r12, %rsi
callq 0xb844
movq %r13, %rdi
callq 0x43d0
movq %rax, %r13
jmp 0xe24b
addq $0x10, %r15
leaq -0x90(%rbp), %r12
leaq -0x58(%rbp), %r13
leaq -0xc0(%rbp), %r14
movq (%r15), %r15
testq %r15, %r15
je 0xe314
movq 0x28(%rbx), %rdi
movq 0x8(%r15), %rsi
callq 0x9b48
movq %rax, -0x58(%rbp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x8adc
leaq -0x88(%rbp), %rcx
cmpq %rcx, %rax
je 0xe2cc
movq %r12, %rdi
movq %r13, %rsi
callq 0x6c70
jmp 0xe2ee
movq %r14, %rdi
movq %r13, %rsi
callq 0x8adc
leaq -0xb8(%rbp), %rcx
cmpq %rcx, %rax
je 0xe2f3
movq %r14, %rdi
movq %r13, %rsi
callq 0x6c70
incq (%rax)
jmp 0xe28f
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x1, -0x48(%rbp)
movq %r14, %rdi
leaq -0x50(%rbp), %rsi
callq 0xb844
jmp 0xe28f
leaq 0x7d71(%rip), %rsi      # 0x1608c
movq -0x30(%rbp), %rdi
callq 0x4400
testq %rax, %rax
je 0xe466
leaq 0x7d9d(%rip), %rdi      # 0x160d1
pushq $0x25
popq %rsi
pushq $0x1
popq %rdx
movq %rax, -0x30(%rbp)
movq %rax, %rcx
callq 0x4720
movq -0x78(%rbp), %r13
leaq -0x50(%rbp), %r14
leaq -0x88(%rbp), %rax
cmpq %rax, %r13
je 0xe3b9
movq 0x28(%rbx), %rsi
movq 0x20(%r13), %rdx
movq %r14, %rdi
callq 0x9c96
movq -0x50(%rbp), %r12
movq 0x20(%r13), %rsi
movq 0x28(%r13), %r14
movq %rbx, %r15
movq 0x28(%rbx), %rdi
callq 0x9bec
movq -0x30(%rbp), %rdi
leaq 0x7d6a(%rip), %rsi      # 0x160f7
movq %r12, %rdx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x4520
leaq -0x50(%rbp), %r14
movq %r14, %rdi
callq 0x4180
movq %r13, %rdi
callq 0x43d0
movq %rax, %r13
movq %r15, %rbx
jmp 0xe34e
movq -0xa8(%rbp), %r13
leaq -0x50(%rbp), %r14
movq -0x30(%rbp), %r15
movq %rbx, -0x60(%rbp)
leaq -0xb8(%rbp), %rax
cmpq %rax, %r13
je 0xe434
movq 0x28(%rbx), %rsi
movq 0x20(%r13), %rdx
movq %r14, %rdi
callq 0x9c96
movq -0x50(%rbp), %r12
movq 0x20(%r13), %rsi
movq 0x28(%r13), %r14
movq 0x28(%rbx), %rdi
callq 0x9bec
movq %r15, %rdi
leaq 0x7cff(%rip), %rsi      # 0x16106
movq %r12, %rdx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x4520
leaq -0x50(%rbp), %r14
movq %r14, %rdi
callq 0x4180
movq %r13, %rdi
callq 0x43d0
movq %rax, %r13
movq -0x60(%rbp), %rbx
jmp 0xe3cc
movq %r15, %rdi
callq 0x4350
leaq -0xc0(%rbp), %rdi
callq 0x76fa
leaq -0x90(%rbp), %rdi
callq 0x76fa
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10b7b(%rip), %rdi     # 0x1efe8
leaq 0x7c1a(%rip), %rsi      # 0x1608e
callq 0x4340
leaq 0x7c1c(%rip), %rsi      # 0x1609c
movq %rax, %rdi
callq 0x4340
leaq 0x7a6e(%rip), %rsi      # 0x15efd
movq %rax, %rdi
callq 0x4340
pushq $0x37
popq %rsi
movq %rax, %rdi
callq 0x4630
leaq 0x7c09(%rip), %rsi      # 0x160b2
movq %rax, %rdi
callq 0x4340
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x4340
movq %rax, %rdi
callq 0x41a0
movq %rax, %rdi
callq 0x41a0
pushq $-0x1
popq %rdi
callq 0x4430
jmp 0xe4f3
jmp 0xe4f3
jmp 0xe4f3
jmp 0xe4f3
jmp 0xe4e1
jmp 0xe4f3
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x4180
jmp 0xe4f6
jmp 0xe4f3
jmp 0xe4f3
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x76fa
leaq -0x90(%rbp), %rdi
callq 0x76fa
movq %rbx, %rdi
callq 0x4660