// File: /workspace/github_cpp_makefile_star2_O3/schneebergerlab[P]DrLink/separate_kb_molecule.cpp
// Function: write_molecule_kbcov(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, unsigned long>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
bool write_molecule_kbcov(map<string, unsigned long> molecule_kbcov, string molfolder, string mollabel, int mlkey)
{
    // 1. molecule base coverage
    std::stringstream outMCovFile;
    outMCovFile.str(""); 
    outMCovFile << "./" << molfolder << "/" << mollabel << "_" << mlkey << "kb_moleCov_stat.txt";
    ofstream ofp;
    ofp.open( (outMCovFile.str()).c_str(), ios::out);
    if(!ofp.good())
    {
        cout << "   Error: cannot open " << outMCovFile.str() << " to write data. " << endl;
        return false;
    }
    map<string, unsigned long>::iterator mcitr;
    map<string, unsigned long>::iterator mcitr_end;
    mcitr     = molecule_kbcov.begin();
    mcitr_end = molecule_kbcov.end();
    ofp << "#molecule_base_cov\tmolecule_num_in_bin" << endl;
    while(mcitr != mcitr_end)
    {
        ofp << (*mcitr).first << "\t" << (*mcitr).second << endl;
        mcitr ++;
    }
    ofp.close();
    
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3a8, %rsp            # imm = 0x3A8
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x220(%rsp), %rdi
callq 0x4240
leaq 0x30(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xa019(%rip), %rdx      # 0x3eb0a
leaq 0x20(%rsp), %rdi
movq %rdx, %rsi
callq 0x5384
leaq 0x238(%rsp), %r14
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x4490
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x34b2a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x230(%rsp), %r13
leaq 0xa220(%rip), %rsi      # 0x3ed59
movl $0x2, %edx
movq %r13, %rdi
callq 0x43a0
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r13, %rdi
callq 0x43a0
movq %rax, %r12
leaq 0xa1f9(%rip), %rsi      # 0x3ed5a
movl $0x1, %edx
movq %rax, %rdi
callq 0x43a0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r12, %rdi
callq 0x43a0
movq %rax, %r15
leaq 0x6f50(%rip), %rsi      # 0x3bad7
movl $0x1, %edx
movq %rax, %rdi
callq 0x43a0
movq %r15, %rdi
movl %ebp, %esi
callq 0x4580
leaq 0x9ec3(%rip), %rsi      # 0x3ea68
movl $0x13, %edx
movq %rax, %rdi
callq 0x43a0
leaq 0x20(%rsp), %rdi
callq 0x4570
movq %rsp, %rdi
movq %r14, %rsi
callq 0x44f0
movq (%rsp), %rsi
leaq 0x20(%rsp), %rdi
movl $0x10, %edx
callq 0x4060
leaq 0x10(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x34bf5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x20(%rsp), %rax
movq -0x18(%rax), %rax
movl 0x40(%rsp,%rax), %ebp
testl %ebp, %ebp
je 0x34c9f
movq 0x173b7(%rip), %rdi     # 0x4bfc8
leaq 0x5f18(%rip), %rsi      # 0x3ab30
movl $0x16, %edx
callq 0x43a0
movq %rsp, %rdi
movq %r14, %rsi
callq 0x44f0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x1738b(%rip), %rdi     # 0x4bfc8
callq 0x43a0
movq %rax, %rbx
leaq 0x6298(%rip), %rsi      # 0x3aee4
movl $0x10, %edx
movq %rax, %rdi
callq 0x43a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4220
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x34d6f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34d6f
movq 0x18(%rbx), %r14
leaq 0x624b(%rip), %rsi      # 0x3aef5
leaq 0x20(%rsp), %r15
movl $0x26, %edx
movq %r15, %rdi
callq 0x43a0
movq 0x20(%rsp), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %esi
leaq 0x20(%rsp), %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4220
addq $0x8, %rbx
cmpq %rbx, %r14
je 0x34d65
leaq 0x20(%rsp), %r15
leaq 0x9e0d(%rip), %r12      # 0x3eb09
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
movq %r15, %rdi
callq 0x43a0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x43a0
movq 0x40(%r14), %rsi
movq %r13, %rdi
callq 0x4210
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %esi
movq %r13, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4220
movq %r14, %rdi
callq 0x4230
movq %rax, %r14
cmpq %rbx, %rax
jne 0x34cfc
leaq 0x20(%rsp), %rdi
callq 0x4440
testl %ebp, %ebp
sete %bl
movq 0x17245(%rip), %rax     # 0x4bfc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x28(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x20(%rsp,%rcx)
callq 0x42a0
leaq 0x118(%rsp), %rdi
callq 0x4140
movq 0x171eb(%rip), %rsi     # 0x4bf98
leaq 0x220(%rsp), %rdi
callq 0x4260
leaq 0x2a0(%rsp), %rdi
callq 0x4140
movl %ebx, %eax
addq $0x3a8, %rsp            # imm = 0x3A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x34e36
jmp 0x34e36
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x34e22
jmp 0x34e39
jmp 0x34e36
jmp 0x34e31
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x34e43
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34e43
jmp 0x34e31
jmp 0x34e36
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x34e39
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34e39
movq %rax, %rbx
jmp 0x34e43
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x4480
movq 0x1714e(%rip), %rsi     # 0x4bf98
leaq 0x220(%rsp), %rdi
callq 0x4260
leaq 0x2a0(%rsp), %rdi
callq 0x4140
movq %rbx, %rdi
callq 0x45a0