// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
callq 0xbf620
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %rbx
movq 0x4ec86(%rip), %rsi     # 0x10d208
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movq %rbx, 0x120(%rsp)
leaq 0x1b8(%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 0x4ca2a(%rip), %rdi     # 0x10afe8
leaq 0xfa8b(%rip), %rsi      # 0xce050
movl $0x26, %edx
callq 0x84e0
movq 0x4ec32(%rip), %rsi     # 0x10d208
movq 0x4ec33(%rip), %rdx     # 0x10d210
movq 0x4ca04(%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
leaq 0xd8(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x310e6
movq 0x4c9b9(%rip), %rbx     # 0x10afe8
leaq 0xfa41(%rip), %rsi      # 0xce077
movl $0x4, %edx
movq %rbx, %rdi
callq 0x84e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq 0x4c987(%rip), %rdi     # 0x10afe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x4ebb3(%rip), %rsi     # 0x10d228
leaq 0x128(%rsp), %rdi
leaq 0x178(%rsp), %rdx
callq 0x286de
leaq 0x128(%rsp), %rdi
movl $0x8, %esi
callq 0x53224
movq %rax, %rbx
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbe6c0
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x100(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x158(%rsp), %rax
movq %rax, -0x30(%rax)
movl $0x1, %ecx
movq %rcx, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, %edx       # imm = 0x3F800000
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x1a8(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x210(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
movq 0x4c8ac(%rip), %rdi     # 0x10afe8
leaq 0xf939(%rip), %rsi      # 0xce07c
movl $0x23, %edx
callq 0x84e0
movq 0x4ead4(%rip), %rsi     # 0x10d228
movq 0x4ead5(%rip), %rdx     # 0x10d230
movq 0x4c886(%rip), %rdi     # 0x10afe8
callq 0x84e0
movq %rax, %r14
movq (%rax), %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
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0x88(%rsp), %r15
xorl %ebp, %ebp
leaq 0xf0(%rsp), %r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0xb8(%rsp)
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xbed27
movq 0xf0(%rsp), %rax
movb (%rax), %cl
cmpb $0x23, %cl
jne 0xbe819
cmpb $0x23, 0x1(%rax)
je 0xbe7c1
cmpb $0x23, %cl
jne 0xbe819
cmpb $0x43, 0x1(%rax)
je 0xbec7e
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rsi
movl $0x9, %edx
callq 0x50624
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps 0x60(%rsp), %xmm0
movq 0x70(%rsp), %rax
movups (%rsp), %xmm1
movaps %xmm1, 0x60(%rsp)
movq 0x10(%rsp), %rcx
movq %rcx, 0x70(%rsp)
movaps 0x20(%rsp), %xmm1
movaps %xmm0, 0x20(%rsp)
movq %rax, 0x30(%rsp)
movups %xmm1, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x3123c
movq %r12, %rdi
callq 0x3123c
movq 0x60(%rsp), %rax
leaq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x2e45c
movq 0x60(%rsp), %rax
leaq 0x10(%rsp), %rcx
movq %rcx, (%rsp)
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x2e45c
movq 0x60(%rsp), %rax
leaq 0xa8(%rsp), %rcx
movq %rcx, 0x98(%rsp)
movq 0x80(%rax), %rsi
movq 0x88(%rax), %rdx
addq %rsi, %rdx
leaq 0x98(%rsp), %r12
movq %r12, %rdi
callq 0x2e45c
leaq 0xc0(%rsp), %rdi
movq %r12, %rsi
movl $0x2c, %edx
callq 0x50624
movq 0xc0(%rsp), %rdi
movq 0xc8(%rsp), %rsi
leaq 0x2adb0(%rip), %rdx     # 0xe96d6
callq 0xbfb29
movq %rax, %r12
subq 0xc0(%rsp), %r12
shrq $0x5, %r12
cmpq 0xc8(%rsp), %rax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %eax, %r12d
movq 0x60(%rsp), %rsi
movl $0x120, %eax            # imm = 0x120
addq %rax, %rsi
movq 0x68(%rsp), %rdx
leaq 0x160(%rsp), %rdi
leaq 0x78(%rsp), %rcx
callq 0x7fa48
movl $0xb0, %edi
callq 0x8470
movq %rax, %r13
movq %rax, %rdi
movq 0xb8(%rsp), %rsi
movl %r12d, %edx
callq 0xbf8c0
movq %r13, %rdi
leaq 0x160(%rsp), %rsi
callq 0x50e38
incl %ebp
imull $0x3afb7e91, %ebp, %eax # imm = 0x3AFB7E91
addl $0x346dc0, %eax         # imm = 0x346DC0
rorl $0x4, %eax
cmpl $0x68db8, %eax          # imm = 0x68DB8
ja 0xbea06
movl $0xb, %edx
movq 0x4c626(%rip), %rdi     # 0x10afe8
leaq 0x2aaef(%rip), %rsi     # 0xe94b8
callq 0x84e0
movq 0x4c613(%rip), %rdi     # 0x10afe8
movl %ebp, %esi
callq 0x8810
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r12, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq %r13, %rdi
callq 0x5105e
movsd %xmm0, 0x118(%rsp)
movq %r13, %rdi
callq 0x50f48
movsd %xmm0, 0x110(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %r12
movq %r12, %rdi
callq 0x2e45c
movq %r12, %rdi
leaq 0x13228(%rip), %rsi     # 0xd1c7e
callq 0x88c0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x8180
movq %r15, 0x78(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbea92
movq %rdx, 0x78(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x88(%rsp)
jmp 0xbea99
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x80(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x128(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3485c
movsd 0x118(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0xbeaed
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbeb09
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %r12
movq %r12, %rdi
callq 0x2e45c
movq %r12, %rdi
leaq 0x13147(%rip), %rsi     # 0xd1c7e
callq 0x88c0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x8180
movq %r15, 0x78(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbeb73
movq %rdx, 0x78(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x88(%rsp)
jmp 0xbeb7a
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x80(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x178(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3485c
movsd 0x110(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0xbebce
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbebea
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r13, %rdi
callq 0xbfa98
movl $0xb0, %esi
movq %r13, %rdi
callq 0x8480
leaq 0x160(%rsp), %rdi
callq 0x3123c
leaq 0xc0(%rsp), %rdi
callq 0x3123c
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xbec3e
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8480
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xbec59
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xbe7c1
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbe7c1
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rsi
movl $0x9, %edx
callq 0x50624
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps 0x60(%rsp), %xmm0
movq 0x70(%rsp), %rax
movups (%rsp), %xmm1
movaps %xmm1, 0x60(%rsp)
movq 0x10(%rsp), %rcx
movq %rcx, 0x70(%rsp)
movaps 0x20(%rsp), %xmm1
movaps %xmm0, 0x20(%rsp)
movq %rax, 0x30(%rsp)
movups %xmm1, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x3123c
movq %r12, %rdi
callq 0x3123c
movq 0x60(%rsp), %rsi
movl $0x120, %eax            # imm = 0x120
addq %rax, %rsi
movq 0x68(%rsp), %rdx
movq %r13, %rdi
movq %r12, %rcx
callq 0x7fa48
movq 0x28(%rsp), %rax
subq 0x20(%rsp), %rax
shrq $0x5, %rax
movq %rax, 0xb8(%rsp)
movq %r13, %rdi
callq 0x3123c
jmp 0xbe7c1
movq 0x4c2ba(%rip), %rbx     # 0x10afe8
leaq 0xf342(%rip), %rsi      # 0xce077
movl $0x4, %edx
movq %rbx, %rdi
callq 0x84e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq 0x4c288(%rip), %rdi     # 0x10afe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movb $0x0, 0x30(%rsp)
leaq 0x4e4bc(%rip), %rdi     # 0x10d248
leaq 0x12eec(%rip), %rsi     # 0xd1c7f
callq 0x8160
testl %eax, %eax
leaq 0x10(%rsp), %r15
je 0xbedb7
leaq 0x4e4a0(%rip), %rsi     # 0x10d248
leaq 0x20(%rsp), %rdi
callq 0x8270
jmp 0xbeed0
leaq 0x4e44a(%rip), %rdi     # 0x10d208
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x88f0
cmpq $-0x1, %rax
je 0xbee1e
leaq 0x4e42c(%rip), %rsi     # 0x10d208
leaq 0x98(%rsp), %rdi
callq 0x50803
leaq 0x2a6d4(%rip), %rsi     # 0xe94c4
leaq 0x98(%rsp), %rdi
callq 0x88c0
movq %r15, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbee68
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0xbee6f
movq %rsp, %rdi
movq %r15, (%rdi)
movq 0x4e3dd(%rip), %rsi     # 0x10d208
movq 0x4e3de(%rip), %rdx     # 0x10d210
addq %rsi, %rdx
callq 0x2e45c
leaq 0x2a683(%rip), %rsi     # 0xe94c4
movq %rsp, %rdi
callq 0x88c0
leaq 0x20(%rsp), %rdi
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x8540
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0xbeed0
movq 0x10(%rsp), %rsi
jmp 0xbeec8
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rsp, %rbx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x8540
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0xbeeab
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xbeed0
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8480
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %rbx
movq 0x20(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movq 0x4c0f2(%rip), %rdi     # 0x10afe8
leaq 0x2a5de(%rip), %rsi     # 0xe94db
movl $0x51, %edx
callq 0x84e0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x4c0d0(%rip), %rdi     # 0x10afe8
callq 0x84e0
movq %rax, %r14
movq (%rax), %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
movq %rsp, %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x128(%rsp), %rdx
callq 0x31438
leaq 0x98(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
leaq 0x178(%rsp), %rdx
callq 0x31438
movq 0x4c065(%rip), %r14     # 0x10afe8
leaq 0xf216(%rip), %rsi      # 0xce1a0
movl $0x11, %edx
movq %r14, %rdi
callq 0x84e0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq 0x4c033(%rip), %rdi     # 0x10afe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x78(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x318c0
leaq 0x40(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x31980
leaq 0x1c657(%rip), %rsi     # 0xdb644
movl $0x8, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x12c7d(%rip), %rsi     # 0xd1c7e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x2a518(%rip), %rsi     # 0xe952d
movl $0x15, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x12c55(%rip), %rsi     # 0xd1c7e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x2a506(%rip), %rsi     # 0xe9543
movl $0x13, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x12c2d(%rip), %rsi     # 0xd1c7e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x2a4f2(%rip), %rsi     # 0xe9557
movl $0xa, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x12c05(%rip), %rsi     # 0xd1c7e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x240ee(%rip), %rsi     # 0xe317b
movl $0x2, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x12bdd(%rip), %rsi     # 0xd1c7e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x24166(%rip), %rsi     # 0xe321b
movl $0xe, %edx
movq %rbx, %rdi
callq 0x84e0
movq (%rbx), %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 0x8(%rsp), %rax
subq (%rsp), %rax
shrq $0x3, %rax
testl %eax, %eax
jle 0xbf242
movl $0x8, %r12d
xorl %r13d, %r13d
leaq 0x12b70(%rip), %r14     # 0xd1c7e
xorl %ebp, %ebp
movq 0x40(%rsp), %rax
movq (%rax,%r13), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
callq 0x84e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x84e0
movq 0x40(%rsp), %rax
movq (%rax,%r13), %rax
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
movq %r15, %rdi
callq 0x84e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x84e0
movq 0x40(%rsp), %rax
movq (%rax,%r13), %rax
movq 0x40(%rax), %rsi
movq 0x48(%rax), %rdx
movq %r15, %rdi
callq 0x84e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x84e0
movq 0x78(%rsp), %rax
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
movq %r15, %rdi
callq 0x84e0
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x84e0
movq (%rsp), %rax
movsd (%rax,%rbp,8), %xmm0
movq %r15, %rdi
callq 0x8730
movq %rax, %r15
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x84e0
movq 0x98(%rsp), %rax
movsd (%rax,%rbp,8), %xmm0
movq %r15, %rdi
callq 0x8730
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r15, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
incq %rbp
movq 0x8(%rsp), %rax
subq (%rsp), %rax
shrq $0x3, %rax
cltq
addq $0x18, %r13
addq $0x20, %r12
cmpq %rax, %rbp
jl 0xbf110
movq 0x4bd9f(%rip), %rbx     # 0x10afe8
leaq 0xee27(%rip), %rsi      # 0xce077
movl $0x4, %edx
movq %rbx, %rdi
callq 0x84e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq 0x4bd6d(%rip), %rdi     # 0x10afe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x40(%rsp), %rdi
callq 0x31aa2
leaq 0x78(%rsp), %rdi
callq 0x3123c
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xbf2b9
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xbf2cf
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xbf2eb
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x60(%rsp), %rdi
callq 0x3123c
leaq 0x1e0(%rsp), %rdi
callq 0x28816
leaq 0x178(%rsp), %rdi
callq 0x28816
leaq 0x128(%rsp), %rdi
callq 0x28816
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0xbf341
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0xd8(%rsp), %rdi
callq 0x33668
leaq 0x1b0(%rsp), %rdi
callq 0x340dc
xorl %eax, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xbf53d
jmp 0xbf53d
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
jne 0xbf531
jmp 0xbf58c
jmp 0xbf4d9
movq %rax, %r14
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xbf58c
movq 0xa8(%rsp), %rsi
jmp 0xbf536
jmp 0xbf4d9
jmp 0xbf4d9
movq %rax, %r14
jmp 0xbf54f
jmp 0xbf4b7
movq %rax, %r14
jmp 0xbf576
jmp 0xbf4d9
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %rbx, %rdi
jmp 0xbf587
movq %rax, %r14
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbf5fe
movq 0x138(%rsp), %rsi
jmp 0xbf5f6
jmp 0xbf4c1
jmp 0xbf4d1
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %rbx, %rdi
callq 0x8480
jmp 0xbf618
jmp 0xbf53d
jmp 0xbf4d9
jmp 0xbf4a9
movq %rax, %r14
jmp 0xbf523
movq %rax, %r14
movl $0xb0, %esi
movq %r13, %rdi
jmp 0xbf4a2
jmp 0xbf488
jmp 0xbf465
jmp 0xbf488
jmp 0xbf4e1
jmp 0xbf53d
movq %rax, %r14
movq 0x78(%rsp), %rdi
cmpq %r15, %rdi
je 0xbf48b
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbf48b
jmp 0xbf488
jmp 0xbf4e1
movq %rax, %r14
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0xbf4e4
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbf4e4
movq %rax, %r14
jmp 0xbf4f1
jmp 0xbf4e1
jmp 0xbf4e1
movq %rax, %r14
jmp 0xbf4fe
movq %rax, %r14
jmp 0xbf559
jmp 0xbf53d
movq %rax, %r14
jmp 0xbf5fe
movq %rax, %r14
jmp 0xbf5b2
movq %rax, %r14
jmp 0xbf60b
movq %rax, %r14
jmp 0xbf58c
movq %rax, %r14
leaq 0x160(%rsp), %rdi
callq 0x3123c
leaq 0xc0(%rsp), %rdi
callq 0x3123c
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xbf523
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x8480
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xbf58c
movq 0x10(%rsp), %rsi
incq %rsi
jmp 0xbf587
jmp 0xbf542
movq %rax, %r14
jmp 0xbf5a8
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x31aa2
leaq 0x78(%rsp), %rdi
callq 0x3123c
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0xbf576
movq 0xa8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xbf58c
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xbf5a8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x60(%rsp), %rdi
callq 0x3123c
leaq 0x1e0(%rsp), %rdi
callq 0x28816
leaq 0x178(%rsp), %rdi
callq 0x28816
leaq 0x128(%rsp), %rdi
callq 0x28816
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0xbf5fe
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0xd8(%rsp), %rdi
callq 0x33668
leaq 0x1b0(%rsp), %rdi
callq 0x340dc
movq %r14, %rdi
callq 0x8840