// File: millanek[P]evo/process_vcf_testing.cpp
// Function: testMain(int, char**)
int testMain(int argc, char** argv) {
    parseTestOptions(argc, argv);
    std::ios_base::openmode mode = std::ios_base::in;
    string fileName = opt::vcfFile;
    string fileRoot = stripExtension(fileName);
    std::vector<int> depthsHetFailed;
    std::vector<int> depthsHetPassed;
    std::vector<int> numVariantsPerHetCount;
    std::vector<std::vector<int> > num_indiv_het_vs_depth;
    
    
    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;
    std::cerr << "Filter out sites where more than " << opt::max_het_indiv << " individuals are heterozygous"  << std::endl;
    
    // Open connection to read from the vcf file
    std::ifstream* inFile = new std::ifstream(fileName.c_str(), mode);
    
    
    bool gotChromosomeNumber = false;
    int numChromosomes;
    string line;
    int totalVariantNumber = 0;
    while (getline(*inFile, line)) {
        if (line[0] == '#') 
            std::cout << line << std::endl;  
        else {
            totalVariantNumber++;
            FilterResult 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;
                numVariantsPerHetCount.assign(numSamples + 1, 0);
                numChromosomes = (int)numSamples * 2;
                std::cerr << "Number of chromosomes: " << numChromosomes << std::endl;
                gotChromosomeNumber = true;
            }
            result.overallQuality = atoi(fields[5].c_str());
            
            
            if (result.overallQuality >= MIN_OVERALL_VARIANT_PHRED_QUAL) {
                result.overallDepthPassed = testOverallReadDepth(opt::max_overall_depth,opt::min_overall_depth,fields[7]);
                result.biallelicPassed = testBiallelic(fields[4]);
            }
                
            if (result.biallelicPassed) 
                result.counts = getThisVariantCounts(fields);
            
            
            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) {
                    // filter out sites where more than MAX_NUM_HET individuals are heterozygous
                    bool mnhPassed = testMaxNumHet(result, depthsHetFailed, depthsHetPassed, numVariantsPerHetCount, opt::max_het_indiv,num_indiv_het_vs_depth);
                    if (result.overallDepthPassed && mnhPassed) {
                        std::cout << line << std::endl;
                    }
                }
            }  
        }
    }
    
    std::cerr << "Finished filtering; tabulating depths\n" << std::endl;
    // Does the same as R function table
    std::map<int, int> tableHetFailed = tabulateVector(depthsHetFailed);
    std::map<int, int> tableHetPassed = tabulateVector(depthsHetPassed);
    
    std::ios_base::openmode mode_out = std::ios_base::out;
    string hetFailedFileName = fileRoot + ".het_filter.failed_max" + numToString<int>(opt::max_het_indiv);
    std::ofstream* pHetFailOutFile = new std::ofstream(hetFailedFileName.c_str(), mode_out);
    *pHetFailOutFile << "# Failed HetFilter:" << fileName << std::endl;
    *pHetFailOutFile << "Depth\tNum_variants" << std::endl;
    for (std::map<int, int>::const_iterator iter = tableHetFailed.begin(); iter != tableHetFailed.end(); ++iter) {
        *pHetFailOutFile << iter->first << "\t" << iter->second << std::endl;
    }


    string hetPassedFileName = fileRoot + ".het_filter.passed_max" + numToString<int>(opt::max_het_indiv);
    std::ofstream* pHetPassOutFile = new std::ofstream(hetPassedFileName.c_str(), mode_out);
    *pHetPassOutFile << "# Passed HetFilter:" << fileName << std::endl;
    *pHetPassOutFile << "Depth\tNum_variants" << std::endl;
    for (std::map<int, int>::const_iterator iter = tableHetPassed.begin(); iter != tableHetPassed.end(); ++iter) {
        *pHetPassOutFile << iter->first << "\t" << iter->second << std::endl;
    }
    
    string hetVarCountName = fileRoot + ".het_filter.variants_per_het_count_max" + numToString<int>(opt::max_het_indiv);;
    std::ofstream* pHetVarCountFile = new std::ofstream(hetVarCountName.c_str(), mode_out);
    *pHetVarCountFile << "# Number of variants per each het count: " << fileName << std::endl;
    *pHetVarCountFile << "Num_hets\tNum_variants" << std::endl;
    for (std::vector<int>::size_type i = 0; i != numVariantsPerHetCount.size(); i++) {
        *pHetVarCountFile << i << "\t" << numVariantsPerHetCount[i] << std::endl;
    }
    
    string hetDepthScatterplotName = fileRoot + ".het_filter.depth_scatterplot" + numToString<int>(opt::max_het_indiv);;
    std::ofstream* pHetDepthScatterplotFile = new std::ofstream(hetDepthScatterplotName.c_str(), mode_out);
    *pHetDepthScatterplotFile << "# Number of hets and depth for individual variants for a scatterplot: " << fileName << std::endl;
    *pHetDepthScatterplotFile << "Num_hets\tDepth" << std::endl;
    print_matrix<std::vector<std::vector<int> >&>(num_indiv_het_vs_depth, *pHetDepthScatterplotFile);
    
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x730, %rsp            # imm = 0x730
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0xa3850
movl $0x8, -0x14(%rbp)
leaq 0xf8104(%rip), %rsi     # 0x19a840
leaq -0x38(%rbp), %rdi
movq %rdi, -0x598(%rbp)
callq 0xa250
movq -0x598(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x7be70
jmp 0xa275e
leaq -0x80(%rbp), %rdi
callq 0x46270
leaq -0x98(%rbp), %rdi
callq 0x46270
leaq -0xb0(%rbp), %rdi
callq 0x46270
leaq -0xc8(%rbp), %rdi
callq 0x6ccb0
movq 0xf685e(%rip), %rdi     # 0x198ff0
leaq 0x9b23b(%rip), %rsi     # 0x13d9d4
callq 0xa5c0
movq %rax, -0x5a0(%rbp)
jmp 0xa27a7
movq -0x5a0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xa520
movq %rax, -0x5a8(%rbp)
jmp 0xa27c0
movq -0x5a8(%rbp), %rdi
movq 0xf67ba(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa27d5
movq 0xf6814(%rip), %rdi     # 0x198ff0
leaq 0x9b23c(%rip), %rsi     # 0x13da1f
callq 0xa5c0
movq %rax, -0x5b0(%rbp)
jmp 0xa27f1
movq -0x5b0(%rbp), %rdi
movl 0xf7012(%rip), %esi     # 0x199810
callq 0xab20
movq %rax, -0x5b8(%rbp)
jmp 0xa280c
movq -0x5b8(%rbp), %rdi
movq 0xf676e(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa2821
movq 0xf67c8(%rip), %rdi     # 0x198ff0
leaq 0x9b23c(%rip), %rsi     # 0x13da6b
callq 0xa5c0
movq %rax, -0x5c0(%rbp)
jmp 0xa283d
movq -0x5c0(%rbp), %rdi
movl 0xf6fca(%rip), %esi     # 0x199814
callq 0xab20
movq %rax, -0x5c8(%rbp)
jmp 0xa2858
movq -0x5c8(%rbp), %rdi
movq 0xf6722(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa286d
movq 0xf677c(%rip), %rdi     # 0x198ff0
leaq 0x9b230(%rip), %rsi     # 0x13daab
callq 0xa5c0
movq %rax, -0x5d0(%rbp)
jmp 0xa2889
movq -0x5d0(%rbp), %rdi
movl 0xf6f82(%rip), %esi     # 0x199818
callq 0xab20
movq %rax, -0x5d8(%rbp)
jmp 0xa28a4
movq -0x5d8(%rbp), %rdi
movq 0xf66d6(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa28b9
movq 0xf6730(%rip), %rdi     # 0x198ff0
leaq 0x9b276(%rip), %rsi     # 0x13db3d
callq 0xa5c0
movq %rax, -0x5e0(%rbp)
jmp 0xa28d5
movq -0x5e0(%rbp), %rdi
movl 0xf6f3a(%rip), %esi     # 0x19981c
callq 0xab20
movq %rax, -0x5e8(%rbp)
jmp 0xa28f0
movq -0x5e8(%rbp), %rdi
leaq 0x9b261(%rip), %rsi     # 0x13db5f
callq 0xa5c0
movq %rax, -0x5f0(%rbp)
jmp 0xa290c
movq -0x5f0(%rbp), %rdi
movq 0xf666e(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa2921
movl $0x208, %edi            # imm = 0x208
callq 0xa5d0
movq %rax, -0x5f8(%rbp)
jmp 0xa2934
leaq -0x38(%rbp), %rdi
callq 0xa220
movq -0x5f8(%rbp), %rdi
movq %rax, %rsi
movl -0x14(%rbp), %edx
callq 0xab90
jmp 0xa2951
movq -0x5f8(%rbp), %rax
movq %rax, -0xd0(%rbp)
movb $0x0, -0xd1(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0xa820
movl $0x0, -0xfc(%rbp)
movq -0xd0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0xa0d0
movq %rax, -0x600(%rbp)
jmp 0xa2998
movq -0x600(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0xa740
movb %al, -0x601(%rbp)
jmp 0xa29b6
movb -0x601(%rbp), %al
testb $0x1, %al
jne 0xa29c5
jmp 0xa2d8d
xorl %eax, %eax
movl %eax, %esi
leaq -0xf8(%rbp), %rdi
callq 0xac60
movq %rax, -0x610(%rbp)
jmp 0xa29de
movq -0x610(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0xa2a7c
movq 0xf65c0(%rip), %rdi     # 0x198fb8
leaq -0xf8(%rbp), %rsi
callq 0xa520
movq %rax, -0x618(%rbp)
jmp 0xa2a0d
movq -0x618(%rbp), %rdi
movq 0xf656d(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa2a22
jmp 0xa2d88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa3835
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa37ff
movq -0x5f8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl $0x208, %esi            # imm = 0x208
callq 0xa5e0
jmp 0xa37ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa37f3
movl -0xfc(%rbp), %eax
incl %eax
movl %eax, -0xfc(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x956b0
jmp 0xa2a98
leaq -0x228(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
movl $0x9, %edx
callq 0x7bbe0
jmp 0xa2ab2
testb $0x1, -0xd1(%rbp)
jne 0xa2b90
leaq -0x228(%rbp), %rdi
callq 0x3ffd0
addq $-0x9, %rax
movq %rax, -0x230(%rbp)
movq -0x230(%rbp), %rsi
incq %rsi
movl $0x0, -0x234(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0x234(%rbp), %rdx
callq 0x838d0
jmp 0xa2aff
movl -0x230(%rbp), %eax
addl %eax, %eax
movl %eax, -0xd8(%rbp)
movq 0xf64dc(%rip), %rdi     # 0x198ff0
leaq 0x99da8(%rip), %rsi     # 0x13c8c3
callq 0xa5c0
movq %rax, -0x620(%rbp)
jmp 0xa2b29
movq -0x620(%rbp), %rdi
movl -0xd8(%rbp), %esi
callq 0xab20
movq %rax, -0x628(%rbp)
jmp 0xa2b44
movq -0x628(%rbp), %rdi
movq 0xf6436(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa2b59
movb $0x1, -0xd1(%rbp)
jmp 0xa2b90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa2d77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x3dfa0
jmp 0xa2d77
leaq -0x228(%rbp), %rdi
movl $0x5, %esi
callq 0x3d940
movq %rax, %rdi
callq 0xa220
movq %rax, %rdi
callq 0xa970
movl %eax, -0x210(%rbp)
cmpl $0x1e, -0x210(%rbp)
jl 0xa2c46
movl 0xf6c46(%rip), %eax     # 0x199810
movl %eax, -0x634(%rbp)
movl 0xf7c8a(%rip), %eax     # 0x19a860
movl %eax, -0x630(%rbp)
leaq -0x228(%rbp), %rdi
movl $0x7, %esi
callq 0x3d940
movl -0x634(%rbp), %edi
movl -0x630(%rbp), %esi
movq %rax, %rdx
callq 0x80110
movb %al, -0x629(%rbp)
jmp 0xa2c09
movb -0x629(%rbp), %al
andb $0x1, %al
movb %al, -0x20b(%rbp)
leaq -0x228(%rbp), %rdi
movl $0x4, %esi
callq 0x3d940
movq %rax, %rdi
callq 0x800b0
movb %al, -0x635(%rbp)
jmp 0xa2c38
movb -0x635(%rbp), %al
andb $0x1, %al
movb %al, -0x108(%rbp)
testb $0x1, -0x108(%rbp)
je 0xa2c87
leaq -0x338(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x7d310
jmp 0xa2c64
leaq -0x210(%rbp), %rdi
addq $0x8, %rdi
leaq -0x338(%rbp), %rsi
callq 0xa1130
leaq -0x338(%rbp), %rdi
callq 0x3df20
testb $0x1, -0x108(%rbp)
je 0xa2d5d
movl -0x208(%rbp), %eax
movl -0xd8(%rbp), %ecx
subl 0xf6b6e(%rip), %ecx     # 0x199814
cmpl %ecx, %eax
jg 0xa2d5d
movl -0x208(%rbp), %eax
cmpl 0xf6b5a(%rip), %eax     # 0x199814
jl 0xa2d5d
movl -0x204(%rbp), %eax
cmpl 0xf6b4c(%rip), %eax     # 0x199818
jl 0xa2d5b
movl 0xf6b43(%rip), %r8d     # 0x19981c
leaq -0x210(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x98(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
leaq -0xc8(%rbp), %r9
callq 0x80230
movb %al, -0x636(%rbp)
jmp 0xa2d06
movb -0x636(%rbp), %al
andb $0x1, %al
movb %al, -0x339(%rbp)
testb $0x1, -0x20b(%rbp)
je 0xa2d59
testb $0x1, -0x339(%rbp)
je 0xa2d59
movq 0xf628b(%rip), %rdi     # 0x198fb8
leaq -0xf8(%rbp), %rsi
callq 0xa520
movq %rax, -0x640(%rbp)
jmp 0xa2d42
movq -0x640(%rbp), %rdi
movq 0xf6238(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa2d57
jmp 0xa2d59
jmp 0xa2d5b
jmp 0xa2d5d
leaq -0x228(%rbp), %rdi
callq 0x3dfa0
leaq -0x210(%rbp), %rdi
callq 0x95ad0
jmp 0xa2d88
leaq -0x210(%rbp), %rdi
callq 0x95ad0
jmp 0xa37f3
jmp 0xa297c
movq 0xf625c(%rip), %rdi     # 0x198ff0
leaq 0x9be91(%rip), %rsi     # 0x13ec2c
callq 0xa5c0
movq %rax, -0x648(%rbp)
jmp 0xa2da9
movq -0x648(%rbp), %rdi
movq 0xf61d1(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa2dbe
leaq -0x370(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x803b0
jmp 0xa2dd0
leaq -0x3a0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x803b0
jmp 0xa2de5
movl $0x10, -0x3a4(%rbp)
leaq 0x9be5d(%rip), %rdx     # 0x13ec53
leaq -0x3e8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3da80
jmp 0xa2e08
movl 0xf6a0e(%rip), %esi     # 0x19981c
leaq -0x408(%rbp), %rdi
callq 0x3e190
jmp 0xa2e1c
leaq -0x3c8(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
leaq -0x408(%rbp), %rdx
callq 0x3e070
jmp 0xa2e38
leaq -0x408(%rbp), %rdi
callq 0xac88
leaq -0x3e8(%rbp), %rdi
callq 0xac88
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x650(%rbp)
jmp 0xa2e63
leaq -0x3c8(%rbp), %rdi
callq 0xa220
movq -0x650(%rbp), %rdi
movq %rax, %rsi
movl -0x3a4(%rbp), %edx
callq 0xa650
jmp 0xa2e86
movq -0x650(%rbp), %rax
movq %rax, -0x410(%rbp)
movq -0x410(%rbp), %rdi
leaq 0x9bdc8(%rip), %rsi     # 0x13ec6a
callq 0xa5c0
movq %rax, -0x658(%rbp)
jmp 0xa2eb0
movq -0x658(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xa520
movq %rax, -0x660(%rbp)
jmp 0xa2ec9
movq -0x660(%rbp), %rdi
movq 0xf60b1(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa2ede
movq -0x410(%rbp), %rdi
leaq 0x9bd92(%rip), %rsi     # 0x13ec7e
callq 0xa5c0
movq %rax, -0x668(%rbp)
jmp 0xa2efa
movq -0x668(%rbp), %rdi
movq 0xf6080(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa2f0f
leaq -0x370(%rbp), %rdi
callq 0xa3b60
movq %rax, -0x420(%rbp)
leaq -0x418(%rbp), %rdi
leaq -0x420(%rbp), %rsi
callq 0x8ce00
leaq -0x370(%rbp), %rdi
callq 0x8cc60
movq %rax, -0x430(%rbp)
leaq -0x428(%rbp), %rdi
leaq -0x430(%rbp), %rsi
callq 0x8ce00
leaq -0x418(%rbp), %rdi
leaq -0x428(%rbp), %rsi
callq 0xa3b90
testb $0x1, %al
jne 0xa2f77
jmp 0xa309c
movq -0x410(%rbp), %rax
movq %rax, -0x678(%rbp)
leaq -0x418(%rbp), %rdi
callq 0xa3bc0
movq -0x678(%rbp), %rdi
movl (%rax), %esi
callq 0xab20
movq %rax, -0x670(%rbp)
jmp 0xa2fa8
movq -0x670(%rbp), %rdi
leaq 0x92f28(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x680(%rbp)
jmp 0xa2fc4
leaq -0x418(%rbp), %rdi
callq 0xa3bc0
movq -0x680(%rbp), %rdi
movl 0x4(%rax), %esi
callq 0xab20
movq %rax, -0x688(%rbp)
jmp 0xa2fe8
movq -0x688(%rbp), %rdi
movq 0xf5f92(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa2ffd
jmp 0xa2fff
leaq -0x418(%rbp), %rdi
callq 0xa3bf0
jmp 0xa2f35
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa37e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa37db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa3058
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x408(%rbp), %rdi
callq 0xac88
leaq -0x3e8(%rbp), %rdi
callq 0xac88
jmp 0xa37db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa37cf
movq -0x650(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
jmp 0xa37cf
leaq 0x9bbee(%rip), %rdx     # 0x13ec91
leaq -0x470(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3da80
jmp 0xa30b5
movl 0xf6761(%rip), %esi     # 0x19981c
leaq -0x490(%rbp), %rdi
callq 0x3e190
jmp 0xa30c9
leaq -0x450(%rbp), %rdi
leaq -0x470(%rbp), %rsi
leaq -0x490(%rbp), %rdx
callq 0x3e070
jmp 0xa30e5
leaq -0x490(%rbp), %rdi
callq 0xac88
leaq -0x470(%rbp), %rdi
callq 0xac88
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x690(%rbp)
jmp 0xa3110
leaq -0x450(%rbp), %rdi
callq 0xa220
movq -0x690(%rbp), %rdi
movq %rax, %rsi
movl -0x3a4(%rbp), %edx
callq 0xa650
jmp 0xa3133
movq -0x690(%rbp), %rax
movq %rax, -0x498(%rbp)
movq -0x498(%rbp), %rdi
leaq 0x9bb59(%rip), %rsi     # 0x13eca8
callq 0xa5c0
movq %rax, -0x698(%rbp)
jmp 0xa315d
movq -0x698(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xa520
movq %rax, -0x6a0(%rbp)
jmp 0xa3176
movq -0x6a0(%rbp), %rdi
movq 0xf5e04(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa318b
movq -0x498(%rbp), %rdi
leaq 0x9bae5(%rip), %rsi     # 0x13ec7e
callq 0xa5c0
movq %rax, -0x6a8(%rbp)
jmp 0xa31a7
movq -0x6a8(%rbp), %rdi
movq 0xf5dd3(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa31bc
leaq -0x3a0(%rbp), %rdi
callq 0xa3b60
movq %rax, -0x4a8(%rbp)
leaq -0x4a0(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x8ce00
leaq -0x3a0(%rbp), %rdi
callq 0x8cc60
movq %rax, -0x4b8(%rbp)
leaq -0x4b0(%rbp), %rdi
leaq -0x4b8(%rbp), %rsi
callq 0x8ce00
leaq -0x4a0(%rbp), %rdi
leaq -0x4b0(%rbp), %rsi
callq 0xa3b90
testb $0x1, %al
jne 0xa3224
jmp 0xa3327
movq -0x498(%rbp), %rax
movq %rax, -0x6b8(%rbp)
leaq -0x4a0(%rbp), %rdi
callq 0xa3bc0
movq -0x6b8(%rbp), %rdi
movl (%rax), %esi
callq 0xab20
movq %rax, -0x6b0(%rbp)
jmp 0xa3255
movq -0x6b0(%rbp), %rdi
leaq 0x92c7b(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x6c0(%rbp)
jmp 0xa3271
leaq -0x4a0(%rbp), %rdi
callq 0xa3bc0
movq -0x6c0(%rbp), %rdi
movl 0x4(%rax), %esi
callq 0xab20
movq %rax, -0x6c8(%rbp)
jmp 0xa3295
movq -0x6c8(%rbp), %rdi
movq 0xf5ce5(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa32aa
jmp 0xa32ac
leaq -0x4a0(%rbp), %rdi
callq 0xa3bf0
jmp 0xa31e2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa32e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x490(%rbp), %rdi
callq 0xac88
leaq -0x470(%rbp), %rdi
callq 0xac88
jmp 0xa37cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa37c3
movq -0x690(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
jmp 0xa37c3
leaq 0x9b98e(%rip), %rdx     # 0x13ecbc
leaq -0x4f8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3da80
jmp 0xa3340
movl 0xf64d6(%rip), %esi     # 0x19981c
leaq -0x518(%rbp), %rdi
callq 0x3e190
jmp 0xa3354
leaq -0x4d8(%rbp), %rdi
leaq -0x4f8(%rbp), %rsi
leaq -0x518(%rbp), %rdx
callq 0x3e070
jmp 0xa3370
leaq -0x518(%rbp), %rdi
callq 0xac88
leaq -0x4f8(%rbp), %rdi
callq 0xac88
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x6d0(%rbp)
jmp 0xa339b
leaq -0x4d8(%rbp), %rdi
callq 0xa220
movq -0x6d0(%rbp), %rdi
movq %rax, %rsi
movl -0x3a4(%rbp), %edx
callq 0xa650
jmp 0xa33be
movq -0x6d0(%rbp), %rax
movq %rax, -0x520(%rbp)
movq -0x520(%rbp), %rdi
leaq 0x9b909(%rip), %rsi     # 0x13ece3
callq 0xa5c0
movq %rax, -0x6d8(%rbp)
jmp 0xa33e8
movq -0x6d8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xa520
movq %rax, -0x6e0(%rbp)
jmp 0xa3401
movq -0x6e0(%rbp), %rdi
movq 0xf5b79(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa3416
movq -0x520(%rbp), %rdi
leaq 0x9b8e9(%rip), %rsi     # 0x13ed0d
callq 0xa5c0
movq %rax, -0x6e8(%rbp)
jmp 0xa3432
movq -0x6e8(%rbp), %rdi
movq 0xf5b48(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa3447
movq $0x0, -0x528(%rbp)
movq -0x528(%rbp), %rax
movq %rax, -0x6f0(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x467f0
movq %rax, %rcx
movq -0x6f0(%rbp), %rax
cmpq %rcx, %rax
je 0xa3579
movq -0x520(%rbp), %rdi
movq -0x528(%rbp), %rsi
callq 0xa140
movq %rax, -0x6f8(%rbp)
jmp 0xa349b
movq -0x6f8(%rbp), %rdi
leaq 0x92a35(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x700(%rbp)
jmp 0xa34b7
movq -0x528(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x4d100
movq -0x700(%rbp), %rdi
movl (%rax), %esi
callq 0xab20
movq %rax, -0x708(%rbp)
jmp 0xa34e1
movq -0x708(%rbp), %rdi
movq 0xf5a99(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa34f6
jmp 0xa34f8
movq -0x528(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x528(%rbp)
jmp 0xa3452
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa3535
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x518(%rbp), %rdi
callq 0xac88
leaq -0x4f8(%rbp), %rdi
callq 0xac88
jmp 0xa37c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa37b7
movq -0x6d0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
jmp 0xa37b7
leaq 0x9b7a3(%rip), %rdx     # 0x13ed23
leaq -0x568(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3da80
jmp 0xa3592
movl 0xf6284(%rip), %esi     # 0x19981c
leaq -0x588(%rbp), %rdi
callq 0x3e190
jmp 0xa35a6
leaq -0x548(%rbp), %rdi
leaq -0x568(%rbp), %rsi
leaq -0x588(%rbp), %rdx
callq 0x3e070
jmp 0xa35c2
leaq -0x588(%rbp), %rdi
callq 0xac88
leaq -0x568(%rbp), %rdi
callq 0xac88
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x710(%rbp)
jmp 0xa35ed
leaq -0x548(%rbp), %rdi
callq 0xa220
movq -0x710(%rbp), %rdi
movq %rax, %rsi
movl -0x3a4(%rbp), %edx
callq 0xa650
jmp 0xa3610
movq -0x710(%rbp), %rax
movq %rax, -0x590(%rbp)
movq -0x590(%rbp), %rdi
leaq 0x9b715(%rip), %rsi     # 0x13ed41
callq 0xa5c0
movq %rax, -0x718(%rbp)
jmp 0xa363a
movq -0x718(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xa520
movq %rax, -0x720(%rbp)
jmp 0xa3653
movq -0x720(%rbp), %rdi
movq 0xf5927(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa3668
movq -0x590(%rbp), %rdi
leaq 0x9b712(%rip), %rsi     # 0x13ed88
callq 0xa5c0
movq %rax, -0x728(%rbp)
jmp 0xa3684
movq -0x728(%rbp), %rdi
movq 0xf58f6(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0xa3699
movq -0x590(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x92440
jmp 0xa36ae
leaq -0x548(%rbp), %rdi
callq 0xac88
leaq -0x4d8(%rbp), %rdi
callq 0xac88
leaq -0x450(%rbp), %rdi
callq 0xac88
leaq -0x3c8(%rbp), %rdi
callq 0xac88
leaq -0x3a0(%rbp), %rdi
callq 0x83e10
leaq -0x370(%rbp), %rdi
callq 0x83e10
leaq -0xf8(%rbp), %rdi
callq 0xac88
leaq -0xc8(%rbp), %rdi
callq 0x6d0b0
leaq -0xb0(%rbp), %rdi
callq 0x48290
leaq -0x98(%rbp), %rdi
callq 0x48290
leaq -0x80(%rbp), %rdi
callq 0x48290
leaq -0x58(%rbp), %rdi
callq 0xac88
leaq -0x38(%rbp), %rdi
callq 0xac88
xorl %eax, %eax
addq $0x730, %rsp            # imm = 0x730
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa3772
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x588(%rbp), %rdi
callq 0xac88
leaq -0x568(%rbp), %rdi
callq 0xac88
jmp 0xa37b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa37ab
movq -0x710(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
leaq -0x548(%rbp), %rdi
callq 0xac88
leaq -0x4d8(%rbp), %rdi
callq 0xac88
leaq -0x450(%rbp), %rdi
callq 0xac88
leaq -0x3c8(%rbp), %rdi
callq 0xac88
leaq -0x3a0(%rbp), %rdi
callq 0x83e10
leaq -0x370(%rbp), %rdi
callq 0x83e10
leaq -0xf8(%rbp), %rdi
callq 0xac88
leaq -0xc8(%rbp), %rdi
callq 0x6d0b0
leaq -0xb0(%rbp), %rdi
callq 0x48290
leaq -0x98(%rbp), %rdi
callq 0x48290
leaq -0x80(%rbp), %rdi
callq 0x48290
leaq -0x58(%rbp), %rdi
callq 0xac88
leaq -0x38(%rbp), %rdi
callq 0xac88
movq -0x60(%rbp), %rdi
callq 0xab50
nopw (%rax,%rax)