// File: /workspace/github_cpp_makefile_star2_O2/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 $0x2b8, %rsp            # imm = 0x2B8
callq 0x67c2d
leaq 0x778cf(%rip), %rsi     # 0xde820
leaq 0x1b8(%rsp), %rdi
callq 0x404d7
movq 0x76083(%rip), %rdi     # 0xdcfe8
leaq 0x422d4(%rip), %rsi     # 0xa9240
callq 0x8480
leaq 0x778a8(%rip), %rsi     # 0xde820
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
movq 0x76059(%rip), %rdi     # 0xdcfe8
leaq 0x3c4a5(%rip), %rsi     # 0xa343b
callq 0x8480
leaq 0x7789e(%rip), %rsi     # 0xde840
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
movl $0x208, %edi            # imm = 0x208
callq 0x8490
movq %rax, %r15
movq 0x7785a(%rip), %rsi     # 0xde820
pushq $0x8
popq %rdx
movq %rax, %rdi
callq 0x8890
movl $0x208, %edi            # imm = 0x208
callq 0x8490
movq %rax, %rbx
movq 0x7785b(%rip), %rsi     # 0xde840
pushq $0x8
popq %rdx
movq %rax, %rdi
callq 0x8890
movq %rbx, 0x98(%rsp)
leaq 0x42285(%rip), %rdx     # 0xa9284
leaq 0x1f8(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x28806
leaq 0x42273(%rip), %rdx     # 0xa928e
leaq 0x258(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x28806
movl $0x200, %edi            # imm = 0x200
callq 0x8490
movq %rax, %rbx
movq 0x1f8(%rsp), %rsi
pushq $0x10
popq %rdx
movq %rax, %rdi
callq 0x84e0
movq %rbx, 0x90(%rsp)
leaq 0x100(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x32dac(%rip), %rsi     # 0x99e1f
leaq 0x238(%rsp), %rdi
leaq 0x198(%rsp), %rdx
callq 0x21904
leaq 0x1a8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x777bd(%rip), %rsi     # 0xde860
leaq 0x58(%rsp), %rdi
callq 0x4237c
leaq 0x120(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x98(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x80a0
leaq 0x110(%rsp), %rdi
pushq $0x1
popq %rdx
xorl %esi, %esi
callq 0x8100
andq $0x0, 0x140(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x130(%rsp)
leaq 0xe0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xd0(%rsp), %rdi
movl $0x1312d00, %esi        # imm = 0x1312D00
callq 0x8700
leaq 0x188(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x178(%rsp), %rdi
movl $0x1312d00, %esi        # imm = 0x1312D00
callq 0x8700
movq %r15, 0xc8(%rsp)
leaq 0x80(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x70(%rsp), %rdi
movl $0x1312d00, %esi        # imm = 0x1312D00
callq 0x8700
leaq 0x32ca5(%rip), %r12     # 0x99e1f
leaq 0x110(%rsp), %r13
leaq 0x1d8(%rsp), %r14
leaq 0x98(%rsp), %rbp
leaq 0x198(%rsp), %r15
pushq $0x1
popq %rbx
movq %r13, %rdi
movq %r12, %rsi
callq 0x2ea9b
testb %al, %al
je 0x672b7
movq 0x75e31(%rip), %rdi     # 0xdcfe8
leaq 0x3c3dc(%rip), %rsi     # 0xa359a
callq 0x8480
movq %rax, %rdi
movq %r13, %rsi
callq 0x8430
movq %rax, %rdi
callq 0x8230
movq %r13, %rdi
leaq 0x420b8(%rip), %rsi     # 0xa9298
callq 0x2193f
testb %al, %al
je 0x67221
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x3a53b
movq %r15, %rdi
movq %r14, %rsi
callq 0x8550
movq %r14, %rdi
callq 0x8978
movq %r13, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x8100
leaq 0xd0(%rsp), %rdi
jmp 0x6726a
movq %r13, %rdi
leaq 0x4207a(%rip), %rsi     # 0xa92a5
callq 0x2193f
testb %al, %al
je 0x67284
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x3a53b
movq %r15, %rdi
movq %r14, %rsi
callq 0x8550
movq %r14, %rdi
callq 0x8978
movq %r13, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x8100
leaq 0x178(%rsp), %rdi
movq %r15, %rsi
callq 0x8920
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x8920
jmp 0x6719d
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x3a53b
movq %r15, %rdi
movq %r14, %rsi
callq 0x8550
movq %r14, %rdi
callq 0x8978
movq %r13, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x8100
jmp 0x6719d
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq 0x60(%rsp), %rsi
subq 0x58(%rsp), %rsi
sarq $0x5, %rsi
callq 0x34872
xorl %r14d, %r14d
leaq 0x32b3b(%rip), %rbx     # 0x99e1f
xorl %r15d, %r15d
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rax
subq %rdi, %rax
sarq $0x5, %rax
cmpq %rax, %r15
je 0x67323
addq %r14, %rdi
movl $0x1312d00, %esi        # imm = 0x1312D00
callq 0x8700
movq 0x20(%rsp), %rdi
addq %r14, %rdi
movq %rbx, %rsi
callq 0x88f0
incq %r15
addq $0x20, %r14
jmp 0x672e7
leaq 0x41f6e(%rip), %rsi     # 0xa9298
leaq 0x1d8(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x21904
xorl %r14d, %r14d
leaq 0x8(%rsp), %rbx
pushq $0x9
popq %rbp
leaq 0x302d4(%rip), %r13     # 0x97625
leaq 0x298(%rsp), %r15
movq 0xc8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x80a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x6782a
movq 0xf0(%rsp), %rax
cmpb $0x23, (%rax)
je 0x67359
movq %rbx, %rdi
leaq 0xf0(%rsp), %rsi
movl %ebp, %edx
callq 0x40349
movq 0x8(%rsp), %rsi
movl $0xe0, %eax
addq %rax, %rsi
leaq 0x160(%rsp), %rdi
pushq $0x3b
popq %rdx
callq 0x40349
movq 0x160(%rsp), %rdi
leaq 0x302ef(%rip), %rsi     # 0x976ba
callq 0x2ea9b
testb %al, %al
je 0x67810
movq 0x8(%rsp), %rsi
cmpq $0x1, 0x88(%rsi)
jne 0x67810
movq %r14, %rax
notq %rax
movq %rax, 0xc0(%rsp)
movl $0x0, 0x4(%rsp)
pushq $0x9
popq %r12
leaq 0xa0(%rsp), %rbp
movq 0x10(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rax, %r12
je 0x6776e
movq %r12, %rbx
shlq $0x5, %rbx
addq %rbx, %rsi
leaq 0x148(%rsp), %rdi
pushq $0x3a
popq %rdx
callq 0x40349
movq 0x148(%rsp), %rsi
leaq 0x40(%rsp), %rdi
pushq $0x2f
popq %rdx
callq 0x40349
movq %r12, 0x38(%rsp)
cmpb $0x1, 0x77423(%rip)     # 0xde880
jne 0x67499
xorl %r12d, %r12d
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x86f0
decl %eax
cltq
subq %r14, %rax
cmpq %rax, %r12
je 0x674f5
movq 0x20(%rsp), %rax
leaq (%rax,%rbx), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
movq %r13, %rsi
callq 0x88e0
incq %r12
jmp 0x67462
movq 0x8(%rsp), %rdi
leaq 0x41df3(%rip), %rsi     # 0xa9298
callq 0x2193f
movq 0x20(%rsp), %r12
testb %al, %al
je 0x675ff
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x86f0
decl %eax
movslq %eax, %rcx
subq %r14, %rcx
movq %rbp, %rdi
leaq 0x70(%rsp), %rsi
movq %r14, %rdx
callq 0x84b0
leaq (%r12,%rbx), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
movq %rbp, %rsi
callq 0x8920
jmp 0x67643
movq 0x40(%rsp), %rdi
movq %r13, %rsi
callq 0x2193f
testb %al, %al
je 0x6751e
movq 0x40(%rsp), %rdi
addq $0x20, %rdi
movq %r13, %rsi
callq 0x2193f
movq %r13, %rsi
testb %al, %al
jne 0x67552
movq 0x40(%rsp), %rdi
leaq 0x4a75a(%rip), %rsi     # 0xb1c84
callq 0x2193f
testb %al, %al
je 0x67571
movq 0x40(%rsp), %rdi
addq $0x20, %rdi
leaq 0x4a741(%rip), %r12     # 0xb1c84
movq %r12, %rsi
callq 0x2193f
movq %r12, %rsi
testb %al, %al
je 0x67571
movq 0x20(%rsp), %rax
leaq (%rax,%rbx), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
callq 0x88e0
movq 0x38(%rsp), %r12
jmp 0x6774a
movq 0x8(%rsp), %rsi
addq $0x60, %rsi
leaq 0x218(%rsp), %rdi
callq 0x8600
movq 0x8(%rsp), %rsi
subq $-0x80, %rsi
movq %r15, %rdi
callq 0x8600
movq %r15, %rbp
leaq 0xa0(%rsp), %rdi
leaq 0x218(%rsp), %r12
movq %r12, %rsi
movq %r15, %rdx
callq 0x4667a
movq %rbp, %r15
movq %rbp, %rdi
callq 0x8978
movq %r12, %rdi
callq 0x8978
movq 0x20(%rsp), %rax
leaq (%rax,%rbx), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
leaq 0x38ebc(%rip), %rsi     # 0xa049c
callq 0x88e0
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
callq 0x8978
movq 0x38(%rsp), %r12
jmp 0x6774a
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x86f0
movslq %eax, %rcx
addq 0xc0(%rsp), %rcx
addq 0xd8(%rsp), %rcx
movq %rbp, %rdi
leaq 0x70(%rsp), %rsi
movq %r14, %rdx
callq 0x84b0
leaq (%r12,%rbx), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
movq %rbp, %rsi
callq 0x8920
movq %rbp, %rdi
callq 0x8978
movq 0x40(%rsp), %rdi
movq %r13, %rsi
callq 0x2193f
testb %al, %al
movq 0x38(%rsp), %r12
je 0x67681
movq 0x40(%rsp), %rdi
addq $0x20, %rdi
movq %r13, %rsi
callq 0x2193f
testb %al, %al
je 0x67681
movq 0x8(%rsp), %rsi
addq $0x60, %rsi
jmp 0x676b8
movq 0x40(%rsp), %rdi
leaq 0x4a5f7(%rip), %rsi     # 0xb1c84
callq 0x2193f
testb %al, %al
je 0x676cf
movq 0x40(%rsp), %rdi
addq $0x20, %rdi
leaq 0x4a5de(%rip), %rsi     # 0xb1c84
callq 0x2193f
testb %al, %al
je 0x676cf
movq 0x8(%rsp), %rsi
subq $-0x80, %rsi
movq 0x20(%rsp), %rax
leaq (%rax,%rbx), %rdi
addq $-0x120, %rdi           # imm = 0xFEE0
callq 0x8920
jmp 0x6774a
leaq -0x9(%r12), %rbx
shlq $0x5, %rbx
movq 0x20(%rsp), %rdi
addq %rbx, %rdi
movq 0x8(%rsp), %rsi
subq $-0x80, %rsi
callq 0x8920
testb $0x1, 0x4(%rsp)
je 0x676fd
movb $0x1, %al
movl %eax, 0x4(%rsp)
jmp 0x6774a
movq 0x758b4(%rip), %rdi     # 0xdcfb8
leaq 0x41ba8(%rip), %rsi     # 0xa92b3
callq 0x8480
addq 0x58(%rsp), %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x8430
movq %rax, %rdi
callq 0x8230
movq 0x75889(%rip), %rdi     # 0xdcfb8
leaq 0xf0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
callq 0x8230
movb $0x1, %al
movl %eax, 0x4(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x28a08
leaq 0x148(%rsp), %rdi
callq 0x28a08
incq %r12
movq 0x8(%rsp), %rsi
jmp 0x6740d
movq %rsi, %rdi
leaq 0x41b20(%rip), %rsi     # 0xa9298
callq 0x2193f
movl %eax, %ebx
movq 0x8(%rsp), %r12
movq 0x20(%r12), %rdi
callq 0x86f0
testb %bl, %bl
jne 0x6779c
movq 0xd8(%rsp), %rcx
jmp 0x6779e
xorl %ecx, %ecx
leaq 0x8(%rsp), %rbx
pushq $0x9
popq %rbp
movslq %eax, %r14
addq %rcx, %r14
movq 0x70(%rsp), %rax
movb -0x1(%rax,%r14), %al
movq 0x60(%r12), %rcx
cmpb (%rcx), %al
je 0x67810
movq 0x75822(%rip), %rdi     # 0xdcfe8
leaq 0x3ce83(%rip), %rsi     # 0xa4650
callq 0x8480
movq 0x70(%rsp), %rcx
movsbl -0x1(%rcx,%r14), %esi
movq %rax, %rdi
callq 0x8510
movq %rax, %rdi
leaq 0x3ce75(%rip), %rsi     # 0xa4664
callq 0x8480
movq 0x8(%rsp), %rcx
movq 0x60(%rcx), %rcx
movsbl (%rcx), %esi
movq %rax, %rdi
callq 0x8510
movq %rax, %rdi
callq 0x8230
leaq 0x160(%rsp), %rdi
callq 0x28a08
movq %rbx, %rdi
callq 0x28a08
jmp 0x67359
xorl %ebp, %ebp
leaq 0xa0(%rsp), %rbx
pushq $-0x1
popq %r12
xorl %r15d, %r15d
movq 0x60(%rsp), %rax
subq 0x58(%rsp), %rax
sarq $0x5, %rax
movq 0x20(%rsp), %r13
cmpq %rax, %r15
je 0x67885
movq %rbx, %rdi
leaq 0x70(%rsp), %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x84b0
addq %rbp, %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x8920
movq %rbx, %rdi
callq 0x8978
incq %r15
addq $0x20, %rbp
jmp 0x6783b
movq 0x8(%r13), %rax
cmpq 0x78(%rsp), %rax
je 0x678d8
movq 0x75751(%rip), %rdi     # 0xdcfe8
leaq 0x3bc0e(%rip), %rsi     # 0xa34ac
callq 0x8480
movq 0x78(%rsp), %rsi
movq %rax, %rdi
callq 0x8320
leaq 0x3bc1d(%rip), %rsi     # 0xa34d4
movq %rax, %rdi
callq 0x8480
movq 0x20(%rsp), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdi
callq 0x8320
movq %rax, %rdi
callq 0x8230
xorl %r12d, %r12d
leaq 0x37230(%rip), %rbx     # 0x9eb12
leaq 0x278(%rsp), %r14
leaq 0x90(%rsp), %r15
xorl %r13d, %r13d
movq 0x60(%rsp), %rax
subq 0x58(%rsp), %rax
sarq $0x5, %rax
cmpq %rax, %r13
je 0x6795c
movq 0x90(%rsp), %rdi
movq %rbx, %rsi
callq 0x8480
movq 0x58(%rsp), %rsi
addq %r12, %rsi
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
movq 0x20(%rsp), %rsi
addq %r12, %rsi
movq %r14, %rdi
callq 0x8600
movq %r15, %rdi
movq %r14, %rsi
callq 0x42730
movq %r14, %rdi
callq 0x8978
incq %r13
addq $0x20, %r12
jmp 0x678f5
leaq 0x1d8(%rsp), %rdi
callq 0x8978
leaq 0x20(%rsp), %rdi
callq 0x28a08
leaq 0x70(%rsp), %rdi
callq 0x8978
leaq 0x178(%rsp), %rdi
callq 0x8978
leaq 0xd0(%rsp), %rdi
callq 0x8978
leaq 0x130(%rsp), %rdi
callq 0x2f68c
leaq 0x110(%rsp), %rdi
callq 0x8978
leaq 0x58(%rsp), %rdi
callq 0x28a08
leaq 0x198(%rsp), %rdi
callq 0x8978
leaq 0x238(%rsp), %rdi
callq 0x8978
leaq 0xf0(%rsp), %rdi
callq 0x8978
leaq 0x258(%rsp), %rdi
callq 0x8978
leaq 0x1f8(%rsp), %rdi
callq 0x8978
leaq 0x1b8(%rsp), %rdi
callq 0x8978
xorl %eax, %eax
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x67b08
jmp 0x67b70
movq %rax, %r14
jmp 0x67b64
jmp 0x67b08
jmp 0x67b38
jmp 0x67b38
jmp 0x67b8c
movq %rax, %r14
jmp 0x67b99
movq %rax, %r14
jmp 0x67ba6
movq %rax, %r14
jmp 0x67bd7
movq %rax, %r14
jmp 0x67bf1
movq %rax, %r14
movl $0x200, %esi            # imm = 0x200
movq %rbx, %rdi
callq 0x84a0
jmp 0x67bfe
movq %rax, %r14
jmp 0x67bfe
movq %rax, %r14
jmp 0x67c0b
jmp 0x67afb
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %rbx, %rdi
jmp 0x67aa4
jmp 0x67afb
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %r15, %rdi
callq 0x84a0
jmp 0x67c18
jmp 0x67afb
jmp 0x67ac6
jmp 0x67b3d
jmp 0x67b3d
jmp 0x67ac6
movq %rax, %r14
jmp 0x67bc0
movq %rax, %r14
leaq 0xa0(%rsp), %rdi
jmp 0x67af0
movq %rax, %r14
leaq 0x298(%rsp), %rdi
callq 0x8978
jmp 0x67ae8
movq %rax, %r14
leaq 0x218(%rsp), %rdi
callq 0x8978
jmp 0x67b40
jmp 0x67b3d
jmp 0x67b70
movq %rax, %r14
jmp 0x67c18
movq %rax, %r14
jmp 0x67b4a
movq %rax, %r14
jmp 0x67b57
jmp 0x67b8c
jmp 0x67b8c
jmp 0x67b3d
jmp 0x67b8c
movq %rax, %r14
leaq 0x278(%rsp), %rdi
jmp 0x67b2f
jmp 0x67b70
movq %rax, %r14
leaq 0xa0(%rsp), %rdi
callq 0x8978
jmp 0x67b73
jmp 0x67b70
movq %rax, %r14
jmp 0x67b80
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x28a08
leaq 0x148(%rsp), %rdi
callq 0x28a08
leaq 0x160(%rsp), %rdi
callq 0x28a08
leaq 0x8(%rsp), %rdi
callq 0x28a08
jmp 0x67b73
movq %rax, %r14
leaq 0x1d8(%rsp), %rdi
callq 0x8978
leaq 0x20(%rsp), %rdi
callq 0x28a08
jmp 0x67b8f
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0x8978
leaq 0x178(%rsp), %rdi
callq 0x8978
leaq 0xd0(%rsp), %rdi
callq 0x8978
leaq 0x130(%rsp), %rdi
callq 0x2f68c
leaq 0x110(%rsp), %rdi
callq 0x8978
leaq 0x58(%rsp), %rdi
callq 0x28a08
leaq 0x198(%rsp), %rdi
callq 0x8978
leaq 0x238(%rsp), %rdi
callq 0x8978
leaq 0xf0(%rsp), %rdi
callq 0x8978
leaq 0x258(%rsp), %rdi
callq 0x8978
leaq 0x1f8(%rsp), %rdi
callq 0x8978
leaq 0x1b8(%rsp), %rdi
callq 0x8978
movq %r14, %rdi
callq 0x8870