// File: /workspace/github_cpp_makefile_star2_O3/millanek[P]evo/evo_protein_SegregatingSites.cpp
// Function: ProteinSs(int, char**)
int ProteinSs(int argc, char** argv) {
    parseProteinSsOptions(argc, argv);
    std::vector<string> allAligmentFiles; string AAFileName;
    std::vector<string> allNewLabels;
    
    
    std::cerr << "Outputting segregating sites" << std::endl;
    
    if (opt::alignmentFile != "") {
        allAligmentFiles.push_back(opt::alignmentFile);
        // look at suffix
        size_t suffixPos = opt::alignmentFile.find_last_of('.');
        if (suffixPos !=  std::string::npos) {
            if (opt::alignmentFile.substr(suffixPos) == ".fa" || opt::alignmentFile.substr(suffixPos) == ".fasta")
                std::cerr << "for the gene: " << stripExtension(opt::alignmentFile) << std::endl;
            else
                std::cerr << "for the gene: " << opt::alignmentFile << std::endl;
        } else {
            std::cerr << "for the gene: " << opt::alignmentFile << std::endl;
        }
    } else {
        std::ifstream* alignmentList = new std::ifstream(opt::alignmentListFile.c_str());
        std::cerr << "for the genes in: " << opt::alignmentListFile << std::endl;
        std::string line;
        while (getline(*alignmentList, line)) {
            allAligmentFiles.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 mutiple alignment files:
    for (std::vector<std::string>::size_type i = 0; i != allAligmentFiles.size(); i++) {
        std::ifstream* alignment = new std::ifstream(allAligmentFiles[i].c_str());
        std::vector<string> allSeqs; std::vector<string> allSeqsAA;
        std::vector<int> ssPos;
        // Load the DNA alignment
        std::string line; int lineNum = 1;
        while (getline(*alignment, line)) {
            if (lineNum % 2 == 1) assert(line[0] == '>');
            lineNum++;
            if (line[0] == '>' && opt::newLabelFile != "") continue;
            if (line[0] == '>' && opt::newLabelFile == "") { allNewLabels.push_back(line); continue; }
            allSeqs.push_back(line);
        } alignment->close();
        
        // std::cerr << "loaded seqs for: " << allAligmentFiles[i] << std::endl;
        //std::cerr << "allSeqs.size(): " << allSeqs.size() << std::endl;
        // Translate to Amino Acid sequences:
        std::string::size_type geneLength = allSeqs[0].length();
        int numSamples = (int)allSeqs.size();
        std::vector<string> altCodons; altCodons.resize(numSamples);
        allSeqsAA.resize(numSamples);
        std::vector<string> uniqueHpt; std::vector<string> uniqueNames;
        std::vector<string> otherSamples;
        if (numSamples > 0) {
            for (std::vector<std::string>::size_type j = 0; j != numSamples; j++) {
                allSeqsAA[j].reserve(geneLength);
            }
            for (string::size_type k = 0; k != geneLength; k++) {
                // Find if it's a segregating site:
                bool segregating = false;
                for (std::vector<std::string>::size_type j = 0; j != numSamples - 1; j++) {
                    for (std::vector<std::string>::size_type l = j + 1; l != numSamples; l++) {
                        if (allSeqs[j][k] != allSeqs[l][k]) {
                            segregating = true; break;
                        }
                    }
                    if (segregating) break;
                }
                if (segregating) {
                    ssPos.push_back((int)k+1);
                    for (std::vector<std::string>::size_type j = 0; j != numSamples; j++) {
                        allSeqsAA[j] += allSeqs[j][k];
                    }
                }
            }
            
            // Only print unique haplotypes (and keep a list of other samples with the same):
            // otherSamples.resize(numSamples);
            for (std::vector<std::string>::size_type j = 0; j != numSamples; j++) {
                bool unique = true;
                for (std::vector<std::string>::size_type l = 0; l != uniqueHpt.size(); l++) {
                    if (allSeqsAA[j] == uniqueHpt[l]) {
                        unique = false;
                        if (otherSamples[l] != "") otherSamples[l] += ',';
                        otherSamples[l] += allNewLabels[j].substr(1);
                    }
                }
                if (unique) {
                    uniqueHpt.push_back(allSeqsAA[j]);
                    uniqueNames.push_back(allNewLabels[j]);
                    otherSamples.push_back("");
                }
            }
            
            string ancSeq = allSeqsAA[0];  // For now we don't know the ancestral states at the segregating sites
                                            // so just arbitrarily taking the first one as the reference
            for (string::size_type k = 0; k != ancSeq.length(); k++) {
                for (std::vector<std::string>::size_type j = 1; j != numSamples; j++) {
                    if (allSeqsAA[j][k] == ancSeq[k]) {
                        allSeqsAA[j][k] = '.';
                    }
                }
                for (std::vector<std::string>::size_type j = 1; j != uniqueHpt.size(); j++) {
                    if (uniqueHpt[j][k] == ancSeq[k]) {
                        uniqueHpt[j][k] = '.';
                    }
                }
            }
        } else{
            std::cerr << allAligmentFiles[i] << "has no alignment.." << std::endl;
        }
        //std::cerr << "processed seqs for: " << allAligmentFiles[i] << std::endl;
        //std::cerr << "going to output: " << allAligmentFiles[i] << std::endl;
        size_t suffixPos = allAligmentFiles[i].find_last_of('.');
        if (suffixPos != std::string::npos) {
            if (allAligmentFiles[i].substr(suffixPos) == ".fa" || allAligmentFiles[i].substr(suffixPos) == ".fasta")
                AAFileName = opt::outFolder + stripExtension(allAligmentFiles[i]) + "_ssPos.txt";
            else
                AAFileName = opt::outFolder + allAligmentFiles[i] + "_ssPos.txt";
        } else {
            AAFileName = opt::outFolder + allAligmentFiles[i] + "_ssPos.txt";
        }
        //std::cerr << "into: " << AAFileName << std::endl;
        std::ofstream* AAalignment = new std::ofstream(AAFileName.c_str());
        *AAalignment << "Amino Acid positions:" << "\t"; print_vector(ssPos, *AAalignment,' ');
        /*
        for (std::vector<std::string>::size_type j = 0; j != numSamples; j++) {
            if (allNewLabels[j].length() < 16)
                *AAalignment << allNewLabels[j] << "\t\t" << allSeqsAA[j] << std::endl;
            else
                *AAalignment << allNewLabels[j] << "\t" << allSeqsAA[j] << std::endl;
        } AAalignment->close(); */
        for (std::vector<std::string>::size_type j = 0; j != uniqueHpt.size(); j++) {
            if (uniqueNames[j].length() < 16)
                *AAalignment << uniqueNames[j] << "\t\t" << uniqueHpt[j] << "\t" << otherSamples [j] << std::endl;
            else
                *AAalignment << uniqueNames[j] << "\t" << uniqueHpt[j] << "\t" << otherSamples [j] << std::endl;
        } AAalignment->close();
        
        
        
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
callq 0x3e3b8
xorl %eax, %eax
movq %rax, 0x90(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
leaq 0x150(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movq %rax, 0x170(%rsp)
movaps %xmm0, 0x160(%rsp)
movq 0xc4f7f(%rip), %rbx     # 0x101fe8
leaq 0x908bc(%rip), %rsi     # 0xcd92c
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x84e0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq 0xc4f4d(%rip), %rdi     # 0x101fe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0xc5bc1(%rip), %rdi     # 0x102c70
leaq 0x90915(%rip), %rsi     # 0xcd9cb
callq 0x8160
testl %eax, %eax
je 0x3d184
leaq 0xc5ba6(%rip), %rsi     # 0x102c70
leaq 0x80(%rsp), %rdi
callq 0x3133c
leaq 0xc5b92(%rip), %rdi     # 0x102c70
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x88f0
cmpq $-0x1, %rax
je 0x3d276
movq %rax, %rbx
leaq 0xc5b6d(%rip), %rsi     # 0x102c70
leaq 0x20(%rsp), %rdi
movq %rax, %rdx
movq $-0x1, %rcx
callq 0x84a0
leaq 0x9c47c(%rip), %rsi     # 0xd959a
leaq 0x20(%rsp), %rdi
callq 0x8160
testl %eax, %eax
je 0x3d2c4
leaq 0xc5b39(%rip), %rsi     # 0x102c70
movq %rsp, %rdi
movq %rbx, %rdx
movq $-0x1, %rcx
callq 0x84a0
leaq 0x90c43(%rip), %rsi     # 0xcdd93
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x8160
testl %eax, %eax
sete %bpl
movq (%rbx), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x3d2c7
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x3d2c7
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r14
movq 0xc5af8(%rip), %rsi     # 0x102c90
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movq 0xc4e3c(%rip), %rdi     # 0x101fe8
leaq 0x8f06d(%rip), %rsi     # 0xcc220
movl $0x12, %edx
callq 0x84e0
movq 0xc5acc(%rip), %rsi     # 0x102c90
movq 0xc5acd(%rip), %rdx     # 0x102c98
movq 0xc4e16(%rip), %rdi     # 0x101fe8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x20(%rsp), %rbx
leaq 0x80(%rsp), %r15
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3d263
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3133c
jmp 0x3d226
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3d35e
jmp 0x3d3c9
movq 0xc4d6b(%rip), %rdi     # 0x101fe8
leaq 0x906c5(%rip), %rsi     # 0xcd949
movl $0xe, %edx
callq 0x84e0
movq 0xc59db(%rip), %rsi     # 0x102c70
movq 0xc59dc(%rip), %rdx     # 0x102c78
movq 0xc4d45(%rip), %rdi     # 0x101fe8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
jmp 0x3d3b6
movb $0x1, %bpl
leaq 0x30(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x3d2e2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
testb %bpl, %bpl
je 0x3d36d
movq 0xc4cf6(%rip), %rdi     # 0x101fe8
leaq 0x90650(%rip), %rsi     # 0xcd949
movl $0xe, %edx
callq 0x84e0
leaq 0xc5966(%rip), %rsi     # 0x102c70
leaq 0x20(%rsp), %rdi
callq 0x4d82f
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0xc4cc3(%rip), %rdi     # 0x101fe8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x3d3c9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x3d3c9
movq 0xc4c74(%rip), %rdi     # 0x101fe8
leaq 0x905ce(%rip), %rsi     # 0xcd949
movl $0xe, %edx
callq 0x84e0
movq 0xc58e4(%rip), %rsi     # 0x102c70
movq 0xc58e5(%rip), %rdx     # 0x102c78
movq 0xc4c4e(%rip), %rdi     # 0x101fe8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0xc58e0(%rip), %rdi     # 0x102cb0
leaq 0x905f4(%rip), %rsi     # 0xcd9cb
callq 0x8160
testl %eax, %eax
je 0x3d4da
movq 0xc4bfd(%rip), %rdi     # 0x101fe8
leaq 0x900e4(%rip), %rsi     # 0xcd4d6
movl $0x13, %edx
callq 0x84e0
movq 0xc58ad(%rip), %rsi     # 0x102cb0
movq 0xc58ae(%rip), %rdx     # 0x102cb8
movq 0xc4bd7(%rip), %rdi     # 0x101fe8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r14
movq 0xc585c(%rip), %rsi     # 0x102cb0
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x20(%rsp), %rbx
leaq 0x160(%rsp), %r15
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3d4c3
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3133c
jmp 0x3d486
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x3d4da
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x80(%rsp), %rbx
cmpq %rbx, 0x88(%rsp)
je 0x3e100
leaq 0x70(%rsp), %r13
leaq 0x20(%rsp), %rbp
leaq 0xc57af(%rip), %r15     # 0x102cb0
leaq 0x904c3(%rip), %r12     # 0xcd9cb
movq $0x0, 0x98(%rsp)
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r14
movq 0x98(%rsp), %rax
shlq $0x5, %rax
movq %rax, 0x130(%rsp)
movq (%rbx,%rax), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x8860
xorps %xmm0, %xmm0
movaps %xmm0, 0x110(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x120(%rsp)
movq %rcx, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movq %rcx, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %rcx, 0x28(%rsp)
movb $0x0, 0x30(%rsp)
movl $0x1, %ebx
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %edx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3d635
movq 0x20(%rsp), %rax
movb (%rax), %al
testb $0x1, %bl
jne 0x3d5d9
orl $0x1, %ebx
cmpb $0x3e, %al
je 0x3d5e3
jmp 0x3d60b
cmpb $0x3e, %al
jne 0x3e153
incl %ebx
movq %r15, %rdi
movq %r12, %rsi
callq 0x8160
testl %eax, %eax
jne 0x3d594
movq 0x20(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0x3d60b
movq %r15, %rdi
movq %r12, %rsi
callq 0x8160
testl %eax, %eax
je 0x3d620
leaq 0x110(%rsp), %rdi
movq %rbp, %rsi
callq 0x3133c
jmp 0x3d594
leaq 0x160(%rsp), %rdi
movq %rbp, %rsi
callq 0x3133c
jmp 0x3d594
movq %r14, %rdi
callq 0x80f0
movq 0x110(%rsp), %rax
movq 0x118(%rsp), %r14
movq 0x8(%rax), %rbp
subq %rax, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x1e0(%rsp)
movq $0x0, 0x1f0(%rsp)
movq %r14, %rax
shrq $0x5, %rax
movslq %eax, %rbx
leaq 0x1e0(%rsp), %rdi
movq %rbx, %rsi
callq 0x3e6a2
movq 0x130(%rsp), %r15
leaq 0xd0(%rsp), %rdi
movq %rbx, %rsi
callq 0x3e6a2
movq %rbx, 0x58(%rsp)
movq %r14, %rbx
sarq $0x5, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movq %rax, 0x190(%rsp)
movaps %xmm0, 0x180(%rsp)
movq %rax, 0x100(%rsp)
movaps %xmm0, 0xf0(%rsp)
testl %ebx, %ebx
jle 0x3dafc
shlq $0x1b, %r14
movq %r14, 0xa0(%rsp)
movq %rsp, %r13
je 0x3d715
xorl %r14d, %r14d
movq 0x58(%rsp), %r15
movq 0xd0(%rsp), %rdi
addq %r14, %rdi
movq %rbp, %rsi
callq 0x86f0
addq $0x20, %r14
decq %r15
jne 0x3d6f9
testq %rbp, %rbp
je 0x3d800
decl %ebx
xorl %r15d, %r15d
testq %rbx, %rbx
je 0x3d7f4
movq 0x110(%rsp), %rax
leaq 0x20(%rax), %rcx
xorl %edx, %edx
movq %rdx, %rsi
incq %rdx
movq 0x58(%rsp), %r10
cmpq %r10, %rdx
je 0x3d771
shlq $0x5, %rsi
movq (%rax,%rsi), %rsi
movb (%rsi,%r15), %sil
movq %rcx, %rdi
movq %rdx, %r8
movq (%rdi), %r9
cmpb (%r9,%r15), %sil
jne 0x3d77c
incq %r8
addq $0x20, %rdi
cmpq %r8, %r10
jne 0x3d75c
addq $0x20, %rcx
cmpq %rbx, %rdx
jne 0x3d73a
jmp 0x3d7f4
leal 0x1(%r15), %eax
movl %eax, (%rsp)
movq 0xb8(%rsp), %rsi
cmpq 0xc0(%rsp), %rsi
movq 0xa0(%rsp), %r14
je 0x3d7ad
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xb8(%rsp)
jmp 0x3d7bd
leaq 0xb0(%rsp), %rdi
movq %r13, %rdx
callq 0x33074
testq %r14, %r14
je 0x3d7f4
xorl %r14d, %r14d
movq 0x58(%rsp), %r12
movq 0x110(%rsp), %rax
movq (%rax,%r14), %rax
movsbl (%rax,%r15), %esi
movq 0xd0(%rsp), %rdi
addq %r14, %rdi
callq 0x83d0
addq $0x20, %r14
decq %r12
jne 0x3d7ca
incq %r15
cmpq %rbp, %r15
jne 0x3d723
cmpq $0x0, 0xa0(%rsp)
leaq 0x10(%rsp), %rbp
je 0x3d9f8
xorl %r12d, %r12d
movq 0x40(%rsp), %r13
movq 0x48(%rsp), %r14
cmpq %r13, %r14
je 0x3d977
movb $0x1, %cl
xorl %r15d, %r15d
movq %r12, 0x138(%rsp)
movl %ecx, 0xac(%rsp)
movq 0xd0(%rsp), %rbp
shlq $0x5, %r12
movq 0x8(%rbp,%r12), %rbx
movq %r12, 0x1a0(%rsp)
addq %r12, %rbp
subq %r13, %r14
sarq $0x5, %r14
leaq 0x1(%r15), %rax
shlq $0x5, %r15
negq %r14
movq %r15, %r12
movq %rax, %r15
cmpq 0x8(%r13,%r12), %rbx
jne 0x3d893
testq %rbx, %rbx
je 0x3d8ac
movq (%r13,%r12), %rsi
movq (%rbp), %rdi
movq %rbx, %rdx
callq 0x8490
testl %eax, %eax
je 0x3d8ac
addq $0x20, %r12
leaq (%r14,%r15), %rax
incq %rax
incq %r15
cmpq $0x1, %rax
jne 0x3d872
jmp 0x3d960
movq 0xf0(%rsp), %rdi
addq %r12, %rdi
leaq 0x9010d(%rip), %rsi     # 0xcd9cb
callq 0x8160
testl %eax, %eax
je 0x3d8dc
movq 0xf0(%rsp), %rdi
addq %r12, %rdi
movl $0x2c, %esi
callq 0x83d0
movq 0x1a0(%rsp), %rsi
addq 0x160(%rsp), %rsi
movl $0x1, %edx
movq %rsp, %rdi
movq $-0x1, %rcx
callq 0x84a0
leaq 0x10(%rsp), %rbp
addq 0xf0(%rsp), %r12
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x8180
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x3d934
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x40(%rsp), %r13
movq 0x48(%rsp), %r14
movq %r14, %rax
subq %r13, %rax
sarq $0x5, %rax
xorl %ecx, %ecx
cmpq %r15, %rax
movq 0x138(%rsp), %r12
jne 0x3d837
jmp 0x3d9ea
testb $0x1, 0xac(%rsp)
leaq 0x10(%rsp), %rbp
movq 0x138(%rsp), %r12
je 0x3d9ea
movq %r12, %rbx
shlq $0x5, %rbx
movq 0xd0(%rsp), %rsi
addq %rbx, %rsi
leaq 0x40(%rsp), %rdi
callq 0x3133c
addq 0x160(%rsp), %rbx
leaq 0x180(%rsp), %rdi
movq %rbx, %rsi
callq 0x3133c
movq %rbp, (%rsp)
movq %rsp, %rbx
movq %rbx, %rdi
leaq 0x9000f(%rip), %rdx     # 0xcd9cb
movq %rdx, %rsi
callq 0x28a52
leaq 0xf0(%rsp), %rdi
movq %rbx, %rsi
callq 0x3e784
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x3d9ea
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
incq %r12
cmpq 0x58(%rsp), %r12
jne 0x3d817
movq 0xd0(%rsp), %rax
movq %rbp, (%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %rsp, %rdi
callq 0x2ba06
cmpq $0x0, 0x8(%rsp)
leaq 0x70(%rsp), %r13
movq 0x130(%rsp), %r15
movq 0xa0(%rsp), %r11
movq 0x58(%rsp), %rbx
je 0x3dae4
decq %rbx
xorl %eax, %eax
movabsq $0x100000000, %rcx      # imm = 0x100000000
cmpq %rcx, %r11
je 0x3da7f
movl $0x20, %ecx
movq %rbx, %rdx
movq 0xd0(%rsp), %rsi
movq (%rsi,%rcx), %rsi
movb (%rsi,%rax), %dil
movq (%rsp), %r8
cmpb (%r8,%rax), %dil
jne 0x3da76
movb $0x2e, (%rsi,%rax)
addq $0x20, %rcx
decq %rdx
jne 0x3da58
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
cmpq $0x20, %rsi
je 0x3dad6
movl $0x1, %esi
movl $0x20, %edi
movq (%rcx,%rdi), %r8
movb (%r8,%rax), %r9b
movq (%rsp), %r10
cmpb (%r10,%rax), %r9b
jne 0x3dac0
movb $0x2e, (%r8,%rax)
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rdx
incq %rsi
movq %rdx, %r8
subq %rcx, %r8
sarq $0x5, %r8
addq $0x20, %rdi
cmpq %r8, %rsi
jne 0x3da9f
incq %rax
cmpq 0x8(%rsp), %rax
jne 0x3da41
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x3db5c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x3db5c
movq 0x80(%rsp), %rax
movq (%rax,%r15), %rsi
movq 0x8(%rax,%r15), %rdx
movq 0xc44d4(%rip), %rdi     # 0x101fe8
callq 0x84e0
leaq 0x10(%rsp), %rbp
movq %rax, %rbx
movl $0x12, %edx
movq %rax, %rdi
leaq 0x8fe65(%rip), %rsi     # 0xcd995
callq 0x84e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x80(%rsp), %rdi
addq %r15, %rdi
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x88f0
cmpq $-0x1, %rax
je 0x3dc0b
movq %rax, %rbx
movq 0x80(%rsp), %rsi
addq %r15, %rsi
movq %rsp, %r14
movq %r14, %rdi
movq %rax, %rdx
movq $-0x1, %rcx
callq 0x84a0
movq %r14, %rdi
leaq 0x9b9eb(%rip), %rsi     # 0xd959a
callq 0x8160
testl %eax, %eax
je 0x3dc3e
movq 0x80(%rsp), %rsi
addq %r15, %rsi
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
movq $-0x1, %rcx
callq 0x84a0
movq %r14, %rdi
leaq 0x901ab(%rip), %rsi     # 0xcdd93
callq 0x8160
testl %eax, %eax
sete %bl
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3dc40
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x3dc40
addq 0x80(%rsp), %r15
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc50ae(%rip), %rsi     # 0x102cd0
movq %r15, %rdx
callq 0x2e8c4
movq %rbx, %rdi
leaq 0x8fd74(%rip), %rsi     # 0xcd9a8
callq 0x88c0
jmp 0x3dce7
movb $0x1, %bl
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x3dc56
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
testb %bl, %bl
je 0x3dcb9
addq 0x80(%rsp), %r15
leaq 0x1c0(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4d82f
movq 0xc5054(%rip), %rcx     # 0x102cd0
movq 0xc5055(%rip), %r8      # 0x102cd8
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x84d0
movq %r13, 0x60(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3dd6a
movq %rdx, 0x60(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x70(%rsp)
jmp 0x3dd72
addq 0x80(%rsp), %r15
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
leaq 0xc5000(%rip), %rsi     # 0x102cd0
movq %r15, %rdx
callq 0x2e8c4
movq %rbx, %rdi
leaq 0x8fcc6(%rip), %rsi     # 0xcd9a8
callq 0x88c0
movq %rbp, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3dd08
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3dd0f
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x140(%rsp), %rdi
movq %rsp, %rsi
callq 0x8540
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x3dd4d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
leaq 0x20(%rsp), %rbp
je 0x3de42
movq 0x70(%rsp), %rsi
jmp 0x3de3a
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x68(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x8fc12(%rip), %rsi     # 0xcd9a8
callq 0x88c0
movq %rbp, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3ddbc
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x3ddc3
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x140(%rsp), %rdi
movq %rsp, %rsi
callq 0x8540
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x3de01
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
leaq 0x20(%rsp), %rbp
je 0x3de1d
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x1c0(%rsp), %rdi
leaq 0x1d0(%rsp), %rax
cmpq %rax, %rdi
je 0x3de42
movq 0x1d0(%rsp), %rsi
incq %rsi
callq 0x8480
movl $0x200, %edi            # imm = 0x200
callq 0x8470
movq %rax, %r14
movq 0x140(%rsp), %rsi
movq %rax, %rdi
movl $0x10, %edx
callq 0x84c0
movl $0x15, %edx
movq %r14, %rdi
leaq 0x8fb40(%rip), %rsi     # 0xcd9b3
callq 0x84e0
movl $0x1, %edx
movq %r14, %rdi
leaq 0x8fb43(%rip), %rsi     # 0xcd9ca
callq 0x84e0
leaq 0x1a8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x32ee6
leaq 0x1a8(%rsp), %rdi
movq %r14, %rsi
movl $0x20, %edx
movl $0x1, %ecx
callq 0x3e6d2
movq 0x1a8(%rsp), %rdi
testq %rdi, %rdi
je 0x3ded8
movq 0x1b8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x48(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0x3e033
movl $0x8, %r15d
xorl %r12d, %r12d
movq 0x180(%rsp), %rax
movq -0x8(%rax,%r15), %rsi
movq (%rax,%r15), %rdx
cmpq $0xf, %rdx
ja 0x3df86
movq %r14, %rdi
callq 0x84e0
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x8faa7(%rip), %rsi     # 0xcd9c9
callq 0x84e0
movq 0x40(%rsp), %rax
movq -0x8(%rax,%r15), %rsi
movq (%rax,%r15), %rdx
movq %rbx, %rdi
callq 0x84e0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8fa7b(%rip), %rsi     # 0xcd9ca
callq 0x84e0
movq 0xf0(%rsp), %rax
movq -0x8(%rax,%r15), %rsi
movq (%rax,%r15), %rdx
movq %rbx, %rdi
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
jmp 0x3e002
movq %r14, %rdi
callq 0x84e0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8fa2a(%rip), %rsi     # 0xcd9ca
callq 0x84e0
movq 0x40(%rsp), %rax
movq -0x8(%rax,%r15), %rsi
movq (%rax,%r15), %rdx
movq %rbx, %rdi
callq 0x84e0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x8f9fd(%rip), %rsi     # 0xcd9ca
callq 0x84e0
movq 0xf0(%rsp), %rax
movq -0x8(%rax,%r15), %rsi
movq (%rax,%r15), %rdx
movq %rbx, %rdi
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 0x48(%rsp), %rax
subq 0x40(%rsp), %rax
incq %r12
sarq $0x5, %rax
addq $0x20, %r15
cmpq %rax, %r12
jne 0x3def1
movq %r14, %rdi
callq 0x8600
leaq 0xc4c6e(%rip), %r15     # 0x102cb0
leaq 0x8f982(%rip), %r12     # 0xcd9cb
leaq 0xf0(%rsp), %rdi
callq 0x2e784
leaq 0x180(%rsp), %rdi
callq 0x2e784
leaq 0x40(%rsp), %rdi
callq 0x2e784
leaq 0x1e0(%rsp), %rdi
callq 0x2e784
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3e096
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x3e0b3
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0xd0(%rsp), %rdi
callq 0x2e784
leaq 0x110(%rsp), %rdi
callq 0x2e784
movq 0x98(%rsp), %rdx
incq %rdx
movq 0x80(%rsp), %rbx
movq 0x88(%rsp), %rax
subq %rbx, %rax
sarq $0x5, %rax
movq %rdx, 0x98(%rsp)
cmpq %rax, %rdx
jne 0x3d514
leaq 0x160(%rsp), %rdi
callq 0x2e784
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x3e132
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x80(%rsp), %rdi
callq 0x2e784
xorl %eax, %eax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8e0d9(%rip), %rdi     # 0xcc233
leaq 0x8f7f7(%rip), %rsi     # 0xcd958
leaq 0x8f811(%rip), %rcx     # 0xcd979
movl $0x5e, %edx
callq 0x82c0
jmp 0x3e277
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3e2a8
jmp 0x3e371
jmp 0x3e27f
jmp 0x3e277
jmp 0x3e27f
jmp 0x3e277
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
jne 0x3e2a8
jmp 0x3e371
jmp 0x3e277
jmp 0x3e277
jmp 0x3e2ea
jmp 0x3e216
jmp 0x3e2ea
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3e1f0
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x3e1f0
movq %rax, %rbx
movq 0x1c0(%rsp), %rdi
leaq 0x1d0(%rsp), %rax
cmpq %rax, %rdi
je 0x3e2ed
movq 0x1d0(%rsp), %rsi
jmp 0x3e2d5
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x3e2ed
movq 0x70(%rsp), %rsi
jmp 0x3e2d5
jmp 0x3e2ea
jmp 0x3e2c4
jmp 0x3e277
jmp 0x3e2ea
jmp 0x3e2ea
movq %rax, %rbx
movq 0x1a8(%rsp), %rdi
testq %rdi, %rdi
je 0x3e2ed
movq 0x1b8(%rsp), %rsi
subq %rdi, %rsi
jmp 0x3e2d8
movq %rax, %rbx
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdi
jmp 0x3e2d8
jmp 0x3e2e3
movq %rax, %rbx
jmp 0x3e371
movq %rax, %rbx
movl $0x208, %esi            # imm = 0x208
movq %r14, %rdi
jmp 0x3e2b0
jmp 0x3e297
jmp 0x3e2ea
movq %rax, %rbx
jmp 0x3e311
jmp 0x3e2ea
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x3e371
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x3e371
jmp 0x3e2ea
jmp 0x3e2ea
jmp 0x3e2ea
jmp 0x3e2c4
jmp 0x3e2ea
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x3e2ed
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x3e2ed
jmp 0x3e2ea
jmp 0x3e2ea
movq %rax, %rbx
jmp 0x3e31e
jmp 0x3e2ea
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x2e784
leaq 0x180(%rsp), %rdi
callq 0x2e784
leaq 0x40(%rsp), %rdi
callq 0x2e784
leaq 0x1e0(%rsp), %rdi
callq 0x2e784
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x3e33a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x3e357
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0xd0(%rsp), %rdi
callq 0x2e784
leaq 0x110(%rsp), %rdi
callq 0x2e784
leaq 0x160(%rsp), %rdi
callq 0x2e784
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x3e3a3
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x80(%rsp), %rdi
callq 0x2e784
movq %rbx, %rdi
callq 0x8840