// File: /workspace/github_cpp_makefile_star2_O1/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, -0x50(%rbp)
movq %rcx, -0x58(%rbp)
movq %rdx, %r15
movq %rdi, %rbx
leaq -0x88(%rbp), %rcx
xorl %eax, %eax
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq -0xb8(%rbp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq 0x18(%rdx), %r12
addq $0x8, %r15
cmpq %r15, %r12
je 0x11b44
leaq -0x90(%rbp), %r13
leaq -0x48(%rbp), %r14
movq 0x20(%r12), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movq %r13, %rdi
movq %r14, %rsi
callq 0xecce
movq %r12, %rdi
callq 0x5430
movq %rax, %r12
cmpq %r15, %rax
jne 0x11b18
movq -0x58(%rbp), %rax
movq 0x10(%rax), %r12
testq %r12, %r12
je 0x11c48
leaq -0xc0(%rbp), %r15
leaq -0x60(%rbp), %r13
leaq -0x90(%rbp), %r14
movq 0x28(%rbx), %rdi
movq 0x8(%r12), %rsi
callq 0xcd08
movq %rax, -0x60(%rbp)
movq -0x80(%rbp), %rdx
leaq -0x88(%rbp), %rcx
testq %rdx, %rdx
je 0x11b9e
xorl %esi, %esi
cmpq %rax, 0x20(%rdx)
setb %sil
cmovaeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
jmp 0x11b84
leaq -0x88(%rbp), %rsi
movq %rsi, %rdx
cmpq %rsi, %rcx
je 0x11bb8
cmpq 0x20(%rcx), %rax
cmovbq %rsi, %rcx
movq %rcx, %rdx
cmpq %rsi, %rdx
je 0x11bca
movq %r14, %rdi
movq %r13, %rsi
callq 0x92bc
jmp 0x11c1c
movq -0xb0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
testq %rdx, %rdx
je 0x11bf2
xorl %esi, %esi
cmpq %rax, 0x20(%rdx)
setb %sil
cmovaeq %rdx, %rcx
movq 0x10(%rdx,%rsi,8), %rdx
jmp 0x11bd8
leaq -0xb8(%rbp), %rsi
movq %rsi, %rdx
cmpq %rsi, %rcx
je 0x11c0c
cmpq 0x20(%rcx), %rax
cmovbq %rsi, %rcx
movq %rcx, %rdx
cmpq %rsi, %rdx
je 0x11c2e
movq %r15, %rdi
movq %r13, %rsi
callq 0x92bc
incq (%rax)
movq (%r12), %r12
testq %r12, %r12
jne 0x11b67
jmp 0x11c48
movq %rax, -0x48(%rbp)
movq $0x1, -0x40(%rbp)
movq %r15, %rdi
leaq -0x48(%rbp), %rsi
callq 0xecce
jmp 0x11c1f
leaq 0x947d(%rip), %rsi      # 0x1b0cc
movq -0x50(%rbp), %rdi
callq 0x5450
testq %rax, %rax
je 0x11d90
movq %rax, %r15
leaq 0x94a6(%rip), %rdi      # 0x1b111
movl $0x25, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x5750
movq -0x78(%rbp), %r14
leaq -0x88(%rbp), %rax
cmpq %rax, %r14
je 0x11cec
movq 0x28(%rbx), %rsi
movq 0x20(%r14), %rdx
leaq -0x48(%rbp), %rdi
callq 0xce74
movq -0x48(%rbp), %r12
movq 0x20(%r14), %rsi
movq 0x28(%r14), %r13
movq 0x28(%rbx), %rdi
callq 0xcdbe
movq %r15, %rdi
leaq 0x947a(%rip), %rsi      # 0x1b137
movq %r12, %rdx
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x5540
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x11cdf
callq 0x5340
movq %r14, %rdi
callq 0x5430
movq %rax, %r14
jmp 0x11c81
movq -0xa8(%rbp), %r14
leaq -0xb8(%rbp), %rax
cmpq %rax, %r14
je 0x11d5e
movq 0x28(%rbx), %rsi
movq 0x20(%r14), %rdx
leaq -0x48(%rbp), %rdi
callq 0xce74
movq -0x48(%rbp), %r12
movq 0x20(%r14), %rsi
movq 0x28(%r14), %r13
movq 0x28(%rbx), %rdi
callq 0xcdbe
movq %r15, %rdi
leaq 0x9417(%rip), %rsi      # 0x1b146
movq %r12, %rdx
movq %r13, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x5540
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x11d51
callq 0x5340
movq %r14, %rdi
callq 0x5430
movq %rax, %r14
jmp 0x11cf3
movq %r15, %rdi
callq 0x5390
leaq -0xc0(%rbp), %rdi
callq 0x9d4e
leaq -0x90(%rbp), %rdi
callq 0x9d4e
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x11251(%rip), %rdi     # 0x22fe8
leaq 0x9330(%rip), %rsi      # 0x1b0ce
movl $0xd, %edx
callq 0x5420
movq 0x11239(%rip), %rdi     # 0x22fe8
leaq 0x9326(%rip), %rsi      # 0x1b0dc
movl $0x15, %edx
callq 0x5420
movq 0x11221(%rip), %rdi     # 0x22fe8
leaq 0x916f(%rip), %rsi      # 0x1af3d
movl $0x2, %edx
callq 0x5420
movq 0x11209(%rip), %rdi     # 0x22fe8
movl $0x37, %esi
callq 0x5670
movq %rax, %rbx
leaq 0x92ff(%rip), %rsi      # 0x1b0f2
movl $0x17, %edx
movq %rax, %rdi
callq 0x5420
movq %rbx, %rdi
movq -0x50(%rbp), %rsi
callq 0x5380
movq %rax, %rdi
callq 0x51a0
movq %rax, %rdi
callq 0x51a0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x5480
jmp 0x11e49
jmp 0x11e49
jmp 0x11e49
jmp 0x11e30
jmp 0x11e49
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x11e4c
callq 0x5340
jmp 0x11e4c
jmp 0x11e49
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x9d4e
leaq -0x90(%rbp), %rdi
callq 0x9d4e
movq %rbx, %rdi
callq 0x56a0