// File: /workspace/github_cpp_makefile_star2_O1/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 $0x228, %rsp            # imm = 0x228
callq 0x412d0
xorl %eax, %eax
movq %rax, 0x80(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%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 0xcb056(%rip), %rbx     # 0x10afe8
leaq 0x91c47(%rip), %rsi     # 0xd1be0
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 0xcb024(%rip), %rdi     # 0x10afe8
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0xcbc90(%rip), %rdi     # 0x10bc68
leaq 0x91ca0(%rip), %rsi     # 0xd1c7f
callq 0x8160
testl %eax, %eax
je 0x40094
leaq 0xcbc75(%rip), %rsi     # 0x10bc68
leaq 0x70(%rsp), %rdi
callq 0x33db0
leaq 0xcbc64(%rip), %rdi     # 0x10bc68
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x88f0
cmpq $-0x1, %rax
je 0x40183
movq %rax, %rbx
leaq 0xcbc3f(%rip), %rsi     # 0x10bc68
leaq 0x20(%rsp), %rdi
movq %rax, %rdx
movq $-0x1, %rcx
callq 0x84a0
leaq 0xa0f76(%rip), %rsi     # 0xe0fba
leaq 0x20(%rsp), %rdi
callq 0x8160
movl %eax, %ebp
testl %eax, %eax
je 0x401d1
leaq 0xcbc09(%rip), %rsi     # 0x10bc68
leaq 0x208(%rsp), %rdi
movq %rbx, %rdx
movq $-0x1, %rcx
callq 0x84a0
leaq 0x92a7c(%rip), %rsi     # 0xd2af9
leaq 0x208(%rsp), %rdi
callq 0x8160
testl %eax, %eax
sete %bl
jmp 0x401d3
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r14
movq 0xcbbe0(%rip), %rsi     # 0x10bc88
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
movq 0xcaf2c(%rip), %rdi     # 0x10afe8
leaq 0x8e41d(%rip), %rsi     # 0xce4e0
movl $0x12, %edx
callq 0x84e0
movq 0xcbbb4(%rip), %rsi     # 0x10bc88
movq 0xcbbb5(%rip), %rdx     # 0x10bc90
movq 0xcaf06(%rip), %rdi     # 0x10afe8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x20(%rsp), %rbx
leaq 0x70(%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 0x40170
movq %r15, %rdi
movq %rbx, %rsi
callq 0x33db0
jmp 0x40133
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
jne 0x4028e
jmp 0x402f9
movq 0xcae5e(%rip), %rdi     # 0x10afe8
leaq 0x91a6c(%rip), %rsi     # 0xd1bfd
movl $0xe, %edx
callq 0x84e0
movq 0xcbac6(%rip), %rsi     # 0x10bc68
movq 0xcbac7(%rip), %rdx     # 0x10bc70
movq 0xcae38(%rip), %rdi     # 0x10afe8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
jmp 0x402e6
movb $0x1, %bl
testl %ebp, %ebp
je 0x401f8
leaq 0x218(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x401f8
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x30(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x40213
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
testb %bl, %bl
je 0x4029d
movq 0xcadc6(%rip), %rdi     # 0x10afe8
leaq 0x919d4(%rip), %rsi     # 0xd1bfd
movl $0xe, %edx
callq 0x84e0
leaq 0xcba2e(%rip), %rsi     # 0x10bc68
leaq 0x20(%rsp), %rdi
callq 0x50803
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0xcad93(%rip), %rdi     # 0x10afe8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
je 0x402f9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x402f9
movq 0xcad44(%rip), %rdi     # 0x10afe8
leaq 0x91952(%rip), %rsi     # 0xd1bfd
movl $0xe, %edx
callq 0x84e0
movq 0xcb9ac(%rip), %rsi     # 0x10bc68
movq 0xcb9ad(%rip), %rdx     # 0x10bc70
movq 0xcad1e(%rip), %rdi     # 0x10afe8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
leaq 0xcb9a8(%rip), %rdi     # 0x10bca8
leaq 0x91978(%rip), %rsi     # 0xd1c7f
callq 0x8160
testl %eax, %eax
je 0x4040a
movq 0xcaccd(%rip), %rdi     # 0x10afe8
leaq 0x909ac(%rip), %rsi     # 0xd0cce
movl $0x13, %edx
callq 0x84e0
movq 0xcb975(%rip), %rsi     # 0x10bca8
movq 0xcb976(%rip), %rdx     # 0x10bcb0
movq 0xcaca7(%rip), %rdi     # 0x10afe8
callq 0x84e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %rbx, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r14
movq 0xcb924(%rip), %rsi     # 0x10bca8
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 0x403f3
movq %r15, %rdi
movq %rbx, %rsi
callq 0x33db0
jmp 0x403b6
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x4040a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x70(%rsp), %rbx
cmpq %rbx, 0x78(%rsp)
je 0x40ff2
leaq 0x10(%rsp), %r13
leaq 0xa0(%rsp), %r15
leaq 0x20(%rsp), %r12
movq $0x0, 0xb8(%rsp)
movl $0x208, %edi            # imm = 0x208
callq 0x8470
movq %rax, %r14
movq 0xb8(%rsp), %rbp
shlq $0x5, %rbp
movq (%rbx,%rbp), %rsi
movq %rax, %rdi
movl $0x8, %edx
callq 0x8860
xorps %xmm0, %xmm0
movaps %xmm0, 0x120(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x130(%rsp)
movq %rcx, 0xf0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movq %rcx, 0xd0(%rsp)
movaps %xmm0, 0xc0(%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 %r12, %rsi
callq 0x8870
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x40554
testb $0x1, %bl
je 0x404f3
movq 0x20(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0x41042
movq 0x20(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0x40514
leaq 0xcb7a4(%rip), %rdi     # 0x10bca8
leaq 0x91774(%rip), %rsi     # 0xd1c7f
callq 0x8160
testl %eax, %eax
jne 0x4054d
movq 0x20(%rsp), %rax
cmpb $0x3e, (%rax)
jne 0x4053d
leaq 0xcb783(%rip), %rdi     # 0x10bca8
leaq 0x91753(%rip), %rsi     # 0xd1c7f
callq 0x8160
leaq 0x160(%rsp), %rdi
testl %eax, %eax
je 0x40545
leaq 0x120(%rsp), %rdi
movq %r12, %rsi
callq 0x33db0
incl %ebx
jmp 0x404b0
movq %rbp, 0x40(%rsp)
movq %r14, %rdi
callq 0x80f0
movq 0x120(%rsp), %rax
movq 0x128(%rsp), %r14
movq 0x8(%rax), %rbp
subq %rax, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x1d0(%rsp)
movq $0x0, 0x1e0(%rsp)
movq %r14, %rax
shrq $0x5, %rax
movslq %eax, %rbx
leaq 0x1d0(%rsp), %rdi
movq %rbx, %rsi
callq 0x415c4
leaq 0xe0(%rsp), %rdi
movq %rbx, %rsi
callq 0x415c4
movq %rbx, 0x48(%rsp)
movq %r14, %rbx
sarq $0x5, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
xorl %eax, %eax
movq %rax, 0x60(%rsp)
movq %rax, 0x190(%rsp)
movaps %xmm0, 0x180(%rsp)
movq %rax, 0x110(%rsp)
movaps %xmm0, 0x100(%rsp)
testl %ebx, %ebx
jle 0x409e3
shlq $0x1b, %r14
movq %r14, 0xb0(%rsp)
je 0x4062e
xorl %r14d, %r14d
movq 0x48(%rsp), %r15
movq 0xe0(%rsp), %rdi
addq %r14, %rdi
movq %rbp, %rsi
callq 0x86f0
addq $0x20, %r14
decq %r15
jne 0x40612
testq %rbp, %rbp
je 0x40734
decl %ebx
movq 0x48(%rsp), %rax
leaq -0x1(%rax), %r13
xorl %r15d, %r15d
movq 0x120(%rsp), %rcx
leaq 0x20(%rcx), %rdx
xorl %eax, %eax
movq %r13, %rsi
xorl %edi, %edi
movq 0x48(%rsp), %r14
cmpq %rbx, %rdi
je 0x406a0
movq %rdi, %r8
incq %rdi
cmpq %r14, %rdi
je 0x40695
shlq $0x5, %r8
movq (%rcx,%r8), %r8
movb (%r8,%r15), %r8b
movq %rdx, %r9
movq %rsi, %r10
movq (%r9), %r11
cmpb (%r11,%r15), %r8b
jne 0x40693
addq $0x20, %r9
decq %r10
jne 0x4067f
jmp 0x40695
movb $0x1, %al
decq %rsi
addq $0x20, %rdx
testb $0x1, %al
je 0x4065d
testb $0x1, %al
je 0x40728
leal 0x1(%r15), %eax
movl %eax, (%rsp)
movq 0xc8(%rsp), %rsi
cmpq 0xd0(%rsp), %rsi
je 0x406d9
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0xc8(%rsp)
movq 0xb0(%rsp), %rax
jmp 0x406f1
leaq 0xc0(%rsp), %rdi
movq %rsp, %rdx
callq 0x35b1e
movq 0xb0(%rsp), %rax
testq %rax, %rax
je 0x40728
xorl %r12d, %r12d
movq 0x48(%rsp), %r14
movq 0x120(%rsp), %rax
movq (%rax,%r12), %rax
movsbl (%rax,%r15), %esi
movq 0xe0(%rsp), %rdi
addq %r12, %rdi
callq 0x83d0
addq $0x20, %r12
decq %r14
jne 0x406fe
incq %r15
cmpq %rbp, %r15
jne 0x40645
cmpq $0x0, 0xb0(%rsp)
leaq 0x10(%rsp), %r13
movq %rsp, %r14
movq 0x40(%rsp), %r12
je 0x408e3
xorl %ebx, %ebx
movq 0x50(%rsp), %rax
cmpq %rax, 0x58(%rsp)
je 0x40860
movb $0x1, %r12b
xorl %r15d, %r15d
xorl %r13d, %r13d
movq 0xe0(%rsp), %rcx
movq %rbx, %rbp
shlq $0x5, %rbp
movq 0x8(%rcx,%rbp), %rdx
cmpq 0x8(%rax,%r15), %rdx
jne 0x4082c
testq %rdx, %rdx
je 0x407a6
addq %rbp, %rcx
movq (%rax,%r15), %rsi
movq (%rcx), %rdi
callq 0x8490
testl %eax, %eax
jne 0x4082c
movq 0x100(%rsp), %rdi
addq %r15, %rdi
leaq 0x914c7(%rip), %rsi     # 0xd1c7f
callq 0x8160
testl %eax, %eax
je 0x407d6
movq 0x100(%rsp), %rdi
addq %r15, %rdi
movl $0x2c, %esi
callq 0x83d0
addq 0x160(%rsp), %rbp
movl $0x1, %edx
movq %rsp, %rdi
movq %rbp, %rsi
movq $-0x1, %rcx
callq 0x84a0
movq 0x100(%rsp), %rdi
addq %r15, %rdi
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x8180
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x40829
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
xorl %r12d, %r12d
incq %r13
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %r15
cmpq %rcx, %r13
jne 0x4076b
testb $0x1, %r12b
leaq 0x10(%rsp), %r13
movq %rsp, %r14
movq 0x40(%rsp), %r12
je 0x408d5
movq %rbx, %rbp
shlq $0x5, %rbp
movq 0xe0(%rsp), %rsi
addq %rbp, %rsi
leaq 0x50(%rsp), %rdi
callq 0x33db0
addq 0x160(%rsp), %rbp
leaq 0x180(%rsp), %rdi
movq %rbp, %rsi
callq 0x33db0
movq %r13, (%rsp)
movq %r14, %rdi
leaq 0x913dd(%rip), %rdx     # 0xd1c7f
movq %rdx, %rsi
callq 0x28952
leaq 0x100(%rsp), %rdi
movq %r14, %rsi
callq 0x416a6
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x408d0
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x40(%rsp), %r12
incq %rbx
cmpq 0x48(%rsp), %rbx
jne 0x40752
movq 0xe0(%rsp), %rax
movq %r13, (%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x2e45c
leaq 0xa0(%rsp), %r15
cmpq $0x0, 0x8(%rsp)
movabsq $0x100000000, %r9       # imm = 0x100000000
leaq 0x90(%rsp), %rbx
movq 0xb0(%rsp), %r10
movq 0x48(%rsp), %r11
je 0x409cb
decq %r11
xorl %eax, %eax
cmpq %r9, %r10
je 0x4096d
movl $0x20, %ecx
movq %r11, %rdx
movq 0xe0(%rsp), %rsi
movq (%rsi,%rcx), %rsi
movb (%rsi,%rax), %dil
movq (%rsp), %r8
cmpb (%r8,%rax), %dil
jne 0x40964
movb $0x2e, (%rsi,%rax)
addq $0x20, %rcx
decq %rdx
jne 0x40946
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rcx
subq %rsi, %rcx
cmpq $0x20, %rcx
je 0x409bd
movl $0x1, %ecx
movl $0x20, %edx
movq (%rsi,%rdx), %rsi
movb (%rsi,%rax), %dil
movq (%rsp), %r8
cmpb (%r8,%rax), %dil
jne 0x409a0
movb $0x2e, (%rsi,%rax)
incq %rcx
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdi
subq %rsi, %rdi
sarq $0x5, %rdi
addq $0x20, %rdx
cmpq %rdi, %rcx
jne 0x4098a
incq %rax
cmpq 0x8(%rsp), %rax
jne 0x40939
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x40a48
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x40a48
movq 0x70(%rsp), %rax
movq 0x40(%rsp), %r12
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
movq 0xca5eb(%rip), %rdi     # 0x10afe8
callq 0x84e0
leaq 0x90(%rsp), %rbx
movq %rax, %r14
movl $0x12, %edx
movq %rax, %rdi
leaq 0x9122d(%rip), %rsi     # 0xd1c49
callq 0x84e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r14, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x70(%rsp), %rdi
addq %r12, %rdi
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x88f0
cmpq $-0x1, %rax
je 0x40ad6
movq %rax, %r14
movq 0x70(%rsp), %rsi
addq %r12, %rsi
movq %rsp, %rbx
movq %rbx, %rdi
movq %rax, %rdx
movq $-0x1, %rcx
callq 0x84a0
movq %rbx, %rdi
leaq 0xa0529(%rip), %rsi     # 0xe0fba
callq 0x8160
movl %eax, %ebp
testl %eax, %eax
je 0x40b01
movq 0x70(%rsp), %rsi
addq 0x40(%rsp), %rsi
leaq 0x1e8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rdx
movq $-0x1, %rcx
callq 0x84a0
movq %rbx, %rdi
leaq 0x9202f(%rip), %rsi     # 0xd2af9
callq 0x8160
testl %eax, %eax
sete %bl
jmp 0x40b03
addq 0x70(%rsp), %r12
movq %rbx, %rdi
leaq 0xcb1e3(%rip), %rsi     # 0x10bcc8
movq %r12, %rdx
callq 0x31379
movq %rbx, %rdi
leaq 0x91165(%rip), %rsi     # 0xd1c5c
callq 0x88c0
jmp 0x40be6
movb $0x1, %bl
testl %ebp, %ebp
leaq 0x1b0(%rsp), %r14
movq 0x40(%rsp), %r12
je 0x40b39
movq 0x1e8(%rsp), %rdi
leaq 0x1f8(%rsp), %rax
cmpq %rax, %rdi
je 0x40b39
movq 0x1f8(%rsp), %rsi
incq %rsi
callq 0x8480
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x40b4f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
testb %bl, %bl
je 0x40bb8
addq 0x70(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x50803
leaq 0x90(%rsp), %rbx
movq 0xcb156(%rip), %rcx     # 0x10bcc8
movq 0xcb157(%rip), %r8      # 0x10bcd0
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x84d0
movq %r15, 0x90(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x40c6b
movq %rdx, 0x90(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa0(%rsp)
jmp 0x40c72
addq 0x70(%rsp), %r12
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
leaq 0xcb0f9(%rip), %rsi     # 0x10bcc8
movq %r12, %rdx
callq 0x31379
movq %rbx, %rdi
leaq 0x9107b(%rip), %rsi     # 0xd1c5c
callq 0x88c0
movq %r13, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x40c07
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x40c0f
movups (%rcx), %xmm0
movups %xmm0, (%r13)
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 %r13, %rdi
je 0x40c4d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x40d45
movq 0xa0(%rsp), %rsi
jmp 0x40d3d
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x98(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
leaq 0x90fc5(%rip), %rsi     # 0xd1c5c
callq 0x88c0
movq %r13, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x40cbd
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x40cc5
movups (%rcx), %xmm0
movups %xmm0, (%r13)
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 %r13, %rdi
je 0x40d03
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x90(%rsp), %rdi
cmpq %r15, %rdi
je 0x40d20
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0x1b0(%rsp), %rdi
leaq 0x1c0(%rsp), %rax
cmpq %rax, %rdi
je 0x40d45
movq 0x1c0(%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 0x90ef1(%rip), %rsi     # 0xd1c67
callq 0x84e0
movl $0x1, %edx
movq %r14, %rdi
leaq 0x90ef4(%rip), %rsi     # 0xd1c7e
callq 0x84e0
leaq 0x198(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x35990
leaq 0x198(%rsp), %rdi
movq %r14, %rsi
movl $0x20, %edx
movl $0x1, %ecx
callq 0x415f4
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0x40ddb
movq 0x1a8(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
movq 0x58(%rsp), %rax
cmpq 0x50(%rsp), %rax
je 0x40f34
movl $0x8, %ebp
xorl %ebx, %ebx
movq 0x180(%rsp), %rax
movq -0x8(%rax,%rbp), %rsi
movq (%rax,%rbp), %rdx
cmpq $0xf, %rdx
ja 0x40e87
movq %r14, %rdi
callq 0x84e0
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x90e5a(%rip), %rsi     # 0xd1c7d
callq 0x84e0
movq 0x50(%rsp), %rax
movq -0x8(%rax,%rbp), %rsi
movq (%rax,%rbp), %rdx
movq %r12, %rdi
callq 0x84e0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x90e2e(%rip), %rsi     # 0xd1c7e
callq 0x84e0
movq 0x100(%rsp), %rax
movq -0x8(%rax,%rbp), %rsi
movq (%rax,%rbp), %rdx
movq %r12, %rdi
callq 0x84e0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x8450
jmp 0x40f03
movq %r14, %rdi
callq 0x84e0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x90ddd(%rip), %rsi     # 0xd1c7e
callq 0x84e0
movq 0x50(%rsp), %rax
movq -0x8(%rax,%rbp), %rsi
movq (%rax,%rbp), %rdx
movq %r12, %rdi
callq 0x84e0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x90db0(%rip), %rsi     # 0xd1c7e
callq 0x84e0
movq 0x100(%rsp), %rax
movq -0x8(%rax,%rbp), %rsi
movq (%rax,%rbp), %rdx
movq %r12, %rdi
callq 0x84e0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x8450
movsbl %al, %esi
movq %r12, %rdi
callq 0x8040
movq %rax, %rdi
callq 0x8300
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
incq %rbx
sarq $0x5, %rax
addq $0x20, %rbp
cmpq %rax, %rbx
jne 0x40df2
movq %r14, %rdi
callq 0x8600
leaq 0x20(%rsp), %r12
leaq 0x100(%rsp), %rdi
callq 0x3123c
leaq 0x180(%rsp), %rdi
callq 0x3123c
leaq 0x50(%rsp), %rdi
callq 0x3123c
leaq 0x1d0(%rsp), %rdi
callq 0x3123c
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x40f8e
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x40fab
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0xe0(%rsp), %rdi
callq 0x3123c
leaq 0x120(%rsp), %rdi
callq 0x3123c
movq 0xb8(%rsp), %rdx
incq %rdx
movq 0x70(%rsp), %rbx
movq 0x78(%rsp), %rax
subq %rbx, %rax
sarq $0x5, %rax
movq %rdx, 0xb8(%rsp)
cmpq %rax, %rdx
jne 0x40438
leaq 0x160(%rsp), %rdi
callq 0x3123c
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x41024
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x70(%rsp), %rdi
callq 0x3123c
xorl %eax, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8d4aa(%rip), %rdi     # 0xce4f3
leaq 0x90bbc(%rip), %rsi     # 0xd1c0c
leaq 0x90bd6(%rip), %rcx     # 0xd1c2d
movl $0x5e, %edx
callq 0x82c0
jmp 0x4117e
movq %rax, %r15
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x411b2
jmp 0x4128c
jmp 0x41186
jmp 0x4117e
jmp 0x41186
jmp 0x4117e
movq %rax, %r15
movq 0x20(%rsp), %rdi
cmpq %r14, %rdi
jne 0x411b2
jmp 0x4128c
jmp 0x4117e
jmp 0x4117e
jmp 0x41113
jmp 0x41205
movq %r15, %rcx
movq %rax, %r15
movq 0x90(%rsp), %rdi
cmpq %rcx, %rdi
je 0x410e3
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x410e3
movq %rax, %r15
movq 0x1b0(%rsp), %rdi
leaq 0x1c0(%rsp), %rax
cmpq %rax, %rdi
je 0x41208
movq 0x1c0(%rsp), %rsi
jmp 0x411f2
jmp 0x41205
jmp 0x41205
movq %r15, %rcx
movq %rax, %r15
movq 0x90(%rsp), %rdi
cmpq %rcx, %rdi
je 0x41208
movq 0xa0(%rsp), %rsi
jmp 0x411f2
jmp 0x411c6
jmp 0x4117e
jmp 0x41205
jmp 0x41205
movq %rax, %r15
movl $0x200, %esi            # imm = 0x200
movq %r14, %rdi
jmp 0x411f5
movq %rax, %r15
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0x41208
movq 0x1a8(%rsp), %rsi
subq %rdi, %rsi
jmp 0x411f5
jmp 0x411fe
movq %rax, %r15
jmp 0x4128c
movq %rax, %r15
movl $0x208, %esi            # imm = 0x208
movq %r14, %rdi
jmp 0x411ba
jmp 0x411a1
jmp 0x41205
movq %rax, %r15
jmp 0x4122c
jmp 0x41205
movq %rax, %r15
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x4128c
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x4128c
jmp 0x41205
movq %rax, %r15
movq (%rsp), %rdi
cmpq %r13, %rdi
jne 0x411ed
jmp 0x41208
jmp 0x41205
jmp 0x41205
jmp 0x41205
jmp 0x41205
movq %rax, %r15
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x41208
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x8480
jmp 0x41208
jmp 0x41205
movq %rax, %r15
jmp 0x41239
jmp 0x41205
movq %rax, %r15
leaq 0x100(%rsp), %rdi
callq 0x3123c
leaq 0x180(%rsp), %rdi
callq 0x3123c
leaq 0x50(%rsp), %rdi
callq 0x3123c
leaq 0x1d0(%rsp), %rdi
callq 0x3123c
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x41255
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x8480
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x41272
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x8480
leaq 0xe0(%rsp), %rdi
callq 0x3123c
leaq 0x120(%rsp), %rdi
callq 0x3123c
leaq 0x160(%rsp), %rdi
callq 0x3123c
movq 0x140(%rsp), %rdi
leaq 0x150(%rsp), %rax
cmpq %rax, %rdi
je 0x412be
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x8480
leaq 0x70(%rsp), %rdi
callq 0x3123c
movq %r15, %rdi
callq 0x8840