// File: /workspace/github_cpp_makefile_star2_O3/millanek[P]evo/process_vcf_mt_sequences.cpp
// Function: getMtSeqMain(int, char**)
int getMtSeqMain(int argc, char** argv) {
    parseGetMtSeqOptions(argc, argv);
    string vcfFileRoot = stripExtension(opt::vcfFile);    
    
    std::cerr << "Generating the mitochondrial genome sequences using variants from: " << opt::vcfFile << std::endl;
    std::cerr << "and the reference genome: " << opt::genomeFile << std::endl;
    
    // Open connections to read from the vcf and reference genome files
    std::ifstream* vcfFile = new std::ifstream(opt::vcfFile.c_str());
    std::ifstream* genomeFile = new std::ifstream(opt::genomeFile.c_str());
    
    // Prepare an object for output files
    string mtFileName = vcfFileRoot + "_mtDNA.fa";
    string mtRefName = vcfFileRoot + "_mtRef.fa";
    std::ofstream* mtFile = new std::ofstream(mtFileName.c_str());    
    
    string line;
    string currentScaffoldNum = "";
    string currentScaffoldReference;
    string::size_type inStrPos = 0;
    std::vector<string> sampleNames = readSampleNamesFromTextFile(opt::sampleNameFile);;
    string thisScaffoldName; getline(*genomeFile, thisScaffoldName); thisScaffoldName.erase(0,1);
    unsigned int processedVariantCounter = 0;
    
    std::vector<string::size_type> splits;
    
    
    string sc747Ref; sc747Ref.reserve(20000000);
    string sc2036Ref; sc2036Ref.reserve(20000000);
    string mtRef; mtRef.reserve(20000000);
    while (thisScaffoldName != "") {
        std::cerr << "Starting to read " << thisScaffoldName << std::endl;
        if (thisScaffoldName == "scaffold_747") {
            currentScaffoldReference = readScaffold(genomeFile, thisScaffoldName);
            thisScaffoldName.erase(0,1);
            sc747Ref.append(currentScaffoldReference);
            mtRef.append(currentScaffoldReference);
        } else if (thisScaffoldName == "scaffold_2036") {
            currentScaffoldReference = readScaffold(genomeFile, thisScaffoldName);
            thisScaffoldName.erase(0,1);
            sc2036Ref.append(currentScaffoldReference);
            mtRef.append(currentScaffoldReference);
        } else {
            currentScaffoldReference = readScaffold(genomeFile, thisScaffoldName);
            thisScaffoldName.erase(0,1);
        }
    }
    
    std::vector<string> mtStrings;
    mtStrings.resize(sampleNames.size());
    
    for (std::vector<string>::size_type i = 0; i != mtStrings.size(); i++) {
        mtStrings[i].reserve(20000000);
        mtStrings[i] = "";
    }
    
    string scaffold = "scaffold_747";
    while (getline(*vcfFile, line)) {
        if (line[0] == '#')
            continue;
        else {
            processedVariantCounter++;
            std::vector<std::string> fields = split(line, '\t');
            // Also get overall depth for this variant
            std::vector<std::string> info = split(fields[7], ';');
            
            
            if (info[0] != "INDEL" && fields[4].length() == 1) {
                bool printedHet = false;
                for (std::vector<std::string>::size_type i = NUM_NON_GENOTYPE_COLUMNS; i != fields.size(); i++) {
                    //std::cerr << "Going through genotypes1:" << i << std::endl;
                    //std::cerr << scaffoldStrings.size() << " " << inStrPos << " " << fields[1] << " " << currentScaffoldReference.size() << std::endl;
                    std::vector<string> genotypeFields = split(fields[i], ':');
                    // Unphased vcf
                    std::vector<string> genotype = split(genotypeFields[0], '/');
                    if (opt::bLDhat) {
                        for (int j = 0; j != ((atoi(fields[1].c_str()) - 1)-inStrPos); j++) {
                            mtStrings[i- NUM_NON_GENOTYPE_COLUMNS].append("0");
                        }
                        if (genotype[0] == "0" && genotype[1] == "0")
                            mtStrings[i- NUM_NON_GENOTYPE_COLUMNS].append("0");
                        else if (genotype[0] == "1" && genotype[1] == "1")
                            mtStrings[i- NUM_NON_GENOTYPE_COLUMNS].append("1");
                        else {
                            string ambiguityBase = getAmbiguityCode(fields[3], fields[4]);
                            mtStrings[i- NUM_NON_GENOTYPE_COLUMNS].append("2");
                        }
                    } else {
                        if (fields[0] == "scaffold_747")
                            mtStrings[i- NUM_NON_GENOTYPE_COLUMNS].append(mtRef.substr(inStrPos, (atoi(fields[1].c_str()) - 1)-inStrPos));
                        else
                            mtStrings[i- NUM_NON_GENOTYPE_COLUMNS].append(mtRef.substr(inStrPos, (atoi(fields[1].c_str()) + sc747Ref.length() - 1)-inStrPos));
                        //std::cerr << "Going through genotypes2:" << i << std::endl;
                        if (genotype[0] == "0" && genotype[1] == "0")
                            mtStrings[i- NUM_NON_GENOTYPE_COLUMNS].append(fields[3]);
                        else if (genotype[0] == "1" && genotype[1] == "1")
                            mtStrings[i- NUM_NON_GENOTYPE_COLUMNS].append(fields[4]);
                        else {
                            mtStrings[i- NUM_NON_GENOTYPE_COLUMNS].append(fields[4]);
                            if (!printedHet) {
                                std::cout << "Het in mitochondrial sequence:" << sampleNames[i- NUM_NON_GENOTYPE_COLUMNS] << std::endl;
                                std::cout << line << std::endl;
                                printedHet = true;
                            }
                            //string ambiguityBase = getAmbiguityCode(fields[3], fields[4]);
                            //mtStrings[i- NUM_NON_GENOTYPE_COLUMNS].append(ambiguityBase);
                        }
                    }
                    //std::cerr << "Going through genotypes3:" << i << std::endl;
                }
                if (fields[0] == "scaffold_747")
                    inStrPos = atoi(fields[1].c_str());
                else
                    inStrPos = atoi(fields[1].c_str()) + sc747Ref.length();
                
                
                
#ifdef DEBUG
                if (mtRef[inStrPos-1] != fields[3][0]) {
                    std::cerr << "Error!!! Sequence: " << mtRef[inStrPos-1] << " vcf-ref: " << fields[3][0] << std::endl;
                }
#endif
            }

        }
    }
    
    for (std::vector<std::string>::size_type i = 0; i != sampleNames.size(); i++) {
        mtStrings[i].append(mtRef.substr(inStrPos, string::npos));
    }
#ifdef DEBUG
    if (mtStrings[0].length() != mtRef.length()) {
        std::cerr << "Error!!! Reference scaffold/LG length: " << mtRef.length() << " vcf scaffold length: " << mtStrings[0].length() << std::endl;
    }
#endif
    
    for (std::vector<std::string>::size_type i = 0; i != sampleNames.size(); i++) {
        *mtFile << ">" << sampleNames[i] << std::endl;
        print80bpPerLineFile(mtFile, mtStrings[i]);
    }
    
    
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
callq 0x88321
leaq 0x7c8a7(%rip), %rsi     # 0x1037f8
leaq 0x218(%rsp), %rdi
callq 0x4d82f
movq 0x7b083(%rip), %rdi     # 0x101fe8
leaq 0x525e4(%rip), %rsi     # 0xd9550
movl $0x43, %edx
callq 0x84e0
movq 0x7c87b(%rip), %rsi     # 0x1037f8
movq 0x7c87c(%rip), %rdx     # 0x103800
movq 0x7b05d(%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 0x7b027(%rip), %rdi     # 0x101fe8
leaq 0x4dd33(%rip), %rsi     # 0xd4cfb
movl $0x1a, %edx
callq 0x84e0
movq 0x7c83f(%rip), %rsi     # 0x103818
movq 0x7c840(%rip), %rdx     # 0x103820
movq 0x7b001(%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
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %rbx
movq 0x7c7ce(%rip), %rsi     # 0x1037f8
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r15
movq 0x7c7cd(%rip), %rsi     # 0x103818
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movq %r15, 0x98(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x218(%rsp), %rsi
movq 0x220(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0x2ba06
leaq 0x52501(%rip), %rsi     # 0xd9594
leaq 0xa0(%rsp), %rdi
callq 0x88c0
leaq 0x170(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x218(%rsp), %rsi
movq 0x220(%rsp), %rdx
addq %rsi, %rdx
leaq 0x160(%rsp), %rdi
callq 0x2ba06
leaq 0x524cb(%rip), %rsi     # 0xd959e
leaq 0x160(%rsp), %rdi
callq 0x88c0
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r15
movq 0xa0(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movq %r15, 0x158(%rsp)
leaq 0xf0(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x250(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x46897(%rip), %rdx     # 0xcd9cb
leaq 0x240(%rsp), %rdi
movq %rdx, %rsi
callq 0x28a52
leaq 0x128(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x7c6d6(%rip), %rsi     # 0x103838
leaq 0x80(%rsp), %rdi
callq 0x4fe41
leaq 0x148(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x98(%rsp), %r14
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
leaq 0x138(%rsp), %rsi
movq %r14, %rdi
callq 0x8870
leaq 0x138(%rsp), %rdi
movl $0x1, %edx
xorl %esi, %esi
callq 0x8100
leaq 0x190(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x180(%rsp), %rdi
movl $0x1312d00, %esi        # imm = 0x1312D00
callq 0x86f0
leaq 0x208(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x1f8(%rsp), %rdi
movl $0x1312d00, %esi        # imm = 0x1312D00
callq 0x86f0
leaq 0xd0(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xc0(%rsp), %rdi
movl $0x1312d00, %esi        # imm = 0x1312D00
callq 0x86f0
leaq 0x46780(%rip), %rsi     # 0xcd9cb
leaq 0x138(%rsp), %rdi
callq 0x8160
testl %eax, %eax
je 0x87441
movq 0x7ad81(%rip), %r12     # 0x101fe8
leaq 0x138(%rsp), %r15
leaq 0x40(%rsp), %r14
leaq 0x46750(%rip), %r13     # 0xcd9cb
movl $0x11, %edx
movq %r12, %rdi
leaq 0x4dbd0(%rip), %rsi     # 0xd4e5a
callq 0x84e0
movq 0x138(%rsp), %rsi
movq 0x140(%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 %r15, %rdi
leaq 0x522cd(%rip), %rsi     # 0xd95a8
callq 0x8160
testl %eax, %eax
je 0x8734e
movq %r15, %rdi
leaq 0x522c7(%rip), %rsi     # 0xd95b5
callq 0x8160
testl %eax, %eax
je 0x873a6
movq %r14, %rdi
leaq 0x98(%rsp), %rsi
movq %r15, %rdx
callq 0x465f2
leaq 0x118(%rsp), %rdi
movq %r14, %rsi
callq 0x8540
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x8733a
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movl $0x1, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x8100
jmp 0x8742e
movq %r14, %rdi
leaq 0x98(%rsp), %rsi
movq %r15, %rdx
callq 0x465f2
leaq 0x118(%rsp), %rdi
movq %r14, %rsi
callq 0x8540
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x8738d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movl $0x1, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x8100
leaq 0x180(%rsp), %rdi
jmp 0x873fc
movq %r14, %rdi
leaq 0x98(%rsp), %rsi
movq %r15, %rdx
callq 0x465f2
leaq 0x118(%rsp), %rdi
movq %r14, %rsi
callq 0x8540
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x873e5
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
movl $0x1, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x8100
leaq 0x1f8(%rsp), %rdi
movq 0x118(%rsp), %rsi
movq 0x120(%rsp), %rdx
callq 0x8180
movq 0x118(%rsp), %rsi
movq 0x120(%rsp), %rdx
leaq 0xc0(%rsp), %rdi
callq 0x8180
movq %r15, %rdi
movq %r13, %rsi
callq 0x8160
testl %eax, %eax
jne 0x8727b
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x88(%rsp), %rsi
subq 0x80(%rsp), %rsi
sarq $0x5, %rsi
callq 0x3e6a2
movq 0x60(%rsp), %rdi
cmpq %rdi, 0x68(%rsp)
je 0x874ca
xorl %r15d, %r15d
leaq 0x46548(%rip), %r14     # 0xcd9cb
xorl %r12d, %r12d
addq %r15, %rdi
movl $0x1312d00, %esi        # imm = 0x1312D00
callq 0x86f0
movq 0x60(%rsp), %rdi
movq 0x8(%rdi,%r15), %rdx
addq %r15, %rdi
xorl %esi, %esi
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x86c0
incq %r12
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rax
subq %rdi, %rax
sarq $0x5, %rax
addq $0x20, %r15
cmpq %rax, %r12
jne 0x87486
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x520ce(%rip), %rsi     # 0xd95a8
leaq 0x520d3(%rip), %rdx     # 0xd95b4
leaq 0x40(%rsp), %rdi
callq 0x28a52
xorl %r14d, %r14d
leaq 0xe0(%rsp), %r15
leaq 0x1c0(%rsp), %rbp
leaq 0x1d8(%rsp), %r12
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x87bb1
movq 0xe0(%rsp), %rax
cmpb $0x23, (%rax)
je 0x87506
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movl $0x9, %edx
callq 0x4d650
movq 0x28(%rsp), %rsi
movl $0xe0, %eax
addq %rax, %rsi
leaq 0x280(%rsp), %rdi
movl $0x3b, %edx
callq 0x4d650
movq 0x280(%rsp), %rdi
leaq 0x45253(%rip), %rsi     # 0xcc7da
callq 0x8160
testl %eax, %eax
je 0x87b95
movq 0x28(%rsp), %rsi
cmpq $0x1, 0x88(%rsi)
jne 0x87b95
movq 0x30(%rsp), %rax
subq %rsi, %rax
cmpq $0x120, %rax            # imm = 0x120
je 0x87a99
movq %r14, %rax
notq %rax
movq %rax, 0x238(%rsp)
movl $0x9, %r15d
movl $0x0, 0x24(%rsp)
movq %rbp, %rdi
movq %r15, %rbp
shlq $0x5, %rbp
addq %rbp, %rsi
movl $0x3a, %edx
callq 0x4d650
movq 0x1c0(%rsp), %rsi
leaq 0x100(%rsp), %rdi
movl $0x2f, %edx
callq 0x4d650
movq 0x28(%rsp), %rdi
cmpb $0x1, 0x7c244(%rip)     # 0x103858
jne 0x877e1
movq 0x20(%rdi), %rdi
callq 0x86e0
decl %eax
cltq
cmpq %rax, %r14
je 0x87668
xorl %r13d, %r13d
movq 0x60(%rsp), %rax
leaq (%rax,%rbp), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
leaq 0x450ff(%rip), %rsi     # 0xcc745
callq 0x88c0
incq %r13
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x86e0
decl %eax
cltq
subq %r14, %rax
cmpq %rax, %r13
jne 0x8762f
movq 0x100(%rsp), %rdi
leaq 0x450ce(%rip), %rsi     # 0xcc745
callq 0x8160
testl %eax, %eax
jne 0x876a3
movq 0x100(%rsp), %rdi
addq $0x20, %rdi
leaq 0x450b2(%rip), %r13     # 0xcc745
movq %r13, %rsi
callq 0x8160
testl %eax, %eax
je 0x87a01
movq 0x100(%rsp), %rdi
leaq 0x5937a(%rip), %rsi     # 0xe0a2c
callq 0x8160
testl %eax, %eax
jne 0x876de
movq 0x100(%rsp), %rdi
addq $0x20, %rdi
leaq 0x5935e(%rip), %r13     # 0xe0a2c
movq %r13, %rsi
callq 0x8160
testl %eax, %eax
je 0x87a01
movq 0x28(%rsp), %rax
leaq 0x1b0(%rsp), %rcx
movq %rcx, 0x1a0(%rsp)
movq 0x60(%rax), %rsi
movq 0x68(%rax), %rdx
addq %rsi, %rdx
leaq 0x1a0(%rsp), %rdi
callq 0x2ba06
movq 0x28(%rsp), %rax
leaq 0x1e8(%rsp), %rcx
movq %rcx, 0x1d8(%rsp)
movq 0x80(%rax), %rsi
movq 0x88(%rax), %rdx
addq %rsi, %rdx
movq %r12, %r13
movq %r12, %rdi
callq 0x2ba06
movq %rsp, %rdi
leaq 0x1a0(%rsp), %rsi
movq %r13, %rdx
callq 0x57a7a
movq 0x1d8(%rsp), %rdi
leaq 0x1e8(%rsp), %rax
cmpq %rax, %rdi
je 0x87774
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x1a0(%rsp), %rdi
leaq 0x1b0(%rsp), %rax
cmpq %rax, %rdi
je 0x87799
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x60(%rsp), %rax
leaq (%rax,%rbp), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
leaq 0x4a59a(%rip), %rsi     # 0xd1d4a
callq 0x88c0
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
leaq 0x1c0(%rsp), %rbp
je 0x87a67
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x87a67
leaq 0x51dc0(%rip), %rsi     # 0xd95a8
callq 0x8160
movq 0x60(%rsp), %r13
testl %eax, %eax
je 0x87845
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x86e0
movslq %eax, %rcx
addq 0x238(%rsp), %rcx
addq 0x188(%rsp), %rcx
movq %rsp, %rdi
leaq 0xc0(%rsp), %rsi
movq %r14, %rdx
callq 0x84a0
leaq -0x120(,%rbp), %rdi
addq %r13, %rdi
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x8180
jmp 0x87887
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x86e0
decl %eax
movslq %eax, %rcx
subq %r14, %rcx
movq %rsp, %rdi
leaq 0xc0(%rsp), %rsi
movq %r14, %rdx
callq 0x84a0
leaq -0x120(,%rbp), %rdi
addq %r13, %rdi
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x8180
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x878a2
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x100(%rsp), %rdi
leaq 0x44e94(%rip), %rsi     # 0xcc745
callq 0x8160
testl %eax, %eax
jne 0x878da
movq 0x100(%rsp), %rdi
addq $0x20, %rdi
leaq 0x44e78(%rip), %rsi     # 0xcc745
callq 0x8160
testl %eax, %eax
je 0x87a23
movq 0x100(%rsp), %rdi
leaq 0x59143(%rip), %rsi     # 0xe0a2c
callq 0x8160
testl %eax, %eax
jne 0x87912
movq 0x100(%rsp), %rdi
addq $0x20, %rdi
leaq 0x59127(%rip), %rsi     # 0xe0a2c
callq 0x8160
testl %eax, %eax
je 0x87a32
leaq -0x9(%r15), %r13
shlq $0x5, %r13
movq 0x60(%rsp), %rdi
addq %r13, %rdi
movq 0x28(%rsp), %rax
movq 0x80(%rax), %rsi
movq 0x88(%rax), %rdx
callq 0x8180
leaq 0x1c0(%rsp), %rbp
testb $0x1, 0x24(%rsp)
je 0x87954
movb $0x1, %al
movl %eax, 0x24(%rsp)
jmp 0x87a67
movl $0x1e, %edx
movq 0x7a658(%rip), %rdi     # 0x101fb8
leaq 0x51c5c(%rip), %rsi     # 0xd95c3
callq 0x84e0
movq 0x80(%rsp), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq 0x7a634(%rip), %rdi     # 0x101fb8
callq 0x84e0
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 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %rdx
movq 0x7a5ee(%rip), %rdi     # 0x101fb8
callq 0x84e0
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
movb $0x1, %al
movl %eax, 0x24(%rsp)
jmp 0x87a67
movq 0x60(%rsp), %rax
leaq (%rax,%rbp), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
movq %r13, %rsi
callq 0x88c0
leaq 0x1c0(%rsp), %rbp
jmp 0x87a67
movq 0x28(%rsp), %rax
leaq 0x60(%rax), %rcx
addq $0x68, %rax
jmp 0x87a44
movq 0x28(%rsp), %rax
leaq 0x80(%rax), %rcx
addq $0x88, %rax
movq (%rcx), %rsi
movq 0x60(%rsp), %rcx
leaq (%rcx,%rbp), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
movq (%rax), %rdx
callq 0x8180
leaq 0x1c0(%rsp), %rbp
leaq 0x100(%rsp), %rdi
callq 0x2e784
movq %rbp, %rdi
callq 0x2e784
incq %r15
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rax, %r15
jne 0x875d7
movq %rsi, %rdi
leaq 0x51b05(%rip), %rsi     # 0xd95a8
callq 0x8160
movl %eax, %r14d
movq 0x28(%rsp), %r15
movq 0x20(%r15), %rdi
callq 0x86e0
testl %r14d, %r14d
je 0x87ac8
movq 0x188(%rsp), %rcx
jmp 0x87aca
xorl %ecx, %ecx
movslq %eax, %r14
addq %rcx, %r14
movq 0xc0(%rsp), %rax
movb -0x1(%rax,%r14), %al
movq 0x60(%r15), %rcx
cmpb (%rcx), %al
jne 0x87af2
leaq 0xe0(%rsp), %r15
jmp 0x87b95
movl $0x13, %edx
movq 0x7a4ea(%rip), %rdi     # 0x101fe8
leaq 0x4e60f(%rip), %rsi     # 0xd6114
callq 0x84e0
leaq 0xe0(%rsp), %r15
movq 0xc0(%rsp), %rax
movb -0x1(%rax,%r14), %al
movb %al, (%rsp)
movl $0x1, %edx
movq 0x7a4ba(%rip), %rdi     # 0x101fe8
movq %rsp, %rsi
callq 0x84e0
movq %rax, %r13
movl $0xa, %edx
movq %rax, %rdi
leaq 0x4e5e0(%rip), %rsi     # 0xd6128
callq 0x84e0
movq 0x28(%rsp), %rax
movq 0x60(%rax), %rax
movb (%rax), %al
movb %al, (%rsp)
movl $0x1, %edx
movq %r13, %rdi
movq %rsp, %rsi
callq 0x84e0
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
leaq 0x280(%rsp), %rdi
callq 0x2e784
leaq 0x28(%rsp), %rdi
callq 0x2e784
jmp 0x87506
movq 0x88(%rsp), %rax
movq %rax, %rcx
cmpq 0x80(%rsp), %rax
je 0x87c45
xorl %r13d, %r13d
movq %rsp, %rbx
leaq 0xc0(%rsp), %r15
xorl %ebp, %ebp
movq 0x60(%rsp), %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq $-0x1, %rcx
callq 0x84a0
addq %r13, %r12
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x8180
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x87c1f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
incq %rbp
movq 0x80(%rsp), %rax
movq 0x88(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x5, %rdx
addq $0x20, %r13
cmpq %rdx, %rbp
jne 0x87bd6
movq 0x60(%rsp), %rdx
movq 0x8(%rdx), %rdx
cmpq 0xc8(%rsp), %rdx
je 0x87cea
movq 0x7a385(%rip), %rdi     # 0x101fe8
leaq 0x4d102(%rip), %rsi     # 0xd4d6c
movl $0x27, %edx
callq 0x84e0
movq 0xc8(%rsp), %rsi
movq 0x7a365(%rip), %rdi     # 0x101fe8
callq 0x82f0
movq %rax, %rbx
leaq 0x4d102(%rip), %rsi     # 0xd4d94
movl $0x16, %edx
movq %rax, %rdi
callq 0x84e0
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rsi
movq %rbx, %rdi
callq 0x82f0
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 0x80(%rsp), %rax
movq 0x88(%rsp), %rcx
cmpq %rax, %rcx
je 0x87dde
movl $0x8, %ebp
leaq 0x270(%rsp), %r13
xorl %ebx, %ebx
leaq 0x260(%rsp), %r14
leaq 0x158(%rsp), %r15
movq 0x158(%rsp), %r12
movl $0x1, %edx
movq %r12, %rdi
leaq 0x47eb1(%rip), %rsi     # 0xcfbda
callq 0x84e0
movq 0x80(%rsp), %rax
movq -0x8(%rax,%rbp), %rsi
movq (%rax,%rbp), %rdx
movq %r12, %rdi
callq 0x84e0
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 0x60(%rsp), %rax
movq %r13, 0x260(%rsp)
movq -0x8(%rax,%rbp), %rsi
movq (%rax,%rbp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x2ba06
movq %r15, %rdi
movq %r14, %rsi
callq 0x502ab
movq 0x260(%rsp), %rdi
cmpq %r13, %rdi
je 0x87dba
movq 0x270(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x88(%rsp), %rax
subq 0x80(%rsp), %rax
incq %rbx
sarq $0x5, %rax
addq $0x20, %rbp
cmpq %rax, %rbx
jne 0x87d12
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x87dfa
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x60(%rsp), %rdi
callq 0x2e784
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x87e29
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x1f8(%rsp), %rdi
leaq 0x208(%rsp), %rax
cmpq %rax, %rdi
je 0x87e4e
movq 0x208(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x180(%rsp), %rdi
leaq 0x190(%rsp), %rax
cmpq %rax, %rdi
je 0x87e73
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x87e98
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x80(%rsp), %rdi
callq 0x2e784
movq 0x118(%rsp), %rdi
leaq 0x128(%rsp), %rax
cmpq %rax, %rdi
je 0x87eca
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x240(%rsp), %rdi
leaq 0x250(%rsp), %rax
cmpq %rax, %rdi
je 0x87eef
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x87f14
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x160(%rsp), %rdi
leaq 0x170(%rsp), %rax
cmpq %rax, %rdi
je 0x87f39
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x87f5e
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x228(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x87f7f
movq 0x228(%rsp), %rsi
incq %rsi
callq 0x8480
xorl %eax, %eax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x88133
jmp 0x8804e
movq %rax, %r14
jmp 0x8815d
jmp 0x88170
jmp 0x88169
jmp 0x88169
jmp 0x8819b
movq %rax, %r14
jmp 0x881c3
movq %rax, %r14
jmp 0x881e8
movq %rax, %r14
jmp 0x8823f
movq %rax, %r14
jmp 0x88289
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
jmp 0x882a9
jmp 0x87feb
movq %rax, %r14
jmp 0x882ae
movq %rax, %r14
jmp 0x882d3
movq %rax, %r14
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
jmp 0x882e3
jmp 0x880ed
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %r15, %rdi
jmp 0x882f3
jmp 0x880ed
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %rbx, %rdi
jmp 0x882f3
jmp 0x880ed
jmp 0x880de
jmp 0x88133
jmp 0x8804e
movq %rax, %r14
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x88136
movq 0x10(%rsp), %rsi
jmp 0x880bd
jmp 0x88133
movq %rax, %r14
movq 0x1d8(%rsp), %rdi
leaq 0x1e8(%rsp), %rax
cmpq %rax, %rdi
je 0x8809c
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x8809c
movq %rax, %r14
movq 0x1a0(%rsp), %rdi
leaq 0x1b0(%rsp), %rax
cmpq %rax, %rdi
je 0x88136
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x88136
movq %rax, %r14
jmp 0x8820d
jmp 0x88170
jmp 0x8819b
movq %rax, %r14
jmp 0x88143
movq %rax, %r14
jmp 0x88150
jmp 0x8819b
jmp 0x8819b
movq %rax, %r14
jmp 0x882f8
jmp 0x88133
movq %rax, %r14
movq 0x260(%rsp), %rdi
cmpq %r13, %rdi
je 0x88173
movq 0x270(%rsp), %rsi
jmp 0x88129
jmp 0x88170
movq %rax, %r14
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x88173
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x88173
movq %rax, %r14
leaq 0x100(%rsp), %rdi
callq 0x2e784
leaq 0x1c0(%rsp), %rdi
callq 0x2e784
leaq 0x280(%rsp), %rdi
callq 0x2e784
leaq 0x28(%rsp), %rdi
callq 0x2e784
jmp 0x88173
movq %rax, %r14
jmp 0x8818f
jmp 0x88170
movq %rax, %r14
leaq 0x50(%rsp), %rax
movq 0x40(%rsp), %rdi
cmpq %rax, %rdi
je 0x8818f
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x60(%rsp), %rdi
callq 0x2e784
jmp 0x8819e
movq %rax, %r14
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x881c3
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x1f8(%rsp), %rdi
leaq 0x208(%rsp), %rax
cmpq %rax, %rdi
je 0x881e8
movq 0x208(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x180(%rsp), %rdi
leaq 0x190(%rsp), %rax
cmpq %rax, %rdi
je 0x8820d
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x88232
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x80(%rsp), %rdi
callq 0x2e784
movq 0x118(%rsp), %rdi
leaq 0x128(%rsp), %rax
cmpq %rax, %rdi
je 0x88264
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x240(%rsp), %rdi
leaq 0x250(%rsp), %rax
cmpq %rax, %rdi
je 0x88289
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0xf0(%rsp), %rax
movq 0xe0(%rsp), %rdi
cmpq %rax, %rdi
je 0x882ae
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x160(%rsp), %rdi
leaq 0x170(%rsp), %rax
cmpq %rax, %rdi
je 0x882d3
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0xb0(%rsp), %rax
movq 0xa0(%rsp), %rdi
cmpq %rax, %rdi
je 0x882f8
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x228(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x88319
movq 0x228(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r14, %rdi
callq 0x8840