// File: /workspace/github_cpp_makefile_star2_O3/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 0x119d0
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 0xebc8
movq %r12, %rdi
callq 0x5430
movq %rax, %r12
cmpq %r15, %rax
jne 0x119a4
movq -0x58(%rbp), %rax
movq 0x10(%rax), %r14
testq %r14, %r14
je 0x11ae2
leaq -0xc0(%rbp), %r15
leaq -0x48(%rbp), %r12
leaq -0x60(%rbp), %r13
movq 0x28(%rbx), %rdi
movq 0x8(%r14), %rsi
callq 0xcc30
movq %rax, -0x60(%rbp)
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x11a4e
leaq -0x88(%rbp), %r8
movq %r8, %rcx
movq %rdi, %rdx
movq 0x20(%rdi), %rsi
xorl %edi, %edi
cmpq %rax, %rsi
setb %dil
movq %rdx, %r8
cmovbq %rcx, %r8
movq 0x10(%rdx,%rdi,8), %rdi
testq %rdi, %rdi
jne 0x11a11
leaq -0x88(%rbp), %rdi
cmpq %rdi, %r8
je 0x11a4e
cmpq %rax, %rsi
cmovbq %rcx, %rdx
cmpq 0x20(%rdx), %rax
jae 0x11ab7
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x11a9e
leaq -0xb8(%rbp), %r8
movq %r8, %rcx
movq %rdi, %rdx
movq 0x20(%rdi), %rsi
xorl %edi, %edi
cmpq %rax, %rsi
setb %dil
movq %rdx, %r8
cmovbq %rcx, %r8
movq 0x10(%rdx,%rdi,8), %rdi
testq %rdi, %rdi
jne 0x11a61
leaq -0xb8(%rbp), %rdi
cmpq %rdi, %r8
je 0x11a9e
cmpq %rax, %rsi
cmovbq %rcx, %rdx
cmpq 0x20(%rdx), %rax
jae 0x11ac8
movq %rax, -0x48(%rbp)
movq $0x1, -0x40(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0xebc8
jmp 0x11ad6
leaq -0x90(%rbp), %rdi
movq %r13, %rsi
callq 0x9204
jmp 0x11ad3
movq %r15, %rdi
movq %r13, %rsi
callq 0x9204
incq (%rax)
movq (%r14), %r14
testq %r14, %r14
jne 0x119f0
leaq 0x85d3(%rip), %rsi      # 0x1a0bc
movq -0x50(%rbp), %rdi
callq 0x5450
testq %rax, %rax
je 0x11c2a
movq %rax, %r15
leaq 0x85fc(%rip), %rdi      # 0x1a101
movl $0x25, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x5750
movq -0x78(%rbp), %r14
leaq -0x88(%rbp), %rax
cmpq %rax, %r14
je 0x11b86
movq 0x28(%rbx), %rsi
movq 0x20(%r14), %rdx
leaq -0x48(%rbp), %rdi
callq 0xcd9c
movq -0x48(%rbp), %r12
movq 0x20(%r14), %rsi
movq 0x28(%r14), %r13
movq 0x28(%rbx), %rdi
callq 0xcce6
movq %r15, %rdi
leaq 0x85d0(%rip), %rsi      # 0x1a127
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 0x11b79
callq 0x5340
movq %r14, %rdi
callq 0x5430
movq %rax, %r14
jmp 0x11b1b
movq -0xa8(%rbp), %r14
leaq -0xb8(%rbp), %rax
cmpq %rax, %r14
je 0x11bf8
movq 0x28(%rbx), %rsi
movq 0x20(%r14), %rdx
leaq -0x48(%rbp), %rdi
callq 0xcd9c
movq -0x48(%rbp), %r12
movq 0x20(%r14), %rsi
movq 0x28(%r14), %r13
movq 0x28(%rbx), %rdi
callq 0xcce6
movq %r15, %rdi
leaq 0x856d(%rip), %rsi      # 0x1a136
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 0x11beb
callq 0x5340
movq %r14, %rdi
callq 0x5430
movq %rax, %r14
jmp 0x11b8d
movq %r15, %rdi
callq 0x5390
leaq -0xc0(%rbp), %rdi
callq 0x9c62
leaq -0x90(%rbp), %rdi
callq 0x9c62
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x103b7(%rip), %rdi     # 0x21fe8
leaq 0x8486(%rip), %rsi      # 0x1a0be
movl $0xd, %edx
callq 0x5420
movq 0x1039f(%rip), %rdi     # 0x21fe8
leaq 0x847c(%rip), %rsi      # 0x1a0cc
movl $0x15, %edx
callq 0x5420
movq 0x10387(%rip), %rdi     # 0x21fe8
leaq 0x82c5(%rip), %rsi      # 0x19f2d
movl $0x2, %edx
callq 0x5420
movq 0x1036f(%rip), %rdi     # 0x21fe8
movl $0x37, %esi
callq 0x5670
movq %rax, %rbx
leaq 0x8455(%rip), %rsi      # 0x1a0e2
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 0x11ce3
jmp 0x11ce3
jmp 0x11ce3
jmp 0x11cca
jmp 0x11ce3
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x11ce6
callq 0x5340
jmp 0x11ce6
jmp 0x11ce3
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x9c62
leaq -0x90(%rbp), %rdi
callq 0x9c62
movq %rbx, %rdi
callq 0x56a0