// File: /workspace/github_cpp_makefile_star2_O2/medvedevgroup[P]varmatch/src/wholegenome.cpp
// Function: WholeGenome::PathMakeDecision(SequencePath&, std::vector<DiploidVariant, std::allocator<DiploidVariant>>&, std::multimap<int, int, std::less<int>, std::allocator<std::pair<int const, int>>>**, std::__cxx11::list<SequencePath, std::allocator<SequencePath>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, int, int)
bool WholeGenome::PathMakeDecision(SequencePath& sp,
                                 vector<DiploidVariant> & variant_list,
                                 multimap<int, int> * choices_by_pos[],
                                 list<SequencePath> & sequence_path_list,
                                 const string & reference_sequence,
                                 int score_unit,
                                 int match_mode,
                                 int score_scheme)
{
    int pos = sp.current_genome_pos+1;

    vector<pair<int, int>> candidate_choices[2];
    for(int i = 0; i < 2; i++){

        // because if it's (-1,-1), it will do nothing, so it's ok to have this one...
        candidate_choices[i].push_back(pair<int, int>(-1, -1));
        // in this position, make choice of not use any variants, no matter if there is variant

        pair<multimap<int, int>::iterator, multimap<int, int>::iterator> var_range;
        var_range = choices_by_pos[i]->equal_range(pos);

        for(auto it = var_range.first; it != var_range.second; ++it){
            int var_index = (*it).second;
            DiploidVariant var = variant_list[var_index];
            //PrintVariant(var);

            // check if current var influence
            string ref = var.ref; //even we do not know the offset, we know ref start from pos of reference_sequence
            string alts[2];
            alts[0] = var.alts[0];
            alts[1] = alts[0];
            if(var.multi_alts && !var.zero_one_var){
                alts[1] = var.alts[1];
            }else if(var.heterozygous){
                alts[1] = ref;
            }

            // not just purely consider if a vqriant can be applied, but if a choice
            int skiped_y = -1;
            if(alts[1] == ref) skiped_y = 1;

            bool choice_applicable = true;
            for(int k = 0; k < ref.length(); k++){
            // for each ref char
                for(int y = 0; y < 2; y++){
                    // for each strain
                    if(y == skiped_y) continue;
                    if(sp.string_sequences[i*2+y][k+pos] != "."){
                        // decision in this area has already been made
                        if(k >= alts[y].length()){
                            choice_applicable = false;
                            break;
                        }else{
                            if(ref[k] != alts[y][k]){
                                choice_applicable = false;
                                break;
                            }
                        }
                    }
                }
                if(!choice_applicable) break;
            }

            if(choice_applicable){
                candidate_choices[i].push_back(pair<int, int>(var_index, 0));
            }

            if(var.heterozygous){

                //if heterozygous, then there is another choice, check if it is applicable

                string temp = alts[0];
                alts[0] = alts[1];
                alts[1] = temp;

                skiped_y = -1;
                if(alts[0] == ref) skiped_y = 0;

                choice_applicable = true;
                for(int k = 0; k < ref.length(); k++){
                // for each ref char
                    for(int y = 0; y < 2; y++){
                        // for each strain
                        if(skiped_y == y) continue;
                        if(sp.string_sequences[i*2+y][k+pos] != "."){
                            // decision in this area has already been made
                            if(k >= alts[y].length()){
                                // should be a deletion
                                choice_applicable = false;
                                break;
                            }else{
                                // should be equal at current position
                                // can be an insertion, as long as current position is the same
                                if(ref[k] != alts[y][k]){
                                    choice_applicable = false;
                                    break;
                                }
                            }
                        }
                    }
                    if(!choice_applicable) break;
                }

                if(choice_applicable){
                    if(var.multi_alts && !var.zero_one_var){
                        candidate_choices[i].push_back(pair<int, int>(var_index, 1));
                    }else{
                        candidate_choices[i].push_back(pair<int, int>(var_index, -1));
                    }
                }
            }

            if(var.multi_alts && var.zero_one_var){
                // here contains another two combinations  alt1/ref and ref/alt1
                alts[0] = var.alts[1];
                alts[1] = ref;

                choice_applicable = true;
                int y = 0;
                for(int k = 0; k < ref.length(); k++){
                // for each ref char
                    {
                        // for each strain
                        if(sp.string_sequences[i*2+y][k+pos] != "."){
                            // decision in this area has already been made
                            if(k >= alts[y].length()){
                                // should be a deletion
                                choice_applicable = false;
                                break;
                            }else{
                                // should be equal at current position
                                // can be an insertion, as long as current position is the same
                                if(ref[k] != alts[y][k]){
                                    choice_applicable = false;
                                    break;
                                }
                            }
                        }
                    }
                    if(!choice_applicable) break;
                }

                if(choice_applicable){
                    candidate_choices[i].push_back(pair<int, int>(var_index, 1));
                }


                alts[0] = ref;
                alts[1] = var.alts[1];

                choice_applicable = true;
                y = 1;
                for(int k = 0; k < ref.length(); k++){
                // for each ref char
                    {
                        // for each strain
                        if(sp.string_sequences[i*2+y][k+pos] != "."){
                            // decision in this area has already been made
                            if(k >= alts[y].length()){
                                // should be a deletion
                                choice_applicable = false;
                                break;
                            }else{
                                // should be equal at current position
                                // can be an insertion, as long as current position is the same
                                if(ref[k] != alts[y][k]){
                                    choice_applicable = false;
                                    break;
                                }
                            }
                        }
                    }
                    if(!choice_applicable) break;
                }

                if(choice_applicable){
                    candidate_choices[i].push_back(pair<int, int>(var_index, -2));
                }
            }
        }
    }

    //dout << candidate_choices[0].size() << "," << candidate_choices[1].size() << endl;

    for(int i = 0; i < candidate_choices[0].size(); i++){
        for(int j = 0; j < candidate_choices[1].size(); j++){
            // iterate all choices
            SequencePath path = sp;
            pair<int, int> var_choice[2];
            var_choice[0] = candidate_choices[0][i];
            var_choice[1] = candidate_choices[1][j];
            for(int x = 0; x < 2; x++){
                // iterate truth and predict
                int var_index = var_choice[x].first;
                if(var_index != -1){
//                    string temp_sequence = reference_sequence.substr(pos, 1);
//                    path.string_sequences[x*2][pos] = temp_sequence;
//                    path.string_sequences[x*2+1][pos] = temp_sequence;
//                }else{
                    // set score


                    DiploidVariant var = variant_list[var_index];
                    // if(var.flag != x){
                    //     dout << "Error" << endl;
                    // }
                    string ref = var.ref;
                    string alts[2];

                    int c = var_choice[x].second;
                    if(c == -1){
                        alts[0] = ref;
                        alts[1] = var.alts[0];
                    }else if(c == -2){
                        alts[0] = ref;
                        alts[1] = var.alts[1];
                    }else{
                        // c == 0 or 1
                        alts[0] = var.alts[c];
                        alts[1] = alts[0];

                        if(var.multi_alts && !var.zero_one_var){
                            // choose 1 or 0
                            alts[1] = var.alts[1- c];
                        }else{
                            // c is 0, choose 0 or -1
                            if(var.heterozygous) alts[1] = ref;
                        }
                    }

                    path.score += CalculateScore(var,
                                                 c,
                                                 score_unit,
                                                 match_mode,
                                                 score_scheme);

                    ToUpper(ref);
                    ToUpper(alts[0]);
                    ToUpper(alts[1]);
                    for(int y = 0; y < 2; y++){
                        // iterate two alts
                        string alt = alts[y];
                        vector<string> alt_vector;
                        GenerateAltVector(ref, alt, alt_vector);

                        int k = 0;
                        for(; k < ref.length()-1; k++){

                            if(alt_vector[k].size() != 1 || ref[k] != alt_vector[k][0]){
                                path.string_sequences[x*2+y][pos+k] = alt_vector[k];
                            }
                            // else changes nothing

                        }
                        // hence k == ref.length()-1, the last position
                        assert(k == ref.length()-1);
                        string alt_part = alt_vector[k];
                        if(alt_part.length() > 0){
                            if(alt_part.length() > 1){
                                if(alt_part[0] == ref[k]){
                                    if(path.string_sequences[x*2+y][pos+k] == "."){
                                        path.string_sequences[x*2+y][pos+k] = alt_part;
                                    }else{
                                        path.string_sequences[x*2+y][pos+k] += alt_part.substr(1, alt_part.size() - 1);
                                    }
                                }else{
                                    path.string_sequences[x*2+y][pos+k] = alt_part;
                                }
                            }else{
                                if(ref[k] != alt_vector[k][0]){
                                    path.string_sequences[x*2+y][pos+k] = alt_part;
                                }
                            }
                        }else{
                            path.string_sequences[x*2+y][pos+k] = "";
                        }
                    }
                }
                path.choice_made[x][pos] = var_choice[x];
            }
            // choice made
            dout << "after decision at pos " << pos << endl;
            PrintPath(path);
            sequence_path_list.push_back(path);
        }
    }

    //expected number of inserted paths are 2,3,4,6,x...
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3b8, %rsp            # imm = 0x3B8
movq %r8, 0x178(%rsp)
movq %rcx, 0x170(%rsp)
movq %rdx, 0x58(%rsp)
movq %rdi, 0x40(%rsp)
movl 0xc8(%rsi), %eax
incl %eax
leaq 0x4(%rsp), %rcx
movl %eax, (%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x150(%rsp)
movaps %xmm0, 0x140(%rsp)
movaps %xmm0, 0x130(%rsp)
leaq 0xe0(%rsp), %r14
movq %rsi, 0x180(%rsp)
leaq 0x8(%rsi), %r15
leaq 0x60(%rsp), %r12
leaq 0xc0(%rsp), %r13
movq %r15, 0x168(%rsp)
xorl %ebx, %ebx
cmpq $0x2, %rbx
je 0x13177
imulq $0x18, %rbx, %rax
leaq (%rsp,%rax), %rdi
addq $0x130, %rdi            # imm = 0x130
orq $-0x1, 0x218(%rsp)
movq %rdi, 0x30(%rsp)
leaq 0x218(%rsp), %rsi
callq 0x1f3c0
movq 0x170(%rsp), %rax
movq (%rax,%rbx,8), %rdi
leaq 0x4(%rsp), %rsi
callq 0x1f2e8
movq %rdx, 0x48(%rsp)
imulq $0x30, %rbx, %rbp
movq 0x168(%rsp), %rcx
addq %rcx, %rbp
movq %rbx, 0x188(%rsp)
leaq 0x1(,%rbx,2), %rdx
imulq $0x18, %rdx, %rdx
addq %rcx, %rdx
movq %rdx, 0x50(%rsp)
movq %rbp, 0x190(%rsp)
cmpq 0x48(%rsp), %rax
je 0x13163
movq %rax, 0x38(%rsp)
movslq 0x24(%rax), %rcx
movq %rcx, 0x8(%rsp)
imulq $0x58, %rcx, %rsi
movq 0x58(%rsp), %rax
addq (%rax), %rsi
leaq 0x218(%rsp), %rdi
callq 0x1a174
movq %r12, %rdi
leaq 0x220(%rsp), %rsi
callq 0x53f0
pushq $0x10
popq %rax
leaq (%rsp,%rax), %rcx
addq $0xc0, %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
addq $0x20, %rax
cmpq $0x50, %rax
jne 0x12d7d
movq 0x240(%rsp), %rsi
movq %r13, %rdi
callq 0x51d0
movq %r14, %rdi
movq %r13, %rsi
callq 0x51d0
cmpb $0x1, 0x259(%rsp)
jne 0x12dcd
cmpb $0x0, 0x25a(%rsp)
je 0x12ddc
cmpb $0x1, 0x258(%rsp)
movq %r12, %rsi
je 0x12de8
jmp 0x12df0
movq 0x240(%rsp), %rsi
addq $0x20, %rsi
movq %r14, %rdi
callq 0x51d0
movq %r14, %rdi
movq %r12, %rsi
callq 0x93ce
movl %eax, %r12d
xorl %ebp, %ebp
cmpq %rbp, 0x68(%rsp)
jbe 0x12e6c
movslq %ebp, %r13
leaq 0xc8(%rsp), %r14
pushq $-0x30
popq %rbx
testq %rbx, %rbx
je 0x12e67
cmpq $-0x18, %rbx
sete %al
testb %al, %r12b
jne 0x12e5d
movslq 0x4(%rsp), %rdi
addq %r13, %rdi
shlq $0x5, %rdi
addq 0x30(%r15,%rbx), %rdi
leaq 0xfc00(%rip), %rsi      # 0x22a3e
callq 0xca73
testb %al, %al
je 0x12e5d
cmpq %rbp, (%r14)
jbe 0x12e89
movq 0x60(%rsp), %rax
movb (%rax,%rbp), %al
movq -0x8(%r14), %rcx
cmpb (%rcx,%rbp), %al
jne 0x12e89
addq $0x18, %rbx
addq $0x20, %r14
jmp 0x12e15
incq %rbp
jmp 0x12e00
movq 0x8(%rsp), %rax
movl %eax, 0x10(%rsp)
andl $0x0, 0x14(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1f3c0
cmpb $0x1, 0x258(%rsp)
jne 0x12fcb
leaq 0x10(%rsp), %rdi
leaq 0xc0(%rsp), %r12
movq %r12, %rsi
callq 0x53f0
leaq 0xe0(%rsp), %rbx
leaq 0x60(%rsp), %r14
movq %r12, %rdi
movq %rbx, %rsi
callq 0x51d0
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0x51d0
movq %r12, %rdi
movq %r14, %rsi
callq 0x93ce
testb %al, %al
movabsq $0x17ffffffe8, %r12     # imm = 0x17FFFFFFE8
movl $0x0, %eax
cmovneq %rax, %r12
xorl %ebp, %ebp
cmpq %rbp, 0x68(%rsp)
jbe 0x12f5c
movslq %ebp, %r14
leaq 0xc8(%rsp), %rbx
xorl %r13d, %r13d
cmpq $0x30, %r13
je 0x12f57
cmpq %r13, %r12
je 0x12f4d
movslq 0x4(%rsp), %rdi
addq %r14, %rdi
shlq $0x5, %rdi
addq (%r15,%r13), %rdi
leaq 0xfb14(%rip), %rsi      # 0x22a3e
callq 0xca73
testb %al, %al
je 0x12f4d
cmpq %rbp, (%rbx)
jbe 0x12fc1
movq 0x60(%rsp), %rax
movb (%rax,%rbp), %al
movq -0x8(%rbx), %rcx
cmpb (%rcx,%rbp), %al
jne 0x12fc1
addq $0x18, %r13
addq $0x20, %rbx
jmp 0x12f08
incq %rbp
jmp 0x12ef3
cmpb $0x1, 0x259(%rsp)
jne 0x12f70
cmpb $0x0, 0x25a(%rsp)
je 0x12f98
movq 0x8(%rsp), %rax
movl %eax, 0x1b8(%rsp)
orl $-0x1, 0x1bc(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x1f3c0
jmp 0x12fc1
movq 0x8(%rsp), %rax
movl %eax, 0x1b8(%rsp)
movl $0x1, 0x1bc(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x1f3c0
leaq 0x10(%rsp), %rdi
callq 0x55e8
cmpb $0x0, 0x259(%rsp)
leaq 0xe0(%rsp), %r14
leaq 0x60(%rsp), %r12
leaq 0xc0(%rsp), %r13
movq 0x190(%rsp), %rbp
je 0x13122
cmpb $0x1, 0x25a(%rsp)
jne 0x13122
movq 0x240(%rsp), %rsi
addq $0x20, %rsi
movq %r13, %rdi
callq 0x51d0
movq %r14, %rdi
movq %r12, %rsi
callq 0x51d0
xorl %ebx, %ebx
cmpq %rbx, 0x68(%rsp)
jbe 0x13071
movl 0x4(%rsp), %eax
addl %ebx, %eax
movslq %eax, %rdi
shlq $0x5, %rdi
addq (%rbp), %rdi
leaq 0xf9fa(%rip), %rsi      # 0x22a3e
callq 0xca73
testb %al, %al
je 0x1306c
cmpq %rbx, 0xc8(%rsp)
jbe 0x13091
movq 0x60(%rsp), %rax
movb (%rax,%rbx), %al
movq 0xc0(%rsp), %rcx
cmpb (%rcx,%rbx), %al
jne 0x13091
incq %rbx
jmp 0x13025
movq 0x8(%rsp), %rax
movl %eax, 0x10(%rsp)
movl $0x1, 0x14(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1f3c0
movq %r13, %rdi
movq %r12, %rsi
callq 0x51d0
movq 0x240(%rsp), %rsi
addq $0x20, %rsi
movq %r14, %rdi
callq 0x51d0
xorl %ebx, %ebx
cmpq %rbx, 0x68(%rsp)
jbe 0x13102
movl 0x4(%rsp), %eax
addl %ebx, %eax
movslq %eax, %rdi
shlq $0x5, %rdi
movq 0x50(%rsp), %rax
addq (%rax), %rdi
leaq 0xf969(%rip), %rsi      # 0x22a3e
callq 0xca73
testb %al, %al
je 0x130fd
cmpq %rbx, 0xe8(%rsp)
jbe 0x13122
movq 0x60(%rsp), %rax
movb (%rax,%rbx), %al
movq 0xe0(%rsp), %rcx
cmpb (%rcx,%rbx), %al
jne 0x13122
incq %rbx
jmp 0x130b2
movq 0x8(%rsp), %rax
movl %eax, 0x10(%rsp)
movl $0xfffffffe, 0x14(%rsp) # imm = 0xFFFFFFFE
movq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1f3c0
pushq $0x20
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0xc0, %rdi
callq 0x55e8
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x13125
movq %r12, %rdi
callq 0x55e8
leaq 0x218(%rsp), %rdi
callq 0x19c16
movq 0x38(%rsp), %rdi
callq 0x5240
jmp 0x12d38
movq 0x188(%rsp), %rbx
incq %rbx
addq $0x30, %r15
jmp 0x12cb6
leaq 0x80(%rsp), %rbx
xorl %r14d, %r14d
leaq 0xc0(%rsp), %r15
leaq 0x1b8(%rsp), %r13
leaq 0x1f8(%rsp), %rbp
movq 0x138(%rsp), %rax
subq 0x130(%rsp), %rax
sarq $0x3, %rax
cmpq %r14, %rax
jbe 0x136dc
xorl %ecx, %ecx
movq %r14, 0x8(%rsp)
movq 0x150(%rsp), %rax
subq 0x148(%rsp), %rax
sarq $0x3, %rax
movq %rcx, 0x48(%rsp)
cmpq %rcx, %rax
jbe 0x136d4
leaq 0x218(%rsp), %rdi
movq 0x180(%rsp), %rsi
callq 0x1a3e8
movq 0x130(%rsp), %rax
movq 0x148(%rsp), %rcx
movq 0x48(%rsp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movsd (%rax,%r14,8), %xmm1
movlhps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movaps %xmm1, 0x120(%rsp)
xorl %r12d, %r12d
cmpq $0x2, %r12
je 0x13671
movq %r12, 0x38(%rsp)
movslq 0x120(%rsp,%r12,8), %rax
cmpq $-0x1, %rax
je 0x13640
imulq $0x58, %rax, %rsi
movq 0x58(%rsp), %rax
addq (%rax), %rsi
movq %r15, %rdi
callq 0x1a174
leaq 0x10(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x53f0
pushq $0x10
popq %rax
leaq (%rsp,%rax), %rcx
addq $0x60, %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
addq $0x20, %rax
cmpq $0x50, %rax
jne 0x1326d
movq 0x38(%rsp), %rax
movslq 0x124(%rsp,%rax,8), %r12
cmpq $-0x2, %r12
je 0x132bd
cmpl $-0x1, %r12d
jne 0x132da
leaq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x51d0
movq 0xe8(%rsp), %rsi
jmp 0x1333a
leaq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x51d0
movq 0xe8(%rsp), %rsi
addq $0x20, %rsi
jmp 0x1333a
movq %r12, %rsi
shlq $0x5, %rsi
addq 0xe8(%rsp), %rsi
leaq 0x60(%rsp), %rdi
callq 0x51d0
movq %rbx, %rdi
leaq 0x60(%rsp), %rsi
callq 0x51d0
cmpb $0x1, 0x101(%rsp)
jne 0x13314
cmpb $0x0, 0x102(%rsp)
je 0x13325
cmpb $0x1, 0x100(%rsp)
leaq 0x10(%rsp), %rsi
je 0x1333a
jmp 0x13342
pushq $0x1
popq %rax
subl %r12d, %eax
movslq %eax, %rsi
shlq $0x5, %rsi
addq 0xe8(%rsp), %rsi
movq %rbx, %rdi
callq 0x51d0
movq 0x40(%rsp), %rdi
movq %r15, %rsi
movl %r12d, %edx
movl 0x3f0(%rsp), %ecx
movl 0x3f8(%rsp), %r8d
movl 0x400(%rsp), %r9d
callq 0x1106a
addl %eax, 0x370(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x19ac2
movq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x19ac2
movq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0x19ac2
movq 0x38(%rsp), %rax
addq %rax, %rax
movq %rax, 0x50(%rsp)
xorl %r15d, %r15d
leaq 0x1d8(%rsp), %r14
cmpq $0x2, %r15
je 0x135ff
movq %r15, %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %rsi
addq $0x60, %rsi
movq %r13, %rdi
callq 0x53f0
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
andq $0x0, 0xb0(%rsp)
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x53f0
movq %r14, %rdi
movq %r13, %rsi
callq 0x53f0
movq 0x40(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rdx
leaq 0xa0(%rsp), %rcx
callq 0xed80
movq %r13, %r12
movq %r14, %rdi
callq 0x55e8
movq %rbp, %rdi
callq 0x55e8
movq %r15, %rax
orq 0x50(%rsp), %rax
imulq $0x18, %rax, %rbp
leaq 0x220(%rsp), %rax
addq %rax, %rbp
xorl %r13d, %r13d
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x18(%rsp), %rax
decq %rax
cmpq %r14, %rax
jbe 0x1349d
movq 0xa0(%rsp), %rax
leaq (%rax,%r13), %rsi
cmpq $0x1, 0x8(%rax,%r13)
jne 0x1347b
movq 0x10(%rsp), %rax
movb (%rax,%r14), %al
movq (%rsi), %rcx
cmpb (%rcx), %al
je 0x13492
movl 0x4(%rsp), %eax
addl %r14d, %eax
movslq %eax, %rdi
shlq $0x5, %rdi
addq (%rbp), %rdi
callq 0x51d0
incq %r14
decl %ebx
addq $0x20, %r13
jmp 0x1344a
jne 0x1370d
movq 0xa0(%rsp), %rsi
addq %r13, %rsi
leaq 0x198(%rsp), %rdi
callq 0x53f0
movq 0x1a0(%rsp), %rax
testq %rax, %rax
je 0x134f4
cmpq $0x1, %rax
jne 0x1351b
movq 0x10(%rsp), %rax
movb (%rax,%r14), %al
movq 0xa0(%rsp), %rcx
movq (%rcx,%r13), %rcx
cmpb (%rcx), %al
leaq 0x1d8(%rsp), %r14
jne 0x13559
jmp 0x13581
movl 0x4(%rsp), %eax
subl %ebx, %eax
movslq %eax, %rdi
shlq $0x5, %rdi
addq (%rbp), %rdi
leaq 0xf09e(%rip), %rsi      # 0x225aa
callq 0x55b0
leaq 0x1d8(%rsp), %r14
jmp 0x13581
movq 0x198(%rsp), %rax
movb (%rax), %al
movq 0x10(%rsp), %rcx
movl 0x4(%rsp), %edx
subl %ebx, %edx
movslq %edx, %rdi
shlq $0x5, %rdi
addq (%rbp), %rdi
cmpb (%rcx,%r14), %al
jne 0x1356c
leaq 0xf4f6(%rip), %rsi      # 0x22a3e
callq 0xa912
testb %al, %al
leaq 0x1d8(%rsp), %r14
je 0x135b6
movl 0x4(%rsp), %eax
subl %ebx, %eax
movslq %eax, %rdi
shlq $0x5, %rdi
addq (%rbp), %rdi
jmp 0x13574
leaq 0x1d8(%rsp), %r14
leaq 0x198(%rsp), %rsi
callq 0x51d0
leaq 0x198(%rsp), %rdi
callq 0x55e8
leaq 0xa0(%rsp), %rdi
callq 0xadcc
movq %r12, %r13
movq %r12, %rdi
callq 0x55e8
incq %r15
leaq 0x1f8(%rsp), %rbp
jmp 0x133b3
movq 0x1a0(%rsp), %rcx
decq %rcx
leaq 0x398(%rsp), %r13
movq %r13, %rdi
leaq 0x198(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0x5320
movl 0x4(%rsp), %eax
subl %ebx, %eax
movslq %eax, %rdi
shlq $0x5, %rdi
addq (%rbp), %rdi
movq %r13, %rsi
callq 0x55c0
movq %r13, %rdi
callq 0x55e8
jmp 0x13581
pushq $0x20
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x60, %rdi
callq 0x55e8
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x13602
leaq 0x10(%rsp), %rdi
callq 0x55e8
leaq 0xc0(%rsp), %r15
movq %r15, %rdi
callq 0x19c16
leaq 0x80(%rsp), %rbx
movq 0x8(%rsp), %r14
movq 0x38(%rsp), %r12
imulq $0x30, %r12, %rdi
leaq 0x280(%rsp), %rax
addq %rax, %rdi
leaq 0x4(%rsp), %rsi
callq 0x1a556
movq 0x120(%rsp,%r12,8), %rcx
movq %rcx, (%rax)
incq %r12
jmp 0x13223
movq 0x1c948(%rip), %rdi     # 0x2ffc0
leaq 0xf157(%rip), %rsi      # 0x227d6
callq 0x52f0
movl 0x4(%rsp), %esi
movq %rax, %rdi
callq 0x5530
movq %rax, %rdi
callq 0x5190
leaq 0x218(%rsp), %rsi
callq 0x1388a
movq 0x178(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0x1a5a4
leaq 0x218(%rsp), %rdi
callq 0x1a5b0
movq 0x48(%rsp), %rcx
incq %rcx
jmp 0x131be
incq %r14
jmp 0x1319a
pushq $0x18
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x130, %rdi            # imm = 0x130
callq 0x1f38c
addq $-0x18, %rbx
cmpq $-0x18, %rbx
jne 0x136df
movb $0x1, %al
addq $0x3b8, %rsp            # imm = 0x3B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xeee5(%rip), %rdi      # 0x225f9
leaq 0xeef2(%rip), %rsi      # 0x2260d
leaq 0xf01b(%rip), %rcx      # 0x2273d
movl $0x845, %edx            # imm = 0x845
callq 0x5230
jmp 0x13781
jmp 0x13746
jmp 0x13746
jmp 0x13781
jmp 0x13746
jmp 0x1379d
jmp 0x1379d
jmp 0x1379d
jmp 0x1375d
jmp 0x1379d
jmp 0x1379d
jmp 0x1379d
jmp 0x13781
movq %rax, %rbx
jmp 0x13863
movq %rax, %rbx
jmp 0x137c8
movq %rax, %rbx
jmp 0x13849
jmp 0x1375d
movq %rax, %rbx
jmp 0x13856
jmp 0x1379d
jmp 0x13790
movq %rax, %rbx
leaq 0x398(%rsp), %rdi
callq 0x55e8
jmp 0x13793
jmp 0x1379d
jmp 0x1379d
jmp 0x137dc
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x55e8
jmp 0x137a0
movq %rax, %rbx
leaq 0x198(%rsp), %rdi
jmp 0x13800
movq %rax, %rbx
pushq $0x20
popq %r14
leaq (%rsp,%r14), %rdi
addq $0xc0, %rdi
callq 0x55e8
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x137a4
leaq 0x60(%rsp), %rdi
callq 0x55e8
leaq 0x218(%rsp), %rdi
callq 0x19c16
jmp 0x13863
jmp 0x13807
movq %rax, %rbx
jmp 0x13824
jmp 0x13807
movq %rax, %rbx
jmp 0x137f8
movq %rax, %rbx
leaq 0x1d8(%rsp), %rdi
callq 0x55e8
leaq 0x1f8(%rsp), %rdi
callq 0x55e8
jmp 0x1380a
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0xadcc
leaq 0x1b8(%rsp), %rdi
callq 0x55e8
pushq $0x20
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x60, %rdi
callq 0x55e8
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x13828
leaq 0x10(%rsp), %rdi
callq 0x55e8
leaq 0xc0(%rsp), %rdi
callq 0x19c16
leaq 0x218(%rsp), %rdi
callq 0x1a5b0
pushq $0x18
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x130, %rdi            # imm = 0x130
callq 0x1f38c
addq $-0x18, %r14
cmpq $-0x18, %r14
jne 0x13867
movq %rbx, %rdi
callq 0x5540
nop