// File: /workspace/github_cpp_makefile_star2_O1/millanek[P]evo/process_vcf_massoko.cpp
// Function: massokoMain(int, char**)
int massokoMain(int argc, char** argv) {
    parseMassokoOptions(argc, argv);
    std::ios_base::openmode mode = std::ios_base::in;
    string fileName = opt::vcfFile;
    string fileRoot = stripExtension(fileName);
    std::map<int, std::vector<int> > counts_blue;
    
    std::cerr << "Filtering variants from: " << fileName << std::endl;
    std::cerr << "Maximum read depth (overall) set to: " << opt::max_overall_depth << std::endl;
    std::cerr << "Minimum copies for a variant (e.g. 1 for allowing singletons): " << opt::min_copies << std::endl;
    std::cerr << "Minimum read depth at the variant position: " << opt::min_depth_in_any_individual << std::endl;
    
    // Open connection to read from the vcf file
    std::ifstream* inFile = new std::ifstream(fileName.c_str(), mode);
    std::ios_base::openmode mode_out = std::ios_base::out;
    string VarFile12FileName = fileRoot + ".fixed_variants12.txt";
    string VarFile11FileName = fileRoot + ".fixed_variants11.txt";
    string VarFile10FileName = fileRoot + ".fixed_variants10_two_hets.txt";
    string VarFile10HomFileName = fileRoot + ".fixed_variants10_hom.txt";
    string VarFile9FileName = fileRoot + ".fixed_variants9_three_hets.txt";
    string VarFile9HomFileName = fileRoot + ".fixed_variants9_hom.txt";
    std::ofstream* pFixedVarFile12 = new std::ofstream(VarFile12FileName.c_str(), mode_out);
    std::ofstream* pFixedVarFile11 = new std::ofstream(VarFile11FileName.c_str(), mode_out);
    std::ofstream* pFixedVarFile10 = new std::ofstream(VarFile10FileName.c_str(), mode_out);
    std::ofstream* pFixedVarFile10hom = new std::ofstream(VarFile10HomFileName.c_str(), mode_out);
    std::ofstream* pFixedVarFile9 = new std::ofstream(VarFile9FileName.c_str(), mode_out);
    std::ofstream* pFixedVarFile9hom = new std::ofstream(VarFile9HomFileName.c_str(), mode_out);
    bool gotChromosomeNumber = false;
    int numChromosomes;
    string line;
    int totalVariantNumber = 0;
    while (getline(*inFile, line)) {
        if (line[0] == '#') {
            std::cout << line << std::endl;
            *pFixedVarFile12 << line << std::endl; 
            *pFixedVarFile11 << line << std::endl;
            *pFixedVarFile10 << line << std::endl;
        } else {
            totalVariantNumber++;
            MassokoFilterResult result;
            std::vector<std::string> fields = split(line, '\t');
            if (!gotChromosomeNumber) {
                const std::vector<std::string>::size_type numSamples = fields.size() - NUM_NON_GENOTYPE_COLUMNS;
                numChromosomes = numSamples * 2;
                std::cerr << "Number of chromosomes: " << numChromosomes << std::endl;
                gotChromosomeNumber = true;
                initializeCountsBlue(counts_blue, numChromosomes);
            }
            result.overallQuality = atoi(fields[5].c_str());
            
            
            if (result.overallQuality >= MIN_OVERALL_VARIANT_PHRED_QUAL) 
                result.maxDepthPassed = testOverallReadDepth(opt::max_overall_depth,opt::min_overall_depth,fields[7]);
            
            if (result.maxDepthPassed)
                result.biallelicPassed = testBiallelic(fields[4]);
            
            if (result.biallelicPassed) 
                result.counts = getMassokoVariantCounts(fields);
            
            // filter out sites where more than MAX_NUM_HET individuals are heterozygous
            int num_hets = getNumHets(result);
            
            if (result.biallelicPassed && result.counts.overall <= (numChromosomes - opt::min_copies) && result.counts.overall >= opt::min_copies) {
                if (result.counts.minimumDepthInAnIndividual >= opt::min_depth_in_any_individual) {
                    std::cout << line << std::endl;
                    counts_blue[result.counts.overall][result.counts.blue]++;
                    if (result.counts.overall == 12 && (result.counts.blue == 12 || result.counts.blue == 0)) {
                        *pFixedVarFile12 << line << std::endl;
                    }
                    if (result.counts.overall == 11 && (result.counts.blue == 11 || result.counts.blue == 0)) {
                        *pFixedVarFile11 << line << std::endl;
                    }
                    if (result.counts.overall == 13 && (result.counts.blue == 12 || result.counts.blue == 1)) {
                        *pFixedVarFile11 << line << std::endl;
                    }
                    if (result.counts.overall == 10 && (result.counts.blue == 10 || result.counts.blue == 0) && (num_hets == 2)) {
                        *pFixedVarFile10 << line << std::endl;
                    } else if (result.counts.overall == 10 && (result.counts.blue == 10 || result.counts.blue == 0)) {
                        *pFixedVarFile10hom << line << std::endl;
                    }
                    if (result.counts.overall == 14 && (result.counts.blue == 12 || result.counts.blue == 2) && (num_hets == 2)) {
                        *pFixedVarFile10 << line << std::endl;
                    } else if (result.counts.overall == 14 && (result.counts.blue == 14 || result.counts.blue == 2)) {
                        *pFixedVarFile10hom << line << std::endl;
                    }
                    if (result.counts.overall == 9 && (result.counts.blue == 9 || result.counts.blue == 0) && (num_hets == 3)) {
                        *pFixedVarFile9 << line << std::endl;
                    } else if (result.counts.overall == 9 && (result.counts.blue == 9 || result.counts.blue == 0)) {
                        *pFixedVarFile9hom << line << std::endl;
                    }
                    if (result.counts.overall == 15 && (result.counts.blue == 12 || result.counts.blue == 3) && (num_hets == 3)) {
                        *pFixedVarFile9 << line << std::endl;
                    } else if (result.counts.overall == 15 && (result.counts.blue == 12 || result.counts.blue == 3)) {
                        *pFixedVarFile9hom << line << std::endl;
                    }
                }
            }
        }
    }
    for (int i = numChromosomes - opt::min_copies; i >= opt::min_copies; i--) {
        for (std::vector<std::string>::size_type j = 0; j != counts_blue[i].size(); j++) {
            if (j == (counts_blue[i].size()-1)) {
                std::cerr << counts_blue[i][j];
            } else {
                std::cerr << counts_blue[i][j] << "\t";
            }
        } std::cerr << std::endl;
    } 
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3a8, %rsp            # imm = 0x3A8
callq 0x66fe4
leaq 0x130(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0xa67a6(%rip), %rsi     # 0x10c380
movq 0xa67a7(%rip), %rdx     # 0x10c388
addq %rsi, %rdx
leaq 0x120(%rsp), %rbx
movq %rbx, %rdi
callq 0x2e45c
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x50803
leaq 0x380(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq 0xa53c0(%rip), %rdi     # 0x10afe8
leaq 0x736f9(%rip), %rsi     # 0xd9328
movl $0x19, %edx
callq 0x84e0
movq 0x120(%rsp), %rsi
movq 0x128(%rsp), %rdx
movq 0xa5398(%rip), %rdi     # 0x10afe8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0xa5362(%rip), %rdi     # 0x10afe8
leaq 0x736e6(%rip), %rsi     # 0xd9373
movl $0x25, %edx
callq 0x84e0
movl 0xa58bf(%rip), %esi     # 0x10b55c
movq 0xa5344(%rip), %rdi     # 0x10afe8
callq 0x8810
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0xa530e(%rip), %rdi     # 0x10afe8
leaq 0x736de(%rip), %rsi     # 0xd93bf
movl $0x3f, %edx
callq 0x84e0
movl 0xa5867(%rip), %esi     # 0x10b558
movq 0xa52f0(%rip), %rdi     # 0x10afe8
callq 0x8810
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0xa52ba(%rip), %rdi     # 0x10afe8
leaq 0x736ca(%rip), %rsi     # 0xd93ff
movl $0x2c, %edx
callq 0x84e0
movl 0xa581b(%rip), %esi     # 0x10b560
movq 0xa529c(%rip), %rdi     # 0x10afe8
callq 0x8810
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %rbx
movq 0x120(%rsp), %rsi
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
leaq 0x110(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x100(%rsp), %rdi
callq 0x2e45c
leaq 0x74e1a(%rip), %rsi     # 0xdabe4
leaq 0x100(%rsp), %rdi
callq 0x88c0
leaq 0xf0(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0xe0(%rsp), %rdi
callq 0x2e45c
leaq 0x74df6(%rip), %rsi     # 0xdabfa
leaq 0xe0(%rsp), %rdi
callq 0x88c0
leaq 0xd0(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0xc0(%rsp), %rdi
callq 0x2e45c
leaq 0x74dd2(%rip), %rsi     # 0xdac10
leaq 0xc0(%rsp), %rdi
callq 0x88c0
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0x2e45c
leaq 0x74db7(%rip), %rsi     # 0xdac2f
leaq 0xa0(%rsp), %rdi
callq 0x88c0
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x2e45c
leaq 0x74d97(%rip), %rsi     # 0xdac49
leaq 0x80(%rsp), %rdi
callq 0x88c0
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0x2e45c
leaq 0x74d83(%rip), %rsi     # 0xdac69
leaq 0x60(%rsp), %rdi
callq 0x88c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r15
movq 0x100(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r12
movq 0xe0(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r13
movq 0xc0(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r14
movq 0xa0(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq 0x80(%rsp), %rsi
movq %rax, 0x58(%rsp)
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %r14, 0x140(%rsp)
movq 0x60(%rsp), %rsi
movq %rax, 0x50(%rsp)
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0xa5008(%rip), %r14     # 0x10afe8
movq $0x0, 0x148(%rsp)
movq %rax, 0x28(%rsp)
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x66b3c
movq 0x8(%rsp), %rsi
cmpb $0x23, (%rsi)
jne 0x66129
movq 0x10(%rsp), %rdx
movq 0xa4f77(%rip), %rdi     # 0x10afb8
callq 0x84e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbp, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r15, %rdi
callq 0x84e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbp, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x84e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbp, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r13, %rdi
callq 0x84e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbp, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
jmp 0x65ff1
xorl %ecx, %ecx
movl %ecx, 0x150(%rsp)
movb %cl, 0x154(%rsp)
movabsq $0x7fffffff00000000, %rax # imm = 0x7FFFFFFF00000000
movq %rax, 0x158(%rsp)
movl %ecx, 0x160(%rsp)
leaq 0x178(%rsp), %rax
movq %rax, 0x168(%rsp)
movq %rcx, 0x170(%rsp)
movb %cl, 0x178(%rsp)
leaq 0x198(%rsp), %rax
movq %rax, 0x188(%rsp)
movq %rcx, 0x190(%rsp)
movb %cl, 0x198(%rsp)
movabsq $0x7fefffffffffffff, %rax # imm = 0x7FEFFFFFFFFFFFFF
movq %rax, 0x1a8(%rsp)
movq %rcx, 0x1b0(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x1b8(%rsp)
movb %cl, 0x1c0(%rsp)
movq %rcx, 0x238(%rsp)
movl %ecx, 0x240(%rsp)
movq %rcx, 0x248(%rsp)
movw %cx, 0x250(%rsp)
leaq 0x158(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0xcc(%rax)
movups %xmm0, 0xc0(%rax)
movups %xmm0, 0xb0(%rax)
movups %xmm0, 0xa0(%rax)
movups %xmm0, 0x90(%rax)
movups %xmm0, 0x80(%rax)
movups %xmm0, 0x70(%rax)
movl %ecx, 0x254(%rsp)
movw %cx, 0x258(%rsp)
leaq 0x260(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movl $0x9, %edx
callq 0x50624
testb $0x1, 0x148(%rsp)
jne 0x662d3
movq 0x268(%rsp), %rbp
subq 0x260(%rsp), %rbp
movl $0x17, %edx
movq %r14, %rdi
leaq 0x72135(%rip), %rsi     # 0xd83a3
callq 0x84e0
movq %rbp, %rsi
shrq $0x4, %rsi
andl $-0x2, %esi
addl $-0x12, %esi
movq %r14, %rdi
movq %rsi, 0x28(%rsp)
callq 0x8810
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbp, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movb $0x1, %al
movq %rax, 0x148(%rsp)
leaq 0x378(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x65a9d
movq 0x260(%rsp), %rbp
movq 0xa0(%rbp), %rdi
callq 0x86e0
movl %eax, 0x150(%rsp)
cmpl $0x1e, %eax
jl 0x66311
movl 0xa5263(%rip), %edi     # 0x10b55c
addq $0xe0, %rbp
xorl %esi, %esi
movq %rbp, %rdx
callq 0x52a77
movb %al, 0x154(%rsp)
cmpb $0x1, 0x154(%rsp)
jne 0x66333
movq 0x260(%rsp), %rdi
subq $-0x80, %rdi
callq 0x52a3e
movb %al, 0x258(%rsp)
cmpb $0x1, 0x258(%rsp)
jne 0x66666
movq %r15, (%rsp)
leaq 0x278(%rsp), %rdi
leaq 0x260(%rsp), %rsi
callq 0x65814
movl 0x280(%rsp), %eax
leaq 0x158(%rsp), %rbp
movl %eax, 0x8(%rbp)
movq 0x278(%rsp), %rax
movq %rax, (%rbp)
leaq 0x168(%rsp), %rdi
leaq 0x288(%rsp), %r15
movq %r15, %rsi
callq 0x8540
leaq 0x188(%rsp), %rdi
leaq 0x2a8(%rsp), %rsi
callq 0x8540
movups 0x40(%r15), %xmm0
movups 0x49(%r15), %xmm1
movups %xmm0, 0x50(%rbp)
movups %xmm1, 0x59(%rbp)
movq 0x1c8(%rsp), %rdi
movq 0x1d0(%rsp), %rax
movq 0x1d8(%rsp), %rsi
movq 0x2e8(%rsp), %rcx
movq %rcx, 0x1c8(%rsp)
movups 0x2f0(%rsp), %xmm0
movups %xmm0, 0x1d0(%rsp)
movq %rdi, 0x2e8(%rsp)
movq %rax, 0x2f0(%rsp)
movq %rsi, 0x2f8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%r15)
movq $0x0, 0x70(%r15)
testq %rdi, %rdi
je 0x66424
subq %rdi, %rsi
callq 0x8480
movq 0x1e0(%rsp), %rdi
movq 0x1e8(%rsp), %rax
movq 0x1f0(%rsp), %rsi
movq 0x300(%rsp), %rcx
movq %rcx, 0x1e0(%rsp)
movups 0x308(%rsp), %xmm0
movups %xmm0, 0x1e8(%rsp)
movq %rdi, 0x300(%rsp)
movq %rax, 0x308(%rsp)
movq %rsi, 0x310(%rsp)
leaq 0x288(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x78(%rax)
movq $0x0, 0x88(%rax)
testq %rdi, %rdi
je 0x6649b
subq %rdi, %rsi
callq 0x8480
movq 0x1f8(%rsp), %rdi
movq 0x200(%rsp), %rax
movq 0x208(%rsp), %rsi
movq 0x318(%rsp), %rcx
movq %rcx, 0x1f8(%rsp)
movups 0x320(%rsp), %xmm0
movups %xmm0, 0x200(%rsp)
movq %rdi, 0x318(%rsp)
movq %rax, 0x320(%rsp)
movq %rsi, 0x328(%rsp)
leaq 0x288(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x90(%rax)
movq $0x0, 0xa0(%rax)
testq %rdi, %rdi
movq (%rsp), %r15
je 0x66519
subq %rdi, %rsi
callq 0x8480
movq 0x210(%rsp), %rdi
movq 0x218(%rsp), %rax
movq 0x220(%rsp), %rsi
movq 0x330(%rsp), %rcx
movq %rcx, 0x210(%rsp)
movups 0x338(%rsp), %xmm0
movups %xmm0, 0x218(%rsp)
movq %rdi, 0x330(%rsp)
movq %rax, 0x338(%rsp)
movq %rsi, 0x340(%rsp)
leaq 0x288(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0xa8(%rax)
movq $0x0, 0xb8(%rax)
testq %rdi, %rdi
je 0x66593
subq %rdi, %rsi
callq 0x8480
movq 0x228(%rsp), %rdi
testq %rdi, %rdi
movl $0x0, %ebp
je 0x665db
movq 0x248(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq %rbp, 0x228(%rsp)
movl %ebp, 0x230(%rsp)
movq %rbp, 0x238(%rsp)
movl %ebp, 0x240(%rsp)
movq %rbp, 0x248(%rsp)
leaq 0x288(%rsp), %rdx
movq 0xe0(%rdx), %rax
leaq 0x158(%rsp), %rcx
movq %rax, 0xf0(%rcx)
movups 0xc0(%rdx), %xmm0
movups 0xd0(%rdx), %xmm1
movups %xmm1, 0xe0(%rcx)
movups %xmm0, 0xd0(%rcx)
movq %rbp, 0x348(%rsp)
movl %ebp, 0x350(%rsp)
movq %rbp, 0x358(%rsp)
movl %ebp, 0x360(%rsp)
movq %rbp, 0x368(%rsp)
movzwl 0x370(%rsp), %eax
movw %ax, 0x250(%rsp)
movl 0x374(%rsp), %eax
movl %eax, 0x254(%rsp)
leaq 0x278(%rsp), %rdi
callq 0x31188
movq 0x1c8(%rsp), %rax
movq 0x1d0(%rsp), %rcx
subq %rax, %rcx
je 0x666a1
sarq $0x2, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %edx, %edx
xorl %ebp, %ebp
xorl %esi, %esi
cmpl $0x1, (%rax,%rdx,4)
sete %sil
addl %esi, %ebp
incq %rdx
cmpq %rdx, %rcx
jne 0x6668b
jmp 0x666a3
xorl %ebp, %ebp
cmpb $0x1, 0x258(%rsp)
jne 0x66b1d
movl 0x158(%rsp), %eax
movl 0xa4e9a(%rip), %ecx     # 0x10b558
cmpl %ecx, %eax
jl 0x66b1d
movq 0x28(%rsp), %rdx
subl %ecx, %edx
cmpl %edx, %eax
jg 0x66b1d
movl 0x15c(%rsp), %eax
cmpl 0xa4e7e(%rip), %eax     # 0x10b560
jl 0x66b1d
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0xa48bf(%rip), %rdi     # 0x10afb8
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, (%rsp)
callq 0x8450
movq (%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x378(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x672f4
movslq 0x254(%rsp), %rcx
movq (%rax), %rax
incl (%rax,%rcx,4)
cmpl $0xc, 0x158(%rsp)
jne 0x667a5
movl 0x254(%rsp), %eax
cmpl $0xc, %eax
je 0x66767
testl %eax, %eax
jne 0x667a5
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r15, %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, (%rsp)
callq 0x8450
movq (%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
cmpl $0xb, 0x158(%rsp)
jne 0x667fd
movl 0x254(%rsp), %eax
cmpl $0xb, %eax
je 0x667bf
testl %eax, %eax
jne 0x667fd
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, (%rsp)
callq 0x8450
movq (%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
cmpl $0xd, 0x158(%rsp)
jne 0x66856
movl 0x254(%rsp), %eax
cmpl $0xc, %eax
je 0x66818
cmpl $0x1, %eax
jne 0x66856
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, (%rsp)
callq 0x8450
movq (%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl 0x158(%rsp), %eax
cmpl $0xa, %eax
jne 0x66909
movl 0x254(%rsp), %edx
cmpl $0xa, %edx
sete %cl
testl %edx, %edx
sete %dl
cmpl $0x2, %ebp
jne 0x668b1
orb %dl, %cl
je 0x668b1
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r13, %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, (%rsp)
callq 0x8450
movq (%rsp), %rdi
jmp 0x668f9
cmpl $0xa, %eax
jne 0x66909
movl 0x254(%rsp), %eax
cmpl $0xa, %eax
je 0x668c6
testl %eax, %eax
jne 0x66909
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x140(%rsp), %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, (%rsp)
callq 0x8450
movq (%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl 0x158(%rsp), %eax
cmpl $0xe, %eax
jne 0x669be
movl 0x254(%rsp), %edx
cmpl $0xc, %edx
sete %cl
cmpl $0x2, %edx
sete %dl
cmpl $0x2, %ebp
jne 0x66965
orb %dl, %cl
je 0x66965
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r13, %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, (%rsp)
callq 0x8450
movq (%rsp), %rdi
jmp 0x669ae
cmpl $0xe, %eax
jne 0x669be
movl 0x254(%rsp), %eax
cmpl $0xe, %eax
je 0x6697b
cmpl $0x2, %eax
jne 0x669be
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x140(%rsp), %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, (%rsp)
callq 0x8450
movq (%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl 0x158(%rsp), %eax
cmpl $0x9, %eax
jne 0x66a70
movl 0x254(%rsp), %edx
cmpl $0x9, %edx
sete %cl
testl %edx, %edx
sete %dl
cmpl $0x3, %ebp
jne 0x66a1b
orb %dl, %cl
je 0x66a1b
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x58(%rsp), %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, (%rsp)
callq 0x8450
movq (%rsp), %rdi
jmp 0x66a60
cmpl $0x9, %eax
jne 0x66a70
movl 0x254(%rsp), %eax
cmpl $0x9, %eax
je 0x66a30
testl %eax, %eax
jne 0x66a70
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x50(%rsp), %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, (%rsp)
callq 0x8450
movq (%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl 0x158(%rsp), %eax
cmpl $0xf, %eax
jne 0x66b1d
movl 0x254(%rsp), %edx
cmpl $0xc, %edx
sete %cl
cmpl $0x3, %edx
sete %dl
cmpl $0x3, %ebp
jne 0x66ac9
orb %dl, %cl
je 0x66ac9
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x58(%rsp), %rdi
callq 0x84e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x8450
jmp 0x66b0a
cmpl $0xf, %eax
jne 0x66b1d
movl 0x254(%rsp), %eax
cmpl $0xc, %eax
je 0x66adf
cmpl $0x3, %eax
jne 0x66b1d
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x50(%rsp), %rdi
callq 0x84e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbp, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x260(%rsp), %rdi
callq 0x3123c
leaq 0x158(%rsp), %rdi
callq 0x31188
jmp 0x65ff1
movl 0xa4a16(%rip), %eax     # 0x10b558
movq 0x28(%rsp), %rcx
subl %eax, %ecx
movl %ecx, 0x150(%rsp)
cmpl %eax, %ecx
jge 0x66caa
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x66b74
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x66b90
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x66bb5
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x66bda
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x66bff
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x66c24
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x66c49
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x378(%rsp), %rdi
callq 0x67358
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x66c71
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x66c96
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x8480
xorl %eax, %eax
addq $0x3a8, %rsp            # imm = 0x3A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
leaq 0x378(%rsp), %rbx
leaq 0x150(%rsp), %r15
leaq 0x6afba(%rip), %r12     # 0xd1c7e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x672f4
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
cmpq %rcx, %r13
jne 0x66d2a
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r14, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl 0x150(%rsp), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x150(%rsp)
movl $0x0, %r13d
cmpl 0xa4835(%rip), %eax     # 0x10b558
jg 0x66cc4
jmp 0x66b58
movq %rbx, %rdi
movq %r15, %rsi
callq 0x672f4
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
decq %rcx
cmpq %rcx, %r13
jne 0x66d64
movq %rbx, %rdi
movq %r15, %rsi
callq 0x672f4
movq (%rax), %rax
movl (%rax,%r13,4), %esi
movq %r14, %rdi
callq 0x8810
jmp 0x66d8e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x672f4
movq (%rax), %rax
movl (%rax,%r13,4), %esi
movq %r14, %rdi
callq 0x8810
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x84e0
incq %r13
jmp 0x66cc4
jmp 0x66e70
movq %rax, %r14
jmp 0x66e80
jmp 0x66e70
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq 0x50(%rsp), %rdi
jmp 0x66eb5
jmp 0x66e18
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq 0x58(%rsp), %rdi
jmp 0x66eb5
jmp 0x66e18
movq %r14, %rdi
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
jmp 0x66eb5
jmp 0x66e18
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %r13, %rdi
jmp 0x66eb5
jmp 0x66e18
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %r12, %rdi
jmp 0x66eb5
jmp 0x66e18
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
jmp 0x66eb5
jmp 0x66e18
movq %rax, %r14
jmp 0x66eba
jmp 0x66e22
movq %rax, %r14
jmp 0x66ed6
jmp 0x66e2c
movq %rax, %r14
jmp 0x66efb
jmp 0x66e36
movq %rax, %r14
jmp 0x66f20
jmp 0x66e40
movq %rax, %r14
jmp 0x66f45
jmp 0x66e4a
movq %rax, %r14
jmp 0x66f6a
jmp 0x66e8f
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %rbx, %rdi
jmp 0x66f8a
jmp 0x66e8f
movq %rax, %r14
jmp 0x66fb7
jmp 0x66e70
movq %rax, %r14
leaq 0x260(%rsp), %rdi
callq 0x3123c
leaq 0x158(%rsp), %rdi
callq 0x31188
jmp 0x66e9e
movq %rax, %r14
jmp 0x66f8f
jmp 0x66e9b
jmp 0x66e9b
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x66eba
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x66ed6
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x66efb
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x66f20
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x66f45
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x66f6a
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x66f8f
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x378(%rsp), %rdi
callq 0x67358
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x66fb7
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x130(%rsp), %rax
movq 0x120(%rsp), %rdi
cmpq %rax, %rdi
je 0x66fdc
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r14, %rdi
callq 0x8840