// File: chhylp123[P]hifiasm/hic.cpp
// Function: debug_tangle_bubble(bubble_type*, long long, long long, char const*)
void debug_tangle_bubble(bubble_type* bub, long long beg_idx, long long end_idx, const char* command)
{
    // long long beg_idx = (long long)bub->b_g->n_seq - bub->tangle_bub;
    // long long end_idx = (long long)bub->b_g->n_seq - 1;
    long long i, j, k;
    ma_utg_t *u = NULL;
    uint32_t beg_utg, sink_utg, *a = NULL, n, btg_left, ori_left, btg_right, ori_right, root_0, root_1;
    for (i = beg_idx; i <= end_idx; i++)
    {
        get_bubbles(bub, i, &beg_utg, &sink_utg, &a, &n, NULL);
        fprintf(stderr, "\n(%lld) %s: beg=utg%.6ul, sink=utg%.6ul, n: %u\n", i, command, (beg_utg>>1)+1, (sink_utg>>1)+1, n);
        for (k = 0; k < n; k++)
        {
            fprintf(stderr, "mid=utg%.6ul\n", (a[k]>>1)+1);
        }
        
        for (j = 0; j < bub->b_ug->g->n_seq; j++)
        {
            u = &(bub->b_ug->u.a[j]);
            if(u->n) continue;
            for (k = 0; k < u->n; k++)
            {
                if((long long)(u->a[k]>>33) != i) continue;
                fprintf(stderr, "is the %lld-th bubble at btg%.6lldl\n", k, j+1);
                if(k > 0)
                {
                    btg_left = u->a[k-1]>>33;
                    ori_left = u->a[k-1]>>32&1;
                    get_bubbles(bub, btg_left, ori_left == 1?&root_0:NULL, ori_left == 0?&root_0:NULL, NULL, NULL, NULL);
                    fprintf(stderr, "left-utg%.6ul\n", (ori_left>>1)+1);
                }

                if(k + 1 < u->n)
                {
                    btg_right = u->a[k+1]>>33;
                    ori_right = (u->a[k+1]>>32&1)^1;
                    get_bubbles(bub, btg_right, ori_right == 1?&root_1:NULL, ori_right == 0?&root_1:NULL, NULL, NULL, NULL);
                    fprintf(stderr, "right-utg%.6ul\n", (ori_right>>1)+1);
                }
            }
        }
        
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
jg 0x1e2ad8
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x44(%rbp), %rdx
leaq -0x48(%rbp), %rcx
leaq -0x50(%rbp), %r8
leaq -0x54(%rbp), %r9
xorl %eax, %eax
movq $0x0, (%rsp)
callq 0x1c4b20
movq 0x1e1861(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x44(%rbp), %r8d
shrl %r8d
addl $0x1, %r8d
movl -0x48(%rbp), %r9d
shrl %r9d
addl $0x1, %r9d
movl -0x54(%rbp), %eax
leaq 0x1aa2a6(%rip), %rsi    # 0x38ca50
movl %eax, (%rsp)
movb $0x0, %al
callq 0x22a0
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl -0x54(%rbp), %ecx
cmpq %rcx, %rax
jge 0x1e27fe
movq 0x1e1811(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x50(%rbp), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %edx
shrl %edx
addl $0x1, %edx
leaq 0x1aa297(%rip), %rsi    # 0x38ca80
movb $0x0, %al
callq 0x22a0
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1e27bc
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0xc0(%rcx), %rcx
movq 0x18(%rcx), %rcx
movl 0x14(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
cmpq %rcx, %rax
jge 0x1e2ac5
movq -0x8(%rbp), %rax
movq 0xc0(%rax), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x1e2857
jmp 0x1e2ab4
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
jge 0x1e2ab2
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
cmpq -0x28(%rbp), %rax
je 0x1e2892
jmp 0x1e2aa1
movq 0x1e1747(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
leaq 0x1aa1df(%rip), %rsi    # 0x38ca8e
movb $0x0, %al
callq 0x22a0
cmpq $0x0, -0x38(%rbp)
jle 0x1e299f
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x58(%rbp)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
andq $0x1, %rax
movl %eax, -0x5c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movl -0x58(%rbp), %eax
movq %rax, -0x78(%rbp)
cmpl $0x1, -0x5c(%rbp)
jne 0x1e291d
leaq -0x68(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x1e2928
xorl %eax, %eax
movq %rax, -0x88(%rbp)
jmp 0x1e2928
movq -0x88(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpl $0x0, -0x5c(%rbp)
jne 0x1e2949
leaq -0x68(%rbp), %rax
movq %rax, -0x98(%rbp)
jmp 0x1e2954
xorl %eax, %eax
movq %rax, -0x98(%rbp)
jmp 0x1e2954
movq -0x90(%rbp), %rdx
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdi
movq -0x98(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %r8
movq $0x0, (%rsp)
callq 0x1c4b20
movq 0x1e165a(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movl -0x5c(%rbp), %edx
shrl %edx
addl $0x1, %edx
leaq 0x1aa11b(%rip), %rsi    # 0x38cab3
movb $0x0, %al
callq 0x22a0
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq -0x40(%rbp), %rcx
movl 0x10(%rcx), %ecx
cmpq %rcx, %rax
jge 0x1e2a9f
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
shrq $0x20, %rax
andq $0x1, %rax
xorq $0x1, %rax
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl -0x60(%rbp), %eax
movq %rax, -0xa0(%rbp)
cmpl $0x1, -0x64(%rbp)
jne 0x1e2a17
leaq -0x6c(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x1e2a22
xorl %eax, %eax
movq %rax, -0xb0(%rbp)
jmp 0x1e2a22
movq -0xb0(%rbp), %rax
movq %rax, -0xb8(%rbp)
cmpl $0x0, -0x64(%rbp)
jne 0x1e2a43
leaq -0x6c(%rbp), %rax
movq %rax, -0xc0(%rbp)
jmp 0x1e2a4e
xorl %eax, %eax
movq %rax, -0xc0(%rbp)
jmp 0x1e2a4e
movq -0xb8(%rbp), %rdx
movq -0xa0(%rbp), %rsi
movq -0xa8(%rbp), %rdi
movq -0xc0(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %r8
movq $0x0, (%rsp)
callq 0x1c4b20
movq 0x1e155a(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movl -0x64(%rbp), %edx
shrl %edx
addl $0x1, %edx
leaq 0x1aa02a(%rip), %rsi    # 0x38cac2
movb $0x0, %al
callq 0x22a0
jmp 0x1e2aa1
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1e285f
jmp 0x1e2ab4
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1e2806
jmp 0x1e2ac7
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1e2743
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)