// File: medvedevgroup[P]varmatch/src/wholegenome.cpp
// Function: WholeGenome::AppendChangedSpNoGenotype(SequencePath&, std::vector<DiploidVariant, std::allocator<DiploidVariant>>&, std::__cxx11::list<SequencePath, std::allocator<SequencePath>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int, int, int, int, int)
bool WholeGenome::AppendChangedSpNoGenotype(SequencePath& sp,
                         vector<DiploidVariant> & variant_list,
                         list<SequencePath> & sequence_path_list,
                         const string & reference_sequence,
                         int score_unit,
                         int match_mode,
                         int score_scheme,
                         int variant_index,
                         int c)
{
    int pos = sp.current_genome_pos+1;
    SequencePath path = sp;
    if(c == NOT_USE){
        path.choice_vector[variant_index] = c;
        sequence_path_list.push_back(path);
        return true;
    }

    pair<int, int> var_choice[2];
    int x = 0;
    int var_index = variant_index;
    DiploidVariant var = variant_list[var_index];
    if(var.flag) x = 1;
    string ref = var.ref;
    string alts[2];

    if(c == 0 || c == 1){
        // c == 0 or 1
        alts[0] = var.alts[c];
    }else{
        dout << "Unrecognized choice" << endl;
    }
    path.score += CalculateScore(var,
                                 c,
                                 score_unit,
                                 match_mode,
                                 score_scheme);
    ToUpper(ref);
    ToUpper(alts[0]);
    int y = 0;

    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] = "";
    }
    // choice made
    path.choice_vector[variant_index] = c;
    //dout << "after decision at variant " << variant_index << endl;
    //PrintPath(path);
    sequence_path_list.push_back(path);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x370(%rbp)
