// File: /workspace/github_cpp_makefile_star2_O3/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 0x66ca3
leaq 0x140(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x9da49(%rip), %rsi     # 0x103388
movq 0x9da4a(%rip), %rdx     # 0x103390
addq %rsi, %rdx
leaq 0x130(%rsp), %rbx
movq %rbx, %rdi
callq 0x2ba06
leaq 0x38(%rsp), %rdi
movq %rbx, %rsi
callq 0x4d82f
leaq 0x280(%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 0x9c65b(%rip), %rdi     # 0x101fe8
leaq 0x6d4d4(%rip), %rsi     # 0xd2e68
movl $0x19, %edx
callq 0x84e0
movq 0x130(%rsp), %rsi
movq 0x138(%rsp), %rdx
movq 0x9c633(%rip), %rdi     # 0x101fe8
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 0x9c5fd(%rip), %rdi     # 0x101fe8
leaq 0x6d4c1(%rip), %rsi     # 0xd2eb3
movl $0x25, %edx
callq 0x84e0
movl 0x9cb5a(%rip), %esi     # 0x10255c
movq 0x9c5df(%rip), %rdi     # 0x101fe8
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 0x9c5a9(%rip), %rdi     # 0x101fe8
leaq 0x6d4b9(%rip), %rsi     # 0xd2eff
movl $0x3f, %edx
callq 0x84e0
movl 0x9cb02(%rip), %esi     # 0x102558
movq 0x9c58b(%rip), %rdi     # 0x101fe8
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 0x9c555(%rip), %rdi     # 0x101fe8
leaq 0x6d4a5(%rip), %rsi     # 0xd2f3f
movl $0x2c, %edx
callq 0x84e0
movl 0x9cab6(%rip), %esi     # 0x102560
movq 0x9c537(%rip), %rdi     # 0x101fe8
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 0x130(%rsp), %rsi
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
leaq 0x118(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0x108(%rsp), %rdi
callq 0x2ba06
leaq 0x6ebf5(%rip), %rsi     # 0xd4724
leaq 0x108(%rsp), %rdi
callq 0x88c0
leaq 0xf8(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0xe8(%rsp), %rdi
callq 0x2ba06
leaq 0x6ebd1(%rip), %rsi     # 0xd473a
leaq 0xe8(%rsp), %rdi
callq 0x88c0
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %rdi
callq 0x2ba06
leaq 0x6ebad(%rip), %rsi     # 0xd4750
leaq 0xc8(%rsp), %rdi
callq 0x88c0
leaq 0xb8(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa8(%rsp), %rdi
callq 0x2ba06
leaq 0x6eb92(%rip), %rsi     # 0xd476f
leaq 0xa8(%rsp), %rdi
callq 0x88c0
leaq 0x98(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0x2ba06
leaq 0x6eb72(%rip), %rsi     # 0xd4789
leaq 0x88(%rsp), %rdi
callq 0x88c0
leaq 0x78(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rdi
callq 0x2ba06
leaq 0x6eb5e(%rip), %rsi     # 0xd47a9
leaq 0x68(%rsp), %rdi
callq 0x88c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r15
movq 0x108(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r12
movq 0xe8(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r13
movq 0xc8(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r14
movq 0xa8(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq 0x88(%rsp), %rsi
movq %rax, 0x60(%rsp)
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %r14, 0x128(%rsp)
movq 0x68(%rsp), %rsi
movq %rax, 0x58(%rsp)
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x9c2a3(%rip), %r14     # 0x101fe8
movq $0x0, 0x8(%rsp)
movq %rax, 0x30(%rsp)
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x667fb
movq 0x10(%rsp), %rsi
cmpb $0x23, (%rsi)
jne 0x65e8b
movq 0x18(%rsp), %rdx
movq 0x9c215(%rip), %rdi     # 0x101fb8
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 0x10(%rsp), %rsi
movq 0x18(%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 0x10(%rsp), %rsi
movq 0x18(%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 0x10(%rsp), %rsi
movq 0x18(%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 0x65d53
xorl %ecx, %ecx
movl %ecx, 0x168(%rsp)
movb %cl, 0x16c(%rsp)
movabsq $0x7fffffff00000000, %rax # imm = 0x7FFFFFFF00000000
movq %rax, 0x170(%rsp)
movl %ecx, 0x178(%rsp)
leaq 0x190(%rsp), %rax
movq %rax, 0x180(%rsp)
movq %rcx, 0x188(%rsp)
movb %cl, 0x190(%rsp)
leaq 0x1b0(%rsp), %rax
movq %rax, 0x1a0(%rsp)
movq %rcx, 0x1a8(%rsp)
movb %cl, 0x1b0(%rsp)
movsd 0x65e26(%rip), %xmm0    # 0xcbd20
movups %xmm0, 0x1c0(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x1d0(%rsp)
movb %cl, 0x1d8(%rsp)
movq %rcx, 0x250(%rsp)
movl %ecx, 0x258(%rsp)
movq %rcx, 0x260(%rsp)
movw %cx, 0x268(%rsp)
leaq 0x170(%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, 0x26c(%rsp)
movw %cx, 0x270(%rsp)
leaq 0x150(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movl $0x9, %edx
callq 0x4d650
testb $0x1, 0x8(%rsp)
jne 0x6601a
movq 0x158(%rsp), %rbp
subq 0x150(%rsp), %rbp
movl $0x17, %edx
movq %r14, %rdi
leaq 0x6bf24(%rip), %rsi     # 0xd1ee3
callq 0x84e0
movq %rbp, %rsi
shrq $0x4, %rsi
andl $-0x2, %esi
addl $-0x12, %esi
movq %r14, %rdi
movq %rsi, 0x30(%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
leaq 0x278(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x65802
movq 0x150(%rsp), %rbp
movq 0xa0(%rbp), %rdi
callq 0x86e0
movl %eax, 0x168(%rsp)
cmpl $0x1d, %eax
jle 0x6606b
movl 0x9c51c(%rip), %edi     # 0x10255c
addq $0xe0, %rbp
xorl %esi, %esi
movq %rbp, %rdx
callq 0x4f8ca
movb %al, 0x16c(%rsp)
testb %al, %al
jne 0x66075
testb $0x1, 0x270(%rsp)
jne 0x66095
jmp 0x6632a
testb $0x1, 0x16c(%rsp)
je 0x6605c
movq 0x150(%rsp), %rdi
subq $-0x80, %rdi
callq 0x4f891
movb %al, 0x270(%rsp)
testb %al, %al
je 0x6632a
movq %r15, 0x8(%rsp)
leaq 0x2a8(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x65590
movl 0x2b0(%rsp), %eax
leaq 0x170(%rsp), %rbp
movl %eax, 0x8(%rbp)
movq 0x2a8(%rsp), %rax
movq %rax, (%rbp)
leaq 0x180(%rsp), %rdi
leaq 0x2b8(%rsp), %r15
movq %r15, %rsi
callq 0x8540
leaq 0x1a0(%rsp), %rdi
leaq 0x2d8(%rsp), %rsi
callq 0x8540
movups 0x40(%r15), %xmm0
movups 0x49(%r15), %xmm1
movups %xmm0, 0x50(%rbp)
movups %xmm1, 0x59(%rbp)
movq 0x1e0(%rsp), %rdi
movq 0x1f0(%rsp), %rsi
movups 0x318(%rsp), %xmm0
movups %xmm0, 0x1e0(%rsp)
movq 0x328(%rsp), %rax
movq %rax, 0x1f0(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%r15)
movq $0x0, 0x70(%r15)
testq %rdi, %rdi
je 0x66159
subq %rdi, %rsi
callq 0x8480
movq 0x1f8(%rsp), %rdi
movq 0x208(%rsp), %rsi
movups 0x330(%rsp), %xmm0
movups %xmm0, 0x1f8(%rsp)
movq 0x340(%rsp), %rax
movq %rax, 0x208(%rsp)
leaq 0x2b8(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x78(%rax)
movq $0x0, 0x88(%rax)
testq %rdi, %rdi
je 0x661b0
subq %rdi, %rsi
callq 0x8480
movq 0x210(%rsp), %rdi
movq 0x220(%rsp), %rsi
movups 0x348(%rsp), %xmm0
movups %xmm0, 0x210(%rsp)
movq 0x358(%rsp), %rax
movq %rax, 0x220(%rsp)
leaq 0x2b8(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x90(%rax)
movq $0x0, 0xa0(%rax)
testq %rdi, %rdi
movq 0x8(%rsp), %r15
je 0x6620f
subq %rdi, %rsi
callq 0x8480
movq 0x228(%rsp), %rdi
movq 0x238(%rsp), %rsi
movups 0x360(%rsp), %xmm0
movups %xmm0, 0x228(%rsp)
movq 0x370(%rsp), %rax
movq %rax, 0x238(%rsp)
leaq 0x2b8(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0xa8(%rax)
movq $0x0, 0xb8(%rax)
testq %rdi, %rdi
je 0x66269
subq %rdi, %rsi
callq 0x8480
movq 0x240(%rsp), %rdi
testq %rdi, %rdi
je 0x6629d
movq 0x260(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq $0x0, 0x240(%rsp)
movl $0x0, 0x248(%rsp)
leaq 0x2b8(%rsp), %rdx
movq 0xe0(%rdx), %rax
leaq 0x170(%rsp), %rcx
movq %rax, 0xf0(%rcx)
movups 0xc0(%rdx), %xmm0
movups 0xd0(%rdx), %xmm1
movups %xmm1, 0xe0(%rcx)
movups %xmm0, 0xd0(%rcx)
xorl %eax, %eax
movq %rax, 0x378(%rsp)
movl %eax, 0x380(%rsp)
movq %rax, 0x388(%rsp)
movl %eax, 0x390(%rsp)
movq %rax, 0x398(%rsp)
movzwl 0x3a0(%rsp), %eax
movw %ax, 0x268(%rsp)
movl 0x3a4(%rsp), %eax
movl %eax, 0x26c(%rsp)
leaq 0x2a8(%rsp), %rdi
callq 0x2e6d0
movq 0x1e0(%rsp), %rax
movq 0x1e8(%rsp), %rcx
subq %rax, %rcx
je 0x66365
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 0x6634f
jmp 0x66367
xorl %ebp, %ebp
cmpb $0x1, 0x270(%rsp)
jne 0x667d5
movl 0x170(%rsp), %eax
movl 0x9c1d6(%rip), %ecx     # 0x102558
cmpl %ecx, %eax
jl 0x667d5
movq 0x30(%rsp), %rdx
subl %ecx, %edx
cmpl %edx, %eax
jg 0x667d5
movl 0x174(%rsp), %eax
cmpl 0x9c1ba(%rip), %eax     # 0x102560
jl 0x667d5
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x9bbfb(%rip), %rdi     # 0x101fb8
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, 0x8(%rsp)
callq 0x8450
movq 0x8(%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x278(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x66fae
movslq 0x26c(%rsp), %rcx
movq (%rax), %rax
incl (%rax,%rcx,4)
movl 0x170(%rsp), %eax
cmpl $0xc, %eax
jne 0x6647a
movl 0x26c(%rsp), %eax
cmpl $0xc, %eax
je 0x66433
testl %eax, %eax
jne 0x667d5
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, 0x8(%rsp)
callq 0x8450
movq 0x8(%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl 0x170(%rsp), %eax
cmpl $0xb, %eax
jne 0x664da
movl 0x26c(%rsp), %eax
cmpl $0xb, %eax
je 0x66493
testl %eax, %eax
jne 0x665df
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, 0x8(%rsp)
callq 0x8450
movq 0x8(%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl 0x170(%rsp), %eax
cmpl $0xd, %eax
jne 0x6653b
movl 0x26c(%rsp), %eax
cmpl $0xc, %eax
je 0x664f4
cmpl $0x1, %eax
jne 0x667d5
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r12, %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, 0x8(%rsp)
callq 0x8450
movq 0x8(%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl 0x170(%rsp), %eax
cmpl $0xa, %eax
jne 0x665df
movl 0x26c(%rsp), %eax
cmpl $0xa, %eax
sete %cl
testl %eax, %eax
sete %dl
cmpl $0x2, %ebp
jne 0x66591
orb %dl, %cl
je 0x66591
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, 0x8(%rsp)
callq 0x8450
movq 0x8(%rsp), %rdi
jmp 0x665cf
cmpl $0xa, %eax
je 0x6659a
testl %eax, %eax
jne 0x665df
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x128(%rsp), %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, 0x8(%rsp)
callq 0x8450
movq 0x8(%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl 0x170(%rsp), %eax
cmpl $0xe, %eax
jne 0x66693
movl 0x26c(%rsp), %eax
cmpl $0xc, %eax
sete %cl
cmpl $0x2, %eax
sete %dl
cmpl $0x2, %ebp
jne 0x6663d
orb %dl, %cl
je 0x6663d
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r13, %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, 0x8(%rsp)
callq 0x8450
movq 0x8(%rsp), %rdi
jmp 0x6667c
cmpl $0xe, %eax
je 0x66647
cmpl $0x2, %eax
jne 0x6668c
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x128(%rsp), %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, 0x8(%rsp)
callq 0x8450
movq 0x8(%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl 0x170(%rsp), %eax
cmpl $0x9, %eax
jne 0x66736
movl 0x26c(%rsp), %eax
cmpl $0x9, %eax
sete %cl
testl %eax, %eax
sete %dl
cmpl $0x3, %ebp
jne 0x666eb
orb %dl, %cl
je 0x666eb
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x60(%rsp), %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, 0x8(%rsp)
callq 0x8450
movq 0x8(%rsp), %rdi
jmp 0x66726
cmpl $0x9, %eax
je 0x666f4
testl %eax, %eax
jne 0x66736
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x58(%rsp), %rdi
callq 0x84e0
movq (%rax), %rcx
movq -0x18(%rcx), %rdi
addq %rax, %rdi
movl $0xa, %esi
movq %rax, 0x8(%rsp)
callq 0x8450
movq 0x8(%rsp), %rdi
movsbl %al, %esi
callq 0x8040
movq %rax, %rdi
callq 0x8300
cmpl $0xf, 0x170(%rsp)
jne 0x667d5
movl 0x26c(%rsp), %eax
cmpl $0xc, %eax
sete %cl
cmpl $0x3, %eax
sete %dl
cmpl $0x3, %ebp
jne 0x6678d
orb %dl, %cl
je 0x6678d
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x60(%rsp), %rdi
callq 0x84e0
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x8450
jmp 0x667c2
cmpl $0xc, %eax
je 0x66797
cmpl $0x3, %eax
jne 0x667d5
movq 0x10(%rsp), %rsi
movq 0x18(%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
movsbl %al, %esi
movq %rbp, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x150(%rsp), %rdi
callq 0x2e784
leaq 0x170(%rsp), %rdi
callq 0x2e6d0
movb $0x1, %al
movq %rax, 0x8(%rsp)
jmp 0x65d53
movl 0x9bd57(%rip), %eax     # 0x102558
movq 0x30(%rsp), %rcx
subl %eax, %ecx
movl %ecx, 0x168(%rsp)
cmpl %eax, %ecx
jge 0x66969
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x66833
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x6684f
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x66874
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x66899
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x668be
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x668e3
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x66908
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x278(%rsp), %rdi
callq 0x67014
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x66930
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x130(%rsp), %rdi
leaq 0x140(%rsp), %rax
cmpq %rax, %rdi
je 0x66955
movq 0x140(%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 0x278(%rsp), %rbx
leaq 0x168(%rsp), %r15
leaq 0x67047(%rip), %r12     # 0xcd9ca
movq %rbx, %rdi
movq %r15, %rsi
callq 0x66fae
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
cmpq %rcx, %r13
jne 0x669e9
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 0x168(%rsp), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x168(%rsp)
movl $0x0, %r13d
cmpl 0x9bb76(%rip), %eax     # 0x102558
jg 0x66983
jmp 0x66817
movq %rbx, %rdi
movq %r15, %rsi
callq 0x66fae
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
decq %rcx
cmpq %rcx, %r13
jne 0x66a23
movq %rbx, %rdi
movq %r15, %rsi
callq 0x66fae
movq (%rax), %rax
movl (%rax,%r13,4), %esi
movq %r14, %rdi
callq 0x8810
jmp 0x66a4d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x66fae
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 0x66983
jmp 0x66b2f
jmp 0x66b2f
movq %rax, %r14
jmp 0x66b3f
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq 0x58(%rsp), %rdi
jmp 0x66b74
jmp 0x66ad7
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq 0x60(%rsp), %rdi
jmp 0x66b74
jmp 0x66ad7
movq %r14, %rdi
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
jmp 0x66b74
jmp 0x66ad7
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %r13, %rdi
jmp 0x66b74
jmp 0x66ad7
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %r12, %rdi
jmp 0x66b74
jmp 0x66ad7
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
jmp 0x66b74
jmp 0x66ad7
movq %rax, %r14
jmp 0x66b79
jmp 0x66ae1
movq %rax, %r14
jmp 0x66b95
jmp 0x66aeb
movq %rax, %r14
jmp 0x66bba
jmp 0x66af5
movq %rax, %r14
jmp 0x66bdf
jmp 0x66aff
movq %rax, %r14
jmp 0x66c04
jmp 0x66b09
movq %rax, %r14
jmp 0x66c29
jmp 0x66b4e
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %rbx, %rdi
jmp 0x66c49
jmp 0x66b4e
movq %rax, %r14
jmp 0x66c76
jmp 0x66b2f
movq %rax, %r14
leaq 0x150(%rsp), %rdi
callq 0x2e784
leaq 0x170(%rsp), %rdi
callq 0x2e6d0
jmp 0x66b5d
movq %rax, %r14
jmp 0x66c4e
jmp 0x66b5a
jmp 0x66b5a
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x66b79
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x68(%rsp), %rdi
leaq 0x78(%rsp), %rax
cmpq %rax, %rdi
je 0x66b95
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x66bba
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x66bdf
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x66c04
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x66c29
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x66c4e
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x278(%rsp), %rdi
callq 0x67014
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x66c76
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x130(%rsp), %rdi
leaq 0x140(%rsp), %rax
cmpq %rax, %rdi
je 0x66c9b
movq 0x140(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r14, %rdi
callq 0x8840