// File: /workspace/github_cpp_makefile_star2_O1/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, (%rsp)
movq 0xb8(%rdi), %rdi
callq 0xb0285
movq %rax, %r15
cmpq $0x0, (%rax)
je 0x145756
xorl %eax, %eax
xorl %ebp, %ebp
movq (%rsp), %r13
movq 0x10(%r15), %rcx
leaq (%rax,%rax,4), %rax
cmpl $0x0, 0x10(%rcx,%rax,8)
jne 0x1455ff
incl %ebp
movq %rbp, %rax
cmpq %rbp, (%r15)
ja 0x1455e1
jmp 0x145756
leaq (%rcx,%rax,8), %rbx
movq 0x1449d6(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0xea52b(%rip), %rsi     # 0x22fb3f
movq 0x8(%rsp), %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x22b0
movl 0x10(%rbx), %ecx
testl %ecx, %ecx
je 0x1455f0
xorl %edx, %edx
movq %rbx, 0x18(%rsp)
movq 0x18(%rbx), %rax
movq (%rax,%rdx,8), %rax
incq %rdx
movl %ecx, %ecx
cmpq %rcx, %rdx
movq %rdx, 0x20(%rsp)
jae 0x14566f
movq (%rsp), %rcx
movq 0xb8(%rcx), %rdx
movq 0x28(%rdx), %rcx
movq %rax, %rsi
shrq $0x20, %rsi
movl 0x4(%rcx,%rsi,8), %ecx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq 0x8(%rdx), %rcx
jmp 0x145671
xorl %ecx, %ecx
movl $0x10, %r9d
movl $0x10, %r8d
testq %rcx, %rcx
je 0x145687
movzbl 0x12(%rcx), %r8d
testq %rcx, %rcx
je 0x145695
movzwl 0x10(%rcx), %r9d
shrl $0xf, %r9d
movq %rax, %rbx
shrq $0x21, %rbx
movq 0x28(%r13), %rsi
movq 0x40(%r13), %rcx
movl (%rcx,%rbx,4), %r14d
movl 0x4(%rcx,%rbx,4), %r12d
movl (%rsi,%r14,4), %edx
leal 0x1(%r14), %ecx
movq %rsi, 0x10(%rsp)
movl (%rsi,%rcx,4), %ecx
movq 0x14491c(%rip), %rsi    # 0x289fe0
movq (%rsi), %rdi
shrl %edx
incl %edx
shrl %ecx
incl %ecx
movq 0xb8(%r13), %rsi
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 0xea455(%rip), %rsi     # 0x22fb4e
xorl %eax, %eax
pushq %r11
pushq %r10
pushq %rbx
callq 0x22b0
addq $0x20, %rsp
movq 0xb8(%r13), %rax
movq 0x20(%rax), %rax
cmpb $0x2, 0x4(%rax,%rbx,8)
jne 0x145724
subl %r14d, %r12d
addl $-0x2, %r12d
jne 0x14573f
movq 0x18(%rsp), %rbx
movl 0x10(%rbx), %ecx
movq 0x20(%rsp), %rdx
cmpq %rcx, %rdx
jb 0x145630
jmp 0x1455f0
movq 0x10(%rsp), %rax
leaq (%rax,%r14,4), %rsi
addq $0x8, %rsi
movl %r12d, %edi
callq 0x1d13b
jmp 0x145724
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa0004