// File: millanek[P]evo/evo_codingSeqs_fromGenomes.cpp
// Function: SeqFromGenomes(int, char**)
int SeqFromGenomes(int argc, char** argv) {
    parseSeqFromGenomesOptions(argc, argv);
    // Load up the annotation file
    std::ifstream* geneFile = new std::ifstream(opt::geneFile.c_str());
    Annotation wgAnnotation(geneFile, false);
    std::vector<std::vector<string> > annotation;
    
    std::cerr << "Getting subsequences defined in " << opt::geneFile << std::endl;
    
    std::vector<string> allGenomeFiles; string AAFileName;
    std::vector<string> allNewLabels;
    if (opt::genomeFile != "") {
        allGenomeFiles.push_back(opt::genomeFile);
        std::cerr << "from the genome in: " << stripExtension(opt::genomeFile) << std::endl;
    } else {
        std::ifstream* alignmentList = new std::ifstream(opt::genomeListFile.c_str());
        std::cerr << "from the genomes listed in: " << opt::genomeListFile << std::endl;
        std::string line;
        while (getline(*alignmentList, line)) {
            allGenomeFiles.push_back(line);
        }
    }
    if (opt::newLabelFile != "") {
        std::cerr << "using labels from: " << opt::newLabelFile << std::endl;
        std::ifstream* newLabels = new std::ifstream(opt::newLabelFile.c_str());
        std::string line;
        while (getline(*newLabels, line)) {
            allNewLabels.push_back(line);
        }
    }
    
    // Loop over the genome files and load all into memory (so can handle only a few genomes):
    std::vector<std::map<std::string,string>> allGenomes;
    for (std::vector<std::string>::size_type i = 0; i != allGenomeFiles.size(); i++) {
        std::ifstream* genome = new std::ifstream(allGenomeFiles[i].c_str());
        std::map<std::string,string> allSeqs;
        // Load the whole genome
        std::string scaffoldSeq; scaffoldSeq.reserve(20000000); scaffoldSeq = "";
        std::string line; std::string thisScaffold;
        while (getline(*genome, line)) {
            if (line[0] == '>') {
                if (scaffoldSeq != "") { allSeqs[thisScaffold] = scaffoldSeq;}
                thisScaffold = line.substr(1); scaffoldSeq = "";
                continue;
            }
            scaffoldSeq.append(line);
        } genome->close();
        allSeqs[thisScaffold] = scaffoldSeq; // The final scaffold
        std::cerr << "Loaded sequences from: " << allGenomeFiles[i] << std::endl;
        allGenomes.push_back(allSeqs);
    }
    
    for(std::map<std::string,string>::iterator itGenome = allGenomes[0].begin(); itGenome != allGenomes[0].end(); ++itGenome) {
        //std::cerr << itGenome->first << std::endl;
        
        annotation = wgAnnotation.annotationMap[itGenome->first]; // Get annotation for this scaffold
        if (annotation.size() == 0) continue; // if we don't have any, just move to the next scaffold
        
        // check that this scaffold is present in all genomes:
        bool scaffoldInAllGenomes = true;
        for (std::vector<std::map<std::string,string>>::size_type i = 1; i != allGenomes.size(); i++) {
            if (allGenomes[i].count(itGenome->first) == 0)
                scaffoldInAllGenomes = false;
        }
        if (!scaffoldInAllGenomes) continue; // if not, just move on to the next scaffold
        
        //std::cerr << "Going through the annotation..." << std::endl;
        for (std::vector<std::vector<string> >::size_type k = 0; k != annotation.size(); k++) {
            std::vector<string> annotLineVec = split(annotation[k][0], '\t');
            string thisGeneName = annotLineVec[4];
            // std::cerr << "Gene:" << thisGeneName << std::endl;
            string geneSequence = getReferenceForThisRegion(annotation[k], annotLineVec[3], itGenome->second);
            int geneLengthDivisibleByThree = geneSequence.length() % 3;
            
            std::ofstream* geneOutFiles;
            if (geneLengthDivisibleByThree == 0)
                geneOutFiles = new std::ofstream(thisGeneName.c_str());
            else
                geneOutFiles = new std::ofstream((opt::nonDivPrefix+'_'+thisGeneName).c_str());
            
            *geneOutFiles << ">" << stripExtension(allGenomeFiles[0]) << std::endl;
            *geneOutFiles << geneSequence << std::endl;
            for (std::vector<std::map<std::string,string>>::size_type i = 1; i != allGenomes.size(); i++) {
                *geneOutFiles << ">" << stripExtension(allGenomeFiles[i]) << std::endl;
                string geneSequence = getReferenceForThisRegion(annotation[k], annotLineVec[3], allGenomes[i][itGenome->first]);
                *geneOutFiles << geneSequence << std::endl;
            } geneOutFiles->close();
            //std::cerr << "Got all sequences for: " << thisGeneName << std::endl;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x560, %rsp            # imm = 0x560
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x57ff0
movl $0x208, %edi            # imm = 0x208
callq 0xa5d0
movq %rax, -0x3e0(%rbp)
movq %rax, -0x3e8(%rbp)
leaq 0x14304b(%rip), %rdi    # 0x19a028
callq 0xa220
movq -0x3e0(%rbp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0xab90
jmp 0x56ff8
movq -0x3e8(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq -0xe8(%rbp), %rdi
leaq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x58390
leaq -0x100(%rbp), %rdi
callq 0x3f5f0
movq 0x141fc8(%rip), %rdi    # 0x198ff0
leaq 0xddeac(%rip), %rsi     # 0x134edb
callq 0xa5c0
movq %rax, -0x3f0(%rbp)
jmp 0x5703d
movq -0x3f0(%rbp), %rdi
leaq 0x142fdd(%rip), %rsi    # 0x19a028
callq 0xa520
movq %rax, -0x3f8(%rbp)
jmp 0x57059
movq -0x3f8(%rbp), %rdi
movq 0x141f21(%rip), %rsi    # 0x198f88
callq 0xa610
jmp 0x5706e
leaq -0x118(%rbp), %rdi
callq 0x48da0
leaq -0x138(%rbp), %rdi
callq 0xa820
leaq -0x150(%rbp), %rdi
callq 0x48da0
leaq 0x142f0f(%rip), %rdi    # 0x199fa8
leaq 0xdee3f(%rip), %rsi     # 0x135edf
callq 0x50eb0
movb %al, -0x3f9(%rbp)
jmp 0x570ad
movb -0x3f9(%rbp), %al
testb $0x1, %al
jne 0x570bc
jmp 0x571a5
leaq 0x142ee5(%rip), %rsi    # 0x199fa8
leaq -0x118(%rbp), %rdi
callq 0x48dc0
jmp 0x570d1
movq 0x141f18(%rip), %rdi    # 0x198ff0
leaq 0xdde1d(%rip), %rsi     # 0x134efc
callq 0xa5c0
movq %rax, -0x408(%rbp)
jmp 0x570ed
leaq 0x142eb4(%rip), %rsi    # 0x199fa8
leaq -0x170(%rbp), %rdi
callq 0x7be70
jmp 0x57102
movq -0x408(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0xa520
movq %rax, -0x410(%rbp)
jmp 0x5711e
movq -0x410(%rbp), %rdi
movq 0x141e5c(%rip), %rsi    # 0x198f88
callq 0xa610
jmp 0x57133
leaq -0x170(%rbp), %rdi
callq 0xac88
jmp 0x572e9
movq -0x3e8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x208, %esi            # imm = 0x208
callq 0xa5e0
jmp 0x57fe4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x57fcc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x57fa8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x170(%rbp), %rdi
callq 0xac88
jmp 0x57fa8
movl $0x208, %edi            # imm = 0x208
callq 0xa5d0
movq %rax, -0x418(%rbp)
jmp 0x571b8
leaq 0x142e09(%rip), %rdi    # 0x199fc8
callq 0xa220
movq -0x418(%rbp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0xab90
jmp 0x571da
movq -0x418(%rbp), %rax
movq %rax, -0x178(%rbp)
movq 0x141e01(%rip), %rdi    # 0x198ff0
leaq 0xddd1b(%rip), %rsi     # 0x134f11
callq 0xa5c0
movq %rax, -0x420(%rbp)
jmp 0x57204
movq -0x420(%rbp), %rdi
leaq 0x142db6(%rip), %rsi    # 0x199fc8
callq 0xa520
movq %rax, -0x428(%rbp)
jmp 0x57220
movq -0x428(%rbp), %rdi
movq 0x141d5a(%rip), %rsi    # 0x198f88
callq 0xa610
jmp 0x57235
leaq -0x198(%rbp), %rdi
callq 0xa820
movq -0x178(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0xa0d0
movq %rax, -0x430(%rbp)
jmp 0x5725d
movq -0x430(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0xa740
movb %al, -0x431(%rbp)
jmp 0x5727b
movb -0x431(%rbp), %al
testb $0x1, %al
jne 0x57287
jmp 0x572dd
leaq -0x118(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x48dc0
jmp 0x5729c
jmp 0x57241
movq -0x418(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x208, %esi            # imm = 0x208
callq 0xa5e0
jmp 0x57fa8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x198(%rbp), %rdi
callq 0xac88
jmp 0x57fa8
leaq -0x198(%rbp), %rdi
callq 0xac88
leaq 0x142cf8(%rip), %rdi    # 0x199fe8
leaq 0xdebe8(%rip), %rsi     # 0x135edf
callq 0x50eb0
movb %al, -0x432(%rbp)
jmp 0x57304
movb -0x432(%rbp), %al
testb $0x1, %al
jne 0x57313
jmp 0x57457
movq 0x141cd6(%rip), %rdi    # 0x198ff0
leaq 0xddc0d(%rip), %rsi     # 0x134f2e
callq 0xa5c0
movq %rax, -0x440(%rbp)
jmp 0x5732f
movq -0x440(%rbp), %rdi
leaq 0x142cab(%rip), %rsi    # 0x199fe8
callq 0xa520
movq %rax, -0x448(%rbp)
jmp 0x5734b
movq -0x448(%rbp), %rdi
movq 0x141c2f(%rip), %rsi    # 0x198f88
callq 0xa610
jmp 0x57360
movl $0x208, %edi            # imm = 0x208
callq 0xa5d0
movq %rax, -0x450(%rbp)
jmp 0x57373
leaq 0x142c6e(%rip), %rdi    # 0x199fe8
callq 0xa220
movq -0x450(%rbp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0xab90
jmp 0x57395
movq -0x450(%rbp), %rax
movq %rax, -0x1a0(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0xa820
movq -0x1a0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0xa0d0
movq %rax, -0x458(%rbp)
jmp 0x573cb
movq -0x458(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0xa740
movb %al, -0x459(%rbp)
jmp 0x573e9
movb -0x459(%rbp), %al
testb $0x1, %al
jne 0x573f5
jmp 0x5744b
leaq -0x150(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x48dc0
jmp 0x5740a
jmp 0x573af
movq -0x450(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x208, %esi            # imm = 0x208
callq 0xa5e0
jmp 0x57fa8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0xac88
jmp 0x57fa8
leaq -0x1c0(%rbp), %rdi
callq 0xac88
leaq -0x1d8(%rbp), %rdi
callq 0x58490
movq $0x0, -0x1e0(%rbp)
movq -0x1e0(%rbp), %rax
movq %rax, -0x468(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x3ffd0
movq %rax, %rcx
movq -0x468(%rbp), %rax
cmpq %rcx, %rax
je 0x5781a
movl $0x208, %edi            # imm = 0x208
callq 0xa5d0
movq %rax, -0x470(%rbp)
jmp 0x574ae
movq -0x1e0(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0x3d940
movq %rax, %rdi
callq 0xa220
movq -0x470(%rbp), %rdi
movq %rax, %rsi
movl $0x8, %edx
callq 0xab90
jmp 0x574df
movq -0x470(%rbp), %rax
movq %rax, -0x1e8(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x584b0
leaq -0x238(%rbp), %rdi
movq %rdi, -0x478(%rbp)
callq 0xa820
movq -0x478(%rbp), %rdi
movl $0x1312d00, %esi        # imm = 0x1312D00
callq 0xa980
jmp 0x5751f
leaq 0xde9b9(%rip), %rsi     # 0x135edf
leaq -0x238(%rbp), %rdi
callq 0xa810
jmp 0x57534
leaq -0x258(%rbp), %rdi
callq 0xa820
leaq -0x278(%rbp), %rdi
callq 0xa820
movq -0x1e8(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0xa0d0
movq %rax, -0x480(%rbp)
jmp 0x57568
movq -0x480(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0xa740
movb %al, -0x481(%rbp)
jmp 0x57586
movb -0x481(%rbp), %al
testb $0x1, %al
jne 0x57595
jmp 0x57706
xorl %eax, %eax
movl %eax, %esi
leaq -0x258(%rbp), %rdi
callq 0xac60
movq %rax, -0x490(%rbp)
jmp 0x575ae
movq -0x490(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3e, %eax
jne 0x576ec
leaq 0xde917(%rip), %rsi     # 0x135edf
leaq -0x238(%rbp), %rdi
callq 0x50eb0
movb %al, -0x491(%rbp)
jmp 0x575dc
movb -0x491(%rbp), %al
testb $0x1, %al
jne 0x575eb
jmp 0x5768b
leaq -0x218(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x584d0
movq %rax, -0x4a0(%rbp)
jmp 0x57607
movq -0x4a0(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0xa060
jmp 0x5761c
jmp 0x5768b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x57f9c
movq -0x470(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x208, %esi            # imm = 0x208
callq 0xa5e0
jmp 0x57f9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x577fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x278(%rbp), %rdi
callq 0xac88
leaq -0x258(%rbp), %rdi
callq 0xac88
jmp 0x577fd
leaq -0x298(%rbp), %rdi
leaq -0x258(%rbp), %rsi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0xa5f0
jmp 0x576ac
leaq -0x278(%rbp), %rdi
leaq -0x298(%rbp), %rsi
movq %rsi, -0x4a8(%rbp)
callq 0xa710
movq -0x4a8(%rbp), %rdi
callq 0xac88
leaq 0xde806(%rip), %rsi     # 0x135edf
leaq -0x238(%rbp), %rdi
callq 0xa810
jmp 0x576e7
jmp 0x5754c
leaq -0x238(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0xac20
jmp 0x57701
jmp 0x5754c
movq -0x1e8(%rbp), %rdi
callq 0xa110
jmp 0x57714
leaq -0x218(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x584d0
movq %rax, -0x4b0(%rbp)
jmp 0x57730
movq -0x4b0(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0xa060
jmp 0x57745
movq 0x1418a4(%rip), %rdi    # 0x198ff0
leaq 0xdd7ef(%rip), %rsi     # 0x134f42
callq 0xa5c0
movq %rax, -0x4b8(%rbp)
jmp 0x57761
movq -0x1e0(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0x3d940
movq -0x4b8(%rbp), %rdi
movq %rax, %rsi
callq 0xa520
movq %rax, -0x4c0(%rbp)
jmp 0x5778c
movq -0x4c0(%rbp), %rdi
movq 0x1417ee(%rip), %rsi    # 0x198f88
callq 0xa610
jmp 0x577a1
leaq -0x1d8(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x585b0
jmp 0x577b6
leaq -0x278(%rbp), %rdi
callq 0xac88
leaq -0x258(%rbp), %rdi
callq 0xac88
leaq -0x238(%rbp), %rdi
callq 0xac88
leaq -0x218(%rbp), %rdi
callq 0x58620
movq -0x1e0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1e0(%rbp)
jmp 0x5746e
leaq -0x238(%rbp), %rdi
callq 0xac88
leaq -0x218(%rbp), %rdi
callq 0x58620
jmp 0x57f9c
leaq -0x1d8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x58640
movq %rax, %rdi
callq 0x58660
movq %rax, -0x2a0(%rbp)
leaq -0x1d8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x58640
movq %rax, %rdi
callq 0x586c0
movq %rax, -0x2a8(%rbp)
leaq -0x2a0(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x58690
testb $0x1, %al
jne 0x57874
jmp 0x57f49
leaq -0x2a0(%rbp), %rdi
callq 0x586f0
movq %rax, %rsi
leaq -0xe8(%rbp), %rdi
callq 0x3f760
movq %rax, -0x4c8(%rbp)
jmp 0x57898
movq -0x4c8(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x3f840
jmp 0x578ad
leaq -0x100(%rbp), %rdi
callq 0x409f0
cmpq $0x0, %rax
jne 0x578c4
jmp 0x57f38
movb $0x1, -0x2a9(%rbp)
movq $0x1, -0x2b8(%rbp)
movq -0x2b8(%rbp), %rax
movq %rax, -0x4d0(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x58710
movq %rax, %rcx
movq -0x4d0(%rbp), %rax
cmpq %rcx, %rax
je 0x5796a
movq -0x2b8(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x58640
movq %rax, -0x4e0(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x586f0
movq -0x4e0(%rbp), %rdi
movq %rax, %rsi
callq 0x58740
movq %rax, -0x4d8(%rbp)
jmp 0x5793d
movq -0x4d8(%rbp), %rax
cmpq $0x0, %rax
jne 0x57951
movb $0x0, -0x2a9(%rbp)
jmp 0x57953
movq -0x2b8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2b8(%rbp)
jmp 0x578d6
testb $0x1, -0x2a9(%rbp)
jne 0x57978
jmp 0x57f38
movq $0x0, -0x2c0(%rbp)
movq -0x2c0(%rbp), %rax
movq %rax, -0x4e8(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x409f0
movq %rax, %rcx
movq -0x4e8(%rbp), %rax
cmpq %rcx, %rax
je 0x57f36
movq -0x2c0(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x3ec10
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3d940
movq %rax, %rsi
leaq -0x2d8(%rbp), %rdi
movl $0x9, %edx
callq 0x7bbe0
jmp 0x579e5
leaq -0x2d8(%rbp), %rdi
movl $0x4, %esi
callq 0x3d940
movq %rax, %rsi
leaq -0x2f8(%rbp), %rdi
callq 0xa250
jmp 0x57a07
movq -0x2c0(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x3ec10
movq %rax, -0x4f8(%rbp)
leaq -0x2d8(%rbp), %rdi
movl $0x3, %esi
callq 0x3d940
movq %rax, -0x4f0(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x586f0
movq -0x4f8(%rbp), %rsi
movq -0x4f0(%rbp), %rdx
movq %rax, %rcx
addq $0x20, %rcx
leaq -0x318(%rbp), %rdi
callq 0x8f120
jmp 0x57a68
leaq -0x318(%rbp), %rdi
callq 0xa930
movl $0x3, %ecx
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, -0x31c(%rbp)
cmpl $0x0, -0x31c(%rbp)
jne 0x57b30
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x500(%rbp)
jmp 0x57aa6
leaq -0x2f8(%rbp), %rdi
callq 0xa220
movq -0x500(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0xa650
jmp 0x57ac8
movq -0x500(%rbp), %rax
movq %rax, -0x328(%rbp)
jmp 0x57c32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x57f28
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x57f1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x57f10
movq -0x500(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
jmp 0x57f10
movl $0x200, %edi            # imm = 0x200
callq 0xa5d0
movq %rax, -0x508(%rbp)
jmp 0x57b43
movb $0x1, -0x369(%rbp)
leaq 0x1424f7(%rip), %rsi    # 0x19a048
leaq -0x368(%rbp), %rdi
movl $0x5f, %edx
callq 0x587a0
jmp 0x57b64
leaq -0x348(%rbp), %rdi
leaq -0x368(%rbp), %rsi
leaq -0x2f8(%rbp), %rdx
callq 0x3da30
jmp 0x57b80
leaq -0x348(%rbp), %rdi
callq 0xa220
movq -0x508(%rbp), %rdi
movq %rax, %rsi
movl $0x10, %edx
callq 0xa650
jmp 0x57ba2
movq -0x508(%rbp), %rax
movb $0x0, -0x369(%rbp)
movq %rax, -0x328(%rbp)
leaq -0x348(%rbp), %rdi
callq 0xac88
leaq -0x368(%rbp), %rdi
callq 0xac88
jmp 0x57c32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x57c11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x57c05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x348(%rbp), %rdi
callq 0xac88
leaq -0x368(%rbp), %rdi
callq 0xac88
testb $0x1, -0x369(%rbp)
jne 0x57c1c
jmp 0x57c2d
movq -0x508(%rbp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0xa5e0
jmp 0x57f10
movq -0x328(%rbp), %rdi
leaq 0xe2fe6(%rip), %rsi     # 0x13ac26
callq 0xa5c0
movq %rax, -0x510(%rbp)
jmp 0x57c4e
xorl %eax, %eax
movl %eax, %esi
leaq -0x118(%rbp), %rdi
callq 0x3d940
movq %rax, %rsi
leaq -0x390(%rbp), %rdi
callq 0x7be70
jmp 0x57c6f
movq -0x510(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0xa520
movq %rax, -0x518(%rbp)
jmp 0x57c8b
movq -0x518(%rbp), %rdi
movq 0x1412ef(%rip), %rsi    # 0x198f88
callq 0xa610
jmp 0x57ca0
leaq -0x390(%rbp), %rdi
callq 0xac88
movq -0x328(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0xa520
movq %rax, -0x520(%rbp)
jmp 0x57cc8
movq -0x520(%rbp), %rdi
movq 0x1412b2(%rip), %rsi    # 0x198f88
callq 0xa610
jmp 0x57cdd
movq $0x1, -0x398(%rbp)
movq -0x398(%rbp), %rax
movq %rax, -0x528(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x58710
movq %rax, %rcx
movq -0x528(%rbp), %rax
cmpq %rcx, %rax
je 0x57ec7
movq -0x328(%rbp), %rdi
leaq 0xe2f03(%rip), %rsi     # 0x13ac26
callq 0xa5c0
movq %rax, -0x530(%rbp)
jmp 0x57d31
movq -0x398(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0x3d940
movq %rax, %rsi
leaq -0x3b8(%rbp), %rdi
callq 0x7be70
jmp 0x57d55
movq -0x530(%rbp), %rdi
leaq -0x3b8(%rbp), %rsi
callq 0xa520
movq %rax, -0x538(%rbp)
jmp 0x57d71
movq -0x538(%rbp), %rdi
movq 0x141209(%rip), %rsi    # 0x198f88
callq 0xa610
jmp 0x57d86
leaq -0x3b8(%rbp), %rdi
callq 0xac88
movq -0x2c0(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x3ec10
movq %rax, -0x558(%rbp)
leaq -0x2d8(%rbp), %rdi
movl $0x3, %esi
callq 0x3d940
movq %rax, -0x550(%rbp)
movq -0x398(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
callq 0x58640
movq %rax, -0x548(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x586f0
movq -0x548(%rbp), %rdi
movq %rax, %rsi
callq 0x584d0
movq %rax, -0x540(%rbp)
jmp 0x57e02
movq -0x540(%rbp), %rcx
movq -0x550(%rbp), %rdx
movq -0x558(%rbp), %rsi
leaq -0x3d8(%rbp), %rdi
callq 0x8f120
jmp 0x57e25
movq -0x328(%rbp), %rdi
leaq -0x3d8(%rbp), %rsi
callq 0xa520
movq %rax, -0x560(%rbp)
jmp 0x57e41
movq -0x560(%rbp), %rdi
movq 0x141139(%rip), %rsi    # 0x198f88
callq 0xa610
jmp 0x57e56
leaq -0x3d8(%rbp), %rdi
callq 0xac88
movq -0x398(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x398(%rbp)
jmp 0x57ce8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x390(%rbp), %rdi
callq 0xac88
jmp 0x57f10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x3b8(%rbp), %rdi
callq 0xac88
jmp 0x57f10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x3d8(%rbp), %rdi
callq 0xac88
jmp 0x57f10
movq -0x328(%rbp), %rdi
callq 0xa840
jmp 0x57ed5
leaq -0x318(%rbp), %rdi
callq 0xac88
leaq -0x2f8(%rbp), %rdi
callq 0xac88
leaq -0x2d8(%rbp), %rdi
callq 0x3dfa0
movq -0x2c0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2c0(%rbp)
jmp 0x57983
leaq -0x318(%rbp), %rdi
callq 0xac88
leaq -0x2f8(%rbp), %rdi
callq 0xac88
leaq -0x2d8(%rbp), %rdi
callq 0x3dfa0
jmp 0x57f9c
jmp 0x57f38
leaq -0x2a0(%rbp), %rdi
callq 0x58820
jmp 0x57839
leaq -0x1d8(%rbp), %rdi
callq 0x58850
leaq -0x150(%rbp), %rdi
callq 0x3dfa0
leaq -0x138(%rbp), %rdi
callq 0xac88
leaq -0x118(%rbp), %rdi
callq 0x3dfa0
leaq -0x100(%rbp), %rdi
callq 0x3ec50
leaq -0xe8(%rbp), %rdi
callq 0x588b0
xorl %eax, %eax
addq $0x560, %rsp            # imm = 0x560
popq %rbp
retq
leaq -0x1d8(%rbp), %rdi
callq 0x58850
leaq -0x150(%rbp), %rdi
callq 0x3dfa0
leaq -0x138(%rbp), %rdi
callq 0xac88
leaq -0x118(%rbp), %rdi
callq 0x3dfa0
leaq -0x100(%rbp), %rdi
callq 0x3ec50
leaq -0xe8(%rbp), %rdi
callq 0x588b0
movq -0x20(%rbp), %rdi
callq 0xab50
nopl (%rax)