// File: /workspace/github_cpp_makefile_star2_O3/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 0x438(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xb79b(%rip), %rdx      # 0x3eb0a
leaq 0x428(%rsp), %rdi
movq %rdx, %rsi
callq 0x5384
leaq 0x868(%rsp), %rbx
leaq 0x428(%rsp), %rsi
movq %rbx, %rdi
callq 0x4490
movq 0x428(%rsp), %rdi
cmpq %r12, %rdi
je 0x333b4
movq 0x438(%rsp), %rsi
incq %rsi
callq 0x4340
cmpl $0x4, %ebp
jg 0x336e2
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 0xb78f(%rip), %rsi      # 0x3eb82
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 0xb787(%rip), %rsi      # 0x3ebba
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 0xa858(%rip), %rsi      # 0x3dccb
movl $0x10, %edx
movq %r14, %rdi
callq 0x43a0
leaq 0xb794(%rip), %rsi      # 0x3ec1b
movl $0x15, %edx
movq %r14, %rdi
callq 0x43a0
leaq 0xae8f(%rip), %rsi      # 0x3e32a
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 0xb72c(%rip), %rsi      # 0x3ec31
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 0xa7be(%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 0xab5d(%rip), %rsi      # 0x3e10c
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 0xb695(%rip), %rsi      # 0x3ec84
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 0xaba8(%rip), %rsi      # 0x3e1d7
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 0x428(%rsp), %rdi
movq %rbx, %rsi
callq 0x44f0
movq 0x428(%rsp), %rsi
movq 0x430(%rsp), %rdx
movq 0x18939(%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 0x428(%rsp), %rdi
cmpq %r12, %rdi
je 0x336db
movq 0x438(%rsp), %rsi
incq %rsi
callq 0x4340
xorl %ebx, %ebx
jmp 0x345d5
callq 0x4200
movq %rax, %rbx
movq 0x10(%r14), %rsi
leaq 0x428(%rsp), %rdi
leaq 0x228(%rsp), %rdx
callq 0x5346
leaq 0x6c8(%rsp), %rdx
movb $0x2c, (%rdx)
leaq 0x120(%rsp), %rdi
leaq 0x428(%rsp), %rsi
callq 0x367c0
movq 0x428(%rsp), %rdi
cmpq %r12, %rdi
je 0x33740
movq 0x438(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x18(%r14), %rsi
leaq 0x428(%rsp), %rdi
leaq 0x228(%rsp), %rdx
callq 0x5346
leaq 0x6c8(%rsp), %rdx
movb $0x2c, (%rdx)
leaq 0x1c8(%rsp), %rdi
leaq 0x428(%rsp), %rsi
callq 0x367c0
movq 0x428(%rsp), %rdi
cmpq %r12, %rdi
je 0x33796
movq 0x438(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x128(%rsp), %rax
subq 0x120(%rsp), %rax
movq 0x1d0(%rsp), %rcx
subq 0x1c8(%rsp), %rcx
cmpq %rcx, %rax
jne 0x34470
movq 0x20(%r14), %rsi
leaq 0x158(%rsp), %rdi
leaq 0x428(%rsp), %rdx
callq 0x5346
cmpq $0x0, 0x160(%rsp)
jne 0x33801
leaq 0xb51b(%rip), %rcx      # 0x3ed05
leaq 0x158(%rsp), %rdi
movl $0x4, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x44c0
movq 0x120(%rsp), %r13
movq 0x128(%rsp), %rax
movq %rax, 0x180(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x7370(%rip), %rsi      # 0x3ab99
leaq 0x73e8(%rip), %rdx      # 0x3ac18
leaq 0x20(%rsp), %rdi
callq 0x5384
cvtsi2sd %rbx, %xmm0
movsd %xmm0, 0x178(%rsp)
leaq 0x1a0(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
leaq 0x10(%rsp), %rbp
leaq 0x5b0(%rsp), %r15
movq 0x18744(%rip), %rax     # 0x4bfc0
movq (%rax), %rcx
movq %rcx, 0x190(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x188(%rsp)
movq $-0x1, 0xd0(%rsp)
cmpq 0x180(%rsp), %r13
sete %al
movl %eax, 0xa4(%rsp)
je 0x344bd
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xd940
movq 0xd0(%rsp), %rcx
incq %rcx
movq 0x1c8(%rsp), %rax
movq %rcx, 0xd0(%rsp)
shlq $0x5, %rcx
leaq 0x50(%rsp), %rdx
movq %rdx, 0x40(%rsp)
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0xd940
movl $0x21, %edx
movq 0x1869e(%rip), %rdi     # 0x4bfc8
leaq 0xb3d9(%rip), %rsi      # 0x3ed0a
callq 0x43a0
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x18681(%rip), %rdi     # 0x4bfc8
callq 0x43a0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6c9d(%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, 0x428(%rsp)
movq 0x158(%rsp), %rsi
movq 0x160(%rsp), %rdx
addq %rsi, %rdx
leaq 0x428(%rsp), %rbx
movq %rbx, %rdi
callq 0xd940
movq %rbx, %rdi
leaq 0x80fd(%rip), %rsi      # 0x3bad7
callq 0x45e0
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x4120
movq %rbp, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x33a12
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x33a1b
movupd (%rcx), %xmm0
movupd %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x428(%rsp), %rdi
cmpq %r12, %rdi
je 0x33a50
movq 0x438(%rsp), %rsi
incq %rsi
callq 0x4340
movq (%rsp), %rdi
callq 0x44a0
testq %rax, %rax
je 0x33a68
movq %rax, %rdi
callq 0x4500
jmp 0x33a89
callq 0x4050
cmpl $0x2, (%rax)
jne 0x33a89
movq (%rsp), %rdi
movl $0x1fd, %esi            # imm = 0x1FD
callq 0x4190
cmpl $-0x1, %eax
je 0x3460a
leaq 0x428(%rsp), %rbx
movq %rbx, %rdi
callq 0xcb3a
movq 0x80(%rsp), %rsi
movq %rbx, %rdi
movl $0x8, %edx
callq 0x39022
movq 0x428(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x448(%rsp,%rax)
je 0x33bd9
movl $0x2c, %edx
movq 0x184f4(%rip), %rdi     # 0x4bfc8
leaq 0xb251(%rip), %rsi      # 0x3ed2c
callq 0x43a0
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq 0x184d1(%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 %r14d, %r14d
leaq 0x18110(%rip), %rax     # 0x4bc40
movq %rax, 0x5b0(%rsp)
leaq 0x18129(%rip), %rax     # 0x4bc68
movq %rax, 0x5c0(%rsp)
movq $0x0, 0x5b8(%rsp)
leaq 0x428(%rsp), %rdi
leaq 0x18046(%rip), %rsi     # 0x4bba8
callq 0x38fcc
leaq 0x5c0(%rsp), %rdi
callq 0x4140
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x33b8a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x33ba6
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x33bcb
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4340
testb %r14b, %r14b
jne 0x3389f
jmp 0x3456a
xorl %ebx, %ebx
movq $0x0, 0xc8(%rsp)
movq %r13, 0xd8(%rsp)
leaq 0xb8(%rsp), %rax
movq %rax, 0xa8(%rsp)
leaq 0xa8(%rsp), %rdi
leaq 0xaefc(%rip), %rdx      # 0x3eb0a
movq %rdx, %rsi
callq 0x5384
movq 0x5b0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4310
movsbl %al, %edx
movq %r15, %rdi
leaq 0xa8(%rsp), %rsi
callq 0x45c0
cmpq $0x0, 0xb0(%rsp)
movl $0x4, %r15d
movq 0xa8(%rsp), %rdi
je 0x34287
cmpb $0x23, (%rdi)
je 0x34287
movb $0x9, 0x228(%rsp)
leaq 0x1e0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x228(%rsp), %rdx
callq 0x367c0
incq %rbx
movq 0x1e0(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x44d0
movl $0x4, %r15d
cmpl $0x3e8, %eax            # imm = 0x3E8
jl 0x34272
cvtsi2sd %eax, %xmm0
divsd 0x6c12(%rip), %xmm0     # 0x3a8d0
callq 0x4170
cvttsd2si %xmm0, %r14d
movq 0x1a8(%rsp), %rax
testq %rax, %rax
leaq 0x228(%rsp), %r15
je 0x33d2b
movq %rax, %r8
leaq 0x1a0(%rsp), %rdi
movq %rdi, %rcx
movq %r8, %rdx
movl 0x20(%r8), %esi
xorl %r8d, %r8d
cmpl %r14d, %esi
setl %r8b
movq %rdx, %rdi
cmovlq %rcx, %rdi
movq 0x10(%rdx,%r8,8), %r8
testq %r8, %r8
jne 0x33ce8
leaq 0x1a0(%rsp), %r8
cmpq %r8, %rdi
je 0x33d2b
cmpl %r14d, %esi
cmovlq %rcx, %rdx
cmpl %r14d, 0x20(%rdx)
jle 0x33daf
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 %r14d, 0x228(%rsp)
leaq 0x230(%rsp), %rdi
leaq 0x6c8(%rsp), %rsi
callq 0xd104
leaq 0x198(%rsp), %rdi
movq %r15, %rsi
callq 0x31ce0
leaq 0x230(%rsp), %rdi
callq 0xd816
leaq 0x6c8(%rsp), %rdi
callq 0xd816
movq 0x1a8(%rsp), %rax
movq %r12, %rbp
leaq 0x1a0(%rsp), %rcx
movq %rcx, %r12
testq %rax, %rax
je 0x33e04
movq %rcx, %rsi
movq %rcx, %r8
movq %rsi, %rcx
movq %rax, %rdx
movl 0x20(%rax), %edi
xorl %eax, %eax
cmpl %r14d, %edi
setl %al
movq %rdx, %rsi
cmovlq %rcx, %rsi
movq 0x10(%rdx,%rax,8), %rax
testq %rax, %rax
jne 0x33dc8
movq %r8, %r12
cmpq %r8, %rsi
je 0x33e04
cmpl %r14d, %edi
cmovlq %rcx, %rdx
cmpl %r14d, 0x20(%rdx)
cmovgq %r8, %rsi
movq %rsi, %r12
movq %rbx, %r13
movq 0x1e0(%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 0xd940
leaq 0x28(%r12), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0xdd92
addq $0x30, %r12
cmpq %r12, %rax
je 0x33e6a
movq %r13, %rbx
incq 0x40(%rax)
movq %rbp, %r12
leaq 0x10(%rsp), %rbp
jmp 0x33ee4
leaq 0x238(%rsp), %rax
movq %rax, 0x228(%rsp)
movq 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x228(%rsp), %rbx
movq %rbx, %rdi
callq 0xd940
movq %rbp, %r12
movq $0x1, 0x248(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0xde1c
movq 0x228(%rsp), %rdi
leaq 0x238(%rsp), %rax
cmpq %rax, %rdi
leaq 0x10(%rsp), %rbp
movq %r13, %rbx
je 0x33ee4
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x6c8(%rsp), %rdi
callq 0x4240
leaq 0x238(%rsp), %rax
movq %rax, 0x228(%rsp)
leaq 0x228(%rsp), %r15
movq %r15, %rdi
leaq 0xabf7(%rip), %rdx      # 0x3eb0a
movq %rdx, %rsi
callq 0x5384
leaq 0x6e0(%rsp), %rdi
movq %r15, %rsi
callq 0x4490
movq 0x228(%rsp), %rdi
leaq 0x238(%rsp), %rax
cmpq %rax, %rdi
je 0x33f50
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
movl $0x2, %edx
leaq 0x6d8(%rsp), %rdi
leaq 0xadf5(%rip), %rsi      # 0x3ed59
callq 0x43a0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x6d8(%rsp), %rdi
callq 0x43a0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0xadc9(%rip), %rsi      # 0x3ed5a
callq 0x43a0
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r15, %rdi
callq 0x43a0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
leaq 0x7b1d(%rip), %rsi      # 0x3bad7
callq 0x43a0
movq %r15, %rdi
movl %r14d, %esi
callq 0x4580
movl $0x6, %edx
movq %rax, %rdi
leaq 0xab3d(%rip), %rsi      # 0x3eb16
callq 0x43a0
leaq 0x228(%rsp), %rdi
callq 0x4570
leaq 0x60(%rsp), %rdi
leaq 0x6e0(%rsp), %rsi
callq 0x44f0
movq 0x60(%rsp), %rsi
leaq 0x228(%rsp), %rdi
movl $0x11, %edx
callq 0x4060
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x34030
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x228(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x248(%rsp,%rax)
je 0x340db
movl $0x1b, %edx
movq 0x17f72(%rip), %rdi     # 0x4bfc8
leaq 0x6b11(%rip), %rsi      # 0x3ab6e
callq 0x43a0
leaq 0x60(%rsp), %rdi
leaq 0x6e0(%rsp), %rsi
callq 0x44f0
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x17f43(%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 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x340d0
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4340
movl $0x1, %r15d
jmp 0x341ee
movq 0xa8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
leaq 0x228(%rsp), %rdi
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 0x228(%rsp), %rdi
callq 0x4440
incq 0xc8(%rsp)
movq %rbx, %rax
movabsq $0x790fb65668c26139, %rcx # imm = 0x790FB65668C26139
imulq %rcx, %rax
rorq $0x6, %rax
xorl %r15d, %r15d
movabsq $0x10c6f7a0b5ed, %rcx   # imm = 0x10C6F7A0B5ED
cmpq %rcx, %rax
ja 0x341ee
movl $0x9, %edx
movq 0x17e5a(%rip), %rdi     # 0x4bfc8
leaq 0x6d49(%rip), %rsi      # 0x3aebe
callq 0x43a0
movq 0x17e47(%rip), %rdi     # 0x4bfc8
movq %rbx, %rsi
callq 0x4210
movq %rax, %r14
movl $0x16, %edx
movq %rax, %rdi
leaq 0xabc1(%rip), %rsi      # 0x3ed5c
callq 0x43a0
movq %r14, %rdi
movq 0xc8(%rsp), %rsi
callq 0x4210
movq %rax, %r14
movl $0xb, %edx
movq %rax, %rdi
leaq 0xabb1(%rip), %rsi      # 0x3ed73
callq 0x43a0
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
movq 0x190(%rsp), %rax
movq %rax, 0x228(%rsp)
movq -0x18(%rax), %rax
movq 0x188(%rsp), %rcx
movq %rcx, 0x228(%rsp,%rax)
leaq 0x230(%rsp), %rdi
callq 0x42a0
leaq 0x320(%rsp), %rdi
callq 0x4140
leaq 0x6c8(%rsp), %rdi
movq 0x17d5d(%rip), %rsi     # 0x4bf98
callq 0x4260
leaq 0x748(%rsp), %rdi
callq 0x4140
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x34272
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x1e0(%rsp), %rdi
callq 0x6aac
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x342a4
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4340
testb $0x3, %r15b
jne 0x343ee
movq 0x428(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x448(%rsp,%rax)
movq 0xd8(%rsp), %r13
leaq 0x5b0(%rsp), %r15
je 0x33bef
movq 0x1b0(%rsp), %rbx
leaq 0x1a0(%rsp), %rax
cmpq %rax, %rbx
je 0x343e2
leaq 0x28(%rbx), %rsi
leaq 0x1f8(%rsp), %rdi
callq 0xd104
leaq 0x110(%rsp), %rax
movq %rax, 0x100(%rsp)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %rdi
callq 0xd940
leaq 0x148(%rsp), %rax
movq %rax, 0x138(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x138(%rsp), %r14
movq %r14, %rdi
callq 0xd940
movl 0x20(%rbx), %ecx
leaq 0x1f8(%rsp), %rdi
leaq 0x100(%rsp), %rsi
movq %r14, %rdx
callq 0x34ab8
movl %eax, %r14d
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x3439b
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x343c0
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x1f8(%rsp), %rdi
callq 0xd816
testb %r14b, %r14b
je 0x34406
movq %rbx, %rdi
callq 0x4230
movq %rax, %rbx
jmp 0x342e0
addq $0x20, %r13
movb $0x1, %r14b
jmp 0x33b29
xorl %r14d, %r14d
movq 0xd8(%rsp), %r13
leaq 0x5b0(%rsp), %r15
jmp 0x33b29
movl $0x28, %edx
movq 0x17bb6(%rip), %rdi     # 0x4bfc8
leaq 0xa966(%rip), %rsi      # 0x3ed7f
callq 0x43a0
movl 0x20(%rbx), %esi
movq 0x17ba0(%rip), %rdi     # 0x4bfc8
callq 0x4580
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0xa969(%rip), %rsi      # 0x3eda8
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 0x33b26
movq 0x17b51(%rip), %rbx     # 0x4bfc8
leaq 0xa83b(%rip), %rsi      # 0x3ecb9
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 0x17b1f(%rip), %rdi     # 0x4bfc8
callq 0x4030
movq %rax, %rdi
callq 0x4220
xorl %ebx, %ebx
jmp 0x345bb
callq 0x4200
movq %rax, %rbx
movq 0x17afc(%rip), %rdi     # 0x4bfc8
leaq 0x5e72(%rip), %rsi      # 0x3a345
movl $0x12, %edx
callq 0x43a0
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
subsd 0x178(%rsp), %xmm0
divsd 0x5b12(%rip), %xmm0     # 0x3a008
movq 0x17acb(%rip), %rdi     # 0x4bfc8
callq 0x4510
movq %rax, %rbx
leaq 0x5e4c(%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 0x198(%rsp), %rdi
callq 0x312c4
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x34593
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
movl 0xa4(%rsp), %ebx
je 0x345bb
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x1c8(%rsp), %rdi
callq 0x6aac
leaq 0x120(%rsp), %rdi
callq 0x6aac
movq 0x179bc(%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 0x179b7(%rip), %rdi     # 0x4bfc8
leaq 0x75f3(%rip), %rsi      # 0x3bc0b
movl $0x22, %edx
callq 0x43a0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x17996(%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
cmpq %rbp, %rdi
je 0x34677
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x34693
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x3456a
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x3456a
jmp 0x346c8
jmp 0x3478c
movq %rax, %rbx
jmp 0x34a54
jmp 0x3470f
jmp 0x34909
movq %rax, %rbx
movq 0x428(%rsp), %rdi
cmpq %r12, %rdi
je 0x34a82
movq 0x438(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34a82
movq %rax, %rbx
jmp 0x34a82
jmp 0x3475e
jmp 0x34909
movq %rax, %rbx
jmp 0x34a75
jmp 0x3475e
jmp 0x34909
jmp 0x347d1
jmp 0x34930
movq %rax, %rbx
movq 0x228(%rsp), %rdi
leaq 0x238(%rsp), %rax
cmpq %rax, %rdi
je 0x34961
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34961
jmp 0x34859
movq %rax, %rbx
movq 0x428(%rsp), %rdi
cmpq %r12, %rdi
je 0x34a8f
movq 0x438(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34a8f
jmp 0x34911
movq %rax, %rbx
leaq 0x30(%rsp), %r14
jmp 0x349d9
jmp 0x347a8
movq %rax, %rbx
leaq 0x30(%rsp), %r14
jmp 0x34a0b
movq %rax, %rbx
movq 0x428(%rsp), %rdi
cmpq %r12, %rdi
je 0x34926
movq 0x438(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34926
movq %rax, %rbx
leaq 0x30(%rsp), %r14
jmp 0x34a30
jmp 0x34923
movq %rax, %rbx
leaq 0x230(%rsp), %rdi
callq 0xd816
jmp 0x347f8
movq %rax, %rbx
leaq 0x6c8(%rsp), %rdi
callq 0xd816
jmp 0x34986
jmp 0x3493d
jmp 0x34911
jmp 0x348e6
jmp 0x3493d
movq %rax, %rbx
movq 0x228(%rsp), %rdi
leaq 0x238(%rsp), %rax
cmpq %rax, %rdi
je 0x34940
movq 0x238(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34940
movq %rax, %rbx
jmp 0x34986
jmp 0x34859
movq %rax, %rbx
jmp 0x34961
jmp 0x34909
jmp 0x34930
movq %rax, %rbx
jmp 0x348c2
movq %rax, %rbx
jmp 0x3489d
movq %rax, %rbx
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x3489d
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x348c2
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x1f8(%rsp), %rdi
callq 0xd816
leaq 0x30(%rsp), %r14
leaq 0x10(%rsp), %rbp
jmp 0x349cc
movq %rax, %rbx
jmp 0x34993
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x34914
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x4340
jmp 0x34914
jmp 0x34930
movq %rax, %rbx
jmp 0x34a8f
movq %rax, %rbx
leaq 0x228(%rsp), %rdi
callq 0x4480
jmp 0x34940
movq %rax, %rbx
leaq 0x30(%rsp), %r14
jmp 0x349ef
movq %rax, %rbx
leaq 0x30(%rsp), %r14
jmp 0x349cc
movq %rax, %rbx
movq 0x17651(%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 0x34986
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x1e0(%rsp), %rdi
callq 0x6aac
leaq 0x30(%rsp), %r14
leaq 0x10(%rsp), %rbp
jmp 0x349a7
movq %rax, %rbx
leaq 0x30(%rsp), %r14
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x349cc
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x428(%rsp), %rdi
callq 0xcdd6
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x349ef
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x34a0b
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4340
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x34a30
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x198(%rsp), %rdi
callq 0x312c4
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x34a54
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x34a75
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x4340
leaq 0x1c8(%rsp), %rdi
callq 0x6aac
leaq 0x120(%rsp), %rdi
callq 0x6aac
movq 0x17502(%rip), %rsi     # 0x4bf98
leaq 0x850(%rsp), %rdi
callq 0x4260
leaq 0x8d0(%rsp), %rdi
callq 0x4140
movq %rbx, %rdi
callq 0x45a0