// File: /workspace/github_cpp_makefile_star2_O1/schneebergerlab[P]DrLink/sample_molecule.cpp
// Function: read_mcove_dist(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, 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::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>>>*)
bool read_mcove_dist(string                      mcfile, 
                     map<string, unsigned long>* mCov, 
                     map<string, unsigned long>* mCov_intersec)
{
    ifstream ifp;
    ifp.open(mcfile.c_str(), ios::in);
    if(!ifp.is_open())
    {
        cout << "   Error: cannot open file " << mcfile << endl;
        return false;
    }
    cout << "   Info: reading molecule base coverage distribution from " << mcfile << 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;
        std::stringstream key0;
        key0.str(""); 
        key0 << lineinfo[0];
        string        key = key0.str();
        unsigned long num = strtoul(lineinfo[1].c_str(), NULL, 0);
        //
        map<string, unsigned long>::iterator itr;
        itr = (*mCov).find(key);
        if(itr != (*mCov).end() )
        {
            cout << "   Warning: skipping repeated line: " << line << endl;
            continue;
        }
        else
        {
            (*mCov).insert(std::pair<string, unsigned long>(key, num));
        }
        //
        itr = (*mCov_intersec).find(key);
        if(itr != (*mCov_intersec).end())
        {
            if((*itr).second > num)
            {
                // replace with lower value
                (*itr).second = num;
            }
        }
        else
        {
            (*mCov_intersec).insert(std::pair<string, unsigned long>(key, num));
        }
    }    
    ifp.close();
    cout << "   Info: reading done. " << endl;    
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x438, %rsp            # imm = 0x438
movq %rdx, 0x30(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdi, %r14
leaq 0x230(%rsp), %r12
movq %r12, %rdi
callq 0x4390
movq (%r14), %rsi
movq %r12, %rdi
movl $0x8, %edx
callq 0x41e0
leaq 0x2a8(%rsp), %rdi
callq 0x40c0
movl %eax, %ebx
testb %al, %al
je 0x2a532
movq 0x21b44(%rip), %rdi     # 0x4bfc8
leaq 0x14127(%rip), %rsi     # 0x3e5b2
movl $0x3a, %edx
callq 0x43a0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x21b25(%rip), %rdi     # 0x4bfc8
callq 0x43a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %esi
movq %r14, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4220
movb %bl, 0x7(%rsp)
movq 0x230(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x250(%rsp,%rax)
je 0x2a5a8
leaq 0x230(%rsp), %rdi
callq 0x40a0
movb 0x7(%rsp), %bl
movq 0x21ac0(%rip), %r14     # 0x4bfc8
leaq 0x1408b(%rip), %rsi     # 0x3e59a
movl $0x17, %edx
movq %r14, %rdi
callq 0x43a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4310
jmp 0x2a574
movq 0x21a8f(%rip), %rdi     # 0x4bfc8
leaq 0x1062e(%rip), %rsi     # 0x3ab6e
movl $0x1b, %edx
callq 0x43a0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x21a70(%rip), %rdi     # 0x4bfc8
callq 0x43a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %esi
movq %r14, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4220
leaq 0x230(%rsp), %rdi
callq 0x40d0
movl %ebx, %eax
addq $0x438, %rsp            # imm = 0x438
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x70(%rsp), %r15
movq 0x38(%rsp), %rax
addq $0x8, %rax
movq %rax, 0xa0(%rsp)
movq 0x30(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
leaq 0x1454c(%rip), %rbp     # 0x3eb22
leaq 0x60(%rsp), %r13
movq %r15, 0x60(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
movq %rbp, %rdx
callq 0x5384
movq 0x230(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x45c0
cmpq $0x0, 0x68(%rsp)
je 0x2a7c5
movq 0x60(%rsp), %rax
cmpb $0x23, (%rax)
je 0x2a7c5
movb $0x9, 0xa8(%rsp)
leaq 0x80(%rsp), %rdi
movq %r13, %rsi
leaq 0xa8(%rsp), %rdx
callq 0x36b7c
movq 0x88(%rsp), %rax
subq 0x80(%rsp), %rax
cmpq $0x21, %rax
jb 0x2a7b8
leaq 0xa8(%rsp), %rdi
callq 0x4240
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movq %rbp, %rdx
callq 0x5384
leaq 0xc0(%rsp), %rdi
movq %rbx, %rsi
callq 0x4490
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2a6bf
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x80(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0xb8(%rsp), %rdi
callq 0x43a0
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x44f0
movq 0x80(%rsp), %rax
movq 0x20(%rax), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4130
movq %rax, %r14
movq 0x38(%rsp), %rdi
movq %rbx, %rsi
callq 0xde70
cmpq 0xa0(%rsp), %rax
je 0x2a7fb
movl $0x24, %edx
movq 0x21899(%rip), %rdi     # 0x4bfc8
leaq 0x13e3f(%rip), %rsi     # 0x3e575
callq 0x43a0
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x2187c(%rip), %rdi     # 0x4bfc8
callq 0x43a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %esi
movq %r14, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4220
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2a797
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0xa8(%rsp), %rdi
movq 0x217f2(%rip), %rsi     # 0x4bf98
callq 0x4260
leaq 0x128(%rsp), %rdi
callq 0x4140
leaq 0x80(%rsp), %rdi
callq 0x6aa2
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x2a7dc
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x230(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x250(%rsp,%rax)
je 0x2a5db
jmp 0x2a4f0
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xda32
movq %r14, 0x28(%rsp)
movq 0x38(%rsp), %rdi
movq %rbx, %rsi
callq 0xdefa
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2a84d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xde70
cmpq 0x98(%rsp), %rax
je 0x2a879
cmpq %r14, 0x40(%rax)
jbe 0x2a77b
movq %r14, 0x40(%rax)
jmp 0x2a77b
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xda32
movq %r14, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0xdefa
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2a77b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x2a77b
jmp 0x2a8da
jmp 0x2a928
jmp 0x2a928
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2a92b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x2a92b
jmp 0x2a928
jmp 0x2a928
jmp 0x2a91c
jmp 0x2a91c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2a947
movq 0x18(%rsp), %rsi
jmp 0x2a93f
movq %rax, %rbx
jmp 0x2a947
movq %rax, %rbx
jmp 0x2a968
jmp 0x2a97e
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2a947
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x2164a(%rip), %rsi     # 0x4bf98
leaq 0xa8(%rsp), %rdi
callq 0x4260
leaq 0x128(%rsp), %rdi
callq 0x4140
leaq 0x80(%rsp), %rdi
callq 0x6aa2
jmp 0x2a981
jmp 0x2a979
movq %rax, %rbx
jmp 0x2a998
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x2a998
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x230(%rsp), %rdi
callq 0x40d0
movq %rbx, %rdi
callq 0x45a0
nop