// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: update_dump_trio(unsigned char*, unsigned int, unsigned char*, ma_ug_t*)
void update_dump_trio(uint8_t* trio_flag, uint32_t rn, uint8_t *rf, ma_ug_t *ug)
{
    uint32_t k, i, x;
    ma_utg_t *p = NULL; 
    if(ug) {
        for (i = 0; i < ug->u.n; ++i) { // the Segment lines in GFA
            p = &ug->u.a[i];
            if(p->m == 0) continue;
            for (k = 0; k < p->n; k++) {
                x = p->a[k]>>33;
                if(trio_flag[x] == FATHER || trio_flag[x] == MOTHER) {
                    rf[x] = trio_flag[x];
                } else if(rf[x] != FATHER && rf[x] != MOTHER) {
                    rf[x] = DROP;
                }
            }
        }
    } else {
        for (i = 0; i < rn; i++) {
            if(rf[i]) {
                rf[i] <<= 1; rf[i] += 1;
            } else {
                rf[i] = trio_flag[i]; rf[i] <<= 1;
            }

            if(trio_flag[i] == FATHER || trio_flag[i] == MOTHER) {
                trio_flag[i] = ((rf[i]&1)?MOTHER:FATHER);
            } else {
                trio_flag[i] = ((rf[i]&1)?DROP:AMBIGU);
            }
        }
    }    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x100797
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x100792
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x28(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x1006e2
jmp 0x100784
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x100782
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x24(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movl -0x2c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
je 0x10072f
movq -0x8(%rbp), %rax
movl -0x2c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
jne 0x100745
movq -0x8(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb %dl, (%rax,%rcx)
jmp 0x100772
movq -0x18(%rbp), %rax
movl -0x2c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
je 0x100770
movq -0x18(%rbp), %rax
movl -0x2c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
je 0x100770
movq -0x18(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb $0x5, (%rax,%rcx)
jmp 0x100772
jmp 0x100774
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1006e9
jmp 0x100784
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x1006ad
jmp 0x100883
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x100881
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
cmpb $0x0, (%rax,%rcx)
je 0x1007da
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movzbl (%rax,%rcx), %edx
shll %edx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movzbl (%rax,%rcx), %edx
addl $0x1, %edx
movb %dl, (%rax,%rcx)
jmp 0x1007fe
movq -0x8(%rbp), %rax
movl -0x28(%rbp), %ecx
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movzbl (%rax,%rcx), %edx
shll %edx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rax
movl -0x28(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
je 0x10081e
movq -0x8(%rbp), %rax
movl -0x28(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
jne 0x10084a
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movzbl (%rax,%rcx), %edx
andl $0x1, %edx
movl $0x1, %eax
movl $0x2, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movl -0x28(%rbp), %ecx
movb %dl, (%rax,%rcx)
jmp 0x100871
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
movzbl (%rax,%rcx), %edx
andl $0x1, %edx
xorl %eax, %eax
movl $0x5, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movl -0x28(%rbp), %ecx
movb %dl, (%rax,%rcx)
jmp 0x100873
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x10079e
jmp 0x100883
popq %rbp
retq
nopw %cs:(%rax,%rax)