// File: schneebergerlab[P]DrLink/separate_chr_v2.cpp
// Function: separate_chr_v2(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>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, 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, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
bool separate_chr_v2(string filename, map<string, string>* visitedChr, string* tmpflag)
{
    /* this function separates 
    
       xxx_molecule_table_trashme.txt.gz from DrLink molecule or 
       phased_variants.vcf.gz            from longranger
       
       into chr-sepecific sub-files for later processing.
       
       Input:
       
       filename  - name of input gzipped file.
       moleORvcf - if "moleTable", the file is treated as molecule table file; if "vcf", vcf file.
       
       return variable:
       
       visitedChr- map<chr, chrfilename>
    */
    // files need to be gzipped
    if(filename.size() < 4)
    {
        cout << "   Error: unexpted file name " << filename << ". Must be in form of xxx.gz ." << endl;
        return false;
    }
    if(filename.substr(filename.size()-3).compare(".gz") != 0)
    {
        cout << "   Error: only file xxx.gz for molecule table or vcf accepted. " << endl;
        return false;
    }
    //
    map<string, ogzstream*> allofp; // map<filename, filehandle>
    //
    string tmpfileflag= *tmpflag;
    // read and write
    igzstream  fp;
    fp.open(filename.c_str());
    if(!fp.good())
    {
        cout << "   Error: cannot open file " << filename << "; exited. " << endl;
        return false;
    }
    while(fp.good())
    {
        string line("");
        getline(fp, line);
        if(line.size()==0 || line[0]=='#') continue;
        
        //vector<string> lineinfo = split_string(line, '\t');
        
        string chrinfo(""); // == lineinfo[0]
        size_t tabfirst = line.find("\t");
        chrinfo = line.substr(0, tabfirst);
        
        // find chr
        size_t ipos = chrinfo.find("#");     // if found - molecule table; if not - vcf file
        bool   vcf  = false;
        if(ipos == std::string::npos)
        {
            ipos = chrinfo.size();
            vcf  = true;
        }
        string chr;
        if(line.substr(0, 3).compare("Chr")==0 || 
           line.substr(0, 3).compare("chr")==0 || 
           line.substr(0, 3).compare("CHR")==0)
        {
            chr = chrinfo.substr(3, ipos-3); 
        }
        else
        {
            chr = chrinfo.substr(0, ipos); 
        }
        // if has not been not visited, open new file for current chr if not exist
        if(allofp.find(chr)==allofp.end())
        {
            string chrfilename("");
            if(vcf == true)
            {
                int t=0;
                chrfilename = tmpfileflag + "_subfile_chr_" + chr + "_longranger_variants.vcf.gz";
                igzstream iitfp;
                iitfp.open(chrfilename.c_str(), ios::in);
                while(t<10000 && iitfp.good())
                {
                    iitfp.close();
                    tmpfileflag.clear();
                    gen_random(&tmpfileflag, 6);
                    chrfilename = tmpfileflag + "_subfile_chr_" + chr + "_longranger_variants.vcf.gz";
                    iitfp.open(chrfilename.c_str(), ios::in);
                    if(iitfp.good())
                    cout << "   Warning: tmp file " << chrfilename << " exists! Trying another!" << endl;
                }
            }
            else
            {
                int t=0;
                chrfilename = tmpfileflag + "_subfile_chr_" + chr + "_DrLink_molecules.txt.gz";
                igzstream iitfp;
                iitfp.open(chrfilename.c_str(), ios::in);
                while(t<10000 && iitfp.good())
                {
                    iitfp.close();
                    tmpfileflag.clear();
                    gen_random(&tmpfileflag, 6);
                    chrfilename = tmpfileflag + "_subfile_chr_" + chr + "_DrLink_molecules.txt.gz";
                    iitfp.open(chrfilename.c_str(), ios::in);
                    if(iitfp.good())
                    cout << "   Warning: tmp file " << chrfilename << " exists! Trying another!" << endl;
                }                
            }
            ogzstream* f = new ogzstream(chrfilename.c_str(), ios::out);   
            allofp.insert(std::pair<string, ogzstream*>(chr, f) );
            cout << "   Info: new subfile " << chrfilename << " created and opened." << endl;
            // output
            if(line.substr(0, 3).compare("Chr")==0 || 
               line.substr(0, 3).compare("chr")==0 || 
               line.substr(0, 3).compare("CHR")==0)
            {
                *f << line.substr(3) << endl;
            }
            else
            {
                *f << line << endl;
            }
            // collect chr and filename
            (*visitedChr).insert(std::pair<string, string>(chr, chrfilename));
        }
        else //if differ from last Chr, output to existing file for current chr if exists
        {
            ogzstream* f       = allofp[chr];
            // output 
            if(line.substr(0, 3).compare("Chr")==0 || 
               line.substr(0, 3).compare("chr")==0 || 
               line.substr(0, 3).compare("CHR")==0)
            {
                *f << line.substr(3) << endl;
            }
            else
            {
                *f << line << endl;
            }
        }
    }
    //
    fp.close();
    //
    map<string, ogzstream*>::iterator fitr;
    map<string, ogzstream*>::iterator fitr_end;
    fitr     = allofp.begin();
    fitr_end = allofp.end();
    while(fitr != fitr_end)
    {
        ogzstream* f = (*fitr).second;
        (*f).close();
        fitr ++;
    }
    //
    (*tmpflag) = tmpfileflag;
    return true;
}

