// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: print_bubble_graph(bubble_type*, ma_ug_t*, char const*, _IO_FILE*)
void print_bubble_graph(bubble_type* bub, ma_ug_t* ug, const char* prefix, FILE *fp)
{
    uint32_t i, k, *a, n, beg, sink, x;
    asg_t *b_g = bub->b_g;
    char name[32];
    for (i = 0; i < b_g->n_seq; i++)
    {
        get_bubbles(bub, i, &beg, &sink, &a, &n, NULL);
        sprintf(name, "%s%.6d%c", prefix, i, "fb"[i<bub->f_bub?0:1]);
        fprintf(stderr, "S\t%s\t*\tLN:i:%d\n", name, n);

        if(beg != (uint32_t)-1) fprintf(stderr, "A\tutg%.6d%c\t%s\n", (beg>>1)+1, "lc"[ug->u.a[(beg>>1)].circ], "beg");
        if(sink != (uint32_t)-1) fprintf(stderr, "A\tutg%.6d%c\t%s\n", (sink>>1)+1, "lc"[ug->u.a[(sink>>1)].circ], "sink");
        for (k = 0; k < n; k++)
        {
            x = a[k]>>1;
            fprintf(stderr, "A\tutg%.6d%c\t%s\n", x+1, "lc"[ug->u.a[x].circ], "mid");
        }
    }

    asg_arc_t* au = NULL;
    uint32_t nu, u, v;
    for (i = 0; i < b_g->n_seq; i++)
    {
        u = i<<1;
        au = asg_arc_a(b_g, u);
        nu = asg_arc_n(b_g, u);
        for (k = 0; k < nu; k++)
        {
            if(au[k].del) continue;
            v = au[k].v;
            fprintf(stderr, "L\t%s%.6d%c\t%c\t%s%.6d%c\t%c\t%dM\tL1:i:%d\n", 
            prefix, u>>1, "fb"[(u>>1)<bub->f_bub?0:1], "+-"[u&1],
            prefix, v>>1, "fb"[(v>>1)<bub->f_bub?0:1], "+-"[v&1], 0, 0);


            asg_arc_t* av = asg_arc_a(b_g, v^1);
            uint32_t nv = asg_arc_n(b_g, v^1), m;
            for (m = 0; m < nv; m++)
            {
                if(av[m].del) continue;
                if(av[m].v == (u^1)) break;
            }

            if(m == nv) fprintf(stderr, "sb1sb, nv: %u, nu: %u\n", nv, nu);
        }


        u = (i<<1) + 1;
        au = asg_arc_a(ug->g, u);
        nu = asg_arc_n(ug->g, u);
        for (k = 0; k < nu; k++)
        {
            if(au[k].del) continue;
            v = au[k].v;
            fprintf(stderr, "L\t%s%.6d%c\t%c\t%s%.6d%c\t%c\t%dM\tL1:i:%d\n", 
            prefix, u>>1, "fb"[(u>>1)<bub->f_bub?0:1], "+-"[u&1],
            prefix, v>>1, "fb"[(v>>1)<bub->f_bub?0:1], "+-"[v&1], 0, 0);

            asg_arc_t* av = asg_arc_a(b_g, v^1);
            uint32_t nv = asg_arc_n(b_g, v^1), m;
            for (m = 0; m < nv; m++)
            {
                if(av[m].del) continue;
                if(av[m].v == (u^1)) break;
            }

            if(m == nv) fprintf(stderr, "sb2sb, nv: %u, nu: %u\n", nv, nu);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, 0x28(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, 0x20(%rsp)
movq 0xb8(%rdi), %rdx
testl $0x7fffffff, 0x14(%rdx) # imm = 0x7FFFFFFF
movq %rdx, 0x10(%rsp)
je 0x155e59
movq 0x30(%rsp), %rax
addq $0x10, %rax
movq %rax, (%rsp)
xorl %r13d, %r13d
movq 0x20(%rsp), %rcx
movq 0x28(%rcx), %rdx
movq 0x40(%rcx), %rax
movl (%rax,%r13,4), %ebx
movl 0x4(%rax,%r13,4), %r12d
subl %ebx, %r12d
addl $-0x2, %r12d
movl (%rdx,%rbx,4), %ebp
leal 0x1(%rbx), %eax
movq %rdx, 0x8(%rsp)
movl (%rdx,%rax,4), %r15d
cmpq 0x80(%rcx), %r13
leaq 0xd99d8(%rip), %rax     # 0x22f782
sbbq $-0x1, %rax
movsbl (%rax), %r8d
leaq 0x40(%rsp), %r14
movq %r14, %rdi
leaq 0xd4429(%rip), %rsi     # 0x22a1ea
movq 0x28(%rsp), %rdx
movl %r13d, %ecx
xorl %eax, %eax
callq 0x2050
movq 0x134209(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0xda344(%rip), %rsi     # 0x230125
movq %r14, %rdx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x22b0
cmpl $-0x1, %ebp
jne 0x155e19
cmpl $-0x1, %r15d
movq 0x10(%rsp), %rdx
jne 0x155e26
testl %r12d, %r12d
jne 0x155e39
incq %r13
movl 0x14(%rdx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r13
jb 0x155d70
jmp 0x155e59
movl %ebp, %edi
movq (%rsp), %rsi
callq 0x1d896
jmp 0x155df3
movl %r15d, %edi
movq (%rsp), %rsi
callq 0x1d8d8
movq 0x10(%rsp), %rdx
jmp 0x155dfe
movq 0x8(%rsp), %rax
leaq (%rax,%rbx,4), %rsi
addq $0x8, %rsi
movl %r12d, %edi
movq (%rsp), %rdx
callq 0x1d91a
movq 0x10(%rsp), %rdx
jmp 0x155e03
testl $0x7fffffff, 0x14(%rdx) # imm = 0x7FFFFFFF
je 0x156157
xorl %r9d, %r9d
leaq (%r9,%r9), %rbx
movq 0x28(%rdx), %rax
movq %r9, %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rax
movq %rax, 0x38(%rsp)
testl %eax, %eax
movq %r9, 0x8(%rsp)
movq %rbx, (%rsp)
je 0x155fe3
movq 0x38(%rsp), %rcx
movq %rcx, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %r12
shlq $0x3, %r12
addq 0x8(%rdx), %r12
movq %rbx, %r15
orq $0x1, %r15
movl %ecx, %r14d
xorl %ebp, %ebp
leaq (,%rbp,2), %rax
addq %rbp, %rax
cmpl $0x0, 0xc(%r12,%rax,8)
jns 0x155ed6
incq %rbp
cmpq %r14, %rbp
jne 0x155eb6
jmp 0x155fe3
leaq (%r12,%rax,8), %rax
movl 0x8(%rax), %r13d
movq 0x20(%rsp), %rax
movq 0x80(%rax), %rax
cmpq %rax, %r9
leaq 0xd988e(%rip), %rsi     # 0x22f782
movq %rsi, %rcx
sbbq $-0x1, %rcx
movq 0x1340de(%rip), %rdx    # 0x289fe0
movq (%rdx), %rdi
movsbl (%rcx), %r8d
movl %r13d, %r10d
shrl %r10d
cmpq %rax, %r10
movq %rsi, %rax
sbbq $-0x1, %rax
movsbl (%rax), %eax
movq %rax, 0x18(%rsp)
movl %r13d, %eax
andl $0x1, %eax
leaq 0xd0295(%rip), %rcx     # 0x2261c3
movsbl (%rax,%rcx), %r11d
xorl %ebx, %ebx
leaq 0xda216(%rip), %rsi     # 0x230152
movq 0x28(%rsp), %rdx
movl %r9d, %ecx
movl $0x2b, %r9d
xorl %eax, %eax
pushq %rbx
pushq %rbx
pushq %r11
pushq 0x30(%rsp)
pushq %r10
pushq %rdx
callq 0x22b0
movq 0x40(%rsp), %rcx
addq $0x30, %rsp
movq 0x28(%rcx), %rax
xorq $0x1, %r13
movq (%rax,%r13,8), %rdx
testl %edx, %edx
je 0x155fab
movq 0x8(%rcx), %rcx
movq %rdx, %rsi
shrq $0x20, %rsi
movl %edx, %eax
leaq (%rsi,%rsi,2), %rsi
leaq (%rcx,%rsi,8), %rcx
addq $0xc, %rcx
xorl %ebx, %ebx
cmpl $0x0, (%rcx)
js 0x155f9d
movl -0x4(%rcx), %esi
cmpq %rsi, %r15
je 0x155fab
incq %rbx
addq $0x18, %rcx
cmpq %rbx, %rax
jne 0x155f90
movl %edx, %ebx
cmpl %edx, %ebx
movq 0x8(%rsp), %r9
movq (%rsp), %rbx
jne 0x155ec9
movq 0x13401d(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0xda1ac(%rip), %rsi     # 0x230179
movq 0x38(%rsp), %rcx
xorl %eax, %eax
callq 0x22b0
movq 0x8(%rsp), %r9
jmp 0x155ec9
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rcx
movq 0x8(%rcx,%rbx,8), %rcx
movq %rcx, 0x18(%rsp)
testl %ecx, %ecx
je 0x15613e
movq 0x18(%rsp), %rdx
movq %rdx, %rcx
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %r12
shlq $0x3, %r12
addq 0x8(%rax), %r12
movl %edx, %r14d
xorl %r15d, %r15d
leaq (%r15,%r15,2), %rax
cmpl $0x0, 0xc(%r12,%rax,8)
jns 0x156039
incq %r15
cmpq %r14, %r15
jne 0x156020
jmp 0x15613e
leaq (%r12,%rax,8), %rax
movl 0x8(%rax), %r13d
movq 0x20(%rsp), %rax
movq 0x80(%rax), %rax
cmpq %rax, %r9
leaq 0xd972b(%rip), %rsi     # 0x22f782
movq %rsi, %rcx
sbbq $-0x1, %rcx
movq 0x133f7b(%rip), %rdx    # 0x289fe0
movq (%rdx), %rdi
movsbl (%rcx), %r8d
movl %r13d, %r10d
shrl %r10d
cmpq %rax, %r10
movq %rsi, %rax
sbbq $-0x1, %rax
movsbl (%rax), %r11d
movl %r13d, %eax
andl $0x1, %eax
leaq 0xd0136(%rip), %rcx     # 0x2261c3
movsbl (%rax,%rcx), %ebp
xorl %ebx, %ebx
leaq 0xda0b8(%rip), %rsi     # 0x230152
movq 0x28(%rsp), %rdx
movl %r9d, %ecx
movl $0x2d, %r9d
xorl %eax, %eax
pushq %rbx
pushq %rbx
pushq %rbp
pushq %r11
pushq %r10
pushq %rdx
callq 0x22b0
addq $0x30, %rsp
movq 0x10(%rsp), %rcx
movq 0x28(%rcx), %rax
xorq $0x1, %r13
movq (%rax,%r13,8), %rdx
movq (%rsp), %rdi
testl %edx, %edx
je 0x15610a
movq 0x8(%rcx), %rcx
movq %rdx, %rsi
shrq $0x20, %rsi
movl %edx, %eax
leaq (%rsi,%rsi,2), %rsi
leaq (%rcx,%rsi,8), %rcx
addq $0xc, %rcx
xorl %ebx, %ebx
cmpl $0x0, (%rcx)
js 0x1560fc
movl -0x4(%rcx), %esi
cmpq %rsi, %rdi
je 0x15610a
incq %rbx
addq $0x18, %rcx
cmpq %rbx, %rax
jne 0x1560ef
movl %edx, %ebx
cmpl %edx, %ebx
movq 0x8(%rsp), %r9
jne 0x15602c
movq 0x133ec2(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0xda068(%rip), %rsi     # 0x230190
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x22b0
movq 0x8(%rsp), %r9
jmp 0x15602c
incq %r9
movq 0x10(%rsp), %rdx
movl 0x14(%rdx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r9
jb 0x155e69
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq