// File: /workspace/github_cpp_makefile_star2_O1/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 0x2773f9(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x21dfbe(%rip), %rsi    # 0x230baf
leaq 0x21acb6(%rip), %rdx    # 0x22d8ae
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22b0
movq (%r14), %rax
cmpq $0x0, (%rax)
movq %r14, 0x30(%rsp)
je 0x12c80
pushq $0xb
popq %r13
pushq $0x1
popq %rbp
movq 0x40(%r14), %rcx
movl 0x4(%rcx,%rbx,8), %eax
testq %rax, %rax
je 0x12c71
movq 0x30(%rsp), %rdx
movq 0x18(%rdx), %rdx
movl (%rcx,%rbx,8), %ecx
imulq $0x1c, %rcx, %rcx
leaq (%rdx,%rcx), %r14
addq $0x18, %r14
imulq $0x1c, %rax, %r15
xorl %r12d, %r12d
cmpl %ebx, (%r14,%r12)
jne 0x12c53
addq $0x1c, %r12
cmpq %r12, %r15
jne 0x12c42
jmp 0x12c71
movq 0x277386(%rip), %rax    # 0x289fe0
movq (%rax), %rcx
leaq 0x21ac56(%rip), %rdi    # 0x22d8ba
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2410
jmp 0x12c48
incl %ebx
movq 0x30(%rsp), %r14
movq (%r14), %rax
cmpq %rbx, (%rax)
ja 0x12c16
cmpq $0x0, 0x8(%r14)
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
je 0x12eae
pushq $-0x1
popq %rdx
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
xorl %eax, %eax
movl %edx, 0x24(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x40(%rsp)
movq 0x18(%r14), %rcx
imulq $0x1c, %rax, %rax
leaq (%rcx,%rax), %r9
movl 0x8(%rcx,%rax), %r15d
movl 0xc(%rcx,%rax), %r12d
movl (%rcx,%rax), %r10d
movl 0x4(%rcx,%rax), %r11d
cmpl 0x18(%rcx,%rax), %edx
movq %r9, 0x28(%rsp)
movl %r10d, 0xc(%rsp)
movl %r11d, 0x8(%rsp)
jne 0x12ced
movl 0x24(%rsp), %eax
cmpl 0x14(%r9), %eax
je 0x12e6e
movl 0x14(%r9), %eax
movl %eax, 0x24(%rsp)
movl 0x18(%r9), %ecx
movq (%r14), %rax
movq 0x10(%rax), %rbp
movq %rcx, 0x38(%rsp)
imulq $0x28, %rcx, %rax
cmpl $0x0, 0x10(%rbp,%rax)
je 0x12e4e
addq %rax, %rbp
xorl %r14d, %r14d
xorl %ebx, %ebx
cmpq %r14, %r15
jne 0x12d26
cmpl %ebx, %r10d
jne 0x12d96
cmpq %r14, %r12
jne 0x12d4f
movq 0x20(%rsi), %rax
movq 0x18(%rbp), %rcx
movq (%rcx,%r14,8), %rcx
shrq $0x21, %rcx
movl (%rax,%rcx,8), %eax
andl %r8d, %eax
leal (%rbx,%rax), %edx
decl %edx
cmpl %edx, %r11d
jne 0x12dd6
movq 0x18(%rbp), %rax
movq (%rax,%r14,8), %r13
cmpq %r15, %r14
jb 0x12d83
cmpq %r12, %r14
ja 0x12d83
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 0x12e12
addl %r13d, %ebx
incq %r14
movl 0x10(%rbp), %eax
cmpq %rax, %r14
jb 0x12d1c
jmp 0x12e4e
movq 0x277243(%rip), %rax    # 0x289fe0
movq (%rax), %rcx
leaq 0x218ed0(%rip), %rdi    # 0x22bc77
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 0x12d26
movq 0x277203(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x21aaeb(%rip), %rsi    # 0x22d8d2
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 0x12d4f
movq 0x2771c7(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x21aac6(%rip), %rsi    # 0x22d8e9
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 0x12d83
movq 0x40(%rsp), %rcx
incl %ecx
movq %rcx, %rax
movq 0x30(%rsp), %r14
cmpq %rcx, 0x8(%r14)
movq 0x38(%rsp), %rdx
ja 0x12ca6
jmp 0x12eae
movq 0x27716b(%rip), %rax    # 0x289fe0
movq (%rax), %rcx
leaq 0x21aa47(%rip), %rdi    # 0x22d8c6
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
jmp 0x12ced
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq