// File: chhylp123[P]hifiasm/hic.cpp
// Function: label_unitigs(G_partition*, ma_ug_t*)
void label_unitigs(G_partition* g_p, ma_ug_t* ug)
{
    memset(R_INF.trio_flag, AMBIGU, R_INF.total_reads * sizeof(uint8_t));
    uint32_t i, k, j, *h0, h0_n, *h1, h1_n, uID, *h = NULL, h_n, flag = AMBIGU;
    int status;
    ma_utg_t *u = NULL;

    for (i = 0; i < g_p->n; i++)
    {
        if(g_p->a[i].h[0] > 0 && g_p->a[i].status[0] != 1 && g_p->a[i].status[0] != -1) continue;
        if(g_p->a[i].h[1] > 0 && g_p->a[i].status[1] != 1 && g_p->a[i].status[1] != -1) continue;
        get_phased_block(g_p, NULL, i, NULL, NULL, &h0, &h0_n, &h1, &h1_n, NULL, NULL);

        status = g_p->a[i].status[0];
        h = h0; h_n = h0_n;
        if(status == 1)
        {
            flag = FATHER;
        }
        else if (status == -1)
        {
            flag = MOTHER;
        }
        for (j = 0; j < h_n; j++)
        {
            uID = h[j];
            u = &ug->u.a[uID];
            if(u->m == 0) continue;
            for (k = 0; k < u->n; k++)
            {
                R_INF.trio_flag[u->a[k]>>33] = flag;
            }
        }



        status = g_p->a[i].status[1];
        h = h1; h_n = h1_n;
        if(status == 1)
        {
            flag = FATHER;
        }
        else if (status == -1)
        {
            flag = MOTHER;
        }
        for (j = 0; j < h_n; j++)
        {
            uID = h[j];
            u = &ug->u.a[uID];
            if(u->m == 0) continue;
            for (k = 0; k < u->n; k++)
            {
                R_INF.trio_flag[u->a[k]>>33] = flag;
            }
        }
    }


    uint64_t occ = 0; 
    for (i = 0; i < ug->u.n; i++)
    {
        occ += ug->u.a[i].n;
    }

    ///fprintf(stderr, "# reads: %lu\n", occ);

    for (i = occ = 0; i < R_INF.total_reads; i++)
    {
        if(R_INF.trio_flag[i] == FATHER) occ++;
    }

    ///fprintf(stderr, "# Father reads: %lu\n", occ);

    for (i = occ = 0; i < R_INF.total_reads; i++)
    {
        if(R_INF.trio_flag[i] == MOTHER) occ++;
    }
    
    ///fprintf(stderr, "# Mother reads: %lu\n", occ);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x1c62e6(%rip), %rax    # 0x3c52d0
movq 0x28(%rax), %rdi
leaq 0x1c62db(%rip), %rax    # 0x3c52d0
movq 0x50(%rax), %rdx
shlq $0x0, %rdx
xorl %esi, %esi
callq 0x2100
movq $0x0, -0x48(%rbp)
movl $0x0, -0x50(%rbp)
movq $0x0, -0x60(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x1ff2d9
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x18(%rax)
jbe 0x1ff07f
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, 0x24(%rax)
je 0x1ff07f
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, 0x24(%rax)
je 0x1ff07f
jmp 0x1ff2cb
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x1c(%rax)
jbe 0x1ff0cc
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, 0x28(%rax)
je 0x1ff0cc
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, 0x28(%rax)
je 0x1ff0cc
jmp 0x1ff2cb
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, %edx
xorl %eax, %eax
movl %eax, %r8d
leaq -0x28(%rbp), %r9
leaq -0x2c(%rbp), %r11
leaq -0x38(%rbp), %r10
leaq -0x3c(%rbp), %rax
movq %r8, %rsi
movq %r8, %rcx
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
callq 0x214690
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x24(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x1, -0x54(%rbp)
jne 0x1ff14a
movl $0x1, -0x50(%rbp)
jmp 0x1ff159
cmpl $-0x1, -0x54(%rbp)
jne 0x1ff157
movl $0x2, -0x50(%rbp)
jmp 0x1ff159
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jae 0x1ff1ef
movq -0x48(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x40(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x1ff19b
jmp 0x1ff1e1
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x1ff1df
movl -0x50(%rbp), %eax
movb %al, %dl
leaq 0x1c6116(%rip), %rax    # 0x3c52d0
movq 0x28(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl -0x18(%rbp), %esi
movq (%rcx,%rsi,8), %rcx
shrq $0x21, %rcx
movb %dl, (%rax,%rcx)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1ff1a2
jmp 0x1ff1e1
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1ff160
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x28(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x1, -0x54(%rbp)
jne 0x1ff224
movl $0x1, -0x50(%rbp)
jmp 0x1ff233
cmpl $-0x1, -0x54(%rbp)
jne 0x1ff231
movl $0x2, -0x50(%rbp)
jmp 0x1ff233
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jae 0x1ff2c9
movq -0x48(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x40(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x1ff275
jmp 0x1ff2bb
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x1ff2b9
movl -0x50(%rbp), %eax
movb %al, %dl
leaq 0x1c603c(%rip), %rax    # 0x3c52d0
movq 0x28(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl -0x18(%rbp), %esi
movq (%rcx,%rsi,8), %rcx
shrq $0x21, %rcx
movb %dl, (%rax,%rcx)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1ff27c
jmp 0x1ff2bb
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1ff23a
jmp 0x1ff2cb
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1ff022
movq $0x0, -0x68(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x1ff31c
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1ff2e8
movq $0x0, -0x68(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0x1c5f9b(%rip), %rcx    # 0x3c52d0
cmpq 0x50(%rcx), %rax
jae 0x1ff36b
leaq 0x1c5f8e(%rip), %rax    # 0x3c52d0
movq 0x28(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
jne 0x1ff35e
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x1ff360
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1ff32b
movq $0x0, -0x68(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0x1c5f4c(%rip), %rcx    # 0x3c52d0
cmpq 0x50(%rcx), %rax
jae 0x1ff3ba
leaq 0x1c5f3f(%rip), %rax    # 0x3c52d0
movq 0x28(%rax), %rax
movl -0x14(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
jne 0x1ff3ad
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x1ff3af
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1ff37a
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)