movq -0x18(%rbp), %rax
movl 0xc8(%rax), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x1b8(%rbp), %rdi
callq 0x34b20
cmpl $-0x9, 0x28(%rbp)
jne 0x251ba
movl 0x28(%rbp), %eax
movl %eax, -0x374(%rbp)
leaq -0x50(%rbp), %rdi
movslq 0x20(%rbp), %rsi
callq 0x19a60
movl -0x374(%rbp), %ecx
movl %ecx, (%rax)
movq -0x28(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x34fe0
jmp 0x25190
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1c8(%rbp)
jmp 0x25ace
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
jmp 0x25ae8
leaq -0x1e0(%rbp), %rax
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x388(%rbp)
movq %rax, -0x380(%rbp)
movq -0x380(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x34e90
jmp 0x251eb
movq -0x388(%rbp), %rcx
movq -0x390(%rbp), %rax
addq $0x8, %rax
cmpq %rcx, %rax
movq %rax, -0x380(%rbp)
jne 0x251d6
movl $0x0, -0x1e4(%rbp)
movl 0x20(%rbp), %eax
movl %eax, -0x1e8(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x1e8(%rbp), %rsi
callq 0x33de0
movq %rax, %rsi
leaq -0x240(%rbp), %rdi
callq 0x340a0
jmp 0x2523d
testb $0x1, -0x1f4(%rbp)
je 0x25250
movl $0x1, -0x1e4(%rbp)
leaq -0x238(%rbp), %rsi
leaq -0x260(%rbp), %rdi
callq 0x61b0
jmp 0x25265
leaq -0x2a0(%rbp), %rax
movq %rax, %rcx
addq $0x40, %rcx
movq %rcx, -0x3a0(%rbp)
movq %rax, -0x398(%rbp)
movq -0x398(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x65e0
movq -0x3a8(%rbp), %rax
movq -0x3a0(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x398(%rbp)
jne 0x25281
cmpl $0x0, 0x28(%rbp)
je 0x252be
cmpl $0x1, 0x28(%rbp)
jne 0x2530f
leaq -0x218(%rbp), %rdi
movslq 0x28(%rbp), %rsi
callq 0x9080
movq %rax, %rsi
leaq -0x2a0(%rbp), %rdi
callq 0x6070
jmp 0x252df
jmp 0x25342
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
jmp 0x25ac0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
jmp 0x25a6a
movq 0x4eca2(%rip), %rdi     # 0x73fb8
leaq 0x302bc(%rip), %rsi     # 0x555d9
callq 0x6420
movq %rax, -0x3b0(%rbp)
jmp 0x2532b
movq -0x3b0(%rbp), %rdi
movq 0x4ec47(%rip), %rsi     # 0x73f80
callq 0x6480
jmp 0x25340
jmp 0x25342
movq -0x370(%rbp), %rdi
movl 0x28(%rbp), %edx
movl -0x34(%rbp), %ecx
movl 0x10(%rbp), %r8d
movl 0x18(%rbp), %r9d
leaq -0x240(%rbp), %rsi
callq 0x21fd0
movl %eax, -0x3b4(%rbp)
jmp 0x2536b
movq -0x370(%rbp), %rdi
movl -0x3b4(%rbp), %ecx
movl -0x60(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x60(%rbp)
leaq -0x260(%rbp), %rsi
callq 0x328c0
jmp 0x2538e
movq -0x370(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x328c0
jmp 0x253a3
movl $0x0, -0x2a4(%rbp)
movslq -0x2a4(%rbp), %rax
shlq $0x5, %rax
leaq -0x2a0(%rbp,%rax), %rsi
leaq -0x2c8(%rbp), %rdi
callq 0x61b0
jmp 0x253ce
leaq -0x2e0(%rbp), %rdi
callq 0x12d30
leaq -0x300(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x61b0
jmp 0x253ef
leaq -0x320(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x61b0
jmp 0x25404
movq -0x370(%rbp), %rdi
leaq -0x300(%rbp), %rsi
leaq -0x320(%rbp), %rdx
leaq -0x2e0(%rbp), %rcx
callq 0x1dc90
jmp 0x25427
leaq -0x320(%rbp), %rdi
callq 0x6828
leaq -0x300(%rbp), %rdi
callq 0x6828
movl $0x0, -0x324(%rbp)
movslq -0x324(%rbp), %rax
movq %rax, -0x3c0(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x6630
movq %rax, %rcx
movq -0x3c0(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x255d8
movslq -0x324(%rbp), %rsi
leaq -0x2e0(%rbp), %rdi
callq 0x9080
movq %rax, %rdi
callq 0x6320
cmpq $0x1, %rax
jne 0x25507
movslq -0x324(%rbp), %rsi
leaq -0x260(%rbp), %rdi
callq 0x6810
movq %rax, -0x3c8(%rbp)
jmp 0x254b7
movq -0x3c8(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x3d4(%rbp)
movslq -0x324(%rbp), %rsi
leaq -0x2e0(%rbp), %rdi
callq 0x9080
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x6810
movq %rax, -0x3d0(%rbp)
jmp 0x254ef
movl -0x3d4(%rbp), %eax
movq -0x3d0(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0x255c2
movslq -0x324(%rbp), %rsi
leaq -0x2e0(%rbp), %rdi
callq 0x9080
movq %rax, -0x3e0(%rbp)
movl -0x1e4(%rbp), %eax
movl -0x2a4(%rbp), %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
cltq
leaq (%rax,%rax,2), %rax
leaq -0x1b0(%rbp,%rax,8), %rdi
movl -0x38(%rbp), %eax
movl -0x324(%rbp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
callq 0x9080
movq -0x3e0(%rbp), %rsi
movq %rax, %rdi
callq 0x6070
jmp 0x25566
jmp 0x255c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
jmp 0x25a05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
jmp 0x255b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x6828
leaq -0x300(%rbp), %rdi
callq 0x6828
jmp 0x25a05
jmp 0x255c4
movl -0x324(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x324(%rbp)
jmp 0x25449
movslq -0x324(%rbp), %rax
movq %rax, -0x3e8(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x6630
movq %rax, %rcx
movq -0x3e8(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x25607
jmp 0x25626
leaq 0x2ffdf(%rip), %rdi     # 0x555ed
leaq 0x2ffec(%rip), %rsi     # 0x55601
movl $0x725, %edx            # imm = 0x725
leaq 0x3007b(%rip), %rcx     # 0x5569c
callq 0x62f0
movslq -0x324(%rbp), %rsi
leaq -0x2e0(%rbp), %rdi
callq 0x9080
movq %rax, %rsi
leaq -0x348(%rbp), %rdi
callq 0x61b0
jmp 0x2564a
leaq -0x348(%rbp), %rdi
callq 0x6630
cmpq $0x0, %rax
jbe 0x25935
leaq -0x348(%rbp), %rdi
callq 0x6630
cmpq $0x1, %rax
jbe 0x25882
xorl %eax, %eax
movl %eax, %esi
leaq -0x348(%rbp), %rdi
callq 0x6810
movq %rax, -0x3f0(%rbp)
jmp 0x2568f
movq -0x3f0(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x3fc(%rbp)
movslq -0x324(%rbp), %rsi
leaq -0x260(%rbp), %rdi
callq 0x6810
movq %rax, -0x3f8(%rbp)
jmp 0x256bb
movl -0x3fc(%rbp), %eax
movq -0x3f8(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x25836
movl -0x1e4(%rbp), %eax
movl -0x2a4(%rbp), %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
cltq
leaq (%rax,%rax,2), %rax
leaq -0x1b0(%rbp,%rax,8), %rdi
movl -0x38(%rbp), %eax
movl -0x324(%rbp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
callq 0x9080
movq %rax, %rdi
leaq 0x30321(%rip), %rsi     # 0x55a32
callq 0x125e0
movb %al, -0x3fd(%rbp)
jmp 0x2571e
movb -0x3fd(%rbp), %al
testb $0x1, %al
jne 0x2572a
jmp 0x2578b
movl -0x1e4(%rbp), %eax
movl -0x2a4(%rbp), %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
cltq
leaq (%rax,%rax,2), %rax
leaq -0x1b0(%rbp,%rax,8), %rdi
movl -0x38(%rbp), %eax
movl -0x324(%rbp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
callq 0x9080
movq %rax, %rdi
leaq -0x348(%rbp), %rsi
callq 0x6070
jmp 0x2576f
jmp 0x25834
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
jmp 0x259f9
leaq -0x348(%rbp), %rdi
movq %rdi, -0x408(%rbp)
callq 0x6320
movq -0x408(%rbp), %rsi
movq %rax, %rcx
decq %rcx
leaq -0x368(%rbp), %rdi
movl $0x1, %edx
callq 0x6460
jmp 0x257be
movl -0x1e4(%rbp), %eax
movl -0x2a4(%rbp), %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
cltq
leaq (%rax,%rax,2), %rax
leaq -0x1b0(%rbp,%rax,8), %rdi
movl -0x38(%rbp), %eax
movl -0x324(%rbp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
callq 0x9080
movq %rax, %rdi
leaq -0x368(%rbp), %rsi
callq 0x6560
jmp 0x25803
leaq -0x368(%rbp), %rdi
callq 0x6828
jmp 0x25834
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1c0(%rbp)
movl %eax, -0x1c4(%rbp)
leaq -0x368(%rbp), %rdi
callq 0x6828
jmp 0x259f9
jmp 0x2587d
movl -0x1e4(%rbp), %eax
movl -0x2a4(%rbp), %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
cltq
leaq (%rax,%rax,2), %rax
leaq -0x1b0(%rbp,%rax,8), %rdi
movl -0x38(%rbp), %eax
movl -0x324(%rbp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
callq 0x9080
movq %rax, %rdi
leaq -0x348(%rbp), %rsi
callq 0x6070
jmp 0x2587b
jmp 0x2587d
jmp 0x25933
movslq -0x324(%rbp), %rsi
leaq -0x260(%rbp), %rdi
callq 0x6810
movq %rax, -0x410(%rbp)
jmp 0x2589e
movq -0x410(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x41c(%rbp)
movslq -0x324(%rbp), %rsi
leaq -0x2e0(%rbp), %rdi
callq 0x9080
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x6810
movq %rax, -0x418(%rbp)
jmp 0x258d6
movl -0x41c(%rbp), %eax
movq -0x418(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0x25931
movl -0x1e4(%rbp), %eax
movl -0x2a4(%rbp), %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
cltq
leaq (%rax,%rax,2), %rax
leaq -0x1b0(%rbp,%rax,8), %rdi
movl -0x38(%rbp), %eax
movl -0x324(%rbp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
callq 0x9080
movq %rax, %rdi
leaq -0x348(%rbp), %rsi
callq 0x6070
jmp 0x2592f
jmp 0x25931
jmp 0x25933
jmp 0x2597c
movl -0x1e4(%rbp), %eax
movl -0x2a4(%rbp), %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
cltq
leaq (%rax,%rax,2), %rax
leaq -0x1b0(%rbp,%rax,8), %rdi
movl -0x38(%rbp), %eax
movl -0x324(%rbp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
callq 0x9080
movq %rax, %rdi
leaq 0x2fc2b(%rip), %rsi     # 0x5559e
callq 0x65c0
jmp 0x2597a
jmp 0x2597c
movl 0x28(%rbp), %eax
movl %eax, -0x420(%rbp)
leaq -0x50(%rbp), %rdi
movslq 0x20(%rbp), %rsi
callq 0x19a60
movl -0x420(%rbp), %ecx
movl %ecx, (%rax)
movq -0x28(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x34fe0
jmp 0x259ac
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1c8(%rbp)
leaq -0x348(%rbp), %rdi
callq 0x6828
leaq -0x2e0(%rbp), %rdi
callq 0x13370
leaq -0x2c8(%rbp), %rdi
callq 0x6828
leaq -0x2a0(%rbp), %rax
movq %rax, -0x430(%rbp)
addq $0x40, %rax
movq %rax, -0x428(%rbp)
jmp 0x25a1f
leaq -0x348(%rbp), %rdi
callq 0x6828
leaq -0x2e0(%rbp), %rdi
callq 0x13370
leaq -0x2c8(%rbp), %rdi
callq 0x6828
jmp 0x25a6a
movq -0x428(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x438(%rbp)
callq 0x6828
movq -0x430(%rbp), %rcx
movq -0x438(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x428(%rbp)
jne 0x25a1f
leaq -0x260(%rbp), %rdi
callq 0x6828
leaq -0x240(%rbp), %rdi
callq 0x32c60
jmp 0x25ace
leaq -0x2a0(%rbp), %rax
movq %rax, -0x448(%rbp)
addq $0x40, %rax
movq %rax, -0x440(%rbp)
movq -0x440(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x450(%rbp)
callq 0x6828
movq -0x448(%rbp), %rcx
movq -0x450(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x440(%rbp)
jne 0x25a83
leaq -0x260(%rbp), %rdi
callq 0x6828
leaq -0x240(%rbp), %rdi
callq 0x32c60
jmp 0x25ae8
leaq -0x1b8(%rbp), %rdi
callq 0x35020
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
leaq -0x1b8(%rbp), %rdi
callq 0x35020
movq -0x1c0(%rbp), %rdi
callq 0x6750