// File: /workspace/github_cpp_makefile_star2_O3/MiWitt[P]HLAbaits/main.cpp
// Function: main
int main(int argc, char** argv) {

    try
    {
        // Achtung Anpassung auch weiter unten: if(argc==7) und ifstream inProbes(argv[6]);
        if(argc != 6 && argc != 7)
        {
            cout << "run like: " << basename(argv[0]) << " probe_length mis_matches tiling_step ref_seq_fasta scratch [existing_probes_fasta]" << endl;
            cout << "probe_length: define the length of the probes here probes (recommended 120)"  
                 << "mis_matches: for each new fasta sequence all existing probes are aligned to it using blat. Define the number of allowed mismatches here (recommended 5)"  
                 << "tiling_step: for nun overlapping probes set tiling step = probe_length. Set it to probe_length/2 for half overlapping (recommended 60)"  
                 << "ref_seq_fasta: Provide your collection of fasta sequences here. Set the path to a multiple fasta file "  
                 << "scratch: Set the path to a scratch directory where " << basename(argv[0]) << " has read write access "   
                 << "[existing_probes_fasta]: Provide a file of already existing probes here. Be aware of the important note below"  
                 << "All output goes to stdout, so redirect the output to your destination file. (e.g. > /foo/bar/my_baits.fa)" << endl;
            cout << "IMPORTANT: if you provide an existing probes (baits) file, provide it in following format. First line unique probe name, second line probe sequence, third line unique probe name, etc. NO BLANK LINES, NO REDUNDANT PROBE NAMES." << endl;
            exit(EXIT_FAILURE);
        }
        PROBE_SIZE = atoi(argv[1]);
        MISMATCH = atoi(argv[2]);
        TILING_STEP_SIZE = atoi(argv[3]);
        SCRATCH_DIR = string(argv[5])+"/";

        string scratch_template = SCRATCH_DIR+"template_seq.fasta";
        string scratch_baits = SCRATCH_DIR+"template_baits.fasta";
        string scratch_psl = SCRATCH_DIR+"output.psl";
        string ref_seq_fasta = argv[4];

        string strLine;
        string strLine2;

        map<string,string> new_baits;
        map<string,string> newer_baits;
        string ID = "5884b7a6-2879-4e85-841b-9284beb34974";
        vector<string>  sequences;

        if(argc==7)
        {
            ifstream inProbes(argv[6]);
            while(getline(inProbes,strLine) && getline(inProbes,strLine2))
            {
                new_baits[strLine]=strLine2;
            }
            inProbes.close();
        }
        
        
        CMultiFasta mfa(ref_seq_fasta.c_str());
        for(CMultiFasta::iterator iMfa = mfa.begin(); iMfa != mfa.end(); iMfa++)
        {
            strLine = iMfa->first;
            strLine2 = iMfa->second;
            
            vector<string> tok = Tokenize(strLine," ");
            if(tok[0] != ID)
            {
                string tiling_seq="";
                for(int i = 0; i < sequences.size(); i++)
                {
                    if(sequences[i].size() > MAX_EXON_SIZE)
                        sequences[i].erase(INCLUDE_INTRON_FLANKS,sequences[i].size()-(2*INCLUDE_INTRON_FLANKS));
                    tiling_seq+=sequences[i];
                }
                ofstream out(scratch_template.c_str());
                out << ID << endl;
                out << tiling_seq << endl;
                out.close();

                out.open(scratch_baits.c_str());
                for(map<string,string>::iterator iter = new_baits.begin();iter != new_baits.end();iter++)
                {
                    out << iter->first << endl << iter->second << endl;
                }
                out.close();

                sequences.clear();
                sequences.push_back(strLine2);

                ostringstream osr("");
                osr << "blat  -minScore=" << PROBE_SIZE-MISMATCH 
                    <<  " -repMatch=64000 -fine -fastMap " << scratch_template
                    << " " << scratch_baits << " " << scratch_psl;
                //cout << osr.str() << endl;
                cmd_exec(osr.str());
                // blat -minScore=77 -repMatch=64000 -fine -fastMap HLA_v3.12_block_wise.fasta std_referenz_baits.txt stdout

                vector<pair<int,int> > mapping_res = parseResults(scratch_psl);
                string matches(tiling_seq.size(),'0');
                for(int i = 0; i < mapping_res.size();i++)
                    for(int j = mapping_res[i].first; j < mapping_res[i].second;j++)
                        matches[j]='1';

                vector<pair<int,int> > unmapped = getUnmappedRegions(matches);

                for(int i = 0; i < unmapped.size();i++ )
                {
                    if(tiling_seq.size() < PROBE_SIZE)
                        continue;
                    map<string,string> add_baits = tile(ID,tiling_seq,unmapped[i].first,unmapped[i].second,TILING_STEP_SIZE);
                    new_baits.insert(add_baits.begin(),add_baits.end());
                    if(argc==6)
                        newer_baits.insert(add_baits.begin(),add_baits.end());
                }

                ID=tok[0];

                //for(int i = 0; i < unmapped.size();i++ )
                //    cout << ID << " " << unmapped[i].first << " - " << unmapped[i].second << endl;
                cerr << new_baits.size() << " baits after " << ID << endl;
            }
            else
                sequences.push_back(strLine2);
        }
        


        if(argc==6)
            for(map<string,string>::iterator iter = newer_baits.begin(); iter != newer_baits.end(); iter++)
                cout << iter->first << endl << iter->second << endl;
        else
            for(map<string,string>::iterator iter = new_baits.begin(); iter != new_baits.end(); iter++)
                cout << iter->first << endl << iter->second << endl;
    
        return (EXIT_SUCCESS);
    }
    catch(CMyException e)
    {
        cerr << "An error occured: " << e.what() << endl;
    }
    catch(exception e)
    {
        cerr << "An error occured: " << e.what() << endl;
    }
    catch(...)
    {
        cerr << "An undefined error occured ..." << endl;
    }
    return  EXIT_FAILURE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x648, %rsp            # imm = 0x648
movq %rsi, %rbx
movl %edi, %r13d
leal -0x8(%r13), %eax
cmpl $-0x3, %eax
jbe 0x52d0
movq 0x8(%rbx), %rdi
callq 0x33a0
movl %eax, 0x6dd4(%rip)      # 0xb250
movq 0x10(%rbx), %rdi
callq 0x33a0
movl %eax, 0x6dc9(%rip)      # 0xb254
movq 0x18(%rbx), %rdi
callq 0x33a0
movl %eax, 0x6dbe(%rip)      # 0xb258
movq 0x28(%rbx), %rsi
leaq 0x4d0(%rsp), %rdi
leaq 0x290(%rsp), %rdx
callq 0x5a20
leaq 0x3fd4(%rip), %rsi      # 0x848e
leaq 0x4d0(%rsp), %rdi
callq 0x3450
leaq 0x2d8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x44f7
movq %rdx, 0x2c8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x2d8(%rsp)
jmp 0x44fe
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
leaq 0x2c8(%rsp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x6d74(%rip), %rdi      # 0xb298
movq %r14, %rsi
callq 0x32c0
movq (%r14), %rdi
cmpq %rbp, %rdi
je 0x4544
movq 0x2d8(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x4e0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4565
movq 0x4e0(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0xe0(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x6d20(%rip), %rsi      # 0xb298
movq 0x6d21(%rip), %rdx      # 0xb2a0
addq %rsi, %rdx
leaq 0xd0(%rsp), %rdi
callq 0x5c90
leaq 0x3efa(%rip), %rsi      # 0x8490
leaq 0xd0(%rsp), %rdi
callq 0x3450
leaq 0xc0(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x6ce2(%rip), %rsi      # 0xb298
movq 0x6ce3(%rip), %rdx      # 0xb2a0
addq %rsi, %rdx
leaq 0xb0(%rsp), %rdi
callq 0x5c90
leaq 0x3ecf(%rip), %rsi      # 0x84a3
leaq 0xb0(%rsp), %rdi
callq 0x3450
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x6ca4(%rip), %rsi      # 0xb298
movq 0x6ca5(%rip), %rdx      # 0xb2a0
addq %rsi, %rdx
leaq 0x90(%rsp), %rdi
callq 0x5c90
leaq 0x3ea6(%rip), %rsi      # 0x84b8
leaq 0x90(%rsp), %rdi
callq 0x3450
movq 0x20(%rbx), %rsi
leaq 0x220(%rsp), %rdi
leaq 0x2c8(%rsp), %rdx
callq 0x5a20
leaq 0x170(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x130(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x1e0(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x268(%rsp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x3e21(%rip), %rsi      # 0x84c3
leaq 0x3e3e(%rip), %rdx      # 0x84e7
leaq 0x20(%rsp), %rdi
callq 0x5d26
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
cmpl $0x7, %r13d
jne 0x479d
movq 0x30(%rbx), %rsi
leaq 0x2c8(%rsp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x3430
leaq 0x160(%rsp), %r14
leaq 0x120(%rsp), %r15
leaq 0x1d8(%rsp), %r12
movq 0x2c8(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3440
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4783
movq 0x2c8(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3440
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4783
movq %r12, %rdi
movq %r14, %rsi
callq 0x5b44
movq %rax, %rdi
movq %r15, %rsi
callq 0x3170
jmp 0x46fe
leaq 0x2c8(%rsp), %rdi
callq 0x3070
leaq 0x2c8(%rsp), %rdi
callq 0x3090
movq 0x220(%rsp), %rsi
leaq 0x2c8(%rsp), %rdi
leaq 0x4d0(%rsp), %rdx
callq 0x5a20
leaq 0x290(%rsp), %rdi
leaq 0x2c8(%rsp), %rsi
callq 0x69d4
movq 0x2c8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x47ec
movq 0x2d8(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x2a0(%rsp), %rax
movq 0x10(%rax), %rbp
cmpq %rax, %rbp
je 0x5030
movq 0x67b0(%rip), %rax      # 0xafb8
movq (%rax), %rcx
movq %rcx, 0x1c8(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x1c0(%rsp)
leaq 0x160(%rsp), %rbx
leaq 0x2c8(%rsp), %r12
leaq 0x208(%rsp), %r15
leaq 0x20(%rbp), %rsi
movq %rbx, %rdi
callq 0x3170
leaq 0x40(%rbp), %rsi
leaq 0x120(%rsp), %rdi
callq 0x3170
leaq 0x2d8(%rsp), %rax
movq %rax, 0x2c8(%rsp)
movq %r12, %rdi
leaq 0x3cea(%rip), %rsi      # 0x8558
leaq 0x3ce4(%rip), %rdx      # 0x8559
callq 0x5d26
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x360c
movq 0x2c8(%rsp), %rdi
leaq 0x2d8(%rsp), %rax
cmpq %rax, %rdi
je 0x48ad
movq 0x2d8(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0x208(%rsp), %rax
movq 0x8(%rax), %rdx
cmpq 0x28(%rsp), %rdx
jne 0x48de
testq %rdx, %rdx
je 0x4ffc
movq 0x20(%rsp), %rsi
movq (%rax), %rdi
callq 0x3250
testl %eax, %eax
je 0x4ffc
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x3732(%rip), %rdx      # 0x8026
movq %rdx, %rsi
callq 0x5d26
movq (%rsp), %rdi
cmpq %rdi, 0x8(%rsp)
je 0x4961
xorl %ebx, %ebx
xorl %r15d, %r15d
movq 0x8(%rdi,%rbx), %rdx
cmpq $0x7a3ab, %rdx          # imm = 0x7A3AB
jb 0x4937
addq %rbx, %rdi
addq $-0x12c, %rdx           # imm = 0xFED4
movl $0x96, %esi
callq 0x3080
movq (%rsp), %rdi
movq 0x8(%rdi,%rbx), %rdx
movq (%rdi,%rbx), %rsi
leaq 0x40(%rsp), %rdi
callq 0x30e0
incq %r15
movq (%rsp), %rdi
movq 0x8(%rsp), %rax
subq %rdi, %rax
sarq $0x5, %rax
addq $0x20, %rbx
cmpq %r15, %rax
ja 0x490c
movq 0xd0(%rsp), %rsi
movq %r12, %rbx
movq %r12, %rdi
movl $0x10, %edx
callq 0x3280
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x3290
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3190
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %r12, %rdi
callq 0x3290
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3190
movq %r12, %rdi
callq 0x3310
movq 0xb0(%rsp), %rsi
movq %r12, %rdi
movl $0x10, %edx
callq 0x3050
movq 0x1f0(%rsp), %r15
leaq 0x1e0(%rsp), %rax
cmpq %rax, %r15
je 0x4aab
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
movq %r12, %rdi
callq 0x3290
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3190
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
movq %rax, %rdi
callq 0x3290
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3190
movq %r15, %rdi
callq 0x31a0
movq %rax, %r15
jmp 0x4a16
movq %r12, %rdi
callq 0x3310
movq (%rsp), %rbx
movq 0x8(%rsp), %r15
cmpq %rbx, %r15
je 0x4b05
movq %rbp, 0x1d0(%rsp)
movq %r13, %r14
leaq 0x10(%rbx), %r13
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0x4ae5
movq (%r13), %rsi
incq %rsi
callq 0x3240
leaq 0x20(%r13), %rax
addq $0x10, %r13
cmpq %r15, %r13
movq %rax, %r13
jne 0x4ad0
movq %rbx, 0x8(%rsp)
movq %r14, %r13
movq 0x1d0(%rsp), %rbp
movq %rsp, %rdi
leaq 0x120(%rsp), %rsi
callq 0x5bc0
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0x34f8(%rip), %rdx      # 0x8026
movq %rdx, %rsi
callq 0x5d26
leaq 0x4d0(%rsp), %rdi
movq %rbx, %rsi
movl $0x10, %edx
callq 0x32f0
leaq 0x1b0(%rsp), %r15
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x4b6f
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3240
movl $0x10, %edx
leaq 0x4d0(%rsp), %rdi
leaq 0x3965(%rip), %rsi      # 0x84e8
callq 0x3290
movl 0x66c2(%rip), %esi      # 0xb250
subl 0x66c0(%rip), %esi      # 0xb254
leaq 0x4d0(%rsp), %rdi
callq 0x3400
movq %rax, %rbx
movl $0x20, %edx
movq %rax, %rdi
leaq 0x3946(%rip), %rsi      # 0x84f9
callq 0x3290
movq 0xd0(%rsp), %rsi
movq 0xd8(%rsp), %rdx
movq %rbx, %rdi
callq 0x3290
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x3976(%rip), %rsi      # 0x8558
callq 0x3290
movq 0xb0(%rsp), %rsi
movq 0xb8(%rsp), %rdx
movq %rbx, %rdi
callq 0x3290
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x3947(%rip), %rsi      # 0x8558
callq 0x3290
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
movq %rbx, %rdi
callq 0x3290
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0x4d8(%rsp), %rsi
callq 0x33c0
leaq 0x240(%rsp), %rdi
movq %rbx, %rsi
callq 0x374a
movq 0x240(%rsp), %rdi
leaq 0x250(%rsp), %rax
cmpq %rax, %rdi
je 0x4c78
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x4c94
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x108(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x38c4
movq 0x48(%rsp), %rsi
movq %r15, 0x1a0(%rsp)
leaq 0x1a0(%rsp), %rdi
movl $0x30, %edx
callq 0x32a0
movq 0x108(%rsp), %rax
movq 0x110(%rsp), %rdx
cmpq %rax, %rdx
je 0x4d24
xorl %ecx, %ecx
movslq (%rax,%rcx,8), %rsi
cmpl 0x4(%rax,%rcx,8), %esi
jge 0x4d12
movq 0x1a0(%rsp), %rax
movb $0x31, (%rax,%rsi)
incq %rsi
movq 0x108(%rsp), %rax
movslq 0x4(%rax,%rcx,8), %rdx
cmpq %rdx, %rsi
jl 0x4ce9
movq 0x110(%rsp), %rdx
incq %rcx
movq %rdx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
cmpq %rcx, %rsi
ja 0x4cdf
leaq 0xf0(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x3ba9
movq 0xf0(%rsp), %rax
movq 0xf8(%rsp), %rcx
cmpq %rax, %rcx
je 0x4e9f
movl 0x64f8(%rip), %edx      # 0xb250
xorl %ebx, %ebx
movslq %edx, %rsi
cmpq %rsi, 0x48(%rsp)
jb 0x4e89
leaq 0x150(%rsp), %rax
movq %rax, 0x140(%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x140(%rsp), %rdi
callq 0x5c90
leaq 0x190(%rsp), %rax
movq %rax, 0x180(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x180(%rsp), %r14
movq %r14, %rdi
callq 0x5c90
movq 0xf0(%rsp), %rax
movl (%rax,%rbx,8), %ecx
movl 0x4(%rax,%rbx,8), %r8d
movl 0x6482(%rip), %r9d      # 0xb258
leaq 0x60(%rsp), %rdi
leaq 0x140(%rsp), %rsi
movq %r14, %rdx
callq 0x3c79
movq 0x180(%rsp), %rdi
leaq 0x190(%rsp), %rax
cmpq %rax, %rdi
je 0x4e10
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x4e35
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0x78(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x6500
cmpl $0x6, %r13d
jne 0x4e69
movq 0x78(%rsp), %rsi
leaq 0x260(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x6500
leaq 0x60(%rsp), %rdi
callq 0x5bfe
movl 0x63d7(%rip), %edx      # 0xb250
movq 0xf0(%rsp), %rax
movq 0xf8(%rsp), %rcx
incq %rbx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
cmpq %rbx, %rsi
ja 0x4d5a
movq 0x208(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x3170
movq 0x200(%rsp), %rsi
movq 0x6130(%rip), %rdi      # 0xaff0
callq 0x3180
movq %rax, %rbx
movl $0xd, %edx
movq %rax, %rdi
leaq 0x3643(%rip), %rsi      # 0x851a
callq 0x3290
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x3290
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3190
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x4f35
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x1a0(%rsp), %rdi
cmpq %r15, %rdi
je 0x4f52
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
leaq 0x160(%rsp), %rbx
leaq 0x208(%rsp), %r15
je 0x4f7f
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
leaq 0x4d0(%rsp), %rdi
movq 0x6032(%rip), %rsi      # 0xafc0
callq 0x3160
leaq 0x540(%rsp), %rdi
callq 0x30f0
movq 0x1c8(%rsp), %rax
movq %rax, 0x2c8(%rsp)
movq -0x18(%rax), %rax
movq 0x1c0(%rsp), %rcx
movq %rcx, 0x2c8(%rsp,%rax)
leaq 0x2d0(%rsp), %rdi
callq 0x31f0
leaq 0x3c0(%rsp), %rdi
callq 0x30f0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x500c
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3240
jmp 0x500c
movq %rsp, %rdi
leaq 0x120(%rsp), %rsi
callq 0x5bc0
movq %r15, %rdi
callq 0x5a5e
movq %rbp, %rdi
callq 0x31a0
movq %rax, %rbp
leaq 0x2a0(%rsp), %rax
cmpq %rax, %rbp
jne 0x4837
cmpl $0x6, %r13d
jne 0x50e7
movq 0x278(%rsp), %rbx
leaq 0x268(%rsp), %r12
cmpq %r12, %rbx
je 0x5197
movq 0x5f76(%rip), %r14      # 0xafd0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x3290
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3190
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
movq %rax, %rdi
callq 0x3290
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3190
movq %rbx, %rdi
callq 0x31a0
movq %rax, %rbx
cmpq %r12, %rax
jne 0x505a
jmp 0x5197
movq 0x1f0(%rsp), %rbx
leaq 0x1e0(%rsp), %rax
cmpq %rax, %rbx
je 0x5197
movq 0x5ec9(%rip), %r14      # 0xafd0
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r14, %rdi
callq 0x3290
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3190
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
movq %rax, %rdi
callq 0x3290
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r15, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3190
movq %rbx, %rdi
callq 0x31a0
movq %rax, %rbx
leaq 0x1e0(%rsp), %rax
cmpq %rax, %rbx
jne 0x5107
leaq 0x290(%rsp), %rdi
callq 0x7046
movq %rsp, %rdi
callq 0x5a5e
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x51c8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x260(%rsp), %rdi
callq 0x5bfe
leaq 0x1d8(%rsp), %rdi
callq 0x5bfe
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x5207
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0x160(%rsp), %rdi
leaq 0x170(%rsp), %rax
cmpq %rax, %rdi
je 0x522c
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x230(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x524d
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x5272
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x5297
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x52bc
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3240
xorl %eax, %eax
addq $0x648, %rsp            # imm = 0x648
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5cf9(%rip), %rdi      # 0xafd0
leaq 0x2d79(%rip), %rsi      # 0x8057
movl $0xa, %edx
callq 0x3290
movq (%rbx), %rdi
callq 0x3330
movq 0x5cd9(%rip), %rdi      # 0xafd0
movq %rax, %rsi
callq 0x3220
movq %rax, %r14
leaq 0x2d59(%rip), %rsi      # 0x8062
movl $0x53, %edx
movq %rax, %rdi
callq 0x3290
movq %r14, %rdi
callq 0x3130
movq 0x5cab(%rip), %rdi      # 0xafd0
leaq 0x2d8a(%rip), %rsi      # 0x80b6
movl $0x4b, %edx
callq 0x3290
movq 0x5c93(%rip), %rdi      # 0xafd0
leaq 0x2dbe(%rip), %rsi      # 0x8102
movl $0x97, %edx
callq 0x3290
movq 0x5c7b(%rip), %rdi      # 0xafd0
leaq 0x2e3e(%rip), %rsi      # 0x819a
movl $0x86, %edx
callq 0x3290
movq 0x5c63(%rip), %rdi      # 0xafd0
leaq 0x2ead(%rip), %rsi      # 0x8221
movl $0x66, %edx
callq 0x3290
movq 0x5c4b(%rip), %rdi      # 0xafd0
leaq 0x2efc(%rip), %rsi      # 0x8288
movl $0x33, %edx
callq 0x3290
movq (%rbx), %rdi
callq 0x3330
movq 0x5c2b(%rip), %rdi      # 0xafd0
movq %rax, %rsi
callq 0x3220
movq %rax, %rbx
leaq 0x2f05(%rip), %rsi      # 0x82bc
movl $0x17, %edx
movq %rax, %rdi
callq 0x3290
leaq 0x2f09(%rip), %rsi      # 0x82d4
movl $0x6d, %edx
movq %rbx, %rdi
callq 0x3290
leaq 0x2f63(%rip), %rsi      # 0x8342
movl $0x69, %edx
movq %rbx, %rdi
callq 0x3290
movq %rbx, %rdi
callq 0x3130
movq 0x5bd5(%rip), %rdi      # 0xafd0
leaq 0x2faa(%rip), %rsi      # 0x83ac
movl $0xe1, %edx
callq 0x3290
movq 0x5bbd(%rip), %rdi      # 0xafd0
callq 0x3130
movl $0x1, %edi
callq 0x32b0
jmp 0x5589
jmp 0x5455
movq %rdx, %rbx
movq %rax, %r14
movq 0x2c8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x56fd
movq 0x2d8(%rsp), %rsi
incq %rsi
callq 0x3240
jmp 0x56fd
movq %rdx, %rbx
movq %rax, %r14
jmp 0x56fd
jmp 0x54be
movq %rdx, %rbx
movq %rax, %r14
jmp 0x5721
jmp 0x546f
movq %rdx, %rbx
movq %rax, %r14
jmp 0x57a6
jmp 0x547c
movq %rdx, %rbx
movq %rax, %r14
jmp 0x57cb
jmp 0x5489
movq %rdx, %rbx
movq %rax, %r14
jmp 0x57f0
jmp 0x54be
movq %rdx, %rbx
movq %rax, %r14
leaq 0x4e0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5815
movq 0x4e0(%rsp), %rsi
jmp 0x580d
movq %rdx, %rbx
movq %rax, %r14
jmp 0x5815
jmp 0x5546
jmp 0x56b4
movq %rdx, %rbx
movq %rax, %r14
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x56ba
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3240
jmp 0x56ba
jmp 0x55b0
movq %rdx, %rbx
movq %rax, %r14
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x5689
movq 0x70(%rsp), %rsi
incq %rsi
jmp 0x5684
jmp 0x55b0
movq %rdx, %rbx
movq %rax, %r14
jmp 0x566c
movq %rdx, %rbx
movq %rax, %r14
jmp 0x564f
jmp 0x56ac
movq %rdx, %rbx
movq %rax, %r14
jmp 0x56e3
jmp 0x55a3
movq %rdx, %rbx
movq %rax, %r14
movq 0x2c8(%rsp), %rdi
leaq 0x2d8(%rsp), %rax
cmpq %rax, %rdi
je 0x56f0
movq 0x2d8(%rsp), %rsi
incq %rsi
callq 0x3240
jmp 0x56f0
jmp 0x55a3
movq %rdx, %rbx
movq %rax, %r14
leaq 0x2c8(%rsp), %rdi
callq 0x3090
jmp 0x56fd
jmp 0x55a3
movq %rdx, %rbx
movq %rax, %r14
jmp 0x56f0
jmp 0x5615
movq %rdx, %rbx
movq %rax, %r14
jmp 0x5689
movq %rdx, %rbx
movq %rax, %r14
jmp 0x55ee
movq %rdx, %rbx
movq %rax, %r14
movq 0x180(%rsp), %rdi
leaq 0x190(%rsp), %rax
cmpq %rax, %rdi
je 0x55ee
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x5632
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x3240
jmp 0x5632
movq %rdx, %rbx
movq %rax, %r14
jmp 0x5632
jmp 0x56b4
movq %rdx, %rbx
movq %rax, %r14
leaq 0x60(%rsp), %rdi
callq 0x5bfe
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x564f
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x1a0(%rsp), %rdi
cmpq %r15, %rdi
je 0x566c
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x5689
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x3240
movq 0x5930(%rip), %rsi      # 0xafc0
leaq 0x4d0(%rsp), %rdi
callq 0x3160
leaq 0x540(%rsp), %rdi
callq 0x30f0
jmp 0x56ba
movq %rdx, %rbx
movq %rax, %r14
jmp 0x56c7
movq %rdx, %rbx
movq %rax, %r14
leaq 0x2c8(%rsp), %rdi
callq 0x3340
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x56e3
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x208(%rsp), %rdi
callq 0x5a5e
leaq 0x290(%rsp), %rdi
callq 0x7046
movq %rsp, %rdi
callq 0x5a5e
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x5721
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x260(%rsp), %rdi
callq 0x5bfe
leaq 0x1d8(%rsp), %rdi
callq 0x5bfe
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x5760
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0x160(%rsp), %rdi
leaq 0x170(%rsp), %rax
cmpq %rax, %rdi
je 0x5785
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x230(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x57a6
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x57cb
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0x57f0
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x3240
movq 0xd0(%rsp), %rdi
leaq 0xe0(%rsp), %rax
cmpq %rax, %rdi
je 0x5815
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x3240
cmpl $0x3, %ebx
jne 0x58e3
movq %r14, %rdi
callq 0x32d0
leaq 0x2c8(%rsp), %rdi
movq %rax, %rsi
callq 0x7256
movq %r14, %rdi
callq 0x3110
movq 0x57ab(%rip), %rdi      # 0xaff0
leaq 0x2cfb(%rip), %rsi      # 0x8547
movl $0x12, %edx
callq 0x3290
leaq 0x4d0(%rsp), %rbx
leaq 0x2c8(%rsp), %rsi
movq %rbx, %rdi
callq 0x7506
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x5774(%rip), %rdi      # 0xaff0
callq 0x3290
movq %rax, %rdi
callq 0x3130
leaq 0x4e0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x58aa
movq 0x4e0(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x54af(%rip), %rax      # 0xad60
addq $0x10, %rax
leaq 0x2e0(%rsp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x5982
movq 0x2e0(%rsp), %rsi
incq %rsi
callq 0x3240
jmp 0x5982
cmpl $0x2, %ebx
jne 0x5956
movq %r14, %rdi
callq 0x32d0
movq 0x56d1(%rip), %rax      # 0xafc8
addq $0x10, %rax
movq %rax, 0x2c8(%rsp)
movq %r14, %rdi
callq 0x3110
movq 0x56de(%rip), %rdi      # 0xaff0
leaq 0x2c2e(%rip), %rsi      # 0x8547
movl $0x12, %edx
callq 0x3290
leaq 0x2c8(%rsp), %rdi
callq 0x3460
movq 0x56b9(%rip), %rdi      # 0xaff0
movq %rax, %rsi
callq 0x3220
movq %rax, %rdi
callq 0x3130
leaq 0x2c8(%rsp), %rdi
callq 0x3470
jmp 0x5982
movq %r14, %rdi
callq 0x3110
movq 0x568b(%rip), %rdi      # 0xaff0
leaq 0x2bbc(%rip), %rsi      # 0x8528
movl $0x1e, %edx
callq 0x3290
movq 0x5673(%rip), %rdi      # 0xaff0
callq 0x3130
callq 0x33d0
movl $0x1, %eax
jmp 0x52be
movq %rax, %rbx
callq 0x33d0
jmp 0x5a10
movq %rax, %rbx
jmp 0x59db
movq %rax, %rbx
leaq 0x2c8(%rsp), %rdi
callq 0x3470
callq 0x33d0
jmp 0x5a10
movq %rax, %rbx
leaq 0x4e0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x59db
movq 0x4e0(%rsp), %rsi
incq %rsi
callq 0x3240
leaq 0x537e(%rip), %rax      # 0xad60
addq $0x10, %rax
leaq 0x2e0(%rsp), %rcx
movq %rax, -0x18(%rcx)
movq -0x10(%rcx), %rdi
cmpq %rcx, %rdi
je 0x5a0b
movq 0x2e0(%rsp), %rsi
incq %rsi
callq 0x3240
callq 0x33d0
movq %rbx, %rdi
callq 0x3410
movq %rax, %rdi
callq 0x5abc