// Assembly:
subq $0xf18, %rsp            # imm = 0xF18
movq %rdi, 0x188(%rsp)
movq %rdi, 0xf08(%rsp)
movq %rsi, 0xf00(%rsp)
movq %rdx, 0xef8(%rsp)
callq 0x5310
cmpq $0x4, %rax
jae 0x5ea90
movq 0x2657f(%rip), %rdi     # 0x84fc8
leaq 0xc3e7(%rip), %rsi      # 0x6ae37
callq 0x5460
movq 0x188(%rsp), %rsi
movq %rax, %rdi
callq 0x53e0
movq %rax, %rdi
leaq 0xc3e6(%rip), %rsi      # 0x6ae55
callq 0x5460
movq %rax, %rdi
movq 0x26532(%rip), %rsi     # 0x84fb0
callq 0x54b0
movb $0x0, 0xf17(%rsp)
jmp 0x60250
movq 0x188(%rsp), %rdi
callq 0x5310
movq 0x188(%rsp), %rsi
movq %rax, %rdx
subq $0x3, %rdx
leaq 0xed8(%rsp), %rdi
movq $-0x1, %rcx
callq 0x5490
leaq 0xed8(%rsp), %rdi
leaq 0x7968(%rip), %rsi      # 0x66437
callq 0x5140
movl %eax, 0x184(%rsp)
leaq 0xed8(%rsp), %rdi
callq 0x58b8
movl 0x184(%rsp), %eax
cmpl $0x0, %eax
je 0x5eb23
movq 0x264cd(%rip), %rdi     # 0x84fc8
leaq 0xc371(%rip), %rsi      # 0x6ae73
callq 0x5460
movq %rax, %rdi
movq 0x2649f(%rip), %rsi     # 0x84fb0
callq 0x54b0
movb $0x0, 0xf17(%rsp)
jmp 0x60250
leaq 0xea8(%rsp), %rdi
callq 0x51490
movq 0xef8(%rsp), %rsi
leaq 0xe88(%rsp), %rdi
callq 0x51f0
jmp 0x5eb47
leaq 0xbd8(%rsp), %rdi
callq 0xf8b0
jmp 0x5eb56
movq 0x188(%rsp), %rdi
callq 0x51d0
movq %rax, %rsi
leaq 0xbd8(%rsp), %rdi
movl $0x8, %edx
callq 0xf9c0
jmp 0x5eb7a
movq 0xbd8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0xbd8(%rsp,%rax), %rdi
callq 0x5760
movb %al, 0x183(%rsp)
jmp 0x5eb9c
movb 0x183(%rsp), %al
testb $0x1, %al
jne 0x5ec80
jmp 0x5ebad
movq 0x26414(%rip), %rdi     # 0x84fc8
leaq 0x7f9b(%rip), %rsi      # 0x66b56
callq 0x5460
movq %rax, 0x178(%rsp)
jmp 0x5ebca
movq 0x188(%rsp), %rsi
movq 0x178(%rsp), %rdi
callq 0x53e0
movq %rax, 0x170(%rsp)
jmp 0x5ebe9
movq 0x170(%rsp), %rdi
leaq 0xc2bb(%rip), %rsi      # 0x6aeb3
callq 0x5460
movq %rax, 0x168(%rsp)
jmp 0x5ec07
movq 0x168(%rsp), %rdi
movq 0x2639a(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x5ec1d
movb $0x0, 0xf17(%rsp)
movl $0x1, 0xbd4(%rsp)
jmp 0x601fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x60241
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x60234
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x60227
jmp 0x5ec82
movq 0xbd8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0xbd8(%rsp,%rax), %rdi
callq 0x5760
movb %al, 0x167(%rsp)
jmp 0x5eca4
movb 0x167(%rsp), %al
testb $0x1, %al
jne 0x5ecb4
jmp 0x60105
leaq 0xbaf(%rsp), %rdi
movq %rdi, 0x158(%rsp)
callq 0x57c0
movq 0x158(%rsp), %rdx
leaq 0xbebc(%rip), %rsi      # 0x6ab94
leaq 0xbb0(%rsp), %rdi
callq 0x6880
jmp 0x5ece7
leaq 0xbaf(%rsp), %rdi
callq 0x54d0
leaq 0xd60(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
callq 0x50c0
jmp 0x5ed0b
leaq 0xbb0(%rsp), %rdi
callq 0x5310
cmpq $0x0, %rax
je 0x5ed49
xorl %eax, %eax
movl %eax, %esi
leaq 0xbb0(%rsp), %rdi
callq 0x5880
movq %rax, 0x150(%rsp)
jmp 0x5ed39
movq 0x150(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x5ed98
movl $0x2, 0xbd4(%rsp)
jmp 0x600b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
leaq 0xbaf(%rsp), %rdi
callq 0x54d0
jmp 0x60227
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x600f3
leaq 0xb87(%rsp), %rdi
movq %rdi, 0x148(%rsp)
callq 0x57c0
movq 0x148(%rsp), %rdx
leaq 0xbdd8(%rip), %rsi      # 0x6ab94
leaq 0xb88(%rsp), %rdi
callq 0x6880
jmp 0x5edcb
leaq 0xb87(%rsp), %rdi
callq 0x54d0
leaq 0xbdb4(%rip), %rsi      # 0x6ab93
xorl %eax, %eax
movl %eax, %edx
movq %rdx, 0x140(%rsp)
leaq 0xbb0(%rsp), %rdi
movq %rdi, 0x138(%rsp)
callq 0x5870
movq 0x138(%rsp), %rsi
movq 0x140(%rsp), %rdx
movq %rax, 0xb78(%rsp)
movq 0xb78(%rsp), %rcx
leaq 0xb58(%rsp), %rdi
callq 0x5490
jmp 0x5ee2f
leaq 0xb88(%rsp), %rdi
leaq 0xb58(%rsp), %rsi
callq 0x5550
leaq 0xb58(%rsp), %rdi
callq 0x58b8
leaq 0xb88(%rsp), %rdi
leaq 0xc202(%rip), %rsi      # 0x6b062
xorl %eax, %eax
movl %eax, %edx
callq 0x5870
movq %rax, 0xb50(%rsp)
movb $0x0, 0xb4f(%rsp)
cmpq $-0x1, 0xb50(%rsp)
jne 0x5eee2
leaq 0xb88(%rsp), %rdi
callq 0x5310
movq %rax, 0xb50(%rsp)
movb $0x1, 0xb4f(%rsp)
jmp 0x5eee2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
leaq 0xb87(%rsp), %rdi
callq 0x54d0
jmp 0x600f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x600e6
leaq 0xb28(%rsp), %rdi
callq 0x55e0
movb $0x0, 0xae7(%rsp)
movb $0x0, 0xabf(%rsp)
xorl %eax, %eax
movl %eax, %edx
leaq 0xb08(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
movl $0x3, %ecx
callq 0x5490
jmp 0x5ef1f
leaq 0xb08(%rsp), %rdi
leaq 0xbf90(%rip), %rsi      # 0x6aebe
callq 0x5140
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0x137(%rsp)
je 0x5efdc
xorl %eax, %eax
movl %eax, %edx
leaq 0xae8(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
movl $0x3, %ecx
callq 0x5490
jmp 0x5ef67
movb $0x1, 0xae7(%rsp)
leaq 0xae8(%rsp), %rdi
leaq 0xbf44(%rip), %rsi      # 0x6aec2
callq 0x5140
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0x137(%rsp)
je 0x5efdc
xorl %eax, %eax
movl %eax, %edx
leaq 0xac0(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
movl $0x3, %ecx
callq 0x5490
jmp 0x5efb3
movb $0x1, 0xabf(%rsp)
leaq 0xac0(%rsp), %rdi
leaq 0xbefc(%rip), %rsi      # 0x6aec6
callq 0x5140
cmpl $0x0, %eax
sete %al
movb %al, 0x137(%rsp)
movb 0x137(%rsp), %al
movb %al, 0x136(%rsp)
testb $0x1, 0xabf(%rsp)
jne 0x5eff6
jmp 0x5f003
leaq 0xac0(%rsp), %rdi
callq 0x58b8
testb $0x1, 0xae7(%rsp)
jne 0x5f00f
jmp 0x5f01c
leaq 0xae8(%rsp), %rdi
callq 0x58b8
leaq 0xb08(%rsp), %rdi
callq 0x58b8
movb 0x136(%rsp), %al
testb $0x1, %al
jne 0x5f039
jmp 0x5f0f8
movq 0xb50(%rsp), %rcx
addq $-0x3, %rcx
leaq 0xa98(%rsp), %rdi
leaq 0xb88(%rsp), %rsi
movl $0x3, %edx
callq 0x5490
jmp 0x5f061
leaq 0xb28(%rsp), %rdi
leaq 0xa98(%rsp), %rsi
callq 0x5550
leaq 0xa98(%rsp), %rdi
callq 0x58b8
jmp 0x5f13d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x600d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x5f0e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
testb $0x1, 0xae7(%rsp)
jne 0x5f0d7
jmp 0x5f0e4
leaq 0xae8(%rsp), %rdi
callq 0x58b8
jmp 0x5f0e6
leaq 0xb08(%rsp), %rdi
callq 0x58b8
jmp 0x600d9
movq 0xb50(%rsp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq 0xa78(%rsp), %rdi
leaq 0xb88(%rsp), %rsi
callq 0x5490
jmp 0x5f11b
leaq 0xb28(%rsp), %rdi
leaq 0xa78(%rsp), %rsi
callq 0x5550
leaq 0xa78(%rsp), %rdi
callq 0x58b8
leaq 0xea8(%rsp), %rdi
leaq 0xb28(%rsp), %rsi
callq 0x602d0
movq %rax, 0x128(%rsp)
jmp 0x5f15c
movq 0x128(%rsp), %rax
movq %rax, 0xa70(%rsp)
leaq 0xea8(%rsp), %rdi
callq 0x524c0
movq %rax, 0xa68(%rsp)
leaq 0xa70(%rsp), %rdi
leaq 0xa68(%rsp), %rsi
callq 0x54d00
testb $0x1, %al
jne 0x5f19f
jmp 0x5fe03
leaq 0xa47(%rsp), %rdi
movq %rdi, 0x120(%rsp)
callq 0x57c0
movq 0x120(%rsp), %rdx
leaq 0xb9d1(%rip), %rsi      # 0x6ab94
leaq 0xa48(%rsp), %rdi
callq 0x6880
jmp 0x5f1d2
leaq 0xa47(%rsp), %rdi
callq 0x54d0
movb 0xb4f(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x5f5e2
movl $0x0, 0xa40(%rsp)
leaq 0x9f4e(%rip), %rdx      # 0x69154
leaq 0x9e0(%rsp), %rdi
leaq 0xe88(%rsp), %rsi
callq 0xfae0
jmp 0x5f21d
leaq 0xa00(%rsp), %rdi
leaq 0x9e0(%rsp), %rsi
leaq 0xb28(%rsp), %rdx
callq 0xfbf0
jmp 0x5f23c
leaq 0x9f1f(%rip), %rdx      # 0x69162
leaq 0xa20(%rsp), %rdi
leaq 0xa00(%rsp), %rsi
callq 0x8760
jmp 0x5f25a
leaq 0xa48(%rsp), %rdi
leaq 0xa20(%rsp), %rsi
movq %rsi, 0x118(%rsp)
callq 0x5550
movq 0x118(%rsp), %rdi
callq 0x58b8
leaq 0xa00(%rsp), %rdi
callq 0x58b8
leaq 0x9e0(%rsp), %rdi
callq 0x58b8
leaq 0x740(%rsp), %rdi
callq 0xf8b0
jmp 0x5f2ad
leaq 0xa48(%rsp), %rdi
callq 0x51d0
movq %rax, %rsi
leaq 0x740(%rsp), %rdi
movl $0x8, %edx
callq 0xf9c0
jmp 0x5f2d1
jmp 0x5f2d3
xorl %eax, %eax
cmpl $0x2710, 0xa40(%rsp) # imm = 0x2710
movb %al, 0x117(%rsp)
jge 0x5f31b
movq 0x740(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x740(%rsp,%rax), %rdi
callq 0x5760
movb %al, 0x116(%rsp)
jmp 0x5f30b
movb 0x116(%rsp), %al
movb %al, 0x117(%rsp)
jmp 0x5f31b
movb 0x117(%rsp), %al
testb $0x1, %al
jne 0x5f32b
jmp 0x5f5be
leaq 0x740(%rsp), %rdi
callq 0x65264
jmp 0x5f33a
leaq 0xe88(%rsp), %rdi
movq %rdi, 0x108(%rsp)
callq 0x55b0
movq 0x108(%rsp), %rdi
movl $0x6, %esi
callq 0x60270
jmp 0x5f363
leaq 0x9dea(%rip), %rdx      # 0x69154
leaq 0x6e0(%rsp), %rdi
leaq 0xe88(%rsp), %rsi
callq 0xfae0
jmp 0x5f381
leaq 0x700(%rsp), %rdi
leaq 0x6e0(%rsp), %rsi
leaq 0xb28(%rsp), %rdx
callq 0xfbf0
jmp 0x5f3a0
leaq 0x9dbb(%rip), %rdx      # 0x69162
leaq 0x720(%rsp), %rdi
leaq 0x700(%rsp), %rsi
callq 0x8760
jmp 0x5f3be
leaq 0xa48(%rsp), %rdi
movq %rdi, 0x100(%rsp)
leaq 0x720(%rsp), %rsi
movq %rsi, 0xf8(%rsp)
callq 0x5550
movq 0xf8(%rsp), %rdi
callq 0x58b8
leaq 0x700(%rsp), %rdi
callq 0x58b8
leaq 0x6e0(%rsp), %rdi
callq 0x58b8
movq 0x100(%rsp), %rdi
callq 0x51d0
movq %rax, %rsi
leaq 0x740(%rsp), %rdi
movl $0x8, %edx
callq 0xf9c0
jmp 0x5f42e
movq 0x740(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x740(%rsp,%rax), %rdi
callq 0x5760
movb %al, 0xf7(%rsp)
jmp 0x5f450
movb 0xf7(%rsp), %al
testb $0x1, %al
jne 0x5f460
jmp 0x5f5b9
movq 0x25b61(%rip), %rdi     # 0x84fc8
leaq 0xba5c(%rip), %rsi      # 0x6aeca
callq 0x5460
movq %rax, 0xe8(%rsp)
jmp 0x5f47d
movq 0xe8(%rsp), %rdi
leaq 0xa48(%rsp), %rsi
callq 0x53e0
movq %rax, 0xe0(%rsp)
jmp 0x5f49c
movq 0xe0(%rsp), %rdi
leaq 0xba35(%rip), %rsi      # 0x6aee0
callq 0x5460
movq %rax, 0xd8(%rsp)
jmp 0x5f4ba
movq 0xd8(%rsp), %rdi
movq 0x25ae7(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x5f4d0
jmp 0x5f5b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
leaq 0xa47(%rsp), %rdi
callq 0x54d0
jmp 0x600d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x5fdf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x5f54b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
leaq 0xa00(%rsp), %rdi
callq 0x58b8
leaq 0x9e0(%rsp), %rdi
callq 0x58b8
jmp 0x5fdf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x5f5d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x5f5aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
leaq 0x700(%rsp), %rdi
callq 0x58b8
leaq 0x6e0(%rsp), %rdi
callq 0x58b8
jmp 0x5f5d0
jmp 0x5f2d3
leaq 0x740(%rsp), %rdi
callq 0xfe60
jmp 0x5f98e
leaq 0x740(%rsp), %rdi
callq 0xfe60
jmp 0x5fdf1
movl $0x0, 0x6dc(%rsp)
leaq 0x9b60(%rip), %rdx      # 0x69154
leaq 0x678(%rsp), %rdi
leaq 0xe88(%rsp), %rsi
callq 0xfae0
jmp 0x5f60b
leaq 0x698(%rsp), %rdi
leaq 0x678(%rsp), %rsi
leaq 0xb28(%rsp), %rdx
callq 0xfbf0
jmp 0x5f62a
leaq 0x9bb2(%rip), %rdx      # 0x691e3
leaq 0x6b8(%rsp), %rdi
leaq 0x698(%rsp), %rsi
callq 0x8760
jmp 0x5f648
leaq 0xa48(%rsp), %rdi
leaq 0x6b8(%rsp), %rsi
movq %rsi, 0xd0(%rsp)
callq 0x5550
movq 0xd0(%rsp), %rdi
callq 0x58b8
leaq 0x698(%rsp), %rdi
callq 0x58b8
leaq 0x678(%rsp), %rdi
callq 0x58b8
leaq 0x3d8(%rsp), %rdi
callq 0xf8b0
jmp 0x5f69b
leaq 0xa48(%rsp), %rdi
callq 0x51d0
movq %rax, %rsi
leaq 0x3d8(%rsp), %rdi
movl $0x8, %edx
callq 0xf9c0
jmp 0x5f6bf
jmp 0x5f6c1
xorl %eax, %eax
cmpl $0x2710, 0x6dc(%rsp) # imm = 0x2710
movb %al, 0xcf(%rsp)
jge 0x5f709
movq 0x3d8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x3d8(%rsp,%rax), %rdi
callq 0x5760
movb %al, 0xce(%rsp)
jmp 0x5f6f9
movb 0xce(%rsp), %al
movb %al, 0xcf(%rsp)
jmp 0x5f709
movb 0xcf(%rsp), %al
testb $0x1, %al
jne 0x5f719
jmp 0x5f96d
leaq 0x3d8(%rsp), %rdi
callq 0x65264
jmp 0x5f728
leaq 0xe88(%rsp), %rdi
movq %rdi, 0xc0(%rsp)
callq 0x55b0
movq 0xc0(%rsp), %rdi
movl $0x6, %esi
callq 0x60270
jmp 0x5f751
leaq 0x99fc(%rip), %rdx      # 0x69154
leaq 0x378(%rsp), %rdi
leaq 0xe88(%rsp), %rsi
callq 0xfae0
jmp 0x5f76f
leaq 0x398(%rsp), %rdi
leaq 0x378(%rsp), %rsi
leaq 0xb28(%rsp), %rdx
callq 0xfbf0
jmp 0x5f78e
leaq 0x9a4e(%rip), %rdx      # 0x691e3
leaq 0x3b8(%rsp), %rdi
leaq 0x398(%rsp), %rsi
callq 0x8760
jmp 0x5f7ac
leaq 0xa48(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
leaq 0x3b8(%rsp), %rsi
movq %rsi, 0xb0(%rsp)
callq 0x5550
movq 0xb0(%rsp), %rdi
callq 0x58b8
leaq 0x398(%rsp), %rdi
callq 0x58b8
leaq 0x378(%rsp), %rdi
callq 0x58b8
movq 0xb8(%rsp), %rdi
callq 0x51d0
movq %rax, %rsi
leaq 0x3d8(%rsp), %rdi
movl $0x8, %edx
callq 0xf9c0
jmp 0x5f81c
movq 0x3d8(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x3d8(%rsp,%rax), %rdi
callq 0x5760
movb %al, 0xaf(%rsp)
jmp 0x5f83e
movb 0xaf(%rsp), %al
testb $0x1, %al
jne 0x5f84e
jmp 0x5f968
movq 0x25773(%rip), %rdi     # 0x84fc8
leaq 0xb66e(%rip), %rsi      # 0x6aeca
callq 0x5460
movq %rax, 0xa0(%rsp)
jmp 0x5f86b
movq 0xa0(%rsp), %rdi
leaq 0xa48(%rsp), %rsi
callq 0x53e0
movq %rax, 0x98(%rsp)
jmp 0x5f88a
movq 0x98(%rsp), %rdi
leaq 0xb647(%rip), %rsi      # 0x6aee0
callq 0x5460
movq %rax, 0x90(%rsp)
jmp 0x5f8a8
movq 0x90(%rsp), %rdi
movq 0x256f9(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x5f8be
jmp 0x5f968
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x5f8fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
leaq 0x698(%rsp), %rdi
callq 0x58b8
leaq 0x678(%rsp), %rdi
callq 0x58b8
jmp 0x5fdf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x5f97c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x5f959
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
leaq 0x398(%rsp), %rdi
callq 0x58b8
leaq 0x378(%rsp), %rdi
callq 0x58b8
jmp 0x5f97c
jmp 0x5f6c1
leaq 0x3d8(%rsp), %rdi
callq 0xfe60
jmp 0x5f98e
leaq 0x3d8(%rsp), %rdi
callq 0xfe60
jmp 0x5fdf1
movl $0x298, %edi            # imm = 0x298
callq 0x5470
movq %rax, 0x88(%rsp)
jmp 0x5f9a2
leaq 0xa48(%rsp), %rdi
callq 0x51d0
movq 0x88(%rsp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0x514d0
jmp 0x5f9c6
movq 0x88(%rsp), %rax
movq %rax, 0x370(%rsp)
leaq 0x348(%rsp), %rdi
leaq 0xb28(%rsp), %rsi
leaq 0x370(%rsp), %rdx
callq 0x51640
jmp 0x5f9f5
leaq 0xea8(%rsp), %rdi
leaq 0x348(%rsp), %rsi
callq 0x515f0
movb %dl, 0x7f(%rsp)
movq %rax, 0x80(%rsp)
jmp 0x5fa18
movb 0x7f(%rsp), %al
movq 0x80(%rsp), %rcx
movq %rcx, 0x338(%rsp)
movb %al, 0x340(%rsp)
leaq 0x348(%rsp), %rdi
callq 0x51680
movq 0x25581(%rip), %rdi     # 0x84fc8
leaq 0xb4ab(%rip), %rsi      # 0x6aef9
callq 0x5460
movq %rax, 0x70(%rsp)
jmp 0x5fa5a
movq 0x70(%rsp), %rdi
leaq 0xa48(%rsp), %rsi
callq 0x53e0
movq %rax, 0x68(%rsp)
jmp 0x5fa73
movq 0x68(%rsp), %rdi
leaq 0xb490(%rip), %rsi      # 0x6af0f
callq 0x5460
movq %rax, 0x60(%rsp)
jmp 0x5fa8b
movq 0x60(%rsp), %rdi
movq 0x25519(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x5fa9e
movb $0x0, 0x2f7(%rsp)
movb $0x0, 0x2cf(%rsp)
xorl %eax, %eax
movl %eax, %edx
leaq 0x318(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
movl $0x3, %ecx
callq 0x5490
jmp 0x5face
leaq 0x318(%rsp), %rdi
leaq 0xb3e1(%rip), %rsi      # 0x6aebe
callq 0x5140
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0x5f(%rsp)
je 0x5fb82
xorl %eax, %eax
movl %eax, %edx
leaq 0x2f8(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
movl $0x3, %ecx
callq 0x5490
jmp 0x5fb13
movb $0x1, 0x2f7(%rsp)
leaq 0x2f8(%rsp), %rdi
leaq 0xb398(%rip), %rsi      # 0x6aec2
callq 0x5140
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0x5f(%rsp)
je 0x5fb82
xorl %eax, %eax
movl %eax, %edx
leaq 0x2d0(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
movl $0x3, %ecx
callq 0x5490
jmp 0x5fb5c
movb $0x1, 0x2cf(%rsp)
leaq 0x2d0(%rsp), %rdi
leaq 0xb353(%rip), %rsi      # 0x6aec6
callq 0x5140
cmpl $0x0, %eax
sete %al
movb %al, 0x5f(%rsp)
movb 0x5f(%rsp), %al
movb %al, 0x5e(%rsp)
testb $0x1, 0x2cf(%rsp)
jne 0x5fb96
jmp 0x5fba3
leaq 0x2d0(%rsp), %rdi
callq 0x58b8
testb $0x1, 0x2f7(%rsp)
jne 0x5fbaf
jmp 0x5fbbc
leaq 0x2f8(%rsp), %rdi
callq 0x58b8
leaq 0x318(%rsp), %rdi
callq 0x58b8
movb 0x5e(%rsp), %al
testb $0x1, %al
jne 0x5fbd6
jmp 0x5fd18
movq 0x370(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movq %rax, 0x50(%rsp)
leaq 0x2a8(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
movl $0x3, %edx
movq $-0x1, %rcx
callq 0x5490
jmp 0x5fc0c
movq 0x50(%rsp), %rdi
leaq 0x2a8(%rsp), %rsi
callq 0x53e0
movq %rax, 0x48(%rsp)
jmp 0x5fc25
movq 0x48(%rsp), %rdi
movq 0x2537f(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x5fc38
leaq 0x2a8(%rsp), %rdi
callq 0x58b8
jmp 0x5fd50
movq 0x88(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
movl $0x298, %esi            # imm = 0x298
callq 0x5480
jmp 0x5fdf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
leaq 0x348(%rsp), %rdi
callq 0x51680
jmp 0x5fdf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x5fce0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
testb $0x1, 0x2f7(%rsp)
jne 0x5fcd1
jmp 0x5fcde
leaq 0x2f8(%rsp), %rdi
callq 0x58b8
jmp 0x5fce0
leaq 0x318(%rsp), %rdi
callq 0x58b8
jmp 0x5fdf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
leaq 0x2a8(%rsp), %rdi
callq 0x58b8
jmp 0x5fdf1
movq 0x370(%rsp), %rdi
addq $0x188, %rdi            # imm = 0x188
leaq 0xbb0(%rsp), %rsi
callq 0x53e0
movq %rax, 0x40(%rsp)
jmp 0x5fd3b
movq 0x40(%rsp), %rdi
movq 0x25269(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x5fd4e
jmp 0x5fd50
movq 0xf00(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x268(%rsp), %rdi
leaq 0xb28(%rsp), %rsi
leaq 0xa48(%rsp), %rdx
callq 0x18870
jmp 0x5fd7c
movq 0x38(%rsp), %rdi
leaq 0x268(%rsp), %rsi
callq 0x18820
movb %dl, 0x2f(%rsp)
movq %rax, 0x30(%rsp)
jmp 0x5fd99
movb 0x2f(%rsp), %al
movq 0x30(%rsp), %rcx
movq %rcx, 0x258(%rsp)
movb %al, 0x260(%rsp)
leaq 0x268(%rsp), %rdi
callq 0x188e0
leaq 0xa48(%rsp), %rdi
callq 0x58b8
jmp 0x60090
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
leaq 0x268(%rsp), %rdi
callq 0x188e0
leaq 0xa48(%rsp), %rdi
callq 0x58b8
jmp 0x600d9
leaq 0xea8(%rsp), %rdi
leaq 0xb28(%rsp), %rsi
callq 0x51fa0
movq %rax, 0x20(%rsp)
jmp 0x5fe1f
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x250(%rsp)
movb $0x0, 0x20f(%rsp)
movb $0x0, 0x1e7(%rsp)
xorl %eax, %eax
movl %eax, %edx
leaq 0x230(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
movl $0x3, %ecx
callq 0x5490
jmp 0x5fe5f
leaq 0x230(%rsp), %rdi
leaq 0xb050(%rip), %rsi      # 0x6aebe
callq 0x5140
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0x1f(%rsp)
je 0x5ff13
xorl %eax, %eax
movl %eax, %edx
leaq 0x210(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
movl $0x3, %ecx
callq 0x5490
jmp 0x5fea4
movb $0x1, 0x20f(%rsp)
leaq 0x210(%rsp), %rdi
leaq 0xb007(%rip), %rsi      # 0x6aec2
callq 0x5140
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, 0x1f(%rsp)
je 0x5ff13
xorl %eax, %eax
movl %eax, %edx
leaq 0x1e8(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
movl $0x3, %ecx
callq 0x5490
jmp 0x5feed
movb $0x1, 0x1e7(%rsp)
leaq 0x1e8(%rsp), %rdi
leaq 0xafc2(%rip), %rsi      # 0x6aec6
callq 0x5140
cmpl $0x0, %eax
sete %al
movb %al, 0x1f(%rsp)
movb 0x1f(%rsp), %al
movb %al, 0x1e(%rsp)
testb $0x1, 0x1e7(%rsp)
jne 0x5ff27
jmp 0x5ff34
leaq 0x1e8(%rsp), %rdi
callq 0x58b8
testb $0x1, 0x20f(%rsp)
jne 0x5ff40
jmp 0x5ff4d
leaq 0x210(%rsp), %rdi
callq 0x58b8
leaq 0x230(%rsp), %rdi
callq 0x58b8
movb 0x1e(%rsp), %al
testb $0x1, %al
jne 0x5ff67
jmp 0x60058
movq 0x250(%rsp), %rax
addq $0x188, %rax            # imm = 0x188
movq %rax, 0x10(%rsp)
leaq 0x1c0(%rsp), %rdi
leaq 0xbb0(%rsp), %rsi
movl $0x3, %edx
movq $-0x1, %rcx
callq 0x5490
jmp 0x5ff9d
movq 0x10(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x53e0
movq %rax, 0x8(%rsp)
jmp 0x5ffb6
movq 0x8(%rsp), %rdi
movq 0x24fee(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x5ffc9
leaq 0x1c0(%rsp), %rdi
callq 0x58b8
jmp 0x6008e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
jmp 0x60020
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
testb $0x1, 0x20f(%rsp)
jne 0x60011
jmp 0x6001e
leaq 0x210(%rsp), %rdi
callq 0x58b8
jmp 0x60020
leaq 0x230(%rsp), %rdi
callq 0x58b8
jmp 0x600d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe80(%rsp)
movl %eax, 0xe7c(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x58b8
jmp 0x600d9
movq 0x250(%rsp), %rdi
addq $0x188, %rdi            # imm = 0x188
leaq 0xbb0(%rsp), %rsi
callq 0x53e0
movq %rax, (%rsp)
jmp 0x6007a
movq (%rsp), %rdi
movq 0x24f2b(%rip), %rsi     # 0x84fb0
callq 0x54b0
jmp 0x6008c
jmp 0x6008e
jmp 0x60090
leaq 0xb28(%rsp), %rdi
callq 0x58b8
leaq 0xb88(%rsp), %rdi
callq 0x58b8
movl $0x0, 0xbd4(%rsp)
leaq 0xbb0(%rsp), %rdi
callq 0x58b8
movl 0xbd4(%rsp), %eax
testl %eax, %eax
je 0x600d4
jmp 0x600cf
jmp 0x5ec82
jmp 0x5ec82
leaq 0xb28(%rsp), %rdi
callq 0x58b8
leaq 0xb88(%rsp), %rdi
callq 0x58b8
leaq 0xbb0(%rsp), %rdi
callq 0x58b8
jmp 0x60227
leaq 0xbd8(%rsp), %rdi
callq 0x65264
jmp 0x60114
leaq 0x1b8(%rsp), %rdi
callq 0x52470
leaq 0x1b0(%rsp), %rdi
callq 0x52470
leaq 0xea8(%rsp), %rdi
callq 0x52490
movq %rax, 0x1a8(%rsp)
movq 0x1a8(%rsp), %rax
movq %rax, 0x1b8(%rsp)
leaq 0xea8(%rsp), %rdi
callq 0x524c0
movq %rax, 0x1a0(%rsp)
movq 0x1a0(%rsp), %rax
movq %rax, 0x1b0(%rsp)
leaq 0x1b8(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x524f0
testb $0x1, %al
jne 0x60193
jmp 0x601d4
leaq 0x1b8(%rsp), %rdi
callq 0x52510
movq 0x20(%rax), %rax
movq %rax, 0x198(%rsp)
movq 0x198(%rsp), %rdi
callq 0x65264
jmp 0x601bb
leaq 0x1b8(%rsp), %rdi
xorl %esi, %esi
callq 0x52530
movq %rax, 0x190(%rsp)
jmp 0x60178
movq 0xef8(%rsp), %rdi
leaq 0xe88(%rsp), %rsi
callq 0x5050
jmp 0x601eb
movb $0x1, 0xf17(%rsp)
movl $0x1, 0xbd4(%rsp)
leaq 0xbd8(%rsp), %rdi
callq 0xfe60
leaq 0xe88(%rsp), %rdi
callq 0x58b8
leaq 0xea8(%rsp), %rdi
callq 0x525a0
jmp 0x60250
leaq 0xbd8(%rsp), %rdi
callq 0xfe60
leaq 0xe88(%rsp), %rdi
callq 0x58b8
leaq 0xea8(%rsp), %rdi
callq 0x525a0
jmp 0x60261
movb 0xf17(%rsp), %al
andb $0x1, %al
addq $0xf18, %rsp            # imm = 0xF18
retq
movq 0xe80(%rsp), %rdi
callq 0x57b0
nop