// File: /workspace/github_cpp_makefile_star2_O2/millanek[P]evo/evo_fullAnnotationExtract.cpp
// Function: AnnotationPreformat(int, char**)
int AnnotationPreformat(int argc, char** argv) {
    parseAnnotExtractOptions(argc, argv);
    // Load up the annotation file
    std::ifstream* gpFile = new std::ifstream(opt::gpFile.c_str());
    std::unordered_map<string, bool> gpTranscripts;
    std::cerr << "Loading " << opt::gpFile << std::endl;
    std::string line;
    while (getline(*gpFile, line)) {
        gpTranscripts[split(line, '\t')[0]] = true;
    } gpFile->close();
    std::cerr << "Done" << std::endl;
    
    
    std::ifstream* annotFile = new std::ifstream(opt::annotationFile.c_str());
    std::ofstream* regulatoryFile;
    std::ofstream* intronFile;
    std::ofstream* upstreamFile;
    std::ofstream* downstreamFile;
    if (opt::regulatory) {
        regulatoryFile = new std::ofstream(opt::annotationFile+"Extract_allRegulatory");
        intronFile = new std::ofstream(opt::annotationFile+"Extract_Intron");
        upstreamFile = new std::ofstream(opt::annotationFile+"Extract_Upstream");
        downstreamFile = new std::ofstream(opt::annotationFile+"Extract_Downstream");
    }
    string geneLastLine = ""; string scaffoldLastLine = ""; string startLastLine = ""; string endLastLine = "";
    string directionLastLine = "";
    std::cerr << "Going through " << opt::annotationFile << std::endl;
    while (getline(*annotFile, line)) {
        if (line[0] == '#') continue;
        std::vector<string> annotVec = split(line, '\t');
        if (annotVec[2] == "CDS") { // only outputting CDS coordinates
            std::vector<string> descriptionVec = split(annotVec[8], ' ');
            string transcript = "";
            if (descriptionVec[2] == "transcript_id") {
                transcript = descriptionVec[3].substr(1).substr(0,descriptionVec[3].substr(1).length()-2);
            } else if (descriptionVec[4] == "transcript_id") {
                transcript = descriptionVec[5].substr(1).substr(0,descriptionVec[5].substr(1).length()-2);
            }
            if (gpTranscripts.count(transcript) == 1) {
                string gene = descriptionVec[1].substr(1).substr(0,descriptionVec[1].substr(1).length()-2);
                string scaffold = annotVec[0];
                string start = annotVec[3];
                string end = annotVec[4];
                string direction = annotVec[6];
                std::cout << scaffold << "\t" << start << "\t" << end << "\t" << direction << "\t" << gene << std::endl;
                if (opt::regulatory) {
                    if (gene != geneLastLine) {
                        // First sort out the previous gene:
                        if (directionLastLine == "+") {
                            *downstreamFile << scaffoldLastLine << "\t" << atoi(endLastLine.c_str())+1 << "\t" << atoi(endLastLine.c_str())+opt::bp_3prime+1 << "\t" << directionLastLine << "\t" << geneLastLine << "\t" << "downstream" << std::endl;
                            *regulatoryFile << scaffoldLastLine << "\t" << atoi(endLastLine.c_str())+1 << "\t" << atoi(endLastLine.c_str())+opt::bp_3prime+1 << "\t" << directionLastLine << "\t" << geneLastLine << "\t" << "downstream" << std::endl;
                        }
                        if (directionLastLine == "-") {
                            *upstreamFile << scaffoldLastLine << "\t" << atoi(endLastLine.c_str())+1 << "\t" << atoi(endLastLine.c_str())+opt::bp_5prime+1 << "\t" << directionLastLine << "\t" << geneLastLine << "\t" << "upstream" << std::endl;
                            *regulatoryFile << scaffoldLastLine << "\t" << atoi(endLastLine.c_str())+1 << "\t" << atoi(endLastLine.c_str())+opt::bp_5prime+1 << "\t" << directionLastLine << "\t" << geneLastLine << "\t" << "upstream" << std::endl;
                        }
                        // Now sort out this gene:
                        if (direction == "+") {
                            int startUpstream = atoi(start.c_str())-opt::bp_5prime-1;
                            if (startUpstream < 0) startUpstream = 0;
                            int endUpstream = atoi(start.c_str())-1;
                            if (endUpstream > 0) {
                                *upstreamFile << scaffold << "\t" << startUpstream << "\t" << atoi(start.c_str())-1 << "\t" << direction << "\t" << gene << "\t" << "upstream" << std::endl;
                                *regulatoryFile << scaffold << "\t" << startUpstream << "\t" << atoi(start.c_str())-1 << "\t" << direction << "\t" << gene << "\t" << "upstream" << std::endl;
                            }
                        }
                        if (direction == "-") {
                            int startDownstream = atoi(start.c_str())-opt::bp_5prime-1;
                            if (startDownstream < 0) startDownstream = 0;
                            int endDownstream = atoi(start.c_str())-1;
                            if (endDownstream > 0) {
                                *downstreamFile << scaffold << "\t" << startDownstream << "\t" << atoi(start.c_str())-1 << "\t" << direction << "\t" << gene << "\t" << "downstream" << std::endl;
                                *regulatoryFile << scaffold << "\t" << startDownstream << "\t" << atoi(start.c_str())-1 << "\t" << direction << "\t" << gene << "\t" << "downstream" << std::endl;
                            }
                        }
                    }
                    if (gene == geneLastLine) {
                        int startIntron = atoi(endLastLine.c_str())+1;
                        int endIntron = atoi(start.c_str())-1;
                        if (endIntron > startIntron) {
                            *intronFile << scaffold << "\t" << startIntron << "\t" << endIntron << "\t" << direction << "\t" << gene << "\t" << "intron" << std::endl;
                            *regulatoryFile << scaffold << "\t" << startIntron << "\t" << endIntron << "\t" << direction << "\t" << gene << "\t" << "intron" << std::endl;
                        } else {
                            std::cerr << "WARNING: an intron for gene " << gene << " has negative length" << std::endl;
                        }
                    }
                }
                geneLastLine = gene; startLastLine = start; endLastLine = end; directionLastLine = direction;
                scaffoldLastLine = scaffold;
            }
            //
        }
        // if (gpTranscripts.count() == 1) {
        // }
    } annotFile->close();
    // and the final noncoding element:
    if (opt::regulatory) {
        if (directionLastLine == "+") {
            *downstreamFile << scaffoldLastLine << "\t" << atoi(endLastLine.c_str())+1 << "\t" << atoi(endLastLine.c_str())+opt::bp_3prime+1 << "\t" << directionLastLine << "\t" << geneLastLine << "\t" << "downstream" << std::endl;
            *regulatoryFile << scaffoldLastLine << "\t" << atoi(endLastLine.c_str())+1 << "\t" << atoi(endLastLine.c_str())+opt::bp_3prime+1 << "\t" << directionLastLine << "\t" << geneLastLine << "\t" << "downstream" << std::endl;
        }
        if (directionLastLine == "-") {
            *upstreamFile << scaffoldLastLine << "\t" << atoi(endLastLine.c_str())+1 << "\t" << atoi(endLastLine.c_str())+opt::bp_5prime+1 << "\t" << directionLastLine << "\t" << geneLastLine << "\t" << "upstream" << std::endl;
            *regulatoryFile << scaffoldLastLine << "\t" << atoi(endLastLine.c_str())+1 << "\t" << atoi(endLastLine.c_str())+opt::bp_5prime+1 << "\t" << directionLastLine << "\t" << geneLastLine << "\t" << "upstream" << std::endl;
        }
    }
    std::cerr << "Done" << std::endl;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
callq 0x30f7b
movl $0x208, %edi            # imm = 0x208
callq 0x8490
movq %rax, %r14
movq 0xadfd6(%rip), %rsi     # 0xdd9c8
pushq $0x8
popq %rdx
movq %rax, %rdi
callq 0x8890
leaq 0x1f0(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq 0xad5be(%rip), %rdi     # 0xdcfe8
leaq 0x68f9f(%rip), %rsi     # 0x989d0
callq 0x8480
leaq 0xadf8b(%rip), %rsi     # 0xdd9c8
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
leaq 0x150(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x140(%rsp), %rbx
leaq 0x10(%rsp), %r15
pushq $0x9
popq %rbp
leaq 0x1c0(%rsp), %r12
movq %r14, %rdi
movq %rbx, %rsi
callq 0x80a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2fab9
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x40349
movq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x31208
movb $0x1, (%rax)
movq %r15, %rdi
callq 0x28a08
jmp 0x2fa79
movq %r14, %rdi
callq 0x80e0
movq 0xad520(%rip), %rdi     # 0xdcfe8
leaq 0x66718(%rip), %rsi     # 0x961e7
callq 0x8480
movq %rax, %rdi
callq 0x8230
movl $0x208, %edi            # imm = 0x208
callq 0x8490
movq %rax, %r15
movq 0xadef8(%rip), %rsi     # 0xdd9e8
pushq $0x8
popq %rdx
movq %rax, %rdi
callq 0x8890
cmpb $0x1, 0xadf06(%rip)     # 0xdda08
jne 0x2fc1a
movl $0x200, %edi            # imm = 0x200
callq 0x8490
movq %rax, 0x8(%rsp)
leaq 0xadeca(%rip), %rsi     # 0xdd9e8
leaq 0x68eb4(%rip), %rdx     # 0x989d9
leaq 0x10(%rsp), %rdi
callq 0x28806
leaq 0x10(%rsp), %rsi
pushq $0x10
popq %rdx
movq 0x8(%rsp), %rdi
callq 0x8900
leaq 0x10(%rsp), %rdi
callq 0x8978
movl $0x200, %edi            # imm = 0x200
callq 0x8490
movq %rax, 0xa0(%rsp)
leaq 0xade84(%rip), %rsi     # 0xdd9e8
leaq 0x68e84(%rip), %rdx     # 0x989ef
leaq 0x10(%rsp), %rdi
callq 0x28806
leaq 0x10(%rsp), %rsi
pushq $0x10
popq %rdx
movq 0xa0(%rsp), %rdi
callq 0x8900
leaq 0x10(%rsp), %rdi
callq 0x8978
movl $0x200, %edi            # imm = 0x200
callq 0x8490
movq %rax, 0x30(%rsp)
leaq 0xade3e(%rip), %rsi     # 0xdd9e8
leaq 0x68e4d(%rip), %rdx     # 0x989fe
leaq 0x10(%rsp), %rdi
callq 0x28806
leaq 0x10(%rsp), %rsi
pushq $0x10
popq %rdx
movq 0x30(%rsp), %rdi
callq 0x8900
leaq 0x10(%rsp), %rdi
callq 0x8978
movl $0x200, %edi            # imm = 0x200
callq 0x8490
movq %rax, 0x38(%rsp)
leaq 0xaddfb(%rip), %rsi     # 0xdd9e8
leaq 0x68e1b(%rip), %rdx     # 0x98a0f
leaq 0x10(%rsp), %rdi
callq 0x28806
leaq 0x10(%rsp), %rsi
pushq $0x10
popq %rdx
movq 0x38(%rsp), %rdi
callq 0x8900
leaq 0x10(%rsp), %rdi
callq 0x8978
leaq 0x6a1fe(%rip), %rsi     # 0x99e1f
leaq 0x10(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
callq 0x21904
leaq 0x6a1e5(%rip), %rsi     # 0x99e1f
leaq 0xe0(%rsp), %rdi
leaq 0x1a0(%rsp), %rdx
callq 0x21904
leaq 0x6a1c9(%rip), %rsi     # 0x99e1f
leaq 0x1a0(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x21904
leaq 0x6a1b0(%rip), %rsi     # 0x99e1f
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x21904
leaq 0x6a197(%rip), %rsi     # 0x99e1f
leaq 0x80(%rsp), %rdi
leaq 0x120(%rsp), %rdx
callq 0x21904
movq 0xad344(%rip), %rdi     # 0xdcfe8
leaq 0x68d77(%rip), %rsi     # 0x98a22
callq 0x8480
leaq 0xadd31(%rip), %rsi     # 0xdd9e8
movq %rax, %rdi
callq 0x8430
movq %rax, %rdi
callq 0x8230
leaq 0x140(%rsp), %rbp
leaq 0x1f8(%rsp), %r13
leaq 0x180(%rsp), %rbx
movq %r15, 0x118(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x80a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x30962
movq 0x140(%rsp), %rax
cmpb $0x23, (%rax)
je 0x2fce7
leaq 0x100(%rsp), %rdi
movq %rbp, %rsi
pushq $0x9
popq %rdx
callq 0x40349
movq 0x100(%rsp), %rdi
addq $0x40, %rdi
leaq 0x68cfa(%rip), %rsi     # 0x98a31
callq 0x2193f
testb %al, %al
je 0x30950
movq 0x100(%rsp), %rsi
movl $0x100, %eax            # imm = 0x100
addq %rax, %rsi
leaq 0xa8(%rsp), %rdi
pushq $0x20
popq %rdx
callq 0x40349
leaq 0x120(%rsp), %rdi
leaq 0x6a0ac(%rip), %rsi     # 0x99e1f
movq %r13, %rdx
callq 0x21904
movq 0xa8(%rsp), %rdi
addq $0x40, %rdi
leaq 0x68ca7(%rip), %r14     # 0x98a35
movq %r14, %rsi
callq 0x2193f
testb %al, %al
je 0x2fe24
movq 0xa8(%rsp), %rsi
addq $0x60, %rsi
movq %rbx, %rdi
pushq $0x1
popq %r14
movq %r14, %rdx
pushq $-0x1
popq %r12
movq %r12, %rcx
callq 0x84b0
movq 0xa8(%rsp), %rsi
addq $0x60, %rsi
leaq 0x40(%rsp), %rdi
movq %r14, %rdx
movq %r12, %rcx
callq 0x84b0
movq 0x48(%rsp), %rcx
addq $-0x2, %rcx
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x84b0
leaq 0x120(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x8550
movq %r13, %rdi
callq 0x8978
leaq 0x40(%rsp), %rdi
callq 0x8978
movq %rbx, %rdi
callq 0x8978
jmp 0x2feda
movq 0xa8(%rsp), %rdi
subq $-0x80, %rdi
movq %r14, %rsi
callq 0x2193f
testb %al, %al
leaq 0x120(%rsp), %r14
je 0x2feda
movq %rbp, %r15
movq 0xa8(%rsp), %rsi
movq %rbx, %rdi
movl $0xa0, %ebp
addq %rbp, %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
pushq $-0x1
popq %r12
movq %r12, %rcx
callq 0x84b0
movq 0xa8(%rsp), %rsi
addq %rbp, %rsi
leaq 0x40(%rsp), %rdi
movq %r14, %rdx
movq %r12, %rcx
callq 0x84b0
movq 0x48(%rsp), %rcx
addq $-0x2, %rcx
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x84b0
movq %r15, %rbp
leaq 0x120(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x8550
movq %r13, %rdi
callq 0x8978
leaq 0x40(%rsp), %rdi
callq 0x8978
movq %rbx, %rdi
callq 0x8978
movq 0x118(%rsp), %r15
leaq 0x1c0(%rsp), %rdi
movq %r14, %rsi
callq 0x31340
cmpq $0x1, %rax
jne 0x30936
movq 0xa8(%rsp), %rsi
addq $0x20, %rsi
movq %rbx, %rdi
pushq $0x1
popq %r14
movq %r14, %rdx
pushq $-0x1
popq %r12
movq %r12, %rcx
callq 0x84b0
movq 0xa8(%rsp), %rsi
addq $0x20, %rsi
leaq 0x40(%rsp), %rdi
movq %r14, %rdx
movq %r12, %rcx
callq 0x84b0
movq 0x48(%rsp), %rcx
addq $-0x2, %rcx
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x84b0
leaq 0x40(%rsp), %r14
movq %r14, %rdi
callq 0x8978
movq %rbx, %rdi
callq 0x8978
movq 0x100(%rsp), %rsi
movq %rbx, %rdi
callq 0x8600
movq 0x100(%rsp), %rsi
addq $0x60, %rsi
movq %r14, %rdi
callq 0x8600
movq 0x100(%rsp), %rsi
subq $-0x80, %rsi
leaq 0x160(%rsp), %rdi
callq 0x8600
movq 0x100(%rsp), %rsi
movl $0xc0, %eax
addq %rax, %rsi
leaq 0xc0(%rsp), %rdi
callq 0x8600
movq 0xacffa(%rip), %rdi     # 0xdcfb8
movq %rbx, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69e4e(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x40(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69e32(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x160(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69e13(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69df4(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movq %r13, %rsi
callq 0x8430
movq %rax, %rdi
callq 0x8230
cmpb $0x1, 0xad9bf(%rip)     # 0xdda08
jne 0x308ac
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x311fd
testb %al, %al
je 0x30704
leaq 0x80(%rsp), %rdi
leaq 0x689d0(%rip), %rsi     # 0x98a43
callq 0x2193f
testb %al, %al
je 0x30212
movq 0x38(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69d82(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r14
movq 0x60(%rsp), %rdi
callq 0x86f0
leal 0x1(%rax), %esi
movq %r14, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x69d5b(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r14
movq 0x60(%rsp), %rdi
callq 0x86f0
movl 0xad42d(%rip), %ecx     # 0xdd508
leal (%rax,%rcx), %esi
incl %esi
movq %r14, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x69d2c(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x80(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69d0d(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69cf1(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x68909(%rip), %rsi     # 0x98a45
callq 0x8480
movq %rax, %rdi
callq 0x8230
movq 0x8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69cb9(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r14
movq 0x60(%rsp), %rdi
callq 0x86f0
leal 0x1(%rax), %esi
movq %r14, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x69c92(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r14
movq 0x60(%rsp), %rdi
callq 0x86f0
movl 0xad364(%rip), %ecx     # 0xdd508
leal (%rax,%rcx), %esi
incl %esi
movq %r14, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x69c63(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x80(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69c44(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69c28(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x68840(%rip), %rsi     # 0x98a45
callq 0x8480
movq %rax, %rdi
callq 0x8230
leaq 0x80(%rsp), %rdi
leaq 0x6882f(%rip), %rsi     # 0x98a50
callq 0x2193f
testb %al, %al
je 0x303c0
movq 0x30(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69bd4(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r14
movq 0x60(%rsp), %rdi
callq 0x86f0
leal 0x1(%rax), %esi
movq %r14, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x69bad(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r14
movq 0x60(%rsp), %rdi
callq 0x86f0
movl 0xad283(%rip), %ecx     # 0xdd50c
leal (%rax,%rcx), %esi
incl %esi
movq %r14, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x69b7e(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x80(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69b5f(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69b43(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x68768(%rip), %rsi     # 0x98a52
callq 0x8480
movq %rax, %rdi
callq 0x8230
movq 0x8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69b0b(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r14
movq 0x60(%rsp), %rdi
callq 0x86f0
leal 0x1(%rax), %esi
movq %r14, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x69ae4(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r14
movq 0x60(%rsp), %rdi
callq 0x86f0
movl 0xad1ba(%rip), %ecx     # 0xdd50c
leal (%rax,%rcx), %esi
incl %esi
movq %r14, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x69ab5(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x80(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69a96(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69a7a(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x6869f(%rip), %rsi     # 0x98a52
callq 0x8480
movq %rax, %rdi
callq 0x8230
leaq 0xc0(%rsp), %rdi
leaq 0x68674(%rip), %rsi     # 0x98a43
callq 0x2193f
testb %al, %al
je 0x30562
movq 0x40(%rsp), %rdi
callq 0x86f0
movl 0xad11f(%rip), %r14d    # 0xdd50c
notl %r14d
addl %eax, %r14d
testl %r14d, %r14d
movl $0x0, %ecx
cmovlel %ecx, %r14d
cmpl $0x2, %eax
jl 0x30562
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x699ff(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movl %r14d, %esi
callq 0x8840
movq %rax, %rdi
leaq 0x699e5(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r12
movq 0x40(%rsp), %rdi
callq 0x86f0
leal -0x1(%rax), %esi
movq %r12, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x699be(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x6999f(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movq %r13, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69985(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x685aa(%rip), %rsi     # 0x98a52
callq 0x8480
movq %rax, %rdi
callq 0x8230
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69952(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movl %r14d, %esi
callq 0x8840
movq %rax, %rdi
leaq 0x69938(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r14
movq 0x40(%rsp), %rdi
callq 0x86f0
leal -0x1(%rax), %esi
movq %r14, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x69911(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x698f2(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movq %r13, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x698d8(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x684fd(%rip), %rsi     # 0x98a52
callq 0x8480
movq %rax, %rdi
callq 0x8230
leaq 0xc0(%rsp), %rdi
leaq 0x684df(%rip), %rsi     # 0x98a50
callq 0x2193f
testb %al, %al
je 0x30704
movq 0x40(%rsp), %rdi
callq 0x86f0
movl 0xacf7d(%rip), %r14d    # 0xdd50c
notl %r14d
addl %eax, %r14d
testl %r14d, %r14d
movl $0x0, %ecx
cmovlel %ecx, %r14d
cmpl $0x2, %eax
jl 0x30704
movq 0x38(%rsp), %rdi
movq %rbx, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x6985d(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movl %r14d, %esi
callq 0x8840
movq %rax, %rdi
leaq 0x69843(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r12
movq 0x40(%rsp), %rdi
callq 0x86f0
leal -0x1(%rax), %esi
movq %r12, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x6981c(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x697fd(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movq %r13, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x697e3(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x683fb(%rip), %rsi     # 0x98a45
callq 0x8480
movq %rax, %rdi
callq 0x8230
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x697b0(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movl %r14d, %esi
callq 0x8840
movq %rax, %rdi
leaq 0x69796(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %r14
movq 0x40(%rsp), %rdi
callq 0x86f0
leal -0x1(%rax), %esi
movq %r14, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x6976f(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69750(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movq %r13, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69736(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x6834e(%rip), %rsi     # 0x98a45
callq 0x8480
movq %rax, %rdi
callq 0x8230
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x26b06
testb %al, %al
je 0x308ac
movq 0x60(%rsp), %rdi
callq 0x86f0
movl %eax, %r12d
incl %r12d
movq 0x40(%rsp), %rdi
callq 0x86f0
movl %eax, %r14d
decl %r14d
cmpl %r12d, %r14d
jle 0x30877
movq 0xa0(%rsp), %rdi
movq %rbx, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x696c2(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movl %r12d, %esi
callq 0x8840
movq %rax, %rdi
leaq 0x696a8(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movl %r14d, %esi
callq 0x8840
movq %rax, %rdi
leaq 0x6968e(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x6966f(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movq %r13, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69655(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0x68283(%rip), %rsi     # 0x98a5b
callq 0x8480
movq %rax, %rdi
callq 0x8230
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x69622(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movl %r12d, %esi
callq 0x8840
movq %rax, %rdi
leaq 0x69608(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movl %r14d, %esi
callq 0x8840
movq %rax, %rdi
leaq 0x695ee(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
leaq 0xc0(%rsp), %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x695cf(%rip), %rsi     # 0x99e1e
callq 0x8480
movq %rax, %rdi
movq %r13, %rsi
callq 0x8430
movq %rax, %rdi
leaq 0x695b5(%rip), %rsi     # 0x99e1e
callq 0x8480
leaq 0x681e6(%rip), %rsi     # 0x98a5b
jmp 0x3089c
movq 0xac76a(%rip), %rdi     # 0xdcfe8
leaq 0x681dd(%rip), %rsi     # 0x98a62
callq 0x8480
movq %rax, %rdi
movq %r13, %rsi
callq 0x8430
leaq 0x681e3(%rip), %rsi     # 0x98a7f
movq %rax, %rdi
callq 0x8480
movq %rax, %rdi
callq 0x8230
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x82a0
leaq 0x1a0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x82a0
leaq 0x60(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x82a0
leaq 0x80(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x82a0
leaq 0xe0(%rsp), %rdi
movq %rbx, %rsi
callq 0x82a0
leaq 0xc0(%rsp), %rdi
callq 0x8978
leaq 0x160(%rsp), %rdi
callq 0x8978
leaq 0x40(%rsp), %rdi
callq 0x8978
movq %rbx, %rdi
callq 0x8978
movq %r13, %rdi
callq 0x8978
leaq 0x120(%rsp), %rdi
callq 0x8978
leaq 0xa8(%rsp), %rdi
callq 0x28a08
leaq 0x100(%rsp), %rdi
callq 0x28a08
jmp 0x2fce7
movq %r15, %rdi
callq 0x80e0
cmpb $0x1, 0xad097(%rip)     # 0xdda08
jne 0x30cd3
leaq 0x680c5(%rip), %rsi     # 0x98a43
leaq 0x80(%rsp), %rdi
callq 0x2193f
testb %al, %al
je 0x30b25
leaq 0xe0(%rsp), %rsi
movq 0x38(%rsp), %rdi
callq 0x8430
leaq 0x69472(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
movq %rax, %rbx
movq 0x60(%rsp), %rdi
callq 0x86f0
leal 0x1(%rax), %esi
movq %rbx, %rdi
callq 0x8840
leaq 0x6944b(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
movq %rax, %rbx
movq 0x60(%rsp), %rdi
callq 0x86f0
movl 0xacb1a(%rip), %ecx     # 0xdd508
leal (%rax,%rcx), %esi
incl %esi
movq %rbx, %rdi
callq 0x8840
leaq 0x6941c(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x80(%rsp), %rsi
movq %rax, %rdi
callq 0x8430
leaq 0x693fd(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x8430
leaq 0x693e1(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x67ff9(%rip), %rsi     # 0x98a45
movq %rax, %rdi
callq 0x8480
movq %rax, %rdi
callq 0x8230
leaq 0xe0(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x8430
leaq 0x693a9(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
movq %rax, %rbx
movq 0x60(%rsp), %rdi
callq 0x86f0
leal 0x1(%rax), %esi
movq %rbx, %rdi
callq 0x8840
leaq 0x69382(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
movq %rax, %rbx
movq 0x60(%rsp), %rdi
callq 0x86f0
movl 0xaca51(%rip), %ecx     # 0xdd508
leal (%rax,%rcx), %esi
incl %esi
movq %rbx, %rdi
callq 0x8840
leaq 0x69353(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x80(%rsp), %rsi
movq %rax, %rdi
callq 0x8430
leaq 0x69334(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x8430
leaq 0x69318(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x67f30(%rip), %rsi     # 0x98a45
movq %rax, %rdi
callq 0x8480
movq %rax, %rdi
callq 0x8230
leaq 0x67f24(%rip), %rsi     # 0x98a50
leaq 0x80(%rsp), %rdi
callq 0x2193f
testb %al, %al
je 0x30cd3
leaq 0xe0(%rsp), %rsi
movq 0x30(%rsp), %rdi
callq 0x8430
leaq 0x692c4(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
movq %rax, %rbx
movq 0x60(%rsp), %rdi
callq 0x86f0
leal 0x1(%rax), %esi
movq %rbx, %rdi
callq 0x8840
leaq 0x6929d(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
movq %rax, %rbx
movq 0x60(%rsp), %rdi
callq 0x86f0
movl 0xac970(%rip), %ecx     # 0xdd50c
leal (%rax,%rcx), %esi
incl %esi
movq %rbx, %rdi
callq 0x8840
leaq 0x6926e(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x80(%rsp), %rsi
movq %rax, %rdi
callq 0x8430
leaq 0x6924f(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x8430
leaq 0x69233(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x67e58(%rip), %rsi     # 0x98a52
movq %rax, %rdi
callq 0x8480
movq %rax, %rdi
callq 0x8230
leaq 0xe0(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x8430
leaq 0x691fb(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
movq %rax, %rbx
movq 0x60(%rsp), %rdi
callq 0x86f0
leal 0x1(%rax), %esi
movq %rbx, %rdi
callq 0x8840
leaq 0x691d4(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
movq %rax, %rbx
movq 0x60(%rsp), %rdi
callq 0x86f0
movl 0xac8a7(%rip), %ecx     # 0xdd50c
leal (%rax,%rcx), %esi
incl %esi
movq %rbx, %rdi
callq 0x8840
leaq 0x691a5(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x80(%rsp), %rsi
movq %rax, %rdi
callq 0x8430
leaq 0x69186(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x8430
leaq 0x6916a(%rip), %rsi     # 0x99e1e
movq %rax, %rdi
callq 0x8480
leaq 0x67d8f(%rip), %rsi     # 0x98a52
movq %rax, %rdi
callq 0x8480
movq %rax, %rdi
callq 0x8230
movq 0xac30e(%rip), %rdi     # 0xdcfe8
leaq 0x65506(%rip), %rsi     # 0x961e7
callq 0x8480
movq %rax, %rdi
callq 0x8230
leaq 0x80(%rsp), %rdi
callq 0x8978
leaq 0x60(%rsp), %rdi
callq 0x8978
leaq 0x1a0(%rsp), %rdi
callq 0x8978
leaq 0xe0(%rsp), %rdi
callq 0x8978
leaq 0x10(%rsp), %rdi
callq 0x8978
leaq 0x140(%rsp), %rdi
callq 0x8978
leaq 0x1c0(%rsp), %rdi
callq 0x21b48
xorl %eax, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8978
jmp 0x30d69
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq 0x38(%rsp), %rdi
jmp 0x30e05
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8978
jmp 0x30d8a
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq 0x30(%rsp), %rdi
jmp 0x30e05
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8978
jmp 0x30da8
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq 0xa0(%rsp), %rdi
jmp 0x30e05
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8978
jmp 0x30dc9
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq 0x8(%rsp), %rdi
jmp 0x30e05
movq %rax, %rbx
jmp 0x30f2b
movq %rax, %rbx
jmp 0x30f35
movq %rax, %rbx
jmp 0x30f42
movq %rax, %rbx
jmp 0x30f4f
jmp 0x30eae
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r15, %rdi
callq 0x84a0
jmp 0x30f59
jmp 0x30eae
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r14, %rdi
callq 0x84a0
jmp 0x30f73
jmp 0x30e8a
jmp 0x30e69
jmp 0x30e41
jmp 0x30eae
jmp 0x30eae
movq %rax, %rbx
jmp 0x30f66
jmp 0x30e41
jmp 0x30e69
jmp 0x30e8a
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x8978
jmp 0x30e6c
movq %rax, %rbx
jmp 0x30ec6
jmp 0x30e8a
movq %rax, %rbx
jmp 0x30ed3
movq %rax, %rbx
jmp 0x30edd
movq %rax, %rbx
jmp 0x30eea
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
jmp 0x30ef2
jmp 0x30eb6
jmp 0x30eb6
movq %rax, %rbx
jmp 0x30f04
movq %rax, %rbx
jmp 0x30f11
movq %rax, %rbx
jmp 0x30ef7
jmp 0x30eb6
jmp 0x30ea9
jmp 0x30ea9
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x28a08
jmp 0x30f59
jmp 0x30eae
movq %rax, %rbx
jmp 0x30f1e
movq %rax, %rbx
jmp 0x30f59
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x8978
leaq 0x160(%rsp), %rdi
callq 0x8978
leaq 0x40(%rsp), %rdi
callq 0x8978
leaq 0x180(%rsp), %rdi
callq 0x8978
leaq 0x1f8(%rsp), %rdi
callq 0x8978
leaq 0x120(%rsp), %rdi
callq 0x8978
leaq 0xa8(%rsp), %rdi
callq 0x28a08
leaq 0x100(%rsp), %rdi
callq 0x28a08
leaq 0x80(%rsp), %rdi
callq 0x8978
leaq 0x60(%rsp), %rdi
callq 0x8978
leaq 0x1a0(%rsp), %rdi
callq 0x8978
leaq 0xe0(%rsp), %rdi
callq 0x8978
leaq 0x10(%rsp), %rdi
callq 0x8978
leaq 0x140(%rsp), %rdi
callq 0x8978
leaq 0x1c0(%rsp), %rdi
callq 0x21b48
movq %rbx, %rdi
callq 0x8870