// File: /workspace/github_cpp_makefile_star2_O1/schneebergerlab[P]DrLink/separate_kb_molecule.cpp
// Function: separate_kb_molecule(int, char**)
bool separate_kb_molecule(int argc, char* argv[])
{
    std::stringstream usage;
    usage.str("");
    if(argc < 5)
    {
        usage << endl;
        usage << "   Given sets of molecule info (from DrLink molecule), "                         
              << endl;
        usage << "   this function samples molecules according to intersection of molecule sizes and base coverage"           
              << endl;
        const char *buildString = __DATE__", " __TIME__;
        usage << "   (compiled on " << buildString << ")"                                                   
              << endl << endl;
        usage << "   Usage: DrLink separate_kb mole1.gz,mole2.gz[,...] label1,label2[,...] outprefix" 
              << endl << endl;
        usage << "\twhere "                                                         << endl;
        usage << "\tmole*.gz  :   molecule meta info corresponding to molecule size of pools from DrLink molecule"  
              << endl;
        usage << "\tlabel*    :   sample-specific label of output files"            << endl;
        usage << "\toutprefix :   general label of output files"                    << endl;
        cout  << usage.str() << endl;
        return false;
    }
    double startT   = clock(); 
    // get inputs
    vector<string> mfileinfo  = split_string((string)argv[2], ',');
    vector<string> mlabelinfo = split_string((string)argv[3], ',');
    if(mfileinfo.size() != mlabelinfo.size())
    {
        cout << "   Error: number of molecule files does not match number of labels. Exited." << endl;
        return false;
    }
    string outprefix = (string)argv[4];
    if(outprefix.size()==0)
    {
        outprefix = "Enjo";
    }
    //
    vector<string>::iterator mfitr;
    vector<string>::iterator mfitr_end;
    mfitr     = mfileinfo.begin();
    mfitr_end = mfileinfo.end();
    int i = -1;
    string molheader = "#chr#barcode\tfirst_aligned\tlast_aligned\tmolecule_len\tmolecule_cov\tread_num\tUni_flag\tlast_aligned_end\treads_region\tR1R2\treads_id";
    map<int, map<string,  unsigned long> > molecule_cov; // map<kb, map<0.01x,0.02x,..., number of molecules> >
    while(mfitr != mfitr_end)
    {
        i ++;
        string molfile  = *mfitr;        
        string mollabel = mlabelinfo[i];
        cout << "   Info: building statistics for " << mollabel << ":" << molfile << endl;
        unsigned long raw_mole_num      = 0;
        unsigned long selected_mole_num = 0;
        // create an intermediate folder for collecting details about a CO-molecule
        string molfolder = outprefix+"_"+mollabel;
        DIR* dir = opendir(molfolder.c_str());
        if (dir)
        {
            /* Directory exists. */
            closedir(dir);
        }
        else if (ENOENT == errno)
        {
            /* Directory does not exist. */
            const int dir_err = mkdir(molfolder.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
            if (dir_err == -1)
            {
                cout << "   Error: cannot create directory " << molfolder << endl;
                return false;
            }        
        }
        else ;
        // read raw molecule meta info file
        igzstream molfp;
        molfp.open(molfile.c_str());
        if(!molfp.good())
        {
            cout << "   Error: cannot open file of raw molecule: " << molfile << endl;
            return false;
        }
        while(molfp.good())
        {
            string line("");
            getline(molfp, line);
            if(line.size()==0 || line[0]=='#') continue;            
            vector<string> lineinfo = split_string(line, '\t');
            raw_mole_num ++;
            // molecule size
            int mlen = atoi(lineinfo[3].c_str());
            if(mlen < 1000) continue;
            int mlkey = (int)round((double)mlen/1000);
            map<int, map<string, unsigned long> >::iterator mlitr;
            mlitr = molecule_cov.find(mlkey); // to check if key exists
            if(mlitr == molecule_cov.end())
            {
                map<string, unsigned long> tmpcovmap;
                molecule_cov.insert(std::pair<int, map<string, unsigned long> >(mlkey, tmpcovmap) );
            }
            mlitr = molecule_cov.find(mlkey); // to update key: value
            // molecule cov
            string mckey = lineinfo[4];
            map<string, unsigned long>::iterator mcitr = ((*mlitr).second).find(mckey);
            if(mcitr == (*mlitr).second.end())
            {
                ((*mlitr).second).insert(std::pair<string, unsigned long>(mckey, 1));
            }
            else
            {
                (*mcitr).second += 1;
            }
            // output x.kb molecule to x.kb file
            std::stringstream kbmfile;
            kbmfile.str(""); 
            kbmfile << "./" << molfolder << "/" << mollabel << "_" << mlkey << "kb.txt";
            ofstream outkbfp;
            outkbfp.open(kbmfile.str().c_str(), ios::out | ios::app);
            if(!outkbfp.good())
            {
                cout   << "   Error: cannot open file " << kbmfile.str() << endl;
                return false;
            }
            else
            {
                outkbfp << line << endl;
                outkbfp.close();
                selected_mole_num ++;
            }
            //
            if(raw_mole_num%1000000 == 0)
            {
                cout << "   Info: " 
                     << raw_mole_num 
                     << " raw molecules, where " 
                     << selected_mole_num 
                     << " selected. " 
                     << endl;
            }
        }
        // output sample kb molecule base coverage
        map<int, map<string, unsigned long> >::iterator kbitr;
        map<int, map<string, unsigned long> >::iterator kbitr_end;
        kbitr     = molecule_cov.begin();
        kbitr_end = molecule_cov.end();
        while(kbitr != kbitr_end)
        {
            if(!write_molecule_kbcov((*kbitr).second, molfolder, mollabel, (*kbitr).first))
            {
                cout << "   Error: cannot write molecule cov for " << (*kbitr).first << " kb." << endl;
                return false;
            }
            kbitr ++;
        }
        // next sample
        mfitr ++;
    }
    //
    double finishT= clock();
    cout << "   Time consumed: " << (finishT-startT)/1000000 << " seconds" << endl << endl;    
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x9d8, %rsp            # imm = 0x9D8
movq %rsi, %r14
movl %edi, %ebp
leaq 0x850(%rsp), %rdi
callq 0x4240
leaq 0x238(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xb53f(%rip), %rdx      # 0x3eb22
leaq 0x228(%rsp), %rdi
movq %rdx, %rsi
callq 0x5384
leaq 0x868(%rsp), %rbx
leaq 0x228(%rsp), %rsi
movq %rbx, %rdi
callq 0x4490
movq 0x228(%rsp), %rdi
cmpq %r12, %rdi
je 0x33628
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
cmpl $0x4, %ebp
jg 0x33956
leaq 0x860(%rsp), %r14
movq (%r14), %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 0xb533(%rip), %rsi      # 0x3eb9a
movl $0x37, %edx
movq %r14, %rdi
callq 0x43a0
movq 0x860(%rsp), %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 0xb52b(%rip), %rsi      # 0x3ebd2
movl $0x60, %edx
movq %r14, %rdi
callq 0x43a0
movq 0x860(%rsp), %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 0xa5e4(%rip), %rsi      # 0x3dccb
movl $0x10, %edx
movq %r14, %rdi
callq 0x43a0
leaq 0xb538(%rip), %rsi      # 0x3ec33
movl $0x15, %edx
movq %r14, %rdi
callq 0x43a0
leaq 0xac31(%rip), %rsi      # 0x3e340
movl $0x1, %edx
movq %r14, %rdi
callq 0x43a0
movq 0x860(%rsp), %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 %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
leaq 0xb4d0(%rip), %rsi      # 0x3ec49
movl $0x52, %edx
movq %r14, %rdi
callq 0x43a0
movq 0x860(%rsp), %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 %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
leaq 0xa54a(%rip), %rsi      # 0x3dd2d
movl $0x7, %edx
movq %r14, %rdi
callq 0x43a0
movq 0x860(%rsp), %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 0xa8ff(%rip), %rsi      # 0x3e122
movl $0x5e, %edx
movq %r14, %rdi
callq 0x43a0
movq 0x860(%rsp), %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 0xb439(%rip), %rsi      # 0x3ec9c
movl $0x34, %edx
movq %r14, %rdi
callq 0x43a0
movq 0x860(%rsp), %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 0xa94a(%rip), %rsi      # 0x3e1ed
movl $0x2c, %edx
movq %r14, %rdi
callq 0x43a0
movq 0x860(%rsp), %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 0x228(%rsp), %rdi
movq %rbx, %rsi
callq 0x44f0
movq 0x228(%rsp), %rsi
movq 0x230(%rsp), %rdx
movq 0x186c5(%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
movq 0x228(%rsp), %rdi
cmpq %r12, %rdi
je 0x3394f
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
xorl %ebx, %ebx
jmp 0x34823
callq 0x4200
movq %rax, %rbx
movq 0x10(%r14), %rsi
leaq 0x228(%rsp), %rdi
leaq 0x4c8(%rsp), %rdx
callq 0x5346
leaq 0x6c8(%rsp), %rdx
movb $0x2c, (%rdx)
leaq 0x120(%rsp), %rdi
leaq 0x228(%rsp), %rsi
callq 0x36b7c
movq 0x228(%rsp), %rdi
cmpq %r12, %rdi
je 0x339b4
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x18(%r14), %rsi
leaq 0x228(%rsp), %rdi
leaq 0x4c8(%rsp), %rdx
callq 0x5346
leaq 0x6c8(%rsp), %rdx
movb $0x2c, (%rdx)
leaq 0x198(%rsp), %rdi
leaq 0x228(%rsp), %rsi
callq 0x36b7c
movq 0x228(%rsp), %rdi
cmpq %r12, %rdi
je 0x33a0a
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x128(%rsp), %rax
subq 0x120(%rsp), %rax
movq 0x1a0(%rsp), %rcx
subq 0x198(%rsp), %rcx
cmpq %rcx, %rax
jne 0x346be
movq 0x20(%r14), %rsi
leaq 0x158(%rsp), %rdi
leaq 0x228(%rsp), %rdx
callq 0x5346
movq 0x160(%rsp), %rdx
testq %rdx, %rdx
jne 0x33a75
leaq 0xb2bd(%rip), %rcx      # 0x3ed1d
leaq 0x158(%rsp), %rdi
movl $0x4, %r8d
xorl %esi, %esi
callq 0x44c0
movq 0x120(%rsp), %r14
movq 0x128(%rsp), %rax
movq %rax, 0x190(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x70fc(%rip), %rsi      # 0x3ab99
leaq 0x7174(%rip), %rdx      # 0x3ac18
leaq 0x40(%rsp), %rdi
callq 0x5384
cvtsi2sd %rbx, %xmm0
movsd %xmm0, 0x178(%rsp)
leaq 0x1d0(%rsp), %r13
movl $0x0, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rax, 0x20(%r13)
leaq 0x3b0(%rsp), %rbp
movq 0x184d3(%rip), %rax     # 0x4bfc0
movq (%rax), %rcx
movq %rcx, 0x188(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x180(%rsp)
movq $-0x1, 0xd8(%rsp)
cmpq 0x190(%rsp), %r14
sete %al
movl %eax, 0xac(%rsp)
je 0x3470b
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xda32
movq 0xd8(%rsp), %rcx
incq %rcx
movq 0x198(%rsp), %rax
movq %rcx, 0xd8(%rsp)
shlq $0x5, %rcx
leaq 0x30(%rsp), %rdx
movq %rdx, 0x20(%rsp)
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0xda32
movl $0x21, %edx
movq 0x1842e(%rip), %rdi     # 0x4bfc8
leaq 0xb181(%rip), %rsi      # 0x3ed22
callq 0x43a0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x18411(%rip), %rdi     # 0x4bfc8
callq 0x43a0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6a2d(%rip), %rsi      # 0x3a5fb
callq 0x43a0
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq %rbx, %rdi
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
movq %r12, 0x228(%rsp)
movq 0x158(%rsp), %rsi
movq 0x160(%rsp), %rdx
addq %rsi, %rdx
leaq 0x228(%rsp), %rbx
movq %rbx, %rdi
callq 0xda32
movq %rbx, %rdi
leaq 0x7e8d(%rip), %rsi      # 0x3bad7
callq 0x45e0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x4120
leaq 0x10(%rsp), %rsi
movq %rsi, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x33c87
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x33c8f
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x228(%rsp), %rdi
cmpq %r12, %rdi
je 0x33cc4
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
movq (%rsp), %rdi
callq 0x44a0
testq %rax, %rax
je 0x33cdc
movq %rax, %rdi
callq 0x4500
jmp 0x33cfd
callq 0x4050
cmpl $0x2, (%rax)
jne 0x33cfd
movq (%rsp), %rdi
movl $0x1fd, %esi            # imm = 0x1FD
callq 0x4190
cmpl $-0x1, %eax
je 0x34858
leaq 0x228(%rsp), %rbx
movq %rbx, %rdi
callq 0xcc30
movq 0x80(%rsp), %rsi
movq %rbx, %rdi
movl $0x8, %edx
callq 0x39386
movq 0x228(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x248(%rsp,%rax)
je 0x33d9d
movl $0x2c, %edx
movq 0x18284(%rip), %rdi     # 0x4bfc8
leaq 0xaff9(%rip), %rsi      # 0x3ed44
callq 0x43a0
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq 0x18261(%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
xorl %ebx, %ebx
jmp 0x34591
movq 0x228(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x248(%rsp,%rax)
jne 0x34481
xorl %ebx, %ebx
movq $0x0, 0xd0(%rsp)
leaq 0xc0(%rsp), %rax
movq %rax, 0xb0(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0xad3e(%rip), %rdx      # 0x3eb22
movq %rdx, %rsi
callq 0x5384
movq 0x3b0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %edx
movq %rbp, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x45c0
movl $0x4, %ebp
cmpq $0x0, 0xb8(%rsp)
je 0x34430
movq 0xb0(%rsp), %rax
cmpb $0x23, (%rax)
je 0x34430
movb $0x9, 0x4c8(%rsp)
leaq 0x1b0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
leaq 0x4c8(%rsp), %rdx
callq 0x36b7c
incq %rbx
movq 0x1b0(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x44d0
movl $0x4, %ebp
cmpl $0x3e8, %eax            # imm = 0x3E8
jl 0x34423
movq %rbx, 0xa0(%rsp)
cvtsi2sd %eax, %xmm0
divsd 0x6a36(%rip), %xmm0     # 0x3a8d0
callq 0x4170
cvttsd2si %xmm0, %r15d
movq 0x1d8(%rsp), %rcx
movq %r13, %rbp
movq %r13, %rax
testq %rcx, %rcx
je 0x33ed1
movq %rbp, %rax
xorl %edx, %edx
cmpl %r15d, 0x20(%rcx)
setl %dl
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x33eba
movq %rbp, %rcx
cmpq %rbp, %rax
je 0x33ee4
cmpl %r15d, 0x20(%rax)
cmovgq %rbp, %rax
movq %rax, %rcx
cmpq %rbp, %rcx
jne 0x33f6e
movl $0x0, 0x6d0(%rsp)
xorl %eax, %eax
movq %rax, 0x6d8(%rsp)
leaq 0x6d0(%rsp), %rcx
movq %rcx, 0x6e0(%rsp)
movq %rcx, 0x6e8(%rsp)
movq %rax, 0x6f0(%rsp)
movl %r15d, 0x4c8(%rsp)
leaq 0x4d0(%rsp), %rdi
leaq 0x6c8(%rsp), %rsi
callq 0xd1f6
leaq 0x1c8(%rsp), %rdi
leaq 0x4c8(%rsp), %rsi
callq 0x31f32
leaq 0x4d0(%rsp), %rdi
callq 0xd908
leaq 0x6c8(%rsp), %rdi
callq 0xd908
movq 0x1d8(%rsp), %rcx
movq %rbp, %rax
testq %rcx, %rcx
je 0x33f98
movq %rbp, %rax
xorl %edx, %edx
cmpl %r15d, 0x20(%rcx)
setl %dl
cmovgeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x33f81
movq %rbp, %r12
cmpq %rbp, %rax
je 0x33fab
cmpl %r15d, 0x20(%rax)
cmovgq %rbp, %rax
movq %rax, %r12
movq 0x1b0(%rsp), %rax
leaq 0xf0(%rsp), %rcx
movq %rcx, 0xe0(%rsp)
movq 0x80(%rax), %rsi
movq 0x88(%rax), %rdx
addq %rsi, %rdx
leaq 0xe0(%rsp), %rbx
movq %rbx, %rdi
callq 0xda32
leaq 0x28(%r12), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xde70
addq $0x30, %r12
cmpq %r12, %rax
je 0x3400b
incq 0x40(%rax)
leaq 0x238(%rsp), %r12
jmp 0x34085
leaq 0x4d8(%rsp), %rax
movq %rax, 0x4c8(%rsp)
movq 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x4c8(%rsp), %r12
movq %r12, %rdi
callq 0xda32
leaq 0x238(%rsp), %rbx
movq $0x1, 0x4e8(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq 0xdefa
movq 0x4c8(%rsp), %rdi
leaq 0x4d8(%rsp), %rax
cmpq %rax, %rdi
movq %rbx, %r12
je 0x34085
movq 0x4d8(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x6c8(%rsp), %rdi
callq 0x4240
leaq 0x4d8(%rsp), %rax
movq %rax, 0x4c8(%rsp)
leaq 0x4c8(%rsp), %rbx
movq %rbx, %rdi
leaq 0xaa6e(%rip), %rdx      # 0x3eb22
movq %rdx, %rsi
callq 0x5384
leaq 0x6e0(%rsp), %rdi
movq %rbx, %rsi
callq 0x4490
movq 0x4c8(%rsp), %rdi
leaq 0x4d8(%rsp), %rax
cmpq %rax, %rdi
je 0x340f1
movq 0x4d8(%rsp), %rsi
incq %rsi
callq 0x4340
movl $0x2, %edx
leaq 0x6d8(%rsp), %rdi
leaq 0xac6c(%rip), %rsi      # 0x3ed71
callq 0x43a0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x6d8(%rsp), %rdi
callq 0x43a0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0xac40(%rip), %rsi      # 0x3ed72
callq 0x43a0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbp, %rdi
callq 0x43a0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
leaq 0x797c(%rip), %rsi      # 0x3bad7
callq 0x43a0
movq %rbp, %rdi
movl %r15d, %esi
callq 0x4580
movl $0x6, %edx
movq %rax, %rdi
leaq 0xa9b4(%rip), %rsi      # 0x3eb2e
callq 0x43a0
leaq 0x4c8(%rsp), %rdi
callq 0x4570
leaq 0x60(%rsp), %rdi
leaq 0x6e0(%rsp), %rsi
callq 0x44f0
movq 0x60(%rsp), %rsi
leaq 0x4c8(%rsp), %rdi
movl $0x11, %edx
callq 0x4060
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x341d1
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x4c8(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x4e8(%rsp,%rax)
je 0x3427b
movl $0x1b, %edx
movq 0x17dd1(%rip), %rdi     # 0x4bfc8
leaq 0x6970(%rip), %rsi      # 0x3ab6e
callq 0x43a0
leaq 0x60(%rsp), %rdi
leaq 0x6e0(%rsp), %rsi
callq 0x44f0
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x17da2(%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 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x34271
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4340
movl $0x1, %ebp
jmp 0x34397
movq 0xb0(%rsp), %rsi
movq 0xb8(%rsp), %rdx
leaq 0x4c8(%rsp), %rdi
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
leaq 0x4c8(%rsp), %rdi
callq 0x4440
incq 0xd0(%rsp)
movq 0xa0(%rsp), %rax
movabsq $0x790fb65668c26139, %rcx # imm = 0x790FB65668C26139
imulq %rcx, %rax
rorq $0x6, %rax
xorl %ebp, %ebp
movabsq $0x10c6f7a0b5ed, %rcx   # imm = 0x10C6F7A0B5ED
cmpq %rcx, %rax
ja 0x34397
movl $0x9, %edx
movq 0x17cb6(%rip), %rdi     # 0x4bfc8
leaq 0x6ba5(%rip), %rsi      # 0x3aebe
callq 0x43a0
movq 0x17ca3(%rip), %rdi     # 0x4bfc8
movq 0xa0(%rsp), %rsi
callq 0x4210
movq %rax, %r15
movl $0x16, %edx
movq %rax, %rdi
leaq 0xaa30(%rip), %rsi      # 0x3ed74
callq 0x43a0
movq %r15, %rdi
movq 0xd0(%rsp), %rsi
callq 0x4210
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
leaq 0xaa20(%rip), %rsi      # 0x3ed8b
callq 0x43a0
movq (%r15), %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 0x188(%rsp), %rax
movq %rax, 0x4c8(%rsp)
movq -0x18(%rax), %rax
movq 0x180(%rsp), %rcx
movq %rcx, 0x4c8(%rsp,%rax)
leaq 0x4d0(%rsp), %rdi
callq 0x42a0
leaq 0x5c0(%rsp), %rdi
callq 0x4140
leaq 0x6c8(%rsp), %rdi
movq 0x17bb4(%rip), %rsi     # 0x4bf98
callq 0x4260
leaq 0x748(%rsp), %rdi
callq 0x4140
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x3441b
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0xa0(%rsp), %rbx
leaq 0x1b0(%rsp), %rdi
callq 0x6aa2
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x34455
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4340
testb $0x3, %bpl
jne 0x346af
movq 0x228(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x248(%rsp,%rax)
leaq 0x3b0(%rsp), %rbp
je 0x33dc5
movq 0x1e0(%rsp), %rbx
cmpq %r13, %rbx
je 0x3458b
leaq 0x28(%rbx), %rsi
leaq 0x1f8(%rsp), %rdi
callq 0xd1f6
leaq 0x110(%rsp), %rax
movq %rax, 0x100(%rsp)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %rdi
callq 0xda32
leaq 0x148(%rsp), %rax
movq %rax, 0x138(%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x138(%rsp), %r15
movq %r15, %rdi
callq 0xda32
movl 0x20(%rbx), %ecx
leaq 0x1f8(%rsp), %rdi
leaq 0x100(%rsp), %rsi
movq %r15, %rdx
callq 0x34cf1
movl %eax, %r15d
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x3453c
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x34561
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x1f8(%rsp), %rdi
callq 0xd908
testb %r15b, %r15b
je 0x34645
movq %rbx, %rdi
callq 0x4230
movq %rax, %rbx
cmpq %r13, %rax
jne 0x34492
addq $0x20, %r14
movb $0x1, %bl
leaq 0x176a8(%rip), %rax     # 0x4bc40
movq %rax, 0x3b0(%rsp)
leaq 0x176c1(%rip), %rax     # 0x4bc68
movq %rax, 0x3c0(%rsp)
movq $0x0, 0x3b8(%rsp)
leaq 0x228(%rsp), %rdi
leaq 0x175de(%rip), %rsi     # 0x4bba8
callq 0x39330
leaq 0x3c0(%rsp), %rdi
callq 0x4140
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x345f7
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x34613
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x34638
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4340
testb %bl, %bl
jne 0x33b10
jmp 0x347b8
movl $0x28, %edx
movq 0x17977(%rip), %rdi     # 0x4bfc8
leaq 0xa73f(%rip), %rsi      # 0x3ed97
callq 0x43a0
movl 0x20(%rbx), %esi
movq 0x17961(%rip), %rdi     # 0x4bfc8
callq 0x4580
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0xa742(%rip), %rsi      # 0x3edc0
callq 0x43a0
movq (%rbx), %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 0x33d96
xorl %ebx, %ebx
leaq 0x3b0(%rsp), %rbp
jmp 0x34591
movq 0x17903(%rip), %rbx     # 0x4bfc8
leaq 0xa605(%rip), %rsi      # 0x3ecd1
movl $0x4b, %edx
movq %rbx, %rdi
callq 0x43a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %esi
movq 0x178d1(%rip), %rdi     # 0x4bfc8
callq 0x4030
movq %rax, %rdi
callq 0x4220
xorl %ebx, %ebx
jmp 0x34809
callq 0x4200
movq %rax, %rbx
movq 0x178ae(%rip), %rdi     # 0x4bfc8
leaq 0x5c24(%rip), %rsi      # 0x3a345
movl $0x12, %edx
callq 0x43a0
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
subsd 0x178(%rsp), %xmm0
divsd 0x58c4(%rip), %xmm0     # 0x3a008
movq 0x1787d(%rip), %rdi     # 0x4bfc8
callq 0x4510
movq %rax, %rbx
leaq 0x5bfe(%rip), %rsi      # 0x3a358
movl $0x8, %edx
movq %rax, %rdi
callq 0x43a0
movq (%rbx), %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
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 0x1c8(%rsp), %rdi
callq 0x31516
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x347e1
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
movl 0xac(%rsp), %ebx
je 0x34809
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x198(%rsp), %rdi
callq 0x6aa2
leaq 0x120(%rsp), %rdi
callq 0x6aa2
movq 0x1776e(%rip), %rsi     # 0x4bf98
leaq 0x850(%rsp), %rdi
callq 0x4260
leaq 0x8d0(%rsp), %rdi
callq 0x4140
movl %ebx, %eax
addq $0x9d8, %rsp            # imm = 0x9D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x17769(%rip), %rdi     # 0x4bfc8
leaq 0x73a5(%rip), %rsi      # 0x3bc0b
movl $0x22, %edx
callq 0x43a0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x17748(%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
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x348ca
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x348e6
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x347b8
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x347b8
jmp 0x3491b
jmp 0x34a68
movq %rax, %rbx
jmp 0x34c8d
jmp 0x349c5
jmp 0x34bc1
movq %rax, %rbx
movq 0x228(%rsp), %rdi
cmpq %r12, %rdi
je 0x34cbb
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34cbb
movq %rax, %rbx
jmp 0x34cbb
jmp 0x34a35
jmp 0x34bc1
movq %rax, %rbx
movq 0x4c8(%rsp), %rdi
leaq 0x4d8(%rsp), %rax
cmpq %rax, %rdi
je 0x34b20
movq 0x4d8(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34b20
jmp 0x34a28
movq %rax, %rbx
leaq 0x4d0(%rsp), %rdi
callq 0xd908
jmp 0x349b3
movq %rax, %rbx
leaq 0x6c8(%rsp), %rdi
callq 0xd908
jmp 0x34b45
movq %rax, %rbx
jmp 0x34cae
jmp 0x34a35
jmp 0x34bc1
jmp 0x34ab2
jmp 0x34ae5
jmp 0x34afc
jmp 0x34a28
movq %rax, %rbx
jmp 0x34b45
movq %rax, %rbx
movq 0x4c8(%rsp), %rdi
leaq 0x4d8(%rsp), %rax
cmpq %rax, %rdi
je 0x34aff
movq 0x4d8(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34aff
jmp 0x34afc
jmp 0x34abf
movq %rax, %rbx
jmp 0x34b20
jmp 0x34ae5
movq %rax, %rbx
movq 0x228(%rsp), %rdi
cmpq %r12, %rdi
je 0x34cc8
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34cc8
jmp 0x34bbc
jmp 0x34bc9
movq %rax, %rbx
leaq 0x50(%rsp), %r14
jmp 0x34c03
jmp 0x34c20
jmp 0x34a89
movq %rax, %rbx
leaq 0x50(%rsp), %r14
jmp 0x34c44
movq %rax, %rbx
movq 0x228(%rsp), %rdi
cmpq %r12, %rdi
je 0x34c23
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34c23
movq %rax, %rbx
leaq 0x50(%rsp), %r14
jmp 0x34c69
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x34ae8
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34ae8
jmp 0x34bc1
movq %rax, %rbx
leaq 0x4c8(%rsp), %rdi
callq 0x4480
jmp 0x34aff
jmp 0x34bbc
movq %rax, %rbx
movq 0x17492(%rip), %rsi     # 0x4bf98
leaq 0x6c8(%rsp), %rdi
callq 0x4260
leaq 0x748(%rsp), %rdi
callq 0x4140
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x34b45
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x1b0(%rsp), %rdi
callq 0x6aa2
jmp 0x34bcc
movq %rax, %rbx
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x34b83
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34b83
jmp 0x34bbc
movq %rax, %rbx
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x34bad
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34bad
movq %rax, %rbx
leaq 0x1f8(%rsp), %rdi
callq 0xd908
jmp 0x34bf1
movq %rax, %rbx
jmp 0x34bf1
movq %rax, %rbx
jmp 0x34cc8
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x34bf1
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x50(%rsp), %r14
leaq 0x228(%rsp), %rdi
callq 0xcecc
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x34c28
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34c28
movq %rax, %rbx
leaq 0x50(%rsp), %r14
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x34c44
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x34c69
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x1c8(%rsp), %rdi
callq 0x31516
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x34c8d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x34cae
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x198(%rsp), %rdi
callq 0x6aa2
leaq 0x120(%rsp), %rdi
callq 0x6aa2
movq 0x172c9(%rip), %rsi     # 0x4bf98
leaq 0x850(%rsp), %rdi
callq 0x4260
leaq 0x8d0(%rsp), %rdi
callq 0x4140
movq %rbx, %rdi
callq 0x45a0