// File: schneebergerlab[P]GameteBinning/asPollinator_1.0.cpp
// Function: collect_contig_size(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>>>*)
bool collect_contig_size(string sizefile, map<string, unsigned long>* contigsize)
{
    cout << "   Info: reading contig size info from " << sizefile << endl;
    ifstream ifp;
    ifp.open(sizefile.c_str(), ios::in);
    if(!ifp.good())
    {
        cout << "   Error: cannot open contig size file " << sizefile << endl;
        return false;
    }
    while(ifp.good())
    {
        string line("");
        getline(ifp, line);
        if(line.size() == 0) continue;
        if(line[0]=='#')     continue;
        vector<string> lineinfo = split_string(line, '\t');
        if(lineinfo.size()<2) continue;
        string        ctgid   = lineinfo[0];
        unsigned long ctgsize = strtoul(lineinfo[1].c_str(), NULL, 0);
        (*contigsize).insert(std::pair<string, unsigned long>(ctgid, ctgsize));
        cout << ctgid << "\t" << ctgsize << endl;
    }
    if((*contigsize).size() == 0)
    {
        cout << "   Erorr: no info collected from contig size file. " << endl;
        return false;
    }else
    {
        cout << "   Info: " << (*contigsize).size() << " contig size info collected. " << endl;
    }
    ifp.close();
    //
    return true;
}

// Assembly:
subq $0x368, %rsp            # imm = 0x368
movq %rdi, 0x80(%rsp)
movq %rdi, 0x358(%rsp)
movq %rsi, 0x350(%rsp)
movq 0x2bb32(%rip), %rdi     # 0x38fd8
leaq 0x1ec1c(%rip), %rsi     # 0x2c0c9
callq 0x3320
movq 0x80(%rsp), %rsi
movq %rax, %rdi
callq 0x32e0
movq %rax, %rdi
movq 0x2bafc(%rip), %rsi     # 0x38fc8
callq 0x3370
leaq 0x148(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x33c0
movq 0x80(%rsp), %rdi
callq 0x3150
movq 0x88(%rsp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0x3200
jmp 0xd50a
movq 0x148(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x148(%rsp,%rax), %rdi
callq 0x3520
movb %al, 0x7f(%rsp)
jmp 0xd529
movb 0x7f(%rsp), %al
testb $0x1, %al
jne 0xd5aa
jmp 0xd533
movq 0x2ba9e(%rip), %rdi     # 0x38fd8
leaq 0x1ebb0(%rip), %rsi     # 0x2c0f1
callq 0x3320
movq %rax, 0x70(%rsp)
jmp 0xd54d
movq 0x80(%rsp), %rsi
movq 0x70(%rsp), %rdi
callq 0x32e0
movq %rax, 0x68(%rsp)
jmp 0xd566
movq 0x68(%rsp), %rdi
movq 0x2ba56(%rip), %rsi     # 0x38fc8
callq 0x3370
jmp 0xd579
movb $0x0, 0x367(%rsp)
movl $0x1, 0x138(%rsp)
jmp 0xd9ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0xd9e8
jmp 0xd5ac
movq 0x148(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x148(%rsp,%rax), %rdi
callq 0x3520
movb %al, 0x67(%rsp)
jmp 0xd5cb
movb 0x67(%rsp), %al
testb $0x1, %al
jne 0xd5d8
jmp 0xd8ea
leaq 0x117(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x3570
movq 0x58(%rsp), %rdx
leaq 0x1e86b(%rip), %rsi     # 0x2be61
leaq 0x118(%rsp), %rdi
callq 0x185e0
jmp 0xd605
leaq 0x117(%rsp), %rdi
callq 0x3390
leaq 0x148(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x30a0
jmp 0xd629
leaq 0x118(%rsp), %rdi
callq 0x3250
cmpq $0x0, %rax
jne 0xd68b
movl $0x2, 0x138(%rsp)
jmp 0xd84d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0x117(%rsp), %rdi
callq 0x3390
jmp 0xd9e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0xd8d8
xorl %eax, %eax
movl %eax, %esi
leaq 0x118(%rsp), %rdi
callq 0x35f0
movq %rax, 0x50(%rsp)
jmp 0xd6a3
movq 0x50(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0xd6c0
movl $0x2, 0x138(%rsp)
jmp 0xd84d
movb $0x9, 0xf7(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0x118(%rsp), %rsi
leaq 0xf7(%rsp), %rdx
callq 0x2aa50
jmp 0xd6e7
leaq 0xf8(%rsp), %rdi
callq 0x1a930
cmpq $0x2, %rax
jae 0xd70a
movl $0x2, 0x138(%rsp)
jmp 0xd840
xorl %eax, %eax
movl %eax, %esi
leaq 0xf8(%rsp), %rdi
callq 0x19580
movq %rax, %rsi
leaq 0xd0(%rsp), %rdi
callq 0x3160
jmp 0xd72d
leaq 0xf8(%rsp), %rdi
movl $0x1, %esi
callq 0x19580
movq %rax, %rdi
callq 0x3150
movq %rax, %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x3110
movq %rax, 0xc8(%rsp)
movq 0x350(%rsp), %rax
movq %rax, 0x48(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0x1a9f0
jmp 0xd787
movq 0x48(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x1a9a0
movb %dl, 0x3f(%rsp)
movq %rax, 0x40(%rsp)
jmp 0xd7a4
movb 0x3f(%rsp), %al
movq 0x40(%rsp), %rcx
movq %rcx, 0x90(%rsp)
movb %al, 0x98(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x1aa30
movq 0x2b808(%rip), %rdi     # 0x38fd8
leaq 0xd0(%rsp), %rsi
callq 0x32e0
movq %rax, 0x30(%rsp)
jmp 0xd7e4
movq 0x30(%rsp), %rdi
leaq 0x1e670(%rip), %rsi     # 0x2be60
callq 0x3320
movq %rax, 0x28(%rsp)
jmp 0xd7fc
movq 0x28(%rsp), %rdi
movq 0xc8(%rsp), %rsi
callq 0x30d0
movq %rax, 0x20(%rsp)
jmp 0xd815
movq 0x20(%rsp), %rdi
movq 0x2b7a7(%rip), %rsi     # 0x38fc8
callq 0x3370
jmp 0xd828
leaq 0xd0(%rsp), %rdi
callq 0x31e0
movl $0x0, 0x138(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x18e80
leaq 0x118(%rsp), %rdi
callq 0x31e0
movl 0x138(%rsp), %eax
testl %eax, %eax
je 0xd86c
jmp 0xd867
jmp 0xd5ac
jmp 0xd5ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0xd8cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
jmp 0xd8be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x1aa30
leaq 0xd0(%rsp), %rdi
callq 0x31e0
leaq 0xf8(%rsp), %rdi
callq 0x18e80
leaq 0x118(%rsp), %rdi
callq 0x31e0
jmp 0xd9e8
movq 0x350(%rsp), %rdi
callq 0x1aa40
cmpq $0x0, %rax
jne 0xd942
movq 0x2b6d4(%rip), %rdi     # 0x38fd8
leaq 0x1e80e(%rip), %rsi     # 0x2c119
callq 0x3320
movq %rax, 0x18(%rsp)
jmp 0xd917
movq 0x18(%rsp), %rdi
movq 0x2b6a5(%rip), %rsi     # 0x38fc8
callq 0x3370
jmp 0xd92a
movb $0x0, 0x367(%rsp)
movl $0x1, 0x138(%rsp)
jmp 0xd9ca
movq 0x2b68f(%rip), %rdi     # 0x38fd8
leaq 0x1e7fd(%rip), %rsi     # 0x2c14d
callq 0x3320
movq %rax, 0x10(%rsp)
jmp 0xd95c
movq 0x350(%rsp), %rdi
callq 0x1aa40
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x30d0
movq %rax, 0x8(%rsp)
jmp 0xd97d
movq 0x8(%rsp), %rdi
leaq 0x1e7ce(%rip), %rsi     # 0x2c157
callq 0x3320
movq %rax, (%rsp)
jmp 0xd994
movq (%rsp), %rdi
movq 0x2b629(%rip), %rsi     # 0x38fc8
callq 0x3370
jmp 0xd9a6
jmp 0xd9a8
leaq 0x148(%rsp), %rdi
callq 0x30b0
jmp 0xd9b7
movb $0x1, 0x367(%rsp)
movl $0x1, 0x138(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x30e0
movb 0x367(%rsp), %al
andb $0x1, %al
addq $0x368, %rsp            # imm = 0x368
retq
leaq 0x148(%rsp), %rdi
callq 0x30e0
movq 0x140(%rsp), %rdi
callq 0x3560
nopw %cs:(%rax,%rax)