// File: /workspace/github_cpp_makefile_star2_O2/medvedevgroup[P]varmatch/src/wholegenome.cpp
// Function: WholeGenome::ConstructMatchRecordNoGenotype(SequencePath&, std::vector<DiploidVariant, std::allocator<DiploidVariant>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, int, int, int, int, int)
void WholeGenome::ConstructMatchRecordNoGenotype(SequencePath & best_path,
                                                 vector<DiploidVariant> & variant_list,
                                                 string & subsequence,
                                                 int offset,
                                                 int thread_index,
                                                 int chr_id,
                                                 int mode_index,
                                                 int threshold_index){
    int truth_num = 0;
    int predict_num = 0;

    int truth_edit_distance = 0;
    int predict_edit_distance = 0;

    bool need_match_record = false;
    if(threshold_index == 0) need_match_record = true;

    bool multiple_match = false;
    string parsimonious_ref = subsequence;
    string parsimonious_alt0 = best_path.donor_sequences[0];
    string parsimonious_alt1 = best_path.donor_sequences[0];

    int parsimonious_pos = offset;

//    NormalizeVariantSequence(offset,
//                             parsimonious_ref,
//                             parsimonious_alt0,
//                             parsimonious_alt1,
//                             chr_id);

    string match_record = chrname_by_chrid[chr_id] + "\t" + to_string(parsimonious_pos+1) + "\t" + parsimonious_ref + "\t" + parsimonious_alt0;
    //if(multiple_match) match_record += "/" + parsimonious_alt1;

    string vcf_record[2];
    string phasing_record[2];

    for (int i = 0; i < 2; i++) {
        for (int var_index = 0; var_index < variant_list.size(); var_index++) {
            DiploidVariant variant = variant_list[var_index];
            if(variant.flag != i) continue;
            //The exact wording from the C++ standard is (§4.7/4): "If the source type is bool,
            // the value false is converted to zero and the value true is converted to one."
            int phasing = best_path.choice_vector[var_index];
            if(phasing <= NOT_USE) continue;
            int edit_distance = CalculateEditDistance(variant, phasing, 1);
            if(i == 0){
                truth_num ++;
                truth_edit_distance += edit_distance;
            }else{
                predict_num ++;
                predict_edit_distance += edit_distance;
            }

            if(need_match_record){
                string alt_string = variant.alts[0];
                if(variant.multi_alts){
                    alt_string += "/" + variant.alts[1];
                }
                string phasing_string = "";
                if(phasing == 0){
                    phasing_string += "1|1";
                }else if(phasing == 1){
                    phasing_string += "2|2";
                }
                string variant_record = to_string(variant.pos+1) + "," + variant.ref + "," + alt_string;
                vcf_record[i] += variant_record;
                phasing_record[i] += phasing_string;
                vcf_record[i] += ";";
                phasing_record[i] += ";";
            }
        }
        if(need_match_record){
            vcf_record[i] = vcf_record[i].substr(0, vcf_record[i].size()-1);
            phasing_record[i] = phasing_record[i].substr(0, phasing_record[i].size()-1);
        }

    }

    if(need_match_record){
       match_record += "\t" + vcf_record[0] + "\t" + vcf_record[1];
        match_record += "\t" + phasing_record[0] + "\t" + phasing_record[1];
       match_record += "\t" + to_string(best_path.score) + "\n";
       //complex_match_records[thread_index]->push_back(match_record);
       // this line should be recovered
       match_records_by_mode_by_thread[thread_index][mode_index]->push_back(match_record);
    }

    baseline_total_match_num[thread_index][threshold_index]->at(mode_index) += truth_num;
    query_total_match_num[thread_index][threshold_index]->at(mode_index) += predict_num;

    baseline_total_edit_distance[thread_index][threshold_index]->at(mode_index) += truth_edit_distance;
    query_total_edit_distance[thread_index][threshold_index]->at(mode_index) += predict_edit_distance;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movl %r9d, %ebp
movl %r8d, %ebx
movq %rdx, 0xd8(%rsp)
movq %rsi, %r12
movq %rdi, %r14
leaq 0x1c8(%rsp), %rdi
movq %rcx, %rsi
callq 0x53f0
movq %r12, 0x78(%rsp)
addq $0xd0, %r12
leaq 0x1a8(%rsp), %rdi
movq %r12, %rsi
callq 0x53f0
leaq 0x248(%rsp), %rdi
movq %r12, %rsi
callq 0x53f0
leaq 0xb8(%r14), %rdi
leaq 0x2c0(%rsp), %rsi
callq 0x19a5a
leaq 0xd90b(%rip), %rdx      # 0x225a9
leaq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x96b0
incl %ebx
leaq 0xe0(%rsp), %rdi
movl %ebx, %esi
callq 0x8011
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x94bb
leaq 0xd8cf(%rip), %rdx      # 0x225a9
leaq 0x120(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x7fce
leaq 0x160(%rsp), %rdi
leaq 0x120(%rsp), %rsi
leaq 0x1c8(%rsp), %rdx
callq 0x9691
leaq 0xd899(%rip), %rdx      # 0x225a9
leaq 0x80(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x7fce
leaq 0x100(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x1a8(%rsp), %rdx
callq 0x9691
leaq 0x80(%rsp), %rdi
callq 0x55e8
leaq 0x160(%rsp), %rdi
callq 0x55e8
leaq 0x120(%rsp), %rdi
callq 0x55e8
leaq 0x40(%rsp), %rdi
callq 0x55e8
leaq 0xe0(%rsp), %rdi
callq 0x55e8
leaq 0x20(%rsp), %rdi
callq 0x55e8
pushq $0x10
popq %rax
leaq (%rsp,%rax), %rcx
addq $0x160, %rcx            # imm = 0x160
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
addq $0x20, %rax
cmpq $0x50, %rax
jne 0x14d8d
movl %ebp, 0xc(%rsp)
movq %r14, 0x70(%rsp)
pushq $0x10
popq %rax
leaq (%rsp,%rax), %rcx
addq $0x120, %rcx            # imm = 0x120
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
addq $0x20, %rax
cmpq $0x50, %rax
jne 0x14dba
xorl %r15d, %r15d
leaq 0x80(%rsp), %r13
movl $0x0, 0x1c(%rsp)
movl $0x0, 0x14(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
cmpq $0x2, %r15
je 0x150e4
movq %r15, %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %rcx
addq $0x160, %rcx            # imm = 0x160
movq %rcx, 0x68(%rsp)
addq %rsp, %rax
addq $0x120, %rax            # imm = 0x120
movq %rax, 0x60(%rsp)
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0xd8(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rax
subq %rsi, %rax
cqto
pushq $0x58
popq %rcx
idivq %rcx
cmpq %r12, %rax
jbe 0x1507a
addq %rbp, %rsi
movq %r13, %rdi
callq 0x1a174
movzbl 0xcc(%rsp), %eax
cmpq %rax, %r15
jne 0x15066
movq 0x78(%rsp), %rax
movq 0x168(%rax), %rax
movl (%rax,%r12,4), %ebx
cmpl $-0x8, %ebx
jl 0x15066
movq 0x70(%rsp), %rdi
movq %r13, %rsi
movl %ebx, %edx
pushq $0x1
popq %rcx
callq 0x104ac
testq %r15, %r15
je 0x14eb3
incl 0x18(%rsp)
addl %eax, 0x1c(%rsp)
jmp 0x14ebb
incl 0x10(%rsp)
addl %eax, 0x14(%rsp)
cmpl $0x0, 0x2d0(%rsp)
jne 0x15066
movq 0xa8(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x53f0
cmpb $0x1, 0xc1(%rsp)
leaq 0x20(%rsp), %rdi
jne 0x14f23
movq %r13, %r14
movq 0xa8(%rsp), %rdx
addq $0x20, %rdx
movq %rdi, %r13
leaq 0xd6a8(%rip), %rsi      # 0x225ab
callq 0x9dae
leaq 0x40(%rsp), %rdi
movq %r13, %rsi
callq 0x55c0
movq %r13, %rdi
callq 0x55e8
movq %r13, %rdi
movq %r14, %r13
leaq 0xd680(%rip), %rsi      # 0x225aa
leaq 0xe0(%rsp), %rdx
callq 0x72ee
leaq 0xd90b(%rip), %rsi      # 0x22849
cmpl $0x1, %ebx
je 0x14f4e
testl %ebx, %ebx
jne 0x14f58
leaq 0xd8f7(%rip), %rsi      # 0x22845
leaq 0x20(%rsp), %rdi
callq 0x55a0
movl 0x80(%rsp), %esi
incl %esi
leaq 0x1e8(%rsp), %rbx
movq %rbx, %rdi
callq 0x8011
leaq 0x208(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
leaq 0xd5c3(%rip), %rdx      # 0x22549
callq 0x7fce
leaq 0x228(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
leaq 0x88(%rsp), %rdx
callq 0x9691
leaq 0x268(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
leaq 0xd58e(%rip), %rdx      # 0x22549
callq 0x7fce
leaq 0xe0(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
leaq 0x40(%rsp), %rdx
callq 0x9691
movq %r14, %rdi
callq 0x55e8
leaq 0x228(%rsp), %rdi
callq 0x55e8
leaq 0x208(%rsp), %rdi
callq 0x55e8
leaq 0x1e8(%rsp), %rdi
callq 0x55e8
movq 0x68(%rsp), %rdi
movq %rbx, %rsi
callq 0x55c0
movq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x55c0
movq 0x68(%rsp), %rdi
leaq 0xd814(%rip), %rsi      # 0x22843
callq 0x55a0
movq 0x60(%rsp), %rdi
leaq 0xd803(%rip), %rsi      # 0x22843
callq 0x55a0
leaq 0xe0(%rsp), %rdi
callq 0x55e8
leaq 0x20(%rsp), %rdi
callq 0x55e8
leaq 0x40(%rsp), %rdi
callq 0x55e8
movq %r13, %rdi
callq 0x19c16
incq %r12
addq $0x58, %rbp
jmp 0x14e3a
cmpl $0x0, 0x2d0(%rsp)
jne 0x150dc
movq 0x68(%rsp), %rbx
movq 0x8(%rbx), %rcx
decq %rcx
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x5320
movq %rbx, %rdi
movq %r13, %rsi
callq 0x5390
movq %r13, %rdi
callq 0x55e8
movq 0x60(%rsp), %rbx
movq 0x8(%rbx), %rcx
decq %rcx
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x5320
movq %rbx, %rdi
movq %r13, %rsi
callq 0x5390
movq %r13, %rdi
callq 0x55e8
incq %r15
jmp 0x14e06
cmpl $0x0, 0x2d0(%rsp)
je 0x15105
movslq 0xc(%rsp), %r14
movslq 0x2c8(%rsp), %rbx
movq 0x70(%rsp), %r12
jmp 0x152ae
leaq 0xd49d(%rip), %rsi      # 0x225a9
leaq 0x20(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x9dae
movq 0x70(%rsp), %r12
movl 0xc(%rsp), %ebx
leaq 0xd47b(%rip), %rdx      # 0x225a9
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x7fce
leaq 0x180(%rsp), %rdx
leaq 0x80(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x9691
leaq 0x100(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x55c0
leaq 0x80(%rsp), %rdi
callq 0x55e8
leaq 0x40(%rsp), %rdi
callq 0x55e8
leaq 0x20(%rsp), %rdi
callq 0x55e8
leaq 0xd415(%rip), %rsi      # 0x225a9
leaq 0x20(%rsp), %rdi
leaq 0x120(%rsp), %rdx
callq 0x9dae
leaq 0xd3fc(%rip), %rdx      # 0x225a9
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x7fce
leaq 0x140(%rsp), %rdx
leaq 0x80(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x9691
leaq 0x100(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x55c0
leaq 0x80(%rsp), %rdi
callq 0x55e8
leaq 0x40(%rsp), %rdi
callq 0x55e8
leaq 0x20(%rsp), %rdi
callq 0x55e8
movq 0x78(%rsp), %rax
movl 0x158(%rax), %esi
leaq 0x20(%rsp), %rdi
callq 0x8011
leaq 0xd381(%rip), %rsi      # 0x225a9
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x7fed
leaq 0xbe2e(%rip), %rdx      # 0x2106c
leaq 0x80(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x7fce
leaq 0x100(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x55c0
leaq 0x80(%rsp), %rdi
callq 0x55e8
leaq 0x40(%rsp), %rdi
callq 0x55e8
leaq 0x20(%rsp), %rdi
callq 0x55e8
movq 0x178(%r12), %rax
movslq %ebx, %r14
movq (%rax,%r14,8), %rax
movslq 0x2c8(%rsp), %rbx
movq (%rax,%rbx,8), %rdi
leaq 0x100(%rsp), %rsi
callq 0xc896
movq 0x180(%r12), %rax
movq (%rax,%r14,8), %rax
movslq 0x2d0(%rsp), %r15
movq (%rax,%r15,8), %rdi
movq %rbx, %rsi
callq 0x1a1ca
movl 0x10(%rsp), %ecx
addl %ecx, (%rax)
movq 0x188(%r12), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%r15,8), %rdi
movq %rbx, %rsi
callq 0x1a1ca
movl 0x18(%rsp), %ecx
addl %ecx, (%rax)
movq 0x190(%r12), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%r15,8), %rdi
movq %rbx, %rsi
callq 0x1a1ca
movl 0x14(%rsp), %ecx
addl %ecx, (%rax)
movq 0x198(%r12), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%r15,8), %rdi
movq %rbx, %rsi
callq 0x1a1ca
movl 0x1c(%rsp), %ecx
addl %ecx, (%rax)
pushq $0x20
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0x55e8
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x15331
pushq $0x20
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x55e8
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x1534e
leaq 0x100(%rsp), %rdi
callq 0x55e8
leaq 0x248(%rsp), %rdi
callq 0x55e8
leaq 0x1a8(%rsp), %rdi
callq 0x55e8
leaq 0x1c8(%rsp), %rdi
callq 0x55e8
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x153c4
jmp 0x153d6
jmp 0x153e5
jmp 0x15514
jmp 0x153c4
jmp 0x153d6
jmp 0x153e5
jmp 0x15514
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x55e8
jmp 0x153d9
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x55e8
jmp 0x153e8
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x55e8
jmp 0x15517
jmp 0x15514
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x55e8
jmp 0x15411
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x55e8
jmp 0x15423
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
callq 0x55e8
jmp 0x15435
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x55e8
jmp 0x15444
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x55e8
leaq 0x20(%rsp), %rdi
jmp 0x1555b
movq %rax, %rbx
jmp 0x15451
movq %rax, %rbx
jmp 0x1556d
movq %rax, %rbx
jmp 0x1557a
movq %rax, %rbx
jmp 0x15560
jmp 0x15514
jmp 0x15514
jmp 0x15514
jmp 0x1549e
jmp 0x1548d
jmp 0x1548d
movq %rax, %rbx
jmp 0x154f1
jmp 0x154dc
movq %rax, %rbx
jmp 0x154d2
movq %rax, %rbx
jmp 0x154c5
movq %rax, %rbx
jmp 0x154fb
movq %rax, %rbx
jmp 0x154b8
movq %rax, %rbx
leaq 0x268(%rsp), %rdi
callq 0x55e8
leaq 0x228(%rsp), %rdi
callq 0x55e8
leaq 0x208(%rsp), %rdi
callq 0x55e8
leaq 0x1e8(%rsp), %rdi
jmp 0x154ec
movq %rax, %rbx
jmp 0x15505
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x55e8
leaq 0x20(%rsp), %rdi
callq 0x55e8
leaq 0x40(%rsp), %rdi
callq 0x55e8
leaq 0x80(%rsp), %rdi
callq 0x19c16
jmp 0x15517
movq %rax, %rbx
pushq $0x20
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0x55e8
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x1551b
pushq $0x20
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x55e8
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x15539
leaq 0x100(%rsp), %rdi
callq 0x55e8
leaq 0x248(%rsp), %rdi
callq 0x55e8
leaq 0x1a8(%rsp), %rdi
callq 0x55e8
leaq 0x1c8(%rsp), %rdi
callq 0x55e8
movq %rbx, %rdi
callq 0x5540