// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Overlaps.cpp
// Function: get_trio_labs(buf_t*, ma_ug_t*, Trio_counter*)
void get_trio_labs(buf_t* b, ma_ug_t *ug, Trio_counter* flag)
{    
    flag->father_occ = flag->mother_occ = flag->ambig_occ = flag->drop_occ = 0;
    uint32_t i, v, k, rId;
    if(ug == NULL)
    {
        for (i = 0; i < b->b.n; ++i)
        {
            if(R_INF.trio_flag[b->b.a[i]>>1]==FATHER)
            {
                flag->father_occ++;
            }
            else if(R_INF.trio_flag[b->b.a[i]>>1]==MOTHER)
            {
                flag->mother_occ++;
            }
            else if(R_INF.trio_flag[b->b.a[i]>>1]==AMBIGU)
            {
                flag->ambig_occ++;
            }
            else if(R_INF.trio_flag[b->b.a[i]>>1]==DROP)
            {
                flag->drop_occ++;
            }
        }
    }
    else
    {
        ma_utg_t* u = NULL;
        for (i = 0; i < b->b.n; ++i)
        {
            v = b->b.a[i]>>1;
            u = &(ug->u.a[v]);
            if(u->m == 0) continue;
            for (k = 0; k < u->n; k++)
            {
                rId = u->a[k]>>33;
                if(R_INF.trio_flag[rId]==FATHER)
                {
                    flag->father_occ++;
                }
                else if(R_INF.trio_flag[rId]==MOTHER)
                {
                    flag->mother_occ++;
                }
                else if(R_INF.trio_flag[rId]==AMBIGU)
                {
                    flag->ambig_occ++;
                }
                else if(R_INF.trio_flag[rId]==DROP)
                {
                    flag->drop_occ++;
                }
            }
        }
    }

    flag->total = flag->father_occ + flag->mother_occ + flag->ambig_occ + flag->drop_occ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
movq 0x38(%rdi), %rax
testq %rsi, %rsi
je 0xcdcf5
testq %rax, %rax
je 0xcdd60
movq 0x48(%rdi), %r9
movq 0x10(%rsi), %r10
leaq 0x1c85c7(%rip), %rcx    # 0x296230
movq 0x28(%rcx), %r11
xorl %esi, %esi
leaq 0x16815a(%rip), %rbx    # 0x235dd0
xorl %edi, %edi
xorl %r8d, %r8d
xorl %ecx, %ecx
xorl %r14d, %r14d
movl (%r9,%r14,4), %r15d
shrl %r15d
leaq (%r15,%r15,4), %r15
cmpl $0x0, 0xc(%r10,%r15,8)
je 0xcdce8
leaq (%r10,%r15,8), %r12
movl 0x10(%r12), %r15d
testq %r15, %r15
je 0xcdce8
movq 0x18(%r12), %r12
xorl %r13d, %r13d
movq (%r12,%r13,8), %rbp
shrq $0x21, %rbp
movzbl (%r11,%rbp), %ebp
cmpq $0x5, %rbp
ja 0xcdce0
movslq (%rbx,%rbp,4), %rbp
addq %rbx, %rbp
jmpq *%rbp
incl %r8d
movl %r8d, 0x8(%rdx)
jmp 0xcdce0
incl %edi
movl %edi, 0x4(%rdx)
jmp 0xcdce0
incl %esi
movl %esi, (%rdx)
jmp 0xcdce0
incl %ecx
movl %ecx, 0xc(%rdx)
incq %r13
cmpq %r13, %r15
jne 0xcdca9
incq %r14
movl %r14d, %r15d
cmpq %r15, %rax
ja 0xcdc80
jmp 0xcdd69
testq %rax, %rax
je 0xcdd60
leaq 0x1c852f(%rip), %rcx    # 0x296230
movq 0x28(%rcx), %r9
movq 0x48(%rdi), %r10
xorl %r11d, %r11d
leaq 0x1680d5(%rip), %rbx    # 0x235de8
xorl %esi, %esi
xorl %edi, %edi
xorl %r8d, %r8d
xorl %ecx, %ecx
movl (%r10,%r11,4), %r14d
shrl %r14d
movzbl (%r9,%r14), %r14d
cmpq $0x5, %r14
ja 0xcdd53
movslq (%rbx,%r14,4), %r14
addq %rbx, %r14
jmpq *%r14
incl %r8d
movl %r8d, 0x8(%rdx)
jmp 0xcdd53
incl %edi
movl %edi, 0x4(%rdx)
jmp 0xcdd53
incl %esi
movl %esi, (%rdx)
jmp 0xcdd53
incl %ecx
movl %ecx, 0xc(%rdx)
incq %r11
movl %r11d, %r14d
cmpq %r14, %rax
ja 0xcdd1c
jmp 0xcdd69
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %edi, %edi
xorl %esi, %esi
addl %r8d, %ecx
addl %esi, %edi
addl %ecx, %edi
movl %edi, 0x10(%rdx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq