// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: print_bubble_chain(bubble_type*, char const*)
void print_bubble_chain(bubble_type* bub, const char* command)
{
    ma_ug_t *ug = NULL;
    ug = ma_ug_gen(bub->b_g);
    uint32_t i, k, j, rId, beg, sink, *a, n;
    ma_utg_t *u = NULL;
    asg_arc_t *t = NULL;
    for (i = 0; i < ug->u.n; i++)
    {
        u = &(ug->u.a[i]);
        if(u->n == 0) continue;
        fprintf(stderr,"\n%s: chain-%u\n", command, i);
        for (k = 0; k < u->n; k++)
        {
            rId = u->a[k]>>33;
            get_bubbles(bub, rId, &beg, &sink, &a, &n, NULL);
            t = NULL;
            if(k+1 < u->n) t = &(arc_first(bub->b_g, u->a[k]>>32));
            fprintf(stderr, "[utg%.6dl, utg%.6dl] el=%u no_long_indel=%u, rId=%u, nv: %u, nv^: %u\n", 
                (int)((beg>>1)+1), (int)((sink>>1)+1), t?t->el:16, t?t->no_l_indel:16, rId, arc_cnt(bub->b_g, u->a[k]>>32), arc_cnt(bub->b_g, (u->a[k]>>32)^1));
            // if((u->a[k]>>33) == 9658)
            // {
            //     asg_arc_t *av;
            //     uint32_t nv, nv_i;
            //     av = asg_arc_a(bub->b_g, u->a[k]>>32);
            //     nv = asg_arc_n(bub->b_g, u->a[k]>>32);
            //     for (nv_i = 0; nv_i < nv; nv_i++)
            //     {
            //         if(av[nv_i].del) continue;
            //         fprintf(stderr, "v--->%u\n", av[nv_i].v>>1);
            //     }
                


            //     av = asg_arc_a(bub->b_g, (u->a[k]>>32)^1);
            //     nv = asg_arc_n(bub->b_g, (u->a[k]>>32)^1);
            //     for (nv_i = 0; nv_i < nv; nv_i++)
            //     {
            //         if(av[nv_i].del) continue;
            //         fprintf(stderr, "v^1--->%u\n", av[nv_i].v>>1);
            //     }

            // }
            if(bub->b_g->seq[rId].c == HAP_LABLE)
            {
                for (j = 0; j < n; j++)
                {
                    fprintf(stderr, ">>>utg%.6dl\n", (int)((a[j]>>1)+1));
                }
            }
        }
    }

    ma_ug_destroy(ug);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, %r12
movq 0xb8(%rdi), %rdi
callq 0xb10cd
movq %rax, %r15
cmpq $0x0, (%rax)
je 0x14bda5
xorl %eax, %eax
xorl %ebp, %ebp
movq 0x10(%r15), %rcx
leaq (%rax,%rax,4), %rax
cmpl $0x0, 0x10(%rcx,%rax,8)
jne 0x14bc3f
incl %ebp
movq %rbp, %rax
cmpq %rbp, (%r15)
ja 0x14bc21
jmp 0x14bda5
leaq (%rcx,%rax,8), %rbx
movq 0x149396(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0xf013b(%rip), %rsi     # 0x23bd8f
movq 0x8(%rsp), %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x22b0
movl 0x10(%rbx), %ecx
testl %ecx, %ecx
je 0x14bc30
xorl %r9d, %r9d
movq %rbx, 0x18(%rsp)
movq 0x18(%rbx), %rax
movq (%rax,%r9,8), %rax
incq %r9
movl %ecx, %ecx
cmpq %rcx, %r9
movq %r9, 0x20(%rsp)
jae 0x14bccf
movq 0xb8(%r12), %rsi
movq 0x8(%rsi), %rcx
movq 0x149345(%rip), %rdx    # 0x294fe0
movq (%rdx), %rdi
movl $0x10, %r8d
testq %rcx, %rcx
je 0x14bce7
movq 0x28(%rsi), %rdx
movq %rax, %r8
shrq $0x20, %r8
movl 0x4(%rdx,%r8,8), %edx
leaq (%rdx,%rdx,2), %rdx
movzbl 0x12(%rcx,%rdx,8), %r8d
movzwl 0x10(%rcx,%rdx,8), %r9d
shrl $0xf, %r9d
jmp 0x14bced
movq 0x14930a(%rip), %rcx    # 0x294fe0
movq (%rcx), %rdi
movq 0xb8(%r12), %rsi
movl $0x10, %r8d
movl $0x10, %r9d
movq %rax, %rbx
shrq $0x21, %rbx
movq 0x28(%r12), %r10
movq 0x40(%r12), %rcx
movq %r12, %r13
movl (%rcx,%rbx,4), %r14d
movl 0x4(%rcx,%rbx,4), %r12d
movl (%r10,%r14,4), %edx
leal 0x1(%r14), %ecx
movq %r10, 0x10(%rsp)
movl (%r10,%rcx,4), %ecx
shrl %ecx
incl %ecx
shrl %edx
incl %edx
movq 0x28(%rsi), %rsi
shrq $0x20, %rax
movl (%rsi,%rax,8), %r10d
shlq $0x3, %rax
xorq $0x8, %rax
movl (%rsi,%rax), %r11d
subq $0x8, %rsp
leaq 0xf0058(%rip), %rsi     # 0x23bd9e
xorl %eax, %eax
pushq %r11
pushq %r10
pushq %rbx
callq 0x22b0
movl %r12d, %edi
addq $0x20, %rsp
movq %r13, %r12
movq 0xb8(%r13), %rax
movq 0x20(%rax), %rax
cmpb $0x2, 0x4(%rax,%rbx,8)
jne 0x14bd76
subl %r14d, %edi
addl $-0x2, %edi
jne 0x14bd91
movq 0x18(%rsp), %rbx
movl 0x10(%rbx), %ecx
movq 0x20(%rsp), %r9
cmpq %rcx, %r9
jb 0x14bc71
jmp 0x14bc30
movq 0x10(%rsp), %rax
leaq (%rax,%r14,4), %rsi
addq $0x8, %rsi
callq 0x1c822
jmp 0x14bd76
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa0761