// File: schneebergerlab[P]DrLink/detect_recombsite.cpp
// Function: output_real_molecule_len_distribution(std::map<int, unsigned long, std::less<int>, std::allocator<std::pair<int const, unsigned long>>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool output_real_molecule_len_distribution(map<int, unsigned long> molecule_len_control, string outPrefix)
{
    // all "real" molecule passing checkings on ML, RN and HET
    // among which COs were reported.
    string outMLenFile = outPrefix + "_realMoLen_stat.txt";    
    ofstream ofp;
    ofp.open(outMLenFile.c_str(), ios::out);
    if(!ofp.good())
    {
        cout << "   Error: cannot open " << outMLenFile << " to write data. " << endl;
        return false;
    }
    map<int, unsigned long>::iterator mlitr;
    map<int, unsigned long>::iterator mlitr_end;
    mlitr     = molecule_len_control.begin();
    mlitr_end = molecule_len_control.end();
    ofp << "#molecule_len_kb\tmolecule_num_in_bin" << endl;
    while(mlitr != mlitr_end)
    {
        ofp << (*mlitr).first  << "\t" 
            << (*mlitr).second << endl;
        mlitr ++;
    }
    ofp.close(); 
    return true;
}

// Assembly:
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdi, 0x40(%rsp)
movq %rdi, 0x2a8(%rsp)
movq %rsi, 0x2a0(%rsp)
leaq 0x3d3a5(%rip), %rdx     # 0x68628
leaq 0x280(%rsp), %rdi
callq 0xfae0
leaq 0x80(%rsp), %rdi
callq 0x5770
jmp 0x2b29f
leaq 0x280(%rsp), %rdi
callq 0x51d0
movq %rax, %rsi
leaq 0x80(%rsp), %rdi
movl $0x10, %edx
callq 0x5070
jmp 0x2b2c3
movq 0x80(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x80(%rsp,%rax), %rdi
callq 0x5760
movb %al, 0x3f(%rsp)
jmp 0x2b2e2
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0x2b396
jmp 0x2b2f0
movq 0x59cd1(%rip), %rdi     # 0x84fc8
leaq 0x3b81a(%rip), %rsi     # 0x66b18
callq 0x5460
movq %rax, 0x30(%rsp)
jmp 0x2b30a
movq 0x30(%rsp), %rdi
leaq 0x280(%rsp), %rsi
callq 0x53e0
movq %rax, 0x28(%rsp)
jmp 0x2b323
movq 0x28(%rsp), %rdi
leaq 0x3bb9d(%rip), %rsi     # 0x66ecc
callq 0x5460
movq %rax, 0x20(%rsp)
jmp 0x2b33b
movq 0x20(%rsp), %rdi
movq 0x59c69(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x2b34e
movb $0x0, 0x2b7(%rsp)
movl $0x1, 0x70(%rsp)
jmp 0x2b4be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x2b4e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x5670
jmp 0x2b4e9
leaq 0x68(%rsp), %rdi
callq 0x106c0
leaq 0x60(%rsp), %rdi
callq 0x106c0
movq 0x40(%rsp), %rdi
callq 0x10710
movq 0x40(%rsp), %rdi
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x68(%rsp)
callq 0x102a0
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x3d259(%rip), %rsi     # 0x6863c
leaq 0x80(%rsp), %rdi
callq 0x5460
movq %rax, 0x18(%rsp)
jmp 0x2b3f7
movq 0x18(%rsp), %rdi
movq 0x59bad(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x2b40a
jmp 0x2b40c
leaq 0x68(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x10740
testb $0x1, %al
jne 0x2b421
jmp 0x2b49f
leaq 0x68(%rsp), %rdi
callq 0x10380
movl (%rax), %esi
leaq 0x80(%rsp), %rdi
callq 0x5790
movq %rax, 0x10(%rsp)
jmp 0x2b441
movq 0x10(%rsp), %rdi
leaq 0x3f746(%rip), %rsi     # 0x6ab93
callq 0x5460
movq %rax, 0x8(%rsp)
jmp 0x2b459
leaq 0x68(%rsp), %rdi
callq 0x10380
movq 0x8(%rsp), %rdi
movq 0x8(%rax), %rsi
callq 0x50f0
movq %rax, (%rsp)
jmp 0x2b477
movq (%rsp), %rdi
movq 0x59b2e(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x2b489
leaq 0x68(%rsp), %rdi
xorl %esi, %esi
callq 0x10790
movq %rax, 0x48(%rsp)
jmp 0x2b40c
leaq 0x80(%rsp), %rdi
callq 0x5610
jmp 0x2b4ae
movb $0x1, 0x2b7(%rsp)
movl $0x1, 0x70(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x5670
leaq 0x280(%rsp), %rdi
callq 0x58b8
movb 0x2b7(%rsp), %al
andb $0x1, %al
addq $0x2b8, %rsp            # imm = 0x2B8
retq
leaq 0x280(%rsp), %rdi
callq 0x58b8
movq 0x78(%rsp), %rdi
callq 0x57b0