// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: debug_bub_utg(bubble_type*, ma_ug_t*, asg_t*, unsigned int)
void debug_bub_utg(bubble_type* bub, ma_ug_t *bug, asg_t *bsg, uint32_t check_het)
{
    uint32_t i, k, rId, rId_next, ori, ori_next, root, beg, end;
    uint64_t id0, id1;
    ma_utg_t *u = NULL;
    asg_arc_t *t = NULL;
    for (i = 0; i < bug->u.n; i++)
    {
        u = &(bug->u.a[i]);
        if(u->n == 0) continue;
        for (k = 0; k < u->n; k++)
        {
            if(k+1 >= u->n) continue;
            rId = u->a[k]>>33;
            ori = u->a[k]>>32&1;
            get_bubbles(bub, rId, ori == 1?&root:NULL, ori == 0?&root:NULL, NULL, NULL, NULL);

            t = &(arc_first(bsg, u->a[k]>>32));
            get_bub_id(bub, root>>1, &id0, &id1, check_het);
            if(id0 == (uint64_t)-1 || (t->el == 1 && id1 == (uint64_t)-1) || (t->el == 0 && id1 != (uint64_t)-1))
            {
                fprintf(stderr, "sbsbsb0sbsbsb-utg%.6d, check_het: %u\n", (int)((root>>1)+1), check_het);
                fprintf(stderr, "id0: %lu, id1: %lu, t->el: %u\n", id0, id1, t->el);
                continue;
            }

            ///fprintf(stderr, "aaaaaaaa10aaaaaaaa-utg%.6d\n", (int)((root>>1)+1));

            rId_next = u->a[k+1]>>33;
            ori_next = u->a[k+1]>>32&1;


            get_bubbles(bub, rId, &beg, &end, NULL, NULL, NULL);
            if(ori == 1)
            {
                if(root != beg) fprintf(stderr, "sbsbsb1sbsbsb, root: %u, beg: %u, end: %u\n", root, beg, end);
            }
            else
            {
                if(root != end) fprintf(stderr, "sbsbsb2sbsbsb, root: %u, beg: %u, end: %u\n", root, beg, end);
            }

            if(t->el == 1)
            {
                get_bubbles(bub, rId_next, &beg, &end, NULL, NULL, NULL);
                if(ori_next == 0)
                {
                    if(root != (beg^1)) fprintf(stderr, "sbsbsb3sbsbsb, root: %u, beg: %u, end: %u\n", root, beg, end);
                }
                else
                {
                    if(root != (end^1)) fprintf(stderr, "sbsbsb4sbsbsb, root: %u, beg: %u, end: %u\n", root, beg, end);
                }
            }
        }
    }

    fprintf(stderr, "[M::%s]\n", __func__);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %ecx, 0x10(%rsp)
movq %rdx, 0x48(%rsp)
movq %rdi, 0x18(%rsp)
movq (%rsi), %rax
testq %rax, %rax
je 0x16696
movabsq $0x100000000, %r15      # imm = 0x100000000
xorl %ecx, %ecx
xorl %edi, %edi
movq %rsi, 0x38(%rsp)
movq 0x10(%rsi), %r9
imulq $0x28, %rcx, %rdx
movl 0x10(%r9,%rdx), %ecx
testl %ecx, %ecx
je 0x16688
movq %rdi, 0x40(%rsp)
addq %rdx, %r9
xorl %r14d, %r14d
movq %r9, 0x8(%rsp)
movq %r14, %rbx
incq %r14
movl %ecx, %eax
cmpq %rax, %r14
jae 0x1666e
movq %r14, 0x20(%rsp)
movq 0x18(%r9), %rax
movq (%rax,%rbx,8), %rbp
movq %rbp, %r12
shrq $0x21, %r12
movq %rbp, %rax
andq %r15, %rax
movq 0x18(%rsp), %rdi
movq 0x28(%rdi), %r13
movq 0x40(%rdi), %rcx
movq %rcx, 0x50(%rsp)
movl (%rcx,%r12,4), %ecx
cmpq $0x1, %rax
adcl $0x0, %ecx
movl (%r13,%rcx,4), %r15d
movq 0x48(%rsp), %rdx
movq 0x28(%rdx), %rax
movq %rbp, %rcx
shrq $0x20, %rcx
movl 0x4(%rax,%rcx,8), %eax
imulq $0x18, %rax, %r14
addq 0x8(%rdx), %r14
movl %r15d, 0x14(%rsp)
shrl %r15d
movl %r15d, %esi
leaq 0x30(%rsp), %rdx
leaq 0x28(%rsp), %rcx
movl 0x10(%rsp), %r8d
callq 0x14ac07
cmpq $-0x1, 0x30(%rsp)
je 0x16618
movb 0x12(%r14), %al
cmpb $0x1, %al
sete %dl
movq 0x28(%rsp), %rcx
cmpq $-0x1, %rcx
sete %sil
testb %sil, %dl
jne 0x16618
testb %al, %al
sete %al
cmpq $-0x1, %rcx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
je 0x16618
movq 0x8(%rsp), %r9
movq 0x18(%r9), %rax
movq 0x8(%rax,%rbx,8), %rbx
movq 0x50(%rsp), %rax
movl (%rax,%r12,4), %eax
leal 0x1(%rax), %edx
movl (%r13,%rax,4), %ecx
movl (%r13,%rdx,4), %r8d
movabsq $0x100000000, %r15      # imm = 0x100000000
testq %r15, %rbp
jne 0x1658b
leaq 0x225798(%rip), %rsi    # 0x23bd00
movl 0x14(%rsp), %ebp
cmpl %r8d, %ebp
je 0x1659a
movq 0x27ea68(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x22b0
movq 0x8(%rsp), %r9
jmp 0x1659a
leaq 0x225743(%rip), %rsi    # 0x23bcd5
movl 0x14(%rsp), %ebp
cmpl %ecx, %ebp
jne 0x16571
cmpb $0x1, 0x12(%r14)
movq 0x20(%rsp), %r14
jne 0x1666e
movq %rbx, %rax
shrq $0x21, %rax
movq 0x18(%rsp), %rcx
movq 0x28(%rcx), %rdx
movq 0x40(%rcx), %rcx
movl (%rcx,%rax,4), %eax
movl (%rdx,%rax,4), %ecx
incl %eax
movl (%rdx,%rax,4), %r8d
movl %ebp, %eax
testq %r15, %rbx
jne 0x165ef
xorl %ecx, %eax
cmpl $0x1, %eax
je 0x1666e
movq 0x27e9fd(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x22573e(%rip), %rsi    # 0x23bd2b
jmp 0x16608
xorl %r8d, %eax
cmpl $0x1, %eax
je 0x1666e
movq 0x27e9e2(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x22574e(%rip), %rsi    # 0x23bd56
movl %ebp, %edx
xorl %eax, %eax
callq 0x22b0
movq 0x8(%rsp), %r9
jmp 0x1666e
movq 0x27e9c1(%rip), %rbx    # 0x294fe0
movq (%rbx), %rdi
incl %r15d
leaq 0x225664(%rip), %rsi    # 0x23bc90
movl %r15d, %edx
movl 0x10(%rsp), %ecx
xorl %eax, %eax
callq 0x22b0
movq (%rbx), %rdi
movq 0x30(%rsp), %rdx
movq 0x28(%rsp), %rcx
movzbl 0x12(%r14), %r8d
leaq 0x225663(%rip), %rsi    # 0x23bcb6
xorl %eax, %eax
callq 0x22b0
movabsq $0x100000000, %r15      # imm = 0x100000000
movq 0x8(%rsp), %r9
movq 0x20(%rsp), %r14
movl 0x10(%r9), %ecx
cmpq %rcx, %r14
jb 0x16464
movq 0x38(%rsp), %rsi
movq (%rsi), %rax
movq 0x40(%rsp), %rdi
incl %edi
movq %rdi, %rcx
cmpq %rdi, %rax
ja 0x1643f
movq 0x27e943(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x225e25(%rip), %rsi    # 0x23c4cc
leaq 0x2256d3(%rip), %rdx    # 0x23bd81
xorl %eax, %eax
callq 0x22b0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq