// File: /workspace/github_cpp_makefile_star2_O3/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), %r15
movq %r15, %rdi
callq 0x4390
movq (%rbx), %rsi
movq %r15, %rdi
movl $0x8, %edx
callq 0x41e0
leaq 0xe8(%rsp), %rdi
callq 0x40c0
movl %eax, %ebp
testb %al, %al
je 0x27ea1
movq 0x243fa(%rip), %rdi     # 0x4bfc8
leaq 0x16958(%rip), %rsi     # 0x3e52d
movl $0x31, %edx
callq 0x43a0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x243db(%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)
jne 0x27e61
leaq 0x38(%rsp), %r14
movq 0x10(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x50(%rsp)
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x48(%rsp)
leaq 0x16eaa(%rip), %r12     # 0x3eb0a
leaq 0x28(%rsp), %r13
leaq 0x58(%rsp), %rbx
movq %r14, 0x28(%rsp)
movq %r13, %rdi
movq %r12, %rsi
movq %r12, %rdx
callq 0x5384
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x45c0
cmpq $0x0, 0x30(%rsp)
movq 0x28(%rsp), %rdi
je 0x27e38
cmpb $0x23, (%rdi)
je 0x27e38
movq %r13, %rsi
movq %r15, %rbp
movb $0x9, 0x18(%rsp)
movq %rbx, %r12
movq %rbx, %rdi
leaq 0x18(%rsp), %rdx
callq 0x367c0
movq 0x58(%rsp), %rbx
movq 0x60(%rsp), %r15
subq %rbx, %r15
cmpq $0x21, %r15
jb 0x27e1e
movq (%rbx), %rdi
callq 0x44d0
movl %eax, %r14d
movq -0x20(%rbx,%r15), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4130
movq %rax, %rbx
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x27d40
movq 0x50(%rsp), %rcx
xorl %edx, %edx
cmpl %r14d, 0x20(%rax)
setl %dl
cmovgeq %rax, %rcx
movq 0x10(%rax,%rdx,8), %rax
testq %rax, %rax
jne 0x27d1c
cmpq 0x50(%rsp), %rcx
je 0x27d40
cmpl 0x20(%rcx), %r14d
jge 0x27db0
movl %r14d, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xdfe8
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x27d90
movq 0x48(%rsp), %rax
xorl %edx, %edx
cmpl %r14d, 0x20(%rcx)
setl %dl
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x27d6c
cmpq 0x48(%rsp), %rax
je 0x27d90
cmpl 0x20(%rax), %r14d
jge 0x27e0f
movl %r14d, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xdfe8
leaq 0x38(%rsp), %r14
jmp 0x27e1e
movl $0x24, %edx
movq 0x2420c(%rip), %rdi     # 0x4bfc8
leaq 0x1679c(%rip), %rsi     # 0x3e55f
leaq 0x38(%rsp), %r14
callq 0x43a0
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x241ea(%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
jmp 0x27e1e
cmpq %rbx, 0x28(%rax)
leaq 0x38(%rsp), %r14
jbe 0x27e1e
movq %rbx, 0x28(%rax)
movq %r12, %rbx
movq %r12, %rdi
callq 0x6aac
movq 0x28(%rsp), %rdi
movq %rbp, %r15
leaq 0x16cd2(%rip), %r12     # 0x3eb0a
cmpq %r14, %rdi
je 0x27e4a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x70(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x90(%rsp,%rax)
je 0x27c6a
leaq 0x70(%rsp), %rdi
callq 0x40a0
movb 0x7(%rsp), %bpl
movq 0x24151(%rip), %rbx     # 0x4bfc8
leaq 0x16706(%rip), %rsi     # 0x3e584
movl $0x17, %edx
movq %rbx, %rdi
callq 0x43a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4310
jmp 0x27ee3
movq 0x24120(%rip), %rdi     # 0x4bfc8
leaq 0x12cbf(%rip), %rsi     # 0x3ab6e
movl $0x1b, %edx
callq 0x43a0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x24101(%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
jmp 0x27f18
jmp 0x27f18
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x6aac
jmp 0x27f33
jmp 0x27f30
jmp 0x27f2b
movq %rax, %rbx
jmp 0x27f4f
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x27f4f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x70(%rsp), %rdi
callq 0x40d0
movq %rbx, %rdi
callq 0x45a0