// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: print_bubble_utg(bubble_type*, ma_ug_t*, char const*, _IO_FILE*)
void print_bubble_utg(bubble_type* bub, ma_ug_t* unitig_ug, const char* prefix, FILE *fp)
{
    uint32_t i, k, *a, n, beg, sink, x, occ;
    ma_ug_t *b_ug = bub->b_ug;
    char name[32];
    for (i = 0; i < b_ug->u.n; i++)
    {
        ma_utg_t *p = &b_ug->u.a[i];
        if(p->n == 0) continue;
        for (k = occ = 0; k < p->n; k++)
        {
            x = p->a[k]>>33;
            get_bubbles(bub, x, &beg, &sink, &a, &n, NULL);
            occ += n;
        }
        sprintf(name, "%s%.6d%c", prefix, i + 1, "lc"[p->circ]);
        fprintf(fp, "S\t%s\t*\tLN:i:%u\n", name, occ);
        for (k = 0; k < p->n; k++)
        {
            x = p->a[k]>>33;
            get_bubbles(bub, x, &beg, &sink, &a, &n, NULL);
            if(beg != (uint32_t)-1) fprintf(fp, "A\tutg%.6d%c\t%u\t%s\n", (beg>>1)+1, "lc"[unitig_ug->u.a[(beg>>1)].circ], n, "beg");
            if(sink != (uint32_t)-1) fprintf(fp, "A\tutg%.6d%c\t%u\t%s\n", (sink>>1)+1, "lc"[unitig_ug->u.a[(sink>>1)].circ], n, "sink");
        }
    }

    asg_arc_t* au = NULL;
    uint32_t nu, u, v, j;
    for (i = 0; i < b_ug->u.n; ++i) {
        if(b_ug->u.a[i].m == 0) continue;
        if(b_ug->u.a[i].circ)
        {
            fprintf(fp, "L\t%s%.6dc\t+\t%s%.6dc\t+\t%dM\tL1:i:%d\n", 
            prefix, i+1, prefix, i+1, 0, 0);
            fprintf(fp, "L\t%s%.6dc\t-\t%s%.6dc\t-\t%dM\tL1:i:%d\n", 
            prefix, i+1, prefix, i+1, 0, 0);
        } 
        u = i<<1;
        au = asg_arc_a(b_ug->g, u);
        nu = asg_arc_n(b_ug->g, u);
        for (j = 0; j < nu; j++)
        {
            if(au[j].del) continue;
            v = au[j].v;
            fprintf(fp, "L\t%s%.6d%c\t%c\t%s%.6d%c\t%c\t%dM\tL1:i:%d\n", 
            prefix, (u>>1)+1, "lc"[b_ug->u.a[u>>1].circ], "+-"[u&1],
            prefix, (v>>1)+1, "lc"[b_ug->u.a[v>>1].circ], "+-"[v&1], 0, 0);
        }


        u = (i<<1) + 1;
        au = asg_arc_a(b_ug->g, u);
        nu = asg_arc_n(b_ug->g, u);
        for (j = 0; j < nu; j++)
        {
            if(au[j].del) continue;
            v = au[j].v;
            fprintf(fp, "L\t%s%.6d%c\t%c\t%s%.6d%c\t%c\t%dM\tL1:i:%d\n", 
            prefix, (u>>1)+1, "lc"[b_ug->u.a[u>>1].circ], "+-"[u&1],
            prefix, (v>>1)+1, "lc"[b_ug->u.a[v>>1].circ], "+-"[v&1], 0, 0);
        }
    }

    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, 0x8(%rsp)
movq %rdx, 0x18(%rsp)
movq 0xc0(%rdi), %rbx
cmpq $0x0, (%rbx)
je 0x15ced5
movq %rsi, %r15
movq %rdi, %r12
xorl %eax, %eax
xorl %r9d, %r9d
movq %rbx, 0x10(%rsp)
movq 0x10(%rbx), %rcx
leaq (%rax,%rax,4), %rdx
movl 0x10(%rcx,%rdx,8), %eax
testq %rax, %rax
je 0x15cc5c
leaq (%rcx,%rdx,8), %r13
movq 0x18(%r13), %rcx
movq 0x40(%r12), %rdx
xorl %esi, %esi
xorl %ebp, %ebp
movq (%rcx,%rsi,8), %rdi
shrq $0x21, %rdi
subl (%rdx,%rdi,4), %ebp
movl 0x4(%rdx,%rdi,4), %edi
addl %edi, %ebp
addl $-0x2, %ebp
incq %rsi
cmpq %rsi, %rax
jne 0x15cb13
incl %r9d
movl (%r13), %eax
shrl $0x1f, %eax
leaq 0xd7bfb(%rip), %rcx     # 0x23473b
movsbl (%rax,%rcx), %r8d
movl %r9d, %ecx
leaq 0x30(%rsp), %r14
movq %r14, %rdi
leaq 0xd9883(%rip), %rsi     # 0x2363da
movq 0x18(%rsp), %rdx
movl %r9d, 0x4(%rsp)
xorl %eax, %eax
callq 0x2050
movq 0x8(%rsp), %rdi
leaq 0xdf83f(%rip), %rsi     # 0x23c3b3
movq %r14, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x22b0
cmpl $0x0, 0x10(%r13)
je 0x15cc55
xorl %r14d, %r14d
movq 0x18(%r13), %rax
movq (%rax,%r14,8), %rax
movq 0x28(%r12), %rcx
movq 0x40(%r12), %rdx
shrq $0x21, %rax
movl (%rdx,%rax,4), %esi
movl 0x4(%rdx,%rax,4), %ebp
subl %esi, %ebp
addl $-0x2, %ebp
movl (%rcx,%rsi,4), %eax
leal 0x1(%rsi), %edx
movl (%rcx,%rdx,4), %ebx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
je 0x15cbff
shrl %eax
movl %eax, %edx
incl %edx
movq 0x10(%r15), %rcx
leaq (%rax,%rax,4), %rax
movl (%rcx,%rax,8), %eax
shrl $0x1f, %eax
leaq 0xd7b5d(%rip), %rcx     # 0x23473b
movsbl (%rax,%rcx), %ecx
movq 0x8(%rsp), %rdi
leaq 0xdf7d5(%rip), %rsi     # 0x23c3c3
movl %ebp, %r8d
leaq 0xdf759(%rip), %r9      # 0x23c351
xorl %eax, %eax
callq 0x22b0
cmpl $-0x1, %ebx
je 0x15cc40
shrl %ebx
movl %ebx, %edx
incl %edx
movq 0x10(%r15), %rax
leaq (%rbx,%rbx,4), %rcx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
leaq 0xd7b1c(%rip), %rcx     # 0x23473b
movsbl (%rax,%rcx), %ecx
movq 0x8(%rsp), %rdi
leaq 0xdf794(%rip), %rsi     # 0x23c3c3
movl %ebp, %r8d
leaq 0xdf71c(%rip), %r9      # 0x23c355
xorl %eax, %eax
callq 0x22b0
incq %r14
movl 0x10(%r13), %eax
cmpq %rax, %r14
jb 0x15cb8e
movq 0x10(%rsp), %rbx
movl 0x4(%rsp), %r9d
jmp 0x15cc5f
incl %r9d
movl %r9d, %eax
movq (%rbx), %rcx
cmpq %rax, %rcx
ja 0x15caed
testq %rcx, %rcx
je 0x15ced5
xorl %eax, %eax
xorl %ecx, %ecx
movq %rcx, 0x20(%rsp)
movq 0x10(%rbx), %rcx
leaq (%rax,%rax,4), %rax
cmpl $0x0, 0xc(%rcx,%rax,8)
je 0x15cec2
leaq (%rcx,%rax,8), %rax
cmpl $0x0, (%rax)
movq 0x20(%rsp), %r12
jns 0x15cd00
leal 0x1(%r12), %ebp
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0xdf721(%rip), %rsi     # 0x23c3d6
movq 0x18(%rsp), %r14
movq %r14, %rdx
movl %ebp, %ecx
movq %r14, %r8
movl %ebp, %r9d
xorl %eax, %eax
xorl %r15d, %r15d
pushq %r15
pushq %r15
callq 0x22b0
addq $0x10, %rsp
movq %rbx, %rdi
movq 0x10(%rsp), %rbx
leaq 0xdf713(%rip), %rsi     # 0x23c3f9
movq %r14, %rdx
movl %ebp, %ecx
movq %r14, %r8
movl %ebp, %r9d
xorl %eax, %eax
pushq %r15
pushq %r15
callq 0x22b0
addq $0x10, %rsp
leal (%r12,%r12), %esi
movq 0x18(%rbx), %rcx
movq 0x8(%rcx), %rax
movq 0x28(%rcx), %rcx
movq (%rcx,%rsi,8), %rdx
testl %edx, %edx
je 0x15cdf2
movq %rsi, 0x28(%rsp)
movq %rdx, %rcx
shrq $0x20, %rcx
movl %r12d, %r14d
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leal 0x1(%r14), %esi
movl %esi, 0x4(%rsp)
movl %edx, %edx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %r15
addq $0xc, %r15
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %r13
xorl %r12d, %r12d
cmpl $0x0, (%r15,%r12)
js 0x15cdd4
movl -0x4(%r15,%r12), %eax
movq 0x10(%rbx), %rcx
leaq (%r14,%r14,4), %rdx
movl (%rcx,%rdx,8), %edx
shrl $0x1f, %edx
leaq 0xd79c7(%rip), %rsi     # 0x23473b
movsbl (%rdx,%rsi), %r8d
movl %eax, %r10d
shrl %r10d
leaq (%r10,%r10,4), %rdx
incl %r10d
movl (%rcx,%rdx,8), %ecx
shrl $0x1f, %ecx
movsbl (%rcx,%rsi), %r11d
andl $0x1, %eax
leaq 0xd5538(%rip), %rcx     # 0x2322d3
movsbl (%rax,%rcx), %ebx
movq 0x8(%rsp), %rdi
leaq 0xdf5b3(%rip), %rsi     # 0x23c35e
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movl $0x2b, %r9d
xorl %eax, %eax
xorl %ebp, %ebp
pushq %rbp
pushq %rbp
pushq %rbx
movq 0x28(%rsp), %rbx
pushq %r11
pushq %r10
pushq %rdx
callq 0x22b0
addq $0x30, %rsp
addq $0x18, %r12
cmpq %r12, %r13
jne 0x15cd53
movq 0x18(%rbx), %rcx
movq 0x8(%rcx), %rax
movq 0x28(%rcx), %rcx
movq 0x28(%rsp), %rsi
movl %esi, %edx
movq 0x8(%rcx,%rdx,8), %rcx
testl %ecx, %ecx
je 0x15cec2
movq %rcx, %rdx
shrq $0x20, %rdx
movq 0x20(%rsp), %rsi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
leal 0x1(%rsi), %edi
movl %edi, 0x4(%rsp)
movl %ecx, %ecx
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,8), %r14
addq $0xc, %r14
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %r15
leaq (%rsi,%rsi,4), %r13
xorl %r12d, %r12d
cmpl $0x0, (%r14,%r12)
js 0x15ceb5
movl -0x4(%r14,%r12), %eax
movq 0x10(%rbx), %rcx
movl (%rcx,%r13,8), %edx
shrl $0x1f, %edx
leaq 0xd78e6(%rip), %rsi     # 0x23473b
movsbl (%rdx,%rsi), %r8d
movl %eax, %r10d
shrl %r10d
leaq (%r10,%r10,4), %rdx
incl %r10d
movl (%rcx,%rdx,8), %ecx
shrl $0x1f, %ecx
movsbl (%rcx,%rsi), %r11d
andl $0x1, %eax
leaq 0xd5457(%rip), %rcx     # 0x2322d3
movsbl (%rax,%rcx), %ebx
movq 0x8(%rsp), %rdi
leaq 0xdf4d2(%rip), %rsi     # 0x23c35e
movq 0x18(%rsp), %rdx
movl 0x4(%rsp), %ecx
movl $0x2d, %r9d
xorl %eax, %eax
xorl %ebp, %ebp
pushq %rbp
pushq %rbp
pushq %rbx
movq 0x28(%rsp), %rbx
pushq %r11
pushq %r10
pushq %rdx
callq 0x22b0
addq $0x30, %rsp
addq $0x18, %r12
cmpq %r12, %r15
jne 0x15ce37
movq 0x20(%rsp), %rcx
incl %ecx
movq %rcx, %rax
cmpq %rcx, (%rbx)
ja 0x15cc7b
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq