// File: /workspace/github_cpp_makefile_star2_O3/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 $0x228, %rsp            # imm = 0x228
callq 0xbe661
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %rbx
movq 0x46c72(%rip), %rsi     # 0x104218
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movq %rbx, 0x130(%rsp)
leaq 0x1c8(%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 0x44a06(%rip), %rdi     # 0x101fe8
leaq 0xe797(%rip), %rsi      # 0xcbd80
movl $0x26, %edx
callq 0x84e0
movq 0x46c1e(%rip), %rsi     # 0x104218
movq 0x46c1f(%rip), %rdx     # 0x104220
movq 0x449e0(%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
leaq 0xe8(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x2e64e
movq 0x44995(%rip), %rbx     # 0x101fe8
leaq 0xe74d(%rip), %rsi      # 0xcbda7
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 0x44963(%rip), %rdi     # 0x101fe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x46b9f(%rip), %rsi     # 0x104238
leaq 0x138(%rsp), %rdi
leaq 0x188(%rsp), %rdx
callq 0x287de
leaq 0x138(%rsp), %rdi
movl $0x8, %esi
callq 0x500af
movq %rax, %rbx
leaq 0x148(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbd6e4
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x110(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x168(%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 0x1b8(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x220(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
movq 0x44888(%rip), %rdi     # 0x101fe8
leaq 0xe645(%rip), %rsi      # 0xcbdac
movl $0x23, %edx
callq 0x84e0
movq 0x46ac0(%rip), %rsi     # 0x104238
movq 0x46ac1(%rip), %rdx     # 0x104240
movq 0x44862(%rip), %rdi     # 0x101fe8
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, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
leaq 0xa0(%rsp), %rbp
movl $0x0, 0x4c(%rsp)
leaq 0x100(%rsp), %r14
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
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 0xbdd5c
movq 0x100(%rsp), %rax
cmpb $0x23, (%rax)
jne 0xbd8db
movzbl 0x1(%rax), %eax
cmpl $0x23, %eax
je 0xbd7e7
cmpl $0x43, %eax
jne 0xbd8db
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
movl $0x9, %edx
callq 0x4d650
movq 0x80(%rsp), %rax
movaps (%rsp), %xmm0
movq 0x10(%rsp), %rcx
movq %rcx, 0x80(%rsp)
movaps 0x70(%rsp), %xmm1
movaps %xmm0, 0x70(%rsp)
movaps %xmm1, 0x20(%rsp)
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x2e784
movq %r15, %rdi
callq 0x2e784
movq 0x70(%rsp), %rsi
movl $0x120, %eax            # imm = 0x120
addq %rax, %rsi
movq 0x78(%rsp), %rdx
movq %r13, %rdi
movq %r15, %rcx
callq 0x7f67a
movq 0x28(%rsp), %r12
subq 0x20(%rsp), %r12
shrq $0x5, %r12
movq %r13, %rdi
callq 0x2e784
jmp 0xbd7e7
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rsi
movl $0x9, %edx
callq 0x4d650
movq 0x80(%rsp), %rax
movaps (%rsp), %xmm0
movq 0x10(%rsp), %rcx
movq %rcx, 0x80(%rsp)
movaps 0x70(%rsp), %xmm1
movaps %xmm0, 0x70(%rsp)
movaps %xmm1, 0x20(%rsp)
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x2e784
movq %r15, %rdi
callq 0x2e784
movq 0x70(%rsp), %rax
leaq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x2ba06
movq 0x70(%rsp), %rax
leaq 0x10(%rsp), %rcx
movq %rcx, (%rsp)
movq 0x20(%rax), %rsi
movq 0x28(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x2ba06
movq 0x70(%rsp), %rax
leaq 0xc0(%rsp), %rcx
movq %rcx, 0xb0(%rsp)
movq 0x80(%rax), %rsi
movq 0x88(%rax), %rdx
addq %rsi, %rdx
leaq 0xb0(%rsp), %r15
movq %r15, %rdi
callq 0x2ba06
leaq 0xd0(%rsp), %rdi
movq %r15, %rsi
movl $0x2c, %edx
callq 0x4d650
movq 0xd0(%rsp), %rdi
movq 0xd8(%rsp), %rsi
leaq 0x22d6a(%rip), %rdx     # 0xe074e
callq 0xbeb5f
movq %rax, %r13
subq 0xd0(%rsp), %r13
shrq $0x5, %r13
cmpq 0xd8(%rsp), %rax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %eax, %r13d
movq 0x70(%rsp), %rsi
movl $0x120, %eax            # imm = 0x120
addq %rax, %rsi
movq 0x78(%rsp), %rdx
leaq 0x170(%rsp), %rdi
leaq 0x90(%rsp), %rcx
callq 0x7f67a
movl $0xb0, %edi
callq 0x8470
movq %rax, %r15
movq %rax, %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0xbe8fe
movq %r15, %rdi
leaq 0x170(%rsp), %rsi
callq 0x4ddea
movl 0x4c(%rsp), %eax
incl %eax
movl %eax, 0x4c(%rsp)
imull $0x3afb7e91, %eax, %eax # imm = 0x3AFB7E91
addl $0x346dc0, %eax         # imm = 0x346DC0
rorl $0x4, %eax
cmpl $0x68db8, %eax          # imm = 0x68DB8
ja 0xbdacc
movl $0xb, %edx
movq 0x44562(%rip), %rdi     # 0x101fe8
leaq 0x22aa3(%rip), %rsi     # 0xe0530
callq 0x84e0
movq 0x4454f(%rip), %rdi     # 0x101fe8
movl 0x4c(%rsp), %esi
callq 0x8810
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r13, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq %r15, %rdi
callq 0x4e014
movsd %xmm0, 0x128(%rsp)
movq %r15, %rdi
callq 0x4df06
movsd %xmm0, 0x120(%rsp)
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %r13
movq %r13, %rdi
callq 0x2ba06
movq %r13, %rdi
leaq 0xfeae(%rip), %rsi      # 0xcd9ca
callq 0x88c0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x8180
movq %rbp, 0x90(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbdb5e
movq %rdx, 0x90(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa0(%rsp)
jmp 0xbdb65
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x98(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x138(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x31d96
movsd 0x128(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0xbdbbf
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xbdbdb
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %r13
movq %r13, %rdi
callq 0x2ba06
movq %r13, %rdi
leaq 0xfdc1(%rip), %rsi      # 0xcd9ca
callq 0x88c0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x8180
movq %rbp, 0x90(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbdc4b
movq %rdx, 0x90(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa0(%rsp)
jmp 0xbdc52
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x98(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x188(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x31d96
movsd 0x120(%rsp), %xmm0
movsd %xmm0, (%rax)
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0xbdcac
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xbdcc8
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r15, %rdi
callq 0xbeace
movl $0xb0, %esi
movq %r15, %rdi
callq 0x8480
leaq 0x170(%rsp), %rdi
callq 0x2e784
leaq 0xd0(%rsp), %rdi
callq 0x2e784
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0xbdd1c
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x8480
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xbdd37
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xbd7e7
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbd7e7
movq 0x44285(%rip), %rbx     # 0x101fe8
leaq 0xe03d(%rip), %rsi      # 0xcbda7
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 0x44253(%rip), %rdi     # 0x101fe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movb $0x0, 0x30(%rsp)
leaq 0x46497(%rip), %rdi     # 0x104258
leaq 0xfc03(%rip), %rsi      # 0xcd9cb
callq 0x8160
testl %eax, %eax
leaq 0x10(%rsp), %r15
je 0xbddec
leaq 0x4647b(%rip), %rsi     # 0x104258
leaq 0x20(%rsp), %rdi
callq 0x8270
jmp 0xbdf05
leaq 0x46425(%rip), %rdi     # 0x104218
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x88f0
cmpq $-0x1, %rax
je 0xbde53
leaq 0x46407(%rip), %rsi     # 0x104218
leaq 0xb0(%rsp), %rdi
callq 0x4d82f
leaq 0x22717(%rip), %rsi     # 0xe053c
leaq 0xb0(%rsp), %rdi
callq 0x88c0
movq %r15, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xbde9d
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0xbdea4
movq %rsp, %rdi
movq %r15, (%rdi)
movq 0x463b8(%rip), %rsi     # 0x104218
movq 0x463b9(%rip), %rdx     # 0x104220
addq %rsi, %rdx
callq 0x2ba06
leaq 0x226c6(%rip), %rsi     # 0xe053c
movq %rsp, %rdi
callq 0x88c0
leaq 0x20(%rsp), %rdi
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x8540
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0xbdf05
movq 0x10(%rsp), %rsi
jmp 0xbdefd
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 0xbdee0
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0xbdf05
movq 0xc0(%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 0x440bd(%rip), %rdi     # 0x101fe8
leaq 0x22621(%rip), %rsi     # 0xe0553
movl $0x51, %edx
callq 0x84e0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x4409b(%rip), %rdi     # 0x101fe8
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 0xe8(%rsp), %rsi
leaq 0x138(%rsp), %rdx
callq 0x2e984
leaq 0xb0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
leaq 0x188(%rsp), %rdx
callq 0x2e984
movq 0x44030(%rip), %r14     # 0x101fe8
leaq 0xdf11(%rip), %rsi      # 0xcbed0
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 0x43ffe(%rip), %rdi     # 0x101fe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x90(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x2ee0a
leaq 0x50(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x2eeca
leaq 0x1715f(%rip), %rsi     # 0xd5184
movl $0x8, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0xf991(%rip), %rsi      # 0xcd9ca
movl $0x1, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x22558(%rip), %rsi     # 0xe05a5
movl $0x15, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0xf969(%rip), %rsi      # 0xcd9ca
movl $0x1, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x22546(%rip), %rsi     # 0xe05bb
movl $0x13, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0xf941(%rip), %rsi      # 0xcd9ca
movl $0x1, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x22532(%rip), %rsi     # 0xe05cf
movl $0xa, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0xf919(%rip), %rsi      # 0xcd9ca
movl $0x1, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x1d6a6(%rip), %rsi     # 0xdb76b
movl $0x2, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0xf8f1(%rip), %rsi      # 0xcd9ca
movl $0x1, %edx
movq %rbx, %rdi
callq 0x84e0
leaq 0x1d71e(%rip), %rsi     # 0xdb80b
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 0xbe27d
movl $0x8, %r12d
xorl %r13d, %r13d
leaq 0xf884(%rip), %r14      # 0xcd9ca
xorl %ebp, %ebp
movq 0x50(%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 0x50(%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 0x50(%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 0x90(%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 0xb0(%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 0xbe148
movq 0x43d64(%rip), %rbx     # 0x101fe8
leaq 0xdb1c(%rip), %rsi      # 0xcbda7
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 0x43d32(%rip), %rdi     # 0x101fe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x50(%rsp), %rdi
callq 0x2efec
leaq 0x90(%rsp), %rdi
callq 0x2e784
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xbe2f7
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xbe30d
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xbe329
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x70(%rsp), %rdi
callq 0x2e784
leaq 0x1f0(%rsp), %rdi
callq 0x28916
leaq 0x188(%rsp), %rdi
callq 0x28916
leaq 0x138(%rsp), %rdi
callq 0x28916
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0xbe37f
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0xe8(%rsp), %rdi
callq 0x30bd6
leaq 0x1c0(%rsp), %rdi
callq 0x31630
xorl %eax, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
jne 0xbe56f
jmp 0xbe5cd
jmp 0xbe517
movq %rax, %r14
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0xbe5cd
movq 0xc0(%rsp), %rsi
jmp 0xbe574
jmp 0xbe517
jmp 0xbe517
jmp 0xbe57b
jmp 0xbe57b
movq %rax, %r14
jmp 0xbe58d
jmp 0xbe4f5
movq %rax, %r14
jmp 0xbe5b7
jmp 0xbe517
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %rbx, %rdi
jmp 0xbe5c8
movq %rax, %r14
leaq 0x148(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbe63f
movq 0x148(%rsp), %rsi
jmp 0xbe637
jmp 0xbe4ff
jmp 0xbe50f
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %rbx, %rdi
callq 0x8480
jmp 0xbe659
movq %rax, %r14
jmp 0xbe561
jmp 0xbe51f
jmp 0xbe4b6
jmp 0xbe57b
jmp 0xbe48c
jmp 0xbe4bb
jmp 0xbe4bb
movq %rax, %r14
movq 0x90(%rsp), %rdi
cmpq %rbp, %rdi
je 0xbe4be
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0xbe4be
jmp 0xbe51f
jmp 0xbe51f
jmp 0xbe4bb
jmp 0xbe51f
movq %rax, %r14
jmp 0xbe52f
movq %rax, %r14
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xbe522
movq 0x60(%rsp), %rsi
incq %rsi
jmp 0xbe4e2
movq %rax, %r14
movl $0xb0, %esi
movq %r15, %rdi
callq 0x8480
jmp 0xbe522
movq %rax, %r14
jmp 0xbe53c
jmp 0xbe57b
jmp 0xbe517
movq %rax, %r14
jmp 0xbe59a
jmp 0xbe57b
movq %rax, %r14
jmp 0xbe63f
movq %rax, %r14
jmp 0xbe5f3
movq %rax, %r14
jmp 0xbe64c
movq %rax, %r14
jmp 0xbe5cd
movq %rax, %r14
leaq 0x170(%rsp), %rdi
callq 0x2e784
leaq 0xd0(%rsp), %rdi
callq 0x2e784
movq 0xb0(%rsp), %rdi
leaq 0xc0(%rsp), %rax
cmpq %rax, %rdi
je 0xbe561
movq 0xc0(%rsp), %rsi
incq %rsi
callq 0x8480
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0xbe5cd
movq 0x10(%rsp), %rsi
incq %rsi
jmp 0xbe5c8
jmp 0xbe580
movq %rax, %r14
jmp 0xbe5e9
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x2efec
leaq 0x90(%rsp), %rdi
callq 0x2e784
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xbe5b7
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xbe5cd
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0xbe5e9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x70(%rsp), %rdi
callq 0x2e784
leaq 0x1f0(%rsp), %rdi
callq 0x28916
leaq 0x188(%rsp), %rdi
callq 0x28916
leaq 0x138(%rsp), %rdi
callq 0x28916
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0xbe63f
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0xe8(%rsp), %rdi
callq 0x30bd6
leaq 0x1c0(%rsp), %rdi
callq 0x31630
movq %r14, %rdi
callq 0x8840