// File: /workspace/github_cpp_makefile_star2_O3/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), %r13
movq %r13, %rdi
callq 0x4390
movq (%r14), %rsi
movq %r13, %rdi
movl $0x8, %edx
callq 0x41e0
leaq 0x2a8(%rsp), %rdi
callq 0x40c0
movl %eax, %ebx
testb %al, %al
je 0x2a388
movq 0x21cee(%rip), %rdi     # 0x4bfc8
leaq 0x142bb(%rip), %rsi     # 0x3e59c
movl $0x3a, %edx
callq 0x43a0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x21ccf(%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 0x2a3fe
leaq 0x230(%rsp), %rdi
callq 0x40a0
movb 0x7(%rsp), %bl
movq 0x21c6a(%rip), %r14     # 0x4bfc8
leaq 0x1421f(%rip), %rsi     # 0x3e584
movl $0x17, %edx
movq %r14, %rdi
callq 0x43a0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4310
jmp 0x2a3ca
movq 0x21c39(%rip), %rdi     # 0x4bfc8
leaq 0x107d8(%rip), %rsi     # 0x3ab6e
movl $0x1b, %edx
callq 0x43a0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x21c1a(%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), %r12
movq 0x38(%rsp), %rax
addq $0x8, %rax
movq %rax, 0xa0(%rsp)
movq 0x30(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
leaq 0x146de(%rip), %r14     # 0x3eb0a
leaq 0x60(%rsp), %rbp
movq %r12, 0x60(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x5384
movq 0x230(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %edx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x45c0
cmpq $0x0, 0x68(%rsp)
movq 0x60(%rsp), %rdi
je 0x2a620
cmpb $0x23, (%rdi)
je 0x2a620
movb $0x9, 0xa8(%rsp)
leaq 0x80(%rsp), %rdi
movq %rbp, %rsi
leaq 0xa8(%rsp), %rdx
callq 0x367c0
movq 0x88(%rsp), %rax
subq 0x80(%rsp), %rax
cmpq $0x21, %rax
jb 0x2a60e
leaq 0xa8(%rsp), %rdi
callq 0x4240
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x5384
leaq 0xc0(%rsp), %rdi
movq %rbx, %rsi
callq 0x4490
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2a515
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, %r15
movq 0x38(%rsp), %rdi
movq %rbx, %rsi
callq 0xdd92
cmpq 0xa0(%rsp), %rax
je 0x2a651
movl $0x24, %edx
movq 0x21a43(%rip), %rdi     # 0x4bfc8
leaq 0x13fd3(%rip), %rsi     # 0x3e55f
callq 0x43a0
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x21a26(%rip), %rdi     # 0x4bfc8
callq 0x43a0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4220
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2a5ed
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0xa8(%rsp), %rdi
movq 0x2199c(%rip), %rsi     # 0x4bf98
callq 0x4260
leaq 0x128(%rsp), %rdi
callq 0x4140
leaq 0x80(%rsp), %rdi
callq 0x6aac
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2a632
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x230(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x250(%rsp,%rax)
je 0x2a431
jmp 0x2a346
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 0xd940
movq %r15, 0x28(%rsp)
movq 0x38(%rsp), %rdi
movq %rbx, %rsi
callq 0xde1c
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2a6a3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xdd92
cmpq 0x98(%rsp), %rax
je 0x2a6cf
cmpq %r15, 0x40(%rax)
jbe 0x2a5d1
movq %r15, 0x40(%rax)
jmp 0x2a5d1
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 0xd940
movq %r15, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0xde1c
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2a5d1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x2a5d1
jmp 0x2a730
jmp 0x2a77e
jmp 0x2a77e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2a781
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x2a781
jmp 0x2a77e
jmp 0x2a77e
jmp 0x2a772
jmp 0x2a772
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x2a79d
movq 0x18(%rsp), %rsi
jmp 0x2a795
movq %rax, %rbx
jmp 0x2a79d
movq %rax, %rbx
jmp 0x2a7be
jmp 0x2a7d4
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x2a79d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x217f4(%rip), %rsi     # 0x4bf98
leaq 0xa8(%rsp), %rdi
callq 0x4260
leaq 0x128(%rsp), %rdi
callq 0x4140
leaq 0x80(%rsp), %rdi
callq 0x6aac
jmp 0x2a7d7
jmp 0x2a7cf
movq %rax, %rbx
jmp 0x2a7ee
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2a7ee
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x230(%rsp), %rdi
callq 0x40d0
movq %rbx, %rdi
callq 0x45a0
nop