// File: /workspace/github_cpp_makefile_star2_O2/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 0x180b50(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x11c825(%rip), %rsi    # 0x1eecbf
leaq 0x1194fd(%rip), %rdx    # 0x1eb99e
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22b0
pushq $0xb
popq %r13
pushq $0x1
popq %rbp
movq %r14, 0x38(%rsp)
movl %ebx, %ebx
movq (%r14), %rax
cmpq %rbx, (%rax)
jbe 0xd251a
movq 0x18(%r14), %rax
movq 0x40(%r14), %rcx
movl (%rcx,%rbx,8), %edx
movl 0x4(%rcx,%rbx,8), %ecx
imulq $0x1c, %rcx, %r14
imulq $0x1c, %rdx, %rcx
leaq (%rax,%rcx), %r15
addq $0x18, %r15
xorl %r12d, %r12d
cmpq %r12, %r14
je 0xd2511
cmpl %ebx, (%r15,%r12)
jne 0xd24f3
addq $0x1c, %r12
jmp 0xd24e2
movq 0x180ae6(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x1194a6(%rip), %rdi    # 0x1eb9aa
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2410
jmp 0xd24ed
incl %ebx
movq 0x38(%rsp), %r14
jmp 0xd24b6
pushq $-0x1
popq %rax
movl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
xorl %edx, %edx
movl %eax, 0x24(%rsp)
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
movl %edx, %edx
cmpq %rdx, 0x8(%r14)
jbe 0xd2737
movq 0x18(%r14), %rcx
movq %rdx, 0x40(%rsp)
imulq $0x1c, %rdx, %rdx
leaq (%rcx,%rdx), %r9
movl 0x8(%rcx,%rdx), %r15d
movl 0xc(%rcx,%rdx), %ebp
movl (%rcx,%rdx), %r10d
movl 0x4(%rcx,%rdx), %r11d
movl 0x18(%rcx,%rdx), %ecx
cmpl %ecx, %eax
movq %r9, 0x28(%rsp)
movl %r10d, 0xc(%rsp)
movl %r11d, 0x8(%rsp)
jne 0xd2589
movl %eax, %ecx
movl 0x24(%rsp), %eax
cmpl 0x14(%r9), %eax
je 0xd26f3
movl 0x14(%r9), %eax
movl %eax, 0x24(%rsp)
movq (%r14), %rax
movl %ecx, 0x34(%rsp)
movl %ecx, %ecx
imulq $0x28, %rcx, %r14
addq 0x10(%rax), %r14
xorl %ebx, %ebx
xorl %r12d, %r12d
movl 0x10(%r14), %eax
cmpq %rax, %rbx
jae 0xd26de
cmpq %rbx, %r15
jne 0xd25be
cmpl %r12d, %r10d
jne 0xd2622
movq 0x18(%r14), %rax
cmpq %rbx, %rbp
jne 0xd25e4
movq 0x20(%rsi), %rcx
movq (%rax,%rbp,8), %rdx
shrq $0x21, %rdx
movl (%rcx,%rdx,8), %ecx
andl %r8d, %ecx
leal (%r12,%rcx), %edx
decl %edx
cmpl %edx, %r11d
jne 0xd2662
movq (%rax,%rbx,8), %r13
cmpq %r15, %rbx
setb %al
cmpq %rbp, %rbx
seta %cl
orb %al, %cl
jne 0xd261a
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 0xd26a2
addl %r13d, %r12d
incq %rbx
jmp 0xd25a7
movq 0x1809b7(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x117734(%rip), %rdi    # 0x1e9d67
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 0xd25be
movq 0x180977(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x11934f(%rip), %rsi    # 0x1eb9c2
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(%r14), %rax
jmp 0xd25e4
movq 0x180937(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x119326(%rip), %rsi    # 0x1eb9d9
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 0xd261a
movq 0x40(%rsp), %rdx
incl %edx
movl 0x34(%rsp), %eax
movq 0x38(%rsp), %r14
jmp 0xd2533
movq 0x1808e6(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x1192b2(%rip), %rdi    # 0x1eb9b6
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 0xd2589
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq