// File: chhylp123[P]hifiasm/Purge_Dups.cpp
// Function: debug_p_g_t(p_g_t*, hap_cov_t*, asg_t*)
void debug_p_g_t(p_g_t* pg, hap_cov_t *cov, asg_t *read_g)
{
    fprintf(stderr, "----------[M::%s]----------\n", __func__);
    uint32_t i, offset, v, sid, eid, spos, epos, p_status, p_uid, occ;
    p_node_t *t = NULL;
    ma_utg_t *u = NULL;
    p_node_t *a = NULL;

    for (v = 0; v < pg->ug->u.n; v++)
    {
        ///fprintf(stderr, "\nu->n: %u, uid: %u\n", (uint32_t)(pg->ug->u.a[v].n), v);
        get_p_nodes(pg, &a, &occ, v);
        for (i = 0; i < occ; i++)
        {
            if(a[i].c_ug_id != v) fprintf(stderr, "sbsbsbsbsb\n");
            ///fprintf(stderr, "sid: %u, eid: %u\n", a[i].nodeBeg, a[i].nodeEnd);
        }
    }
    

    for (v = 0, p_status = (uint32_t)-1, p_uid = (uint32_t)-1; v < pg->pg_het_node.n; v++)
    {
        t = &(pg->pg_het_node.a[v]);
        sid = t->nodeBeg;
        eid = t->nodeEnd;
        spos = t->baseBeg;
        epos = t->baseEnd;
        // fprintf(stderr, "sid: %u, eid: %u, spos: %u, epos: %u, t->b_ug_id: %u\n", 
        //                                                 sid, eid, spos, epos, (uint32_t)t->b_ug_id);
        // fprintf(stderr, "pg->pg_het_node.n: %u\n", (uint32_t)pg->pg_het_node.n);
        if(p_uid == t->c_ug_id && p_status == t->h_status)
        {
            fprintf(stderr, "ERROR-(-1)\n");
        } 
        p_status = t->h_status;
        p_uid = t->c_ug_id;

        u = &(pg->ug->u.a[t->c_ug_id]);
        ///fprintf(stderr, "u->n: %u, sid: %u, eid: %u\n", (uint32_t)u->n, sid, eid);
        for (i = offset = 0; i < u->n; i++)
        {
            if(i == sid)
            {
                if(spos != offset)
                {
                    fprintf(stderr, "ERROR-1\n");
                }
            }

            if(i == eid)
            {
                if(epos != (offset+read_g->seq[u->a[i]>>33].len - 1))
                {
                    fprintf(stderr, "ERROR-2, real end: %u\n", 
                                    (uint32_t)(offset+read_g->seq[u->a[i]>>33].len - 1));
                }
            }
            offset += (uint32_t)u->a[i];
            if(i >= sid && i <= eid)
            {
                if(cov->t_ch->ir_het[u->a[i]>>33] != t->h_status)
                {
                    fprintf(stderr, "ERROR-(-3): is_r_het: %u, h_status: %u\n", cov->t_ch->ir_het[u->a[i]>>33], t->h_status);
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq 0x240da5(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x20a7da(%rip), %rsi    # 0x38da1f
leaq 0x20742a(%rip), %rdx    # 0x38a676
movb $0x0, %al
callq 0x22a0
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
cmpq (%rcx), %rax
jae 0x1832ec
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %ecx
leaq -0x58(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x17ad50
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jae 0x1832df
movq -0x58(%rbp), %rax
movl -0x1c(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
cmpl -0x24(%rbp), %eax
je 0x1832d2
movq 0x240d1f(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x2073b7(%rip), %rsi    # 0x38a682
movb $0x0, %al
callq 0x22a0
jmp 0x1832d4
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x18329c
jmp 0x1832e1
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x183272
movl $0x0, -0x24(%rbp)
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x3c(%rbp) # imm = 0xFFFFFFFF
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x183533
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x24(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x48(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x48(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x30(%rbp)
movq -0x48(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x34(%rbp)
movl -0x3c(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jne 0x18337f
movl -0x38(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jne 0x18337f
movq 0x240c72(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x207316(%rip), %rsi    # 0x38a68e
movb $0x0, %al
callq 0x22a0
movq -0x48(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rcx
movl 0x18(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x50(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x183523
movl -0x1c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x1833f8
movl -0x30(%rbp), %eax
cmpl -0x20(%rbp), %eax
je 0x1833f6
movq 0x240bfb(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x205663(%rip), %rsi    # 0x388a52
movb $0x0, %al
callq 0x22a0
jmp 0x1833f8
movl -0x1c(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jne 0x183478
movl -0x34(%rbp), %eax
movl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rdx
movq 0x20(%rdx), %rdx
movq -0x50(%rbp), %rsi
movq 0x18(%rsi), %rsi
movl -0x1c(%rbp), %edi
movq (%rsi,%rdi,8), %rsi
shrq $0x21, %rsi
movl (%rdx,%rsi,8), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
addl %edx, %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x183476
movq 0x240ba6(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movl -0x20(%rbp), %edx
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl -0x1c(%rbp), %esi
movq (%rcx,%rsi,8), %rcx
shrq $0x21, %rcx
movl (%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addl %eax, %edx
subl $0x1, %edx
leaq 0x20722b(%rip), %rsi    # 0x38a69a
movb $0x0, %al
callq 0x22a0
jmp 0x183478
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jb 0x183513
movl -0x1c(%rbp), %eax
cmpl -0x2c(%rbp), %eax
ja 0x183513
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rax
movq 0x10(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl -0x1c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x21, %rcx
movzbl (%rax,%rcx), %eax
movq -0x48(%rbp), %rcx
cmpl 0x14(%rcx), %eax
je 0x183511
movq 0x240b0d(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rax
movq 0x10(%rax), %rax
movq -0x50(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl -0x1c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x21, %rcx
movzbl (%rax,%rcx), %edx
movq -0x48(%rbp), %rax
movl 0x14(%rax), %ecx
leaq 0x2071a7(%rip), %rsi    # 0x38a6b1
movb $0x0, %al
callq 0x22a0
jmp 0x183513
jmp 0x183515
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1833be
jmp 0x183525
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x183301
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)