// File: 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
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xc0, %rsp
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0xc0(%rax), %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x1fff47
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x1ffd5f
jmp 0x1fff39
movl $0x0, -0x54(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x88(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x1ffdd1
movq -0x88(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x38(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
movl -0x50(%rbp), %eax
movl %eax, %esi
leaq -0x48(%rbp), %rdx
leaq -0x4c(%rbp), %rcx
leaq -0x40(%rbp), %r8
leaq -0x44(%rbp), %r9
xorl %eax, %eax
movq $0x0, (%rsp)
callq 0x1c4b20
movl -0x44(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1ffd6d
leaq -0x80(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movq -0x88(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x18550d(%rip), %rax    # 0x385303
movsbl (%rax,%rsi), %r8d
leaq 0x187004(%rip), %rsi    # 0x386e06
movb $0x0, %al
callq 0x2050
movq -0x30(%rbp), %rdi
leaq -0x80(%rbp), %rdx
movl -0x54(%rbp), %ecx
leaq 0x18d1f9(%rip), %rsi    # 0x38d014
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x88(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x1fff37
movq -0x88(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x38(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
movl -0x50(%rbp), %eax
movl %eax, %esi
leaq -0x48(%rbp), %rdx
leaq -0x4c(%rbp), %rcx
leaq -0x40(%rbp), %r8
leaq -0x44(%rbp), %r9
xorl %eax, %eax
movq $0x0, (%rsp)
callq 0x1c4b20
cmpl $-0x1, -0x48(%rbp)
je 0x1ffed2
movq -0x30(%rbp), %rdi
movl -0x48(%rbp), %edx
shrl %edx
addl $0x1, %edx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x48(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x18544e(%rip), %rax    # 0x385303
movsbl (%rax,%rcx), %ecx
movl -0x44(%rbp), %r8d
leaq 0x18d160(%rip), %rsi    # 0x38d024
leaq 0x18d0e7(%rip), %r9     # 0x38cfb2
movb $0x0, %al
callq 0x22a0
cmpl $-0x1, -0x4c(%rbp)
je 0x1fff27
movq -0x30(%rbp), %rdi
movl -0x4c(%rbp), %edx
shrl %edx
addl $0x1, %edx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x4c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x1853f9(%rip), %rax    # 0x385303
movsbl (%rax,%rcx), %ecx
movl -0x44(%rbp), %r8d
leaq 0x18d10b(%rip), %rsi    # 0x38d024
leaq 0x18d096(%rip), %r9     # 0x38cfb6
movb $0x0, %al
callq 0x22a0
jmp 0x1fff29
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1ffe29
jmp 0x1fff39
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1ffd24
movq $0x0, -0x90(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x200389
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0xc(%rax)
jne 0x1fff86
jmp 0x20037b
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x200014
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %r8
movl -0x34(%rbp), %r9d
addl $0x1, %r9d
leaq 0x18d074(%rip), %rsi    # 0x38d037
xorl %eax, %eax
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movb $0x0, %al
callq 0x22a0
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %r8
movl -0x34(%rbp), %r9d
addl $0x1, %r9d
leaq 0x18d05e(%rip), %rsi    # 0x38d05a
xorl %eax, %eax
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movb $0x0, %al
callq 0x22a0
movl -0x34(%rbp), %eax
shll %eax
movl %eax, -0x98(%rbp)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq 0x28(%rcx), %rcx
movl -0x98(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
movl -0x98(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x94(%rbp)
movl $0x0, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
cmpl -0x94(%rbp), %eax
jae 0x2001c5
movq -0x90(%rbp), %rax
movl -0xa0(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x2000af
jmp 0x2001b1
movq -0x90(%rbp), %rax
movl -0xa0(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x9c(%rbp)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl -0x98(%rbp), %ecx
shrl %ecx
addl $0x1, %ecx
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x98(%rbp), %esi
shrl %esi
movl %esi, %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x1851fb(%rip), %rax    # 0x385303
movsbl (%rax,%rsi), %r8d
movl -0x98(%rbp), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x182d7a(%rip), %rax    # 0x382e9b
movsbl (%rax,%rsi), %r9d
movq -0x28(%rbp), %rbx
movl -0x9c(%rbp), %r11d
shrl %r11d
addl $0x1, %r11d
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x9c(%rbp), %esi
shrl %esi
movl %esi, %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x1851a2(%rip), %rax    # 0x385303
movsbl (%rax,%rsi), %r10d
movl -0x9c(%rbp), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x182d21(%rip), %rax    # 0x382e9b
movsbl (%rax,%rsi), %eax
leaq 0x18ce3a(%rip), %rsi    # 0x38cfbf
xorl %r14d, %r14d
movq %rbx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movl $0x0, 0x28(%rsp)
movb $0x0, %al
callq 0x22a0
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x200079
movl -0x34(%rbp), %eax
shll %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq 0x28(%rcx), %rcx
movl -0x98(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rax
movl -0x98(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x94(%rbp)
movl $0x0, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
cmpl -0x94(%rbp), %eax
jae 0x200379
movq -0x90(%rbp), %rax
movl -0xa0(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x200263
jmp 0x200365
movq -0x90(%rbp), %rax
movl -0xa0(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x9c(%rbp)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl -0x98(%rbp), %ecx
shrl %ecx
addl $0x1, %ecx
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x98(%rbp), %esi
shrl %esi
movl %esi, %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x185047(%rip), %rax    # 0x385303
movsbl (%rax,%rsi), %r8d
movl -0x98(%rbp), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x182bc6(%rip), %rax    # 0x382e9b
movsbl (%rax,%rsi), %r9d
movq -0x28(%rbp), %rbx
movl -0x9c(%rbp), %r11d
shrl %r11d
addl $0x1, %r11d
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x9c(%rbp), %esi
shrl %esi
movl %esi, %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x184fee(%rip), %rax    # 0x385303
movsbl (%rax,%rsi), %r10d
movl -0x9c(%rbp), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x182b6d(%rip), %rax    # 0x382e9b
movsbl (%rax,%rsi), %eax
leaq 0x18cc86(%rip), %rsi    # 0x38cfbf
xorl %r14d, %r14d
movq %rbx, (%rsp)
movl %r11d, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
movl $0x0, 0x28(%rsp)
movb $0x0, %al
callq 0x22a0
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x20022d
jmp 0x20037b
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1fff59
addq $0xc0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)