// File: /workspace/github_cpp_makefile_star2_O1/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 0x88920
leaq 0x852a7(%rip), %rsi     # 0x10c7e8
leaq 0x218(%rsp), %rdi
callq 0x50803
movq 0x83a93(%rip), %rdi     # 0x10afe8
leaq 0x59a14(%rip), %rsi     # 0xe0f70
movl $0x43, %edx
callq 0x84e0
movq 0x8527b(%rip), %rsi     # 0x10c7e8
movq 0x8527c(%rip), %rdx     # 0x10c7f0
movq 0x83a6d(%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
movq 0x83a37(%rip), %rdi     # 0x10afe8
leaq 0x53c03(%rip), %rsi     # 0xdb1bb
movl $0x1a, %edx
callq 0x84e0
movq 0x8523f(%rip), %rsi     # 0x10c808
movq 0x85240(%rip), %rdx     # 0x10c810
movq 0x83a11(%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
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %rbx
movq 0x851ce(%rip), %rsi     # 0x10c7e8
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r15
movq 0x851cd(%rip), %rsi     # 0x10c808
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movq %r15, 0x78(%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 0x2e45c
leaq 0x59934(%rip), %rsi     # 0xe0fb4
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 0x2e45c
leaq 0x598fe(%rip), %rsi     # 0xe0fbe
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 0x110(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x250(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4a55e(%rip), %rdx     # 0xd1c7f
leaq 0x240(%rsp), %rdi
movq %rdx, %rsi
callq 0x28952
leaq 0xf0(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x850d9(%rip), %rsi     # 0x10c828
leaq 0x60(%rsp), %rdi
callq 0x52fb6
leaq 0x148(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x78(%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 0x4a44d(%rip), %rsi     # 0xd1c7f
leaq 0x138(%rsp), %rdi
callq 0x8160
testl %eax, %eax
je 0x87a52
movq 0x8379a(%rip), %r14     # 0x10afe8
leaq 0x138(%rsp), %r13
leaq 0x80(%rsp), %rbp
leaq 0x4a41a(%rip), %r15     # 0xd1c7f
movl $0x11, %edx
movq %r14, %rdi
leaq 0x53aa6(%rip), %rsi     # 0xdb31a
callq 0x84e0
movq 0x138(%rsp), %rsi
movq 0x140(%rsp), %rdx
movq %r14, %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 %r13, %rdi
leaq 0x59703(%rip), %rsi     # 0xe0fc8
callq 0x8160
testl %eax, %eax
je 0x8793e
movq %r13, %rdi
leaq 0x596fd(%rip), %rsi     # 0xe0fd5
callq 0x8160
testl %eax, %eax
je 0x879b1
movq %rbp, %rdi
leaq 0x78(%rsp), %rsi
movq %r13, %rdx
callq 0x4956e
leaq 0xe0(%rsp), %rdi
movq %rbp, %rsi
callq 0x8540
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x8792a
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x8480
movl $0x1, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x8100
jmp 0x87a3f
movq %rbp, %rdi
leaq 0x78(%rsp), %rsi
movq %r13, %rdx
callq 0x4956e
leaq 0xe0(%rsp), %rdi
movq %rbp, %rsi
callq 0x8540
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x87983
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x8480
movl $0x1, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x8100
movq 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %rdx
leaq 0x180(%rsp), %rdi
callq 0x8180
jmp 0x87a22
movq %rbp, %rdi
leaq 0x78(%rsp), %rsi
movq %r13, %rdx
callq 0x4956e
leaq 0xe0(%rsp), %rdi
movq %rbp, %rsi
callq 0x8540
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x879f6
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x8480
movl $0x1, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x8100
movq 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %rdx
leaq 0x1f8(%rsp), %rdi
callq 0x8180
movq 0xe0(%rsp), %rsi
movq 0xe8(%rsp), %rdx
leaq 0xc0(%rsp), %rdi
callq 0x8180
movq %r13, %rdi
movq %r15, %rsi
callq 0x8160
testl %eax, %eax
jne 0x87865
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x68(%rsp), %rsi
subq 0x60(%rsp), %rsi
sarq $0x5, %rsi
callq 0x415c4
movq 0x40(%rsp), %rdi
cmpq %rdi, 0x48(%rsp)
je 0x87ad5
xorl %r15d, %r15d
leaq 0x4a1f1(%rip), %r14     # 0xd1c7f
xorl %r12d, %r12d
addq %r15, %rdi
movl $0x1312d00, %esi        # imm = 0x1312D00
callq 0x86f0
movq 0x40(%rsp), %rdi
movq 0x8(%rdi,%r15), %rdx
addq %r15, %rdi
xorl %esi, %esi
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x86c0
incq %r12
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rax
subq %rdi, %rax
sarq $0x5, %rax
addq $0x20, %r15
cmpq %rax, %r12
jne 0x87a91
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x594e0(%rip), %rsi     # 0xe0fc8
leaq 0x594e5(%rip), %rdx     # 0xe0fd4
leaq 0x80(%rsp), %rdi
callq 0x28952
xorl %r14d, %r14d
leaq 0x100(%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 0x881c9
movq 0x100(%rsp), %rax
cmpb $0x23, (%rax)
je 0x87b17
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
movl $0x9, %edx
callq 0x50624
movq 0x28(%rsp), %rsi
movl $0xe0, %eax
addq %rax, %rsi
leaq 0x280(%rsp), %rdi
movl $0x3b, %edx
callq 0x50624
movq 0x280(%rsp), %rdi
leaq 0x4798a(%rip), %rsi     # 0xcf522
callq 0x8160
testl %eax, %eax
je 0x881ad
movq 0x28(%rsp), %rax
cmpq $0x1, 0x88(%rax)
jne 0x881ad
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rax
subq %rsi, %rax
cmpq $0x120, %rax            # imm = 0x120
je 0x880af
movq %r14, %rax
notq %rax
movq %rax, 0x238(%rsp)
movl $0x9, %r15d
movl $0x0, 0x5c(%rsp)
movq %rbp, %rdi
movq %r15, %rbp
shlq $0x5, %rbp
addq %rbp, %rsi
movl $0x3a, %edx
callq 0x50624
movq 0x1c0(%rsp), %rsi
leaq 0x120(%rsp), %rdi
movl $0x2f, %edx
callq 0x50624
movq 0x28(%rsp), %rdi
cmpb $0x1, 0x84c1e(%rip)     # 0x10c848
jne 0x87dfa
movq 0x20(%rdi), %rdi
callq 0x86e0
decl %eax
cltq
cmpq %rax, %r14
je 0x87c7e
xorl %r13d, %r13d
movq 0x40(%rsp), %rax
leaq (%rax,%rbp), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
leaq 0x47831(%rip), %rsi     # 0xcf48d
callq 0x88c0
incq %r13
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x86e0
decl %eax
cltq
subq %r14, %rax
cmpq %rax, %r13
jne 0x87c45
movq 0x120(%rsp), %rdi
leaq 0x47800(%rip), %rsi     # 0xcf48d
callq 0x8160
testl %eax, %eax
jne 0x87cb9
movq 0x120(%rsp), %rdi
addq $0x20, %rdi
leaq 0x477e4(%rip), %r13     # 0xcf48d
movq %r13, %rsi
callq 0x8160
testl %eax, %eax
je 0x88017
movq 0x120(%rsp), %rdi
leaq 0x61cec(%rip), %rsi     # 0xe99b4
callq 0x8160
testl %eax, %eax
jne 0x87cf4
movq 0x120(%rsp), %rdi
addq $0x20, %rdi
leaq 0x61cd0(%rip), %r13     # 0xe99b4
movq %r13, %rsi
callq 0x8160
testl %eax, %eax
je 0x88017
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 0x2e45c
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 0x2e45c
leaq 0x8(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
movq %r13, %rdx
callq 0x5790e
movq 0x1d8(%rsp), %rdi
leaq 0x1e8(%rsp), %rax
cmpq %rax, %rdi
je 0x87d8c
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x1a0(%rsp), %rdi
leaq 0x1b0(%rsp), %rax
cmpq %rax, %rdi
je 0x87db1
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x40(%rsp), %rax
leaq (%rax,%rbp), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
leaq 0x50444(%rip), %rsi     # 0xd820c
callq 0x88c0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
leaq 0x1c0(%rsp), %rbp
je 0x8807d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x8807d
leaq 0x591c7(%rip), %rsi     # 0xe0fc8
callq 0x8160
movq 0x40(%rsp), %r13
testl %eax, %eax
je 0x87e61
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x86e0
movslq %eax, %rcx
addq 0x238(%rsp), %rcx
addq 0x188(%rsp), %rcx
leaq 0x8(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
movq %r14, %rdx
callq 0x84a0
leaq -0x120(,%rbp), %rdi
addq %r13, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x8180
jmp 0x87ea6
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x86e0
decl %eax
movslq %eax, %rcx
subq %r14, %rcx
leaq 0x8(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
movq %r14, %rdx
callq 0x84a0
leaq -0x120(,%rbp), %rdi
addq %r13, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x8180
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x87ec2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x120(%rsp), %rdi
leaq 0x475bc(%rip), %rsi     # 0xcf48d
callq 0x8160
testl %eax, %eax
jne 0x87efa
movq 0x120(%rsp), %rdi
addq $0x20, %rdi
leaq 0x475a0(%rip), %rsi     # 0xcf48d
callq 0x8160
testl %eax, %eax
je 0x88039
movq 0x120(%rsp), %rdi
leaq 0x61aab(%rip), %rsi     # 0xe99b4
callq 0x8160
testl %eax, %eax
jne 0x87f32
movq 0x120(%rsp), %rdi
addq $0x20, %rdi
leaq 0x61a8f(%rip), %rsi     # 0xe99b4
callq 0x8160
testl %eax, %eax
je 0x88048
leaq -0x9(%r15), %r13
shlq $0x5, %r13
movq 0x40(%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, 0x5c(%rsp)
jne 0x8807d
movl $0x1e, %edx
movq 0x8303f(%rip), %rdi     # 0x10afb8
leaq 0x59063(%rip), %rsi     # 0xe0fe3
callq 0x84e0
movq 0x60(%rsp), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq 0x8301e(%rip), %rdi     # 0x10afb8
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 0x100(%rsp), %rsi
movq 0x108(%rsp), %rdx
movq 0x82fd8(%rip), %rdi     # 0x10afb8
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
movb $0x1, %cl
movl %ecx, 0x5c(%rsp)
movq %rax, %rdi
callq 0x8300
jmp 0x8807d
movq 0x40(%rsp), %rax
leaq (%rax,%rbp), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
movq %r13, %rsi
callq 0x88c0
leaq 0x1c0(%rsp), %rbp
jmp 0x8807d
movq 0x28(%rsp), %rax
leaq 0x60(%rax), %rcx
addq $0x68, %rax
jmp 0x8805a
movq 0x28(%rsp), %rax
leaq 0x80(%rax), %rcx
addq $0x88, %rax
movq (%rcx), %rsi
movq 0x40(%rsp), %rcx
leaq (%rcx,%rbp), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
movq (%rax), %rdx
callq 0x8180
leaq 0x1c0(%rsp), %rbp
leaq 0x120(%rsp), %rdi
callq 0x3123c
movq %rbp, %rdi
callq 0x3123c
incq %r15
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rax, %r15
jne 0x87bed
movq %rsi, %rdi
leaq 0x58f0f(%rip), %rsi     # 0xe0fc8
callq 0x8160
movl %eax, %r14d
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x86e0
testl %r14d, %r14d
je 0x880de
movq 0x188(%rsp), %rcx
jmp 0x880e0
xorl %ecx, %ecx
leaq 0x100(%rsp), %r15
movslq %eax, %r14
addq %rcx, %r14
movq 0xc0(%rsp), %rax
movb -0x1(%rax,%r14), %al
movq 0x28(%rsp), %rcx
movq 0x60(%rcx), %rcx
cmpb (%rcx), %al
je 0x881ad
movl $0x13, %edx
movq 0x82ed0(%rip), %rdi     # 0x10afe8
leaq 0x54f65(%rip), %rsi     # 0xdd084
callq 0x84e0
movq 0xc0(%rsp), %rax
movb -0x1(%rax,%r14), %al
movb %al, 0x8(%rsp)
movl $0x1, %edx
movq 0x82ea7(%rip), %rdi     # 0x10afe8
leaq 0x8(%rsp), %rsi
callq 0x84e0
movq %rax, %r13
movl $0xa, %edx
movq %rax, %rdi
leaq 0x54f3b(%rip), %rsi     # 0xdd098
callq 0x84e0
movq 0x28(%rsp), %rax
movq 0x60(%rax), %rax
movb (%rax), %al
movb %al, 0x8(%rsp)
movl $0x1, %edx
movq %r13, %rdi
leaq 0x8(%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 0x3123c
leaq 0x28(%rsp), %rdi
callq 0x3123c
jmp 0x87b17
movq 0x68(%rsp), %rax
cmpq 0x60(%rsp), %rax
je 0x8824c
xorl %r13d, %r13d
leaq 0x8(%rsp), %rbx
leaq 0xc0(%rsp), %r15
xorl %ebp, %ebp
movq 0x40(%rsp), %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq $-0x1, %rcx
callq 0x84a0
addq %r13, %r12
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x8180
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x88232
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x68(%rsp), %rax
subq 0x60(%rsp), %rax
incq %rbp
sarq $0x5, %rax
addq $0x20, %r13
cmpq %rax, %rbp
jne 0x881e7
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
cmpq 0xc8(%rsp), %rax
je 0x882dd
movq 0x82d82(%rip), %rdi     # 0x10afe8
leaq 0x52fbf(%rip), %rsi     # 0xdb22c
movl $0x27, %edx
callq 0x84e0
movq 0xc8(%rsp), %rsi
movq 0x82d62(%rip), %rdi     # 0x10afe8
callq 0x82f0
movq %rax, %rbx
leaq 0x52fbf(%rip), %rsi     # 0xdb254
movl $0x16, %edx
movq %rax, %rdi
callq 0x84e0
movq 0x40(%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 0x68(%rsp), %rax
cmpq 0x60(%rsp), %rax
je 0x883cf
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 0x4e64f(%rip), %rsi     # 0xd6972
callq 0x84e0
movq 0x60(%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 0x40(%rsp), %rax
movq %r13, 0x260(%rsp)
movq -0x8(%rax,%rbp), %rsi
movq (%rax,%rbp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x2e45c
movq %r15, %rdi
movq %r14, %rsi
callq 0x53420
movq 0x260(%rsp), %rdi
cmpq %r13, %rdi
je 0x883b1
movq 0x270(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x68(%rsp), %rax
subq 0x60(%rsp), %rax
incq %rbx
sarq $0x5, %rax
addq $0x20, %rbp
cmpq %rax, %rbx
jne 0x8830c
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x883f4
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x40(%rsp), %rdi
callq 0x3123c
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x88423
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x1f8(%rsp), %rdi
leaq 0x208(%rsp), %rax
cmpq %rax, %rdi
je 0x88448
movq 0x208(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x180(%rsp), %rdi
leaq 0x190(%rsp), %rax
cmpq %rax, %rdi
je 0x8846d
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x88492
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x60(%rsp), %rdi
callq 0x3123c
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x884c1
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x240(%rsp), %rdi
leaq 0x250(%rsp), %rax
cmpq %rax, %rdi
je 0x884e6
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x8850b
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x160(%rsp), %rdi
leaq 0x170(%rsp), %rax
cmpq %rax, %rdi
je 0x88530
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x88555
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x228(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x88576
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 0x8872c
jmp 0x88645
movq %rax, %r14
jmp 0x88756
jmp 0x88769
jmp 0x88762
jmp 0x88762
jmp 0x8879d
movq %rax, %r14
jmp 0x887c5
movq %rax, %r14
jmp 0x887ea
movq %rax, %r14
jmp 0x8883e
movq %rax, %r14
jmp 0x88888
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
jmp 0x888a8
jmp 0x885e2
movq %rax, %r14
jmp 0x888ad
movq %rax, %r14
jmp 0x888d2
movq %rax, %r14
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
jmp 0x888e2
jmp 0x886e5
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %r15, %rdi
jmp 0x888f2
jmp 0x886e5
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %rbx, %rdi
jmp 0x888f2
jmp 0x886e5
jmp 0x886d6
jmp 0x8872c
jmp 0x88645
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8872f
movq 0x18(%rsp), %rsi
jmp 0x886b5
jmp 0x8872c
movq %rax, %r14
movq 0x1d8(%rsp), %rdi
leaq 0x1e8(%rsp), %rax
cmpq %rax, %rdi
je 0x88694
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x88694
movq %rax, %r14
movq 0x1a0(%rsp), %rdi
leaq 0x1b0(%rsp), %rax
cmpq %rax, %rdi
je 0x8872f
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x8872f
movq %rax, %r14
jmp 0x8880f
jmp 0x88769
jmp 0x8879d
movq %rax, %r14
jmp 0x8873c
movq %rax, %r14
jmp 0x88749
jmp 0x8879d
jmp 0x8879d
movq %rax, %r14
jmp 0x888f7
jmp 0x8872c
movq %rax, %r14
movq 0x260(%rsp), %rdi
cmpq %r13, %rdi
je 0x8876c
movq 0x270(%rsp), %rsi
jmp 0x88722
jmp 0x88769
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8876c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x8876c
movq %rax, %r14
leaq 0x120(%rsp), %rdi
callq 0x3123c
leaq 0x1c0(%rsp), %rdi
callq 0x3123c
leaq 0x280(%rsp), %rdi
callq 0x3123c
leaq 0x28(%rsp), %rdi
callq 0x3123c
jmp 0x8876c
movq %rax, %r14
jmp 0x88791
jmp 0x88769
movq %rax, %r14
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x88791
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x40(%rsp), %rdi
callq 0x3123c
jmp 0x887a0
movq %rax, %r14
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x887c5
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x1f8(%rsp), %rdi
leaq 0x208(%rsp), %rax
cmpq %rax, %rdi
je 0x887ea
movq 0x208(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x180(%rsp), %rdi
leaq 0x190(%rsp), %rax
cmpq %rax, %rdi
je 0x8880f
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x138(%rsp), %rdi
leaq 0x148(%rsp), %rax
cmpq %rax, %rdi
je 0x88834
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x60(%rsp), %rdi
callq 0x3123c
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x88863
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x240(%rsp), %rdi
leaq 0x250(%rsp), %rax
cmpq %rax, %rdi
je 0x88888
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x110(%rsp), %rax
movq 0x100(%rsp), %rdi
cmpq %rax, %rdi
je 0x888ad
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x160(%rsp), %rdi
leaq 0x170(%rsp), %rax
cmpq %rax, %rdi
je 0x888d2
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0xb0(%rsp), %rax
movq 0xa0(%rsp), %rdi
cmpq %rax, %rdi
je 0x888f7
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x228(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x88918
movq 0x228(%rsp), %rsi
incq %rsi
callq 0x8480
movq %r14, %rdi
callq 0x8840