// File: /workspace/github_cpp_makefile_star2_O1/schneebergerlab[P]DrLink/sample_molecule.cpp
// Function: read_msize_dist(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<int, unsigned long, std::less<int>, std::allocator<std::pair<int const, unsigned long>>>*, std::map<int, unsigned long, std::less<int>, std::allocator<std::pair<int const, unsigned long>>>*)
bool read_msize_dist(string msfile, map<int, unsigned long>* mNum, map<int, unsigned long>* mNum_intersec)
{
    ifstream ifp;
    ifp.open(msfile.c_str(), ios::in);
    if(!ifp.is_open())
    {
        cout << "   Error: cannot open file " << msfile << endl;
        return false;
    }
    cout << "   Info: reading molecule size distribution from " << msfile << endl;
    while(ifp.good())
    {
        string line("");
        getline(ifp, line);
        if(line.size()==0 || line[0]=='#') continue;
        vector<string> lineinfo = split_string(line, '\t');
        if(lineinfo.size() < 2) continue;
        int           key = atoi(lineinfo[0].c_str());
        unsigned long len = strtoul(lineinfo[lineinfo.size()-1].c_str(), NULL, 0);
        //
        map<int, unsigned long>::iterator itr;
        itr = (*mNum).find(key);
        if(itr != (*mNum).end() )
        {
            cout << "   Warning: skipping repeated line: " << line << endl;
            continue;
        }
        else
        {
            (*mNum).insert(std::pair<int, unsigned long>(key, len));
        }
        //
        itr = (*mNum_intersec).find(key);
        if(itr != (*mNum_intersec).end())
        {
            if((*itr).second > len)
            {
                // replace with lower value
                (*itr).second = len;
            }
        }
        else
        {
            (*mNum_intersec).insert(std::pair<int, unsigned long>(key, len));
        }
    }
    ifp.close();
    cout << "   Info: reading done. " << endl;
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rdx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
leaq 0x70(%rsp), %r13
movq %r13, %rdi
callq 0x4390
movq (%rbx), %rsi
movq %r13, %rdi
movl $0x8, %edx
callq 0x41e0
leaq 0xe8(%rsp), %rdi
callq 0x40c0
movl %eax, %ebp
testb %al, %al
je 0x27df2
movq 0x24280(%rip), %rdi     # 0x4bfc8
leaq 0x167f4(%rip), %rsi     # 0x3e543
movl $0x31, %edx
callq 0x43a0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x24261(%rip), %rdi     # 0x4bfc8
callq 0x43a0
movq %rax, %rbx
movq (%rax), %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
movb %bpl, 0x7(%rsp)
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x90(%rsp,%rax)
je 0x27e65
leaq 0x70(%rsp), %rdi
callq 0x40a0
movb 0x7(%rsp), %bpl
movq 0x24200(%rip), %rbx     # 0x4bfc8
leaq 0x167cb(%rip), %rsi     # 0x3e59a
movl $0x17, %edx
movq %rbx, %rdi
callq 0x43a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4310
jmp 0x27e34
movq 0x241cf(%rip), %rdi     # 0x4bfc8
leaq 0x12d6e(%rip), %rsi     # 0x3ab6e
movl $0x1b, %edx
callq 0x43a0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x241b0(%rip), %rdi     # 0x4bfc8
callq 0x43a0
movq %rax, %rbx
movq (%rax), %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
leaq 0x70(%rsp), %rdi
callq 0x40d0
movl %ebp, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x38(%rsp), %r12
movq 0x10(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x50(%rsp)
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x48(%rsp)
leaq 0x16c95(%rip), %rbx     # 0x3eb22
leaq 0x28(%rsp), %r15
movq %r12, 0x28(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x5384
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %edx
movq %r13, %rdi
movq %r15, %rsi
callq 0x45c0
cmpq $0x0, 0x30(%rsp)
je 0x27fe5
movq 0x28(%rsp), %rax
cmpb $0x23, (%rax)
je 0x27fe5
movb $0x9, 0x18(%rsp)
leaq 0x58(%rsp), %rdi
movq %r15, %rbp
movq %r15, %rsi
leaq 0x18(%rsp), %rdx
callq 0x36b7c
movq 0x58(%rsp), %r15
movq 0x60(%rsp), %r14
subq %r15, %r14
cmpq $0x21, %r14
jb 0x27fd1
movq (%r15), %rdi
callq 0x44d0
movl %eax, %ebx
movq -0x20(%r15,%r14), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4130
movq %rax, %r14
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x50(%rsp), %rsi
movq %rsi, %rax
testq %rcx, %rcx
je 0x27f5e
movq %rsi, %rax
xorl %edx, %edx
cmpl %ebx, 0x20(%rcx)
setl %dl
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x27f48
movq %rsi, %rcx
cmpq %rsi, %rax
je 0x27f70
cmpl 0x20(%rax), %ebx
cmovlq %rsi, %rax
movq %rax, %rcx
cmpq %rsi, %rcx
je 0x28018
movl $0x24, %edx
movq 0x24043(%rip), %rdi     # 0x4bfc8
leaq 0x165e9(%rip), %rsi     # 0x3e575
callq 0x43a0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x24026(%rip), %rdi     # 0x4bfc8
callq 0x43a0
movq %rax, %rbx
movq (%rax), %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
leaq 0x58(%rsp), %rdi
callq 0x6aa2
leaq 0x16b40(%rip), %rbx     # 0x3eb22
movq %rbp, %r15
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x27ffc
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x90(%rsp,%rax)
je 0x27e92
jmp 0x27db2
movl %ebx, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xe0c6
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x48(%rsp), %rsi
movq %rsi, %rax
testq %rcx, %rcx
je 0x2805f
movq %rsi, %rax
xorl %edx, %edx
cmpl %ebx, 0x20(%rcx)
setl %dl
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x28049
movq %rsi, %rcx
cmpq %rsi, %rax
je 0x28071
cmpl 0x20(%rax), %ebx
cmovlq %rsi, %rax
movq %rax, %rcx
cmpq %rsi, %rcx
je 0x28089
cmpq %r14, 0x28(%rcx)
jbe 0x27fd1
movq %r14, 0x28(%rcx)
jmp 0x27fd1
movl %ebx, 0x18(%rsp)
movq %r14, 0x20(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xe0c6
jmp 0x27fd1
jmp 0x280ac
jmp 0x280ac
jmp 0x280c2
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x6aa2
jmp 0x280c5
jmp 0x280bd
movq %rax, %rbx
jmp 0x280dc
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x280dc
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x70(%rsp), %rdi
callq 0x40d0
movq %rbx, %rdi
callq 0x45a0