// File: chhylp123[P]hifiasm/Correct.cpp
// Function: merge_snp_vectors_and_test(haplotype_evdience_alloc*, int)
int merge_snp_vectors_and_test(haplotype_evdience_alloc* hap, int diff_vector_ID)
{
    int8_t *r_vector = Get_Result_SNP_Vector((*hap));
    int vectorLen = Get_SNP_Vector_Length((*hap));
    memset(r_vector, -1, vectorLen);
    hap->result_stat.occ_0 = 0;
    hap->result_stat.occ_1 = 0;

    int8_t* vector;
    int vectorID;
    int i, j;

    for (i = 0; i < (int)hap->core_snp; i++)
    {
        if(i == diff_vector_ID)
        {
            continue;
        }

        vectorID = hap->snp_stat.a[i].id;
        vector = Get_SNP_Vector((*hap), vectorID);

        for (j = 0; j < vectorLen; j++)
        {
            if(r_vector[j] == -1)
            {
                if(vector[j] == 0)
                {
                    hap->result_stat.occ_0++;
                    r_vector[j] = vector[j];
                }
                else if(vector[j] == 1)
                {
                    hap->result_stat.occ_1++;
                    r_vector[j] = vector[j];
                }
            }
            else ///can debug here
            {
                ///has confilict
                if(vector[j] != -1 && vector[j] != 2 && vector[j] != r_vector[j])
                {
                    return 0;
                }
            }
        }
    }

    hap->result_stat.overlap_num = hap->result_stat.occ_0 + hap->result_stat.occ_1;

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x1e0(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x1c8(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x24(%rbp), %rdx
movl $0xff, %esi
callq 0x2100
movq -0x10(%rbp), %rax
movl $0x0, 0x1f4(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x1f8(%rax)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1c4(%rcx), %eax
jge 0x3e564
movl -0x38(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x3e420
jmp 0x3e556
movq -0x10(%rbp), %rax
movq 0x218(%rax), %rax
movslq -0x38(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movq 0x1d0(%rax), %rax
movq -0x10(%rbp), %rcx
movl 0x1c8(%rcx), %ecx
imull -0x34(%rbp), %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x3e554
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $-0x1, %eax
jne 0x3e4fb
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x3e4bd
movq -0x10(%rbp), %rax
movl 0x1f4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1f4(%rax)
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x3e4f9
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x1, %eax
jne 0x3e4f7
movq -0x10(%rbp), %rax
movl 0x1f8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1f8(%rax)
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x3e4f9
jmp 0x3e544
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $-0x1, %eax
je 0x3e542
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2, %eax
je 0x3e542
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x20(%rbp), %rcx
movslq -0x3c(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0x3e542
movl $0x0, -0x4(%rbp)
jmp 0x3e589
jmp 0x3e544
jmp 0x3e546
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3e464
jmp 0x3e556
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x3e400
movq -0x10(%rbp), %rax
movl 0x1f4(%rax), %ecx
movq -0x10(%rbp), %rax
addl 0x1f8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1f0(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)