// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
movq 0x282aae(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x22a8c3(%rip), %rsi    # 0x23cdff
leaq 0x22757b(%rip), %rdx    # 0x239abe
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22b0
movq (%r14), %rax
movq (%rax), %rax
testq %rax, %rax
movq %r14, 0x38(%rsp)
je 0x125cb
pushq $0xb
popq %r13
pushq $0x1
popq %rbp
movq 0x40(%r14), %rdx
movl 0x4(%rdx,%rbx,8), %ecx
testq %rcx, %rcx
je 0x125c4
movq 0x18(%r14), %rax
movl (%rdx,%rbx,8), %edx
imulq $0x1c, %rdx, %rdx
leaq (%rax,%rdx), %r14
addq $0x18, %r14
imulq $0x1c, %rcx, %r15
xorl %r12d, %r12d
cmpl %ebx, (%r14,%r12)
jne 0x1259b
addq $0x1c, %r12
cmpq %r12, %r15
jne 0x1258a
jmp 0x125b9
movq 0x282a3e(%rip), %rax    # 0x294fe0
movq (%rax), %rcx
leaq 0x22751e(%rip), %rdi    # 0x239aca
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2410
jmp 0x12590
movq 0x38(%rsp), %r14
movq (%r14), %rax
movq (%rax), %rax
incl %ebx
cmpq %rbx, %rax
ja 0x12563
cmpq $0x0, 0x8(%r14)
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
je 0x12803
pushq $-0x1
popq %rax
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
movl %eax, 0x24(%rsp)
xorl %edx, %edx
movq %rdx, 0x40(%rsp)
movq 0x18(%r14), %rdx
imulq $0x1c, %rcx, %rcx
leaq (%rdx,%rcx), %r9
movl 0x8(%rdx,%rcx), %r15d
movl 0xc(%rdx,%rcx), %r12d
movl (%rdx,%rcx), %r10d
movl 0x4(%rdx,%rcx), %r11d
movl 0x18(%rdx,%rcx), %ecx
cmpl %ecx, %eax
movq %r9, 0x28(%rsp)
movl %r10d, 0xc(%rsp)
movl %r11d, 0x8(%rsp)
jne 0x1263c
movl %eax, %ecx
movl 0x24(%rsp), %eax
cmpl 0x14(%r9), %eax
je 0x127bf
movl 0x14(%r9), %eax
movl %eax, 0x24(%rsp)
movq (%r14), %rax
movq 0x10(%rax), %rbp
movl %ecx, 0x34(%rsp)
movl %ecx, %eax
imulq $0x28, %rax, %rax
cmpl $0x0, 0x10(%rbp,%rax)
je 0x127a0
addq %rax, %rbp
xorl %r14d, %r14d
xorl %ebx, %ebx
cmpq %r14, %r15
jne 0x12672
cmpl %ebx, %r10d
jne 0x126e4
movq 0x18(%rbp), %rax
cmpq %r14, %r12
jne 0x1269b
movq 0x20(%rsi), %rcx
movq (%rax,%r12,8), %rdx
shrq $0x21, %rdx
movl (%rcx,%rdx,8), %ecx
andl %r8d, %ecx
leal (%rbx,%rcx), %edx
decl %edx
cmpl %edx, %r11d
jne 0x12724
movq (%rax,%r14,8), %r13
cmpq %r15, %r14
setb %al
cmpq %r12, %r14
seta %cl
orb %al, %cl
jne 0x126d1
movq 0xa8(%rdi), %rax
movq 0x10(%rax), %rax
movq %r13, %rcx
shrq $0x21, %rcx
movzbl (%rax,%rcx), %edx
movl 0x14(%r9), %ecx
cmpl %edx, %ecx
jne 0x12764
addl %r13d, %ebx
incq %r14
movl 0x10(%rbp), %eax
cmpq %rax, %r14
jb 0x12668
jmp 0x127a0
movq 0x2828f5(%rip), %rax    # 0x294fe0
movq (%rax), %rcx
leaq 0x225772(%rip), %rdi    # 0x237e67
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
movl 0x8(%rsp), %r11d
movl 0xc(%rsp), %r10d
movq 0x28(%rsp), %r9
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
jmp 0x12672
movq 0x2828b5(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x2273ad(%rip), %rsi    # 0x239ae2
xorl %eax, %eax
callq 0x22b0
movl 0x8(%rsp), %r11d
movl 0xc(%rsp), %r10d
movq 0x28(%rsp), %r9
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x18(%rbp), %rax
jmp 0x1269b
movq 0x282875(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x227384(%rip), %rsi    # 0x239af9
xorl %eax, %eax
callq 0x22b0
movl 0x8(%rsp), %r11d
movl 0xc(%rsp), %r10d
movq 0x28(%rsp), %r9
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
jmp 0x126d1
movq 0x40(%rsp), %rdx
incl %edx
movq %rdx, %rcx
movl 0x34(%rsp), %eax
movq 0x38(%rsp), %r14
cmpq %rdx, 0x8(%r14)
ja 0x125f1
jmp 0x12803
movq 0x28281a(%rip), %rax    # 0x294fe0
movq (%rax), %rcx
leaq 0x227306(%rip), %rdi    # 0x239ad6
pushq $0xb
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
movl 0x8(%rsp), %r11d
movl 0xc(%rsp), %r10d
movq 0x28(%rsp), %r9
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0x18(%r9), %ecx
jmp 0x1263c
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq