// File: millanek[P]evo/evo_diversityFromHaps.cpp
// Function: regionPiMain(int, char**)
int regionPiMain(int argc, char** argv) { 
    parseRegionPiOptions(argc, argv);
    
    // Load up the intervals file
    std::ifstream* bedFile = new std::ifstream(opt::bedFile.c_str());
    std::map<int, string> linearToGenomeMap;
    
    std::cerr << "Loading coordinates from the bed file " << opt::bedFile << std::endl;
    LinkedCoordsBed coords = LinkedCoordsBed(bedFile);          // The bed file needs element names in the fourth column
    std::cerr << "Done" << std::endl;
    
    // Load up the VCF file:
    std::istream* vcfFile = createReader(opt::vcfFile.c_str());
    string line; // std::unordered_map<string, MultiallelicCounts> vcfCountsMap;
    std::unordered_map<string, double> vcfPiMap;
    std::unordered_map<string, double> vcfHetMap;
    std::unordered_map<string, double> vcfInbreedingPvalMap;
    int totalVariantNumber = 0;
    
    std::cerr << "Loading variants from the VCF file " << opt::vcfFile << std::endl;
    std::vector<std::string> fields; int numSamples = -1;
    while (getline(*vcfFile, line)) {
        if (line[0] == '#' && line[1] == '#') {
        
        } else if (line[0] == '#' && line[1] == 'C') {
            fields = split(line, '\t');
            std::vector<std::string> sampleNames(fields.begin()+NUM_NON_GENOTYPE_COLUMNS,fields.end());
            numSamples = (int)sampleNames.size();
        } else {
            totalVariantNumber++;
            fields = split(line, '\t');
            string scaffold = fields[0]; string pos = fields[1]; string altAllele = fields[4];
            std::vector<string> altAlleles = split(altAllele, ','); int starPos = -1;
            std::vector<std::string>::iterator it = std::find(altAlleles.begin(), altAlleles.end(), "*");
            if (it != altAlleles.end()) { starPos = (int) std::distance(altAlleles.begin(), it); }
          /*  if (starPos != -1) {
                std::cerr << "starPos: " << starPos << std::endl;
                std::cerr << "altAllele: " << altAllele << std::endl;
            } */
            
            std::vector<std::string> genotypes(fields.begin()+NUM_NON_GENOTYPE_COLUMNS,fields.end());
            
            MultiallelicCounts* counts = new MultiallelicCounts(numSamples,starPos);
            counts->getMultiallelicCounts(genotypes);
            if (totalVariantNumber % 10000 == 0) {
                std::cerr << "Variant N: " << totalVariantNumber << std::endl;
            }
            double thisVariantPi = counts->getPiThisVariant();
            double thisVariantHet = counts->getHeterozygosityThisVariant();
            //vcfCountsMap[scaffold+"\t"+pos] = *counts;
            vcfPiMap[scaffold+"\t"+pos] = thisVariantPi;
            vcfHetMap[scaffold+"\t"+pos] = thisVariantHet;
            delete counts;
        }
    }
    std::cerr << "Done" << std::endl;
    

    string outPiFileName;
    if (opt::outFile != "") {
        outPiFileName = opt::outFile;
    } else {
        size_t suffixPos = opt::bedFile.find_last_of('.');
        if (suffixPos != std::string::npos) {
            outPiFileName = stripExtension(opt::bedFile) + "_PiVals_perElement.txt";
        } else {
            outPiFileName = opt::bedFile + "_PiVals_perElement.txt";
        }
    }
    std::ofstream* outPiFile = new std::ofstream(outPiFileName.c_str());
    
    std::cerr << "Now calculating Pi and Heterozygosity values per element to be written out into: " << outPiFileName << std::endl;
    std::vector<double> elementPiValues = coords.getMeanPerElement(vcfPiMap);
    std::vector<double> elementHetValues = coords.getMeanPerElement(vcfHetMap);
    std::cerr << "Calculations done" << std::endl;
    
    std::vector<string> elementNames = coords.getElementNames();
    std::vector<std::vector<string> > elementOuterBounds = coords.getElementOuterBoundaries();
    *outPiFile << "scaffold" << "\t" << "regionStartOnScaffold" << "\t" << "regionEndOnScaffold" << "\t" << "regionName" << "\t" << "pi" << "\t" << "heterozygosity" << std::endl;
    for (int i = 0; i < (int)elementPiValues.size(); i++) {
        *outPiFile << elementOuterBounds[i][0] << "\t" << elementOuterBounds[i][1] << "\t" << elementOuterBounds[i][2] << "\t" << elementNames[i] << "\t" << elementPiValues[i] << "\t" << elementHetValues[i] << std::endl;
    }
    
    std::cerr << "Done" << std::endl;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x690, %rsp            # imm = 0x690
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x117400
movl $0x208, %edi            # imm = 0x208
callq 0xa5d0
movq %rax, -0x478(%rbp)
movq %rax, -0x480(%rbp)
leaq 0x85543(%rip), %rdi     # 0x19b700
callq 0xa220
movq -0x478(%rbp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0xab90
jmp 0x1161d8
movq -0x480(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x3d7b0
movq 0x82dfd(%rip), %rdi     # 0x198ff0
leaq 0x1c0ce(%rip), %rsi     # 0x1322c8
callq 0xa5c0
movq %rax, -0x488(%rbp)
jmp 0x116208
movq -0x488(%rbp), %rdi
leaq 0x854ea(%rip), %rsi     # 0x19b700
callq 0xa520
movq %rax, -0x490(%rbp)
jmp 0x116224
movq -0x490(%rbp), %rdi
movq 0x82d56(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0x116239
leaq -0x70(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x3d830
jmp 0x116248
movq 0x82da1(%rip), %rdi     # 0x198ff0
leaq 0x1c099(%rip), %rsi     # 0x1322ef
callq 0xa5c0
movq %rax, -0x498(%rbp)
jmp 0x116264
movq -0x498(%rbp), %rdi
movq 0x82d16(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0x116279
leaq 0x854a0(%rip), %rdi     # 0x19b720
callq 0xa220
movq %rax, -0x4a8(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x4a0(%rbp)
callq 0xab60
movq -0x4a8(%rbp), %rsi
movq -0x4a0(%rbp), %rdx
leaq -0x98(%rbp), %rdi
callq 0x2d6c0
jmp 0x1162bb
leaq -0x98(%rbp), %rdi
movl $0x8, %esi
callq 0x80e30
movq %rax, -0x4b0(%rbp)
jmp 0x1162d5
leaq -0x98(%rbp), %rdi
callq 0xac88
leaq -0x99(%rbp), %rdi
callq 0xa640
movq -0x4b0(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0xa820
leaq -0xf8(%rbp), %rdi
callq 0x3d920
leaq -0x130(%rbp), %rdi
callq 0x3d920
leaq -0x168(%rbp), %rdi
callq 0x3d920
movl $0x0, -0x16c(%rbp)
movq 0x82cb7(%rip), %rdi     # 0x198ff0
leaq 0x1bfb4(%rip), %rsi     # 0x1322f4
callq 0xa5c0
movq %rax, -0x4b8(%rbp)
jmp 0x11634e
movq -0x4b8(%rbp), %rdi
leaq 0x853c4(%rip), %rsi     # 0x19b720
callq 0xa520
movq %rax, -0x4c0(%rbp)
jmp 0x11636a
movq -0x4c0(%rbp), %rdi
movq 0x82c10(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0x11637f
leaq -0x188(%rbp), %rdi
callq 0x48da0
movl $0xffffffff, -0x18c(%rbp) # imm = 0xFFFFFFFF
movq -0x78(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xa0d0
movq %rax, -0x4c8(%rbp)
jmp 0x1163ae
movq -0x4c8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0xa740
movb %al, -0x4c9(%rbp)
jmp 0x1163cc
movb -0x4c9(%rbp), %al
testb $0x1, %al
jne 0x1163db
jmp 0x116c47
xorl %eax, %eax
movl %eax, %esi
leaq -0xc0(%rbp), %rdi
callq 0xac60
movq %rax, -0x4d8(%rbp)
jmp 0x1163f4
movq -0x4d8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x1164d6
leaq -0xc0(%rbp), %rdi
movl $0x1, %esi
callq 0xac60
movq %rax, -0x4e0(%rbp)
jmp 0x116421
movq -0x4e0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x1164d6
jmp 0x116c42
movq -0x480(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x208, %esi            # imm = 0x208
callq 0xa5e0
jmp 0x1173ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1173e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1173dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1164a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x98(%rbp), %rdi
callq 0xac88
leaq -0x99(%rbp), %rdi
callq 0xa640
jmp 0x1173dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1173ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1173a1
xorl %eax, %eax
movl %eax, %esi
leaq -0xc0(%rbp), %rdi
callq 0xac60
movq %rax, -0x4e8(%rbp)
jmp 0x1164ef
movq -0x4e8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x116636
leaq -0xc0(%rbp), %rdi
movl $0x1, %esi
callq 0xac60
movq %rax, -0x4f0(%rbp)
jmp 0x11651c
movq -0x4f0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x43, %eax
jne 0x116636
leaq -0x1a8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
movl $0x9, %edx
callq 0x7bbe0
jmp 0x116549
leaq -0x188(%rbp), %rdi
movq %rdi, -0x500(%rbp)
leaq -0x1a8(%rbp), %rsi
movq %rsi, -0x508(%rbp)
callq 0x50c30
movq -0x508(%rbp), %rdi
callq 0x3dfa0
movq -0x500(%rbp), %rdi
callq 0x44030
movq %rax, -0x1d0(%rbp)
leaq -0x1d0(%rbp), %rdi
movl $0x9, %esi
callq 0x44390
movq -0x500(%rbp), %rdi
movq %rax, -0x1c8(%rbp)
callq 0x44060
movq %rax, -0x1d8(%rbp)
leaq -0x1d9(%rbp), %rdi
movq %rdi, -0x4f8(%rbp)
callq 0x48e80
movq -0x4f8(%rbp), %rcx
movq -0x1c8(%rbp), %rsi
movq -0x1d8(%rbp), %rdx
leaq -0x1c0(%rbp), %rdi
callq 0xc6600
jmp 0x1165ea
leaq -0x1d9(%rbp), %rdi
callq 0x40090
leaq -0x1c0(%rbp), %rdi
callq 0x3ffd0
movl %eax, -0x18c(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x3dfa0
jmp 0x116c40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x1d9(%rbp), %rdi
callq 0x40090
jmp 0x1173a1
movl -0x16c(%rbp), %eax
incl %eax
movl %eax, -0x16c(%rbp)
leaq -0x1f8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
movl $0x9, %edx
callq 0x7bbe0
jmp 0x11665e
leaq -0x188(%rbp), %rdi
movq %rdi, -0x510(%rbp)
leaq -0x1f8(%rbp), %rsi
movq %rsi, -0x518(%rbp)
callq 0x50c30
movq -0x518(%rbp), %rdi
callq 0x3dfa0
movq -0x510(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3d940
movq %rax, %rsi
leaq -0x218(%rbp), %rdi
callq 0xa250
jmp 0x1166ac
leaq -0x188(%rbp), %rdi
movl $0x1, %esi
callq 0x3d940
movq %rax, %rsi
leaq -0x238(%rbp), %rdi
callq 0xa250
jmp 0x1166ce
leaq -0x188(%rbp), %rdi
movl $0x4, %esi
callq 0x3d940
movq %rax, %rsi
leaq -0x258(%rbp), %rdi
callq 0xa250
jmp 0x1166f0
leaq -0x270(%rbp), %rdi
leaq -0x258(%rbp), %rsi
movl $0x2c, %edx
callq 0x7bbe0
jmp 0x11670a
movl $0xffffffff, -0x274(%rbp) # imm = 0xFFFFFFFF
leaq -0x270(%rbp), %rdi
movq %rdi, -0x528(%rbp)
callq 0x44030
movq -0x528(%rbp), %rdi
movq %rax, -0x288(%rbp)
callq 0x44060
movq %rax, -0x290(%rbp)
movq -0x288(%rbp), %rdi
movq -0x290(%rbp), %rsi
leaq 0x37a8c(%rip), %rdx     # 0x14e1e2
callq 0x1176c0
movq %rax, -0x520(%rbp)
jmp 0x116764
movq -0x520(%rbp), %rax
movq %rax, -0x280(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x44060
movq %rax, -0x298(%rbp)
leaq -0x280(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x44190
testb $0x1, %al
jne 0x1167a1
jmp 0x116831
leaq -0x270(%rbp), %rdi
callq 0x44030
movq %rax, -0x2a0(%rbp)
movq -0x280(%rbp), %rax
movq %rax, -0x2a8(%rbp)
movq -0x2a0(%rbp), %rdi
movq -0x2a8(%rbp), %rsi
callq 0x75450
movq %rax, -0x530(%rbp)
jmp 0x1167de
movq -0x530(%rbp), %rax
movl %eax, -0x274(%rbp)
jmp 0x116831
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x116c2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x116c23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x116c17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x116c0b
leaq -0x188(%rbp), %rdi
movq %rdi, -0x540(%rbp)
callq 0x44030
movq %rax, -0x2d0(%rbp)
leaq -0x2d0(%rbp), %rdi
movl $0x9, %esi
callq 0x44390
movq -0x540(%rbp), %rdi
movq %rax, -0x2c8(%rbp)
callq 0x44060
movq %rax, -0x2d8(%rbp)
leaq -0x2d9(%rbp), %rdi
movq %rdi, -0x538(%rbp)
callq 0x48e80
movq -0x538(%rbp), %rcx
movq -0x2c8(%rbp), %rsi
movq -0x2d8(%rbp), %rdx
leaq -0x2c0(%rbp), %rdi
callq 0xc6600
jmp 0x1168ac
leaq -0x2d9(%rbp), %rdi
callq 0x40090
movl $0xb0, %edi
callq 0xa5d0
movq %rax, -0x548(%rbp)
jmp 0x1168cb
movq -0x548(%rbp), %rdi
movl -0x18c(%rbp), %esi
movl -0x274(%rbp), %edx
callq 0x117710
jmp 0x1168e5
movq -0x548(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movq -0x2e8(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x7c720
jmp 0x116908
movl -0x16c(%rbp), %eax
movl $0x2710, %ecx           # imm = 0x2710
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x1169bd
movq 0x826ca(%rip), %rdi     # 0x198ff0
leaq 0x37697(%rip), %rsi     # 0x14dfc4
callq 0xa5c0
movq %rax, -0x550(%rbp)
jmp 0x11693b
movq -0x550(%rbp), %rdi
movl -0x16c(%rbp), %esi
callq 0xab20
movq %rax, -0x558(%rbp)
jmp 0x116956
movq -0x558(%rbp), %rdi
movq 0x82624(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0x11696b
jmp 0x1169bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x2d9(%rbp), %rdi
callq 0x40090
jmp 0x116c0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x116bff
movq -0x548(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0xb0, %esi
callq 0xa5e0
jmp 0x116bff
movq -0x2e8(%rbp), %rdi
callq 0x7cc70
movsd %xmm0, -0x560(%rbp)
jmp 0x1169d3
movsd -0x560(%rbp), %xmm0
movsd %xmm0, -0x2f0(%rbp)
movq -0x2e8(%rbp), %rdi
callq 0x7cac0
movsd %xmm0, -0x568(%rbp)
jmp 0x1169f9
movsd -0x568(%rbp), %xmm0
movsd %xmm0, -0x2f8(%rbp)
movsd -0x2f0(%rbp), %xmm0
movsd %xmm0, -0x570(%rbp)
leaq 0x1f4be(%rip), %rdx     # 0x135ede
leaq -0x338(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x3da80
jmp 0x116a35
leaq -0x318(%rbp), %rdi
leaq -0x338(%rbp), %rsi
leaq -0x238(%rbp), %rdx
callq 0x3da30
jmp 0x116a51
leaq -0xf8(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x3def0
movq %rax, -0x578(%rbp)
jmp 0x116a6d
movq -0x578(%rbp), %rax
movsd -0x570(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x318(%rbp), %rdi
callq 0xac88
leaq -0x338(%rbp), %rdi
callq 0xac88
movsd -0x2f8(%rbp), %xmm0
movsd %xmm0, -0x580(%rbp)
leaq 0x1f42f(%rip), %rdx     # 0x135ede
leaq -0x378(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x3da80
jmp 0x116ac4
leaq -0x358(%rbp), %rdi
leaq -0x378(%rbp), %rsi
leaq -0x238(%rbp), %rdx
callq 0x3da30
jmp 0x116ae0
leaq -0x130(%rbp), %rdi
leaq -0x358(%rbp), %rsi
callq 0x3def0
movq %rax, -0x588(%rbp)
jmp 0x116afc
movq -0x588(%rbp), %rax
movsd -0x580(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x358(%rbp), %rdi
callq 0xac88
leaq -0x378(%rbp), %rdi
callq 0xac88
movq -0x2e8(%rbp), %rax
movq %rax, -0x590(%rbp)
cmpq $0x0, %rax
je 0x116b58
movq -0x590(%rbp), %rdi
callq 0x1178d0
movq -0x590(%rbp), %rdi
movl $0xb0, %esi
callq 0xa5e0
leaq -0x2c0(%rbp), %rdi
callq 0x3dfa0
leaq -0x270(%rbp), %rdi
callq 0x3dfa0
leaq -0x258(%rbp), %rdi
callq 0xac88
leaq -0x238(%rbp), %rdi
callq 0xac88
leaq -0x218(%rbp), %rdi
callq 0xac88
jmp 0x116c40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x116bbf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x318(%rbp), %rdi
callq 0xac88
leaq -0x338(%rbp), %rdi
callq 0xac88
jmp 0x116bff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x116bf3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x358(%rbp), %rdi
callq 0xac88
leaq -0x378(%rbp), %rdi
callq 0xac88
leaq -0x2c0(%rbp), %rdi
callq 0x3dfa0
leaq -0x270(%rbp), %rdi
callq 0x3dfa0
leaq -0x258(%rbp), %rdi
callq 0xac88
leaq -0x238(%rbp), %rdi
callq 0xac88
leaq -0x218(%rbp), %rdi
callq 0xac88
jmp 0x1173a1
jmp 0x116c42
jmp 0x116395
movq 0x823a2(%rip), %rdi     # 0x198ff0
leaq 0x1b69a(%rip), %rsi     # 0x1322ef
callq 0xa5c0
movq %rax, -0x598(%rbp)
jmp 0x116c63
movq -0x598(%rbp), %rdi
movq 0x82317(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0x116c78
leaq -0x398(%rbp), %rdi
callq 0xa820
leaq 0x84ab5(%rip), %rdi     # 0x19b740
leaq 0x1f24d(%rip), %rsi     # 0x135edf
callq 0x50eb0
movb %al, -0x599(%rbp)
jmp 0x116c9f
movb -0x599(%rbp), %al
testb $0x1, %al
jne 0x116cab
jmp 0x116cd6
leaq 0x84a8e(%rip), %rsi     # 0x19b740
leaq -0x398(%rbp), %rdi
callq 0xa060
jmp 0x116cc0
jmp 0x116db7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x117395
leaq 0x84a23(%rip), %rdi     # 0x19b700
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0xabf0
movq %rax, -0x3a0(%rbp)
cmpq $-0x1, -0x3a0(%rbp)
je 0x116d7a
leaq 0x849fa(%rip), %rsi     # 0x19b700
leaq -0x3e0(%rbp), %rdi
callq 0x7be70
jmp 0x116d14
leaq 0x372b5(%rip), %rdx     # 0x14dfd0
leaq -0x3c0(%rbp), %rdi
leaq -0x3e0(%rbp), %rsi
callq 0x3e020
jmp 0x116d30
leaq -0x398(%rbp), %rdi
leaq -0x3c0(%rbp), %rsi
callq 0xa710
leaq -0x3c0(%rbp), %rdi
callq 0xac88
leaq -0x3e0(%rbp), %rdi
callq 0xac88
jmp 0x116db5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x3e0(%rbp), %rdi
callq 0xac88
jmp 0x117395
leaq 0x8497f(%rip), %rsi     # 0x19b700
leaq 0x37248(%rip), %rdx     # 0x14dfd0
leaq -0x400(%rbp), %rdi
callq 0x3da80
jmp 0x116d96
leaq -0x398(%rbp), %rdi
leaq -0x400(%rbp), %rsi
callq 0xa710
leaq -0x400(%rbp), %rdi
callq 0xac88
jmp 0x116db7
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x5a8(%rbp)
jmp 0x116dca
leaq -0x398(%rbp), %rdi
callq 0xa220
movq -0x5a8(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0xa650
jmp 0x116dec
movq -0x5a8(%rbp), %rax
movq %rax, -0x408(%rbp)
movq 0x821ef(%rip), %rdi     # 0x198ff0
leaq 0x371df(%rip), %rsi     # 0x14dfe7
callq 0xa5c0
movq %rax, -0x5b0(%rbp)
jmp 0x116e16
movq -0x5b0(%rbp), %rdi
leaq -0x398(%rbp), %rsi
callq 0xa520
movq %rax, -0x5b8(%rbp)
jmp 0x116e32
movq -0x5b8(%rbp), %rdi
movq 0x82148(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0x116e47
leaq -0x420(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0xf8(%rbp), %rdx
callq 0x3e590
jmp 0x116e60
leaq -0x438(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x130(%rbp), %rdx
callq 0x3e590
jmp 0x116e79
movq 0x82170(%rip), %rdi     # 0x198ff0
leaq 0x1b591(%rip), %rsi     # 0x132418
callq 0xa5c0
movq %rax, -0x5c0(%rbp)
jmp 0x116e95
movq -0x5c0(%rbp), %rdi
movq 0x820e5(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0x116eaa
leaq -0x450(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3e960
jmp 0x116ebc
leaq -0x468(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3ea60
jmp 0x116ece
movq -0x408(%rbp), %rdi
leaq 0x28fbc(%rip), %rsi     # 0x13fe98
callq 0xa5c0
movq %rax, -0x5c8(%rbp)
jmp 0x116eea
movq -0x5c8(%rbp), %rdi
leaq 0x1efe6(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x5d0(%rbp)
jmp 0x116f06
movq -0x5d0(%rbp), %rdi
leaq 0x37125(%rip), %rsi     # 0x14e039
callq 0xa5c0
movq %rax, -0x5d8(%rbp)
jmp 0x116f22
movq -0x5d8(%rbp), %rdi
leaq 0x1efae(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x5e0(%rbp)
jmp 0x116f3e
movq -0x5e0(%rbp), %rdi
leaq 0x37103(%rip), %rsi     # 0x14e04f
callq 0xa5c0
movq %rax, -0x5e8(%rbp)
jmp 0x116f5a
movq -0x5e8(%rbp), %rdi
leaq 0x1ef76(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x5f0(%rbp)
jmp 0x116f76
movq -0x5f0(%rbp), %rdi
leaq 0x370df(%rip), %rsi     # 0x14e063
callq 0xa5c0
movq %rax, -0x5f8(%rbp)
jmp 0x116f92
movq -0x5f8(%rbp), %rdi
leaq 0x1ef3e(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x600(%rbp)
jmp 0x116fae
movq -0x600(%rbp), %rdi
leaq 0x30b7f(%rip), %rsi     # 0x147b3b
callq 0xa5c0
movq %rax, -0x608(%rbp)
jmp 0x116fca
movq -0x608(%rbp), %rdi
leaq 0x1ef06(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x610(%rbp)
jmp 0x116fe6
movq -0x610(%rbp), %rdi
leaq 0x30be7(%rip), %rsi     # 0x147bdb
callq 0xa5c0
movq %rax, -0x618(%rbp)
jmp 0x117002
movq -0x618(%rbp), %rdi
movq 0x81f78(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0x117017
movl $0x0, -0x46c(%rbp)
movl -0x46c(%rbp), %eax
movl %eax, -0x61c(%rbp)
leaq -0x420(%rbp), %rdi
callq 0x3ebf0
movq %rax, %rcx
movl -0x61c(%rbp), %eax
cmpl %ecx, %eax
jge 0x1172ab
movq -0x408(%rbp), %rax
movq %rax, -0x630(%rbp)
movslq -0x46c(%rbp), %rsi
leaq -0x468(%rbp), %rdi
callq 0x3ec10
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3d940
movq -0x630(%rbp), %rdi
movq %rax, %rsi
callq 0xa520
movq %rax, -0x628(%rbp)
jmp 0x11708f
movq -0x628(%rbp), %rdi
leaq 0x1ee41(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x638(%rbp)
jmp 0x1170ab
movslq -0x46c(%rbp), %rsi
leaq -0x468(%rbp), %rdi
callq 0x3ec10
movq %rax, %rdi
movl $0x1, %esi
callq 0x3d940
movq -0x638(%rbp), %rdi
movq %rax, %rsi
callq 0xa520
movq %rax, -0x640(%rbp)
jmp 0x1170e3
movq -0x640(%rbp), %rdi
leaq 0x1eded(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x648(%rbp)
jmp 0x1170ff
movslq -0x46c(%rbp), %rsi
leaq -0x468(%rbp), %rdi
callq 0x3ec10
movq %rax, %rdi
movl $0x2, %esi
callq 0x3d940
movq -0x648(%rbp), %rdi
movq %rax, %rsi
callq 0xa520
movq %rax, -0x650(%rbp)
jmp 0x117137
movq -0x650(%rbp), %rdi
leaq 0x1ed99(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x658(%rbp)
jmp 0x117153
movslq -0x46c(%rbp), %rsi
leaq -0x450(%rbp), %rdi
callq 0x3d940
movq -0x658(%rbp), %rdi
movq %rax, %rsi
callq 0xa520
movq %rax, -0x660(%rbp)
jmp 0x11717e
movq -0x660(%rbp), %rdi
leaq 0x1ed52(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x668(%rbp)
jmp 0x11719a
movslq -0x46c(%rbp), %rsi
leaq -0x420(%rbp), %rdi
callq 0x3ec30
movq -0x668(%rbp), %rdi
movsd (%rax), %xmm0
callq 0xabd0
movq %rax, -0x670(%rbp)
jmp 0x1171c6
movq -0x670(%rbp), %rdi
leaq 0x1ed0a(%rip), %rsi     # 0x135ede
callq 0xa5c0
movq %rax, -0x678(%rbp)
jmp 0x1171e2
movslq -0x46c(%rbp), %rsi
leaq -0x438(%rbp), %rdi
callq 0x3ec30
movq -0x678(%rbp), %rdi
movsd (%rax), %xmm0
callq 0xabd0
movq %rax, -0x680(%rbp)
jmp 0x11720e
movq -0x680(%rbp), %rdi
movq 0x81d6c(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0x117223
jmp 0x117225
movl -0x46c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x46c(%rbp)
jmp 0x117021
movq -0x5a8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
jmp 0x117395
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x117389
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x11737d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x117371
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x468(%rbp), %rdi
callq 0x3ec50
jmp 0x117371
movq 0x81d3e(%rip), %rdi     # 0x198ff0
leaq 0x1b036(%rip), %rsi     # 0x1322ef
callq 0xa5c0
movq %rax, -0x688(%rbp)
jmp 0x1172c7
movq -0x688(%rbp), %rdi
movq 0x81cb3(%rip), %rsi     # 0x198f88
callq 0xa610
jmp 0x1172dc
leaq -0x468(%rbp), %rdi
callq 0x3ec50
leaq -0x450(%rbp), %rdi
callq 0x3dfa0
leaq -0x438(%rbp), %rdi
callq 0x3ecb0
leaq -0x420(%rbp), %rdi
callq 0x3ecb0
leaq -0x398(%rbp), %rdi
callq 0xac88
leaq -0x188(%rbp), %rdi
callq 0x3dfa0
leaq -0x168(%rbp), %rdi
callq 0x2d530
leaq -0x130(%rbp), %rdi
callq 0x2d530
leaq -0xf8(%rbp), %rdi
callq 0x2d530
leaq -0xc0(%rbp), %rdi
callq 0xac88
leaq -0x70(%rbp), %rdi
callq 0x3d8e0
leaq -0x58(%rbp), %rdi
callq 0x3ed30
xorl %eax, %eax
addq $0x690, %rsp            # imm = 0x690
popq %rbp
retq
leaq -0x450(%rbp), %rdi
callq 0x3dfa0
leaq -0x438(%rbp), %rdi
callq 0x3ecb0
leaq -0x420(%rbp), %rdi
callq 0x3ecb0
leaq -0x398(%rbp), %rdi
callq 0xac88
leaq -0x188(%rbp), %rdi
callq 0x3dfa0
leaq -0x168(%rbp), %rdi
callq 0x2d530
leaq -0x130(%rbp), %rdi
callq 0x2d530
leaq -0xf8(%rbp), %rdi
callq 0x2d530
leaq -0xc0(%rbp), %rdi
callq 0xac88
leaq -0x70(%rbp), %rdi
callq 0x3d8e0
leaq -0x58(%rbp), %rdi
callq 0x3ed30
movq -0x20(%rbp), %rdi
callq 0xab50
nopl (%rax,%rax)