// File: /workspace/github_cpp_makefile_star2_O1/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 $0x48, %rsp
movl %ecx, 0x18(%rsp)
movq %rdx, 0x40(%rsp)
cmpq $0x0, (%rsi)
je 0x16f55
movabsq $0x100000000, %r9       # imm = 0x100000000
xorl %eax, %eax
xorl %ecx, %ecx
movq %rsi, 0x30(%rsp)
movq %rdi, 0x8(%rsp)
movq %rcx, 0x38(%rsp)
movq 0x10(%rsi), %r10
imulq $0x28, %rax, %rax
cmpl $0x0, 0x10(%r10,%rax)
je 0x16f3d
addq %rax, %r10
movl 0x10(%r10), %eax
testl %eax, %eax
je 0x16f3d
xorl %r12d, %r12d
movq %r10, 0x10(%rsp)
movq %r12, %rbp
incq %r12
movl %eax, %eax
cmpq %rax, %r12
jae 0x16f30
movq 0x18(%r10), %rax
movq (%rax,%rbp,8), %r13
movq %r13, %rbx
shrq $0x21, %rbx
testq %r9, %r13
jne 0x16d46
movq 0x40(%rdi), %rax
movl (%rax,%rbx,4), %eax
incl %eax
jmp 0x16d4d
movq 0x40(%rdi), %rax
movl (%rax,%rbx,4), %eax
movq %r13, %rcx
shrq $0x20, %rcx
movq 0x28(%rdi), %rdx
movl %eax, %eax
movl (%rdx,%rax,4), %r15d
movq 0x40(%rsp), %rdx
movq 0x28(%rdx), %rax
movl 0x4(%rax,%rcx,8), %eax
imulq $0x18, %rax, %r14
addq 0x8(%rdx), %r14
movl %r15d, 0x1c(%rsp)
shrl %r15d
movl %r15d, %esi
leaq 0x28(%rsp), %rdx
leaq 0x20(%rsp), %rcx
movl 0x18(%rsp), %r8d
callq 0x1445e7
cmpq $-0x1, 0x28(%rsp)
je 0x16eda
movb 0x12(%r14), %al
cmpb $0x1, %al
sete %dl
movq 0x20(%rsp), %rcx
cmpq $-0x1, %rcx
sete %sil
testb %sil, %dl
jne 0x16eda
testb %al, %al
sete %al
cmpq $-0x1, %rcx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
je 0x16eda
movq 0x10(%rsp), %r10
movq 0x18(%r10), %rax
movq 0x8(%rax,%rbp,8), %r15
movq 0x8(%rsp), %rdi
movq 0x28(%rdi), %rax
movq 0x40(%rdi), %rcx
movl (%rcx,%rbx,4), %ecx
leal 0x1(%rcx), %edx
movl (%rax,%rcx,4), %ecx
movl (%rax,%rdx,4), %r8d
movabsq $0x100000000, %r9       # imm = 0x100000000
testq %r9, %r13
jne 0x16e44
leaq 0x218c9e(%rip), %rsi    # 0x22fab0
movl 0x1c(%rsp), %ebx
cmpl %r8d, %ebx
je 0x16e53
movq 0x2731be(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x22b0
movq 0x10(%rsp), %r10
movabsq $0x100000000, %r9       # imm = 0x100000000
movq 0x8(%rsp), %rdi
jmp 0x16e53
leaq 0x218c3a(%rip), %rsi    # 0x22fa85
movl 0x1c(%rsp), %ebx
cmpl %ecx, %ebx
jne 0x16e1b
cmpb $0x1, 0x12(%r14)
jne 0x16f30
movq %r15, %rax
shrq $0x21, %rax
movq 0x28(%rdi), %rdx
movq 0x40(%rdi), %rcx
movl (%rcx,%rax,4), %eax
movl (%rdx,%rax,4), %ecx
incl %eax
movl (%rdx,%rax,4), %r8d
movl %ebx, %eax
testq %r9, %r15
jne 0x16e9e
xorl %ecx, %eax
cmpl $0x1, %eax
je 0x16f30
movq 0x27314e(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x218c3f(%rip), %rsi    # 0x22fadb
jmp 0x16ebb
xorl %r8d, %eax
cmpl $0x1, %eax
je 0x16f30
movq 0x27312f(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x218c4b(%rip), %rsi    # 0x22fb06
movl %ebx, %edx
xorl %eax, %eax
callq 0x22b0
movq 0x10(%rsp), %r10
movabsq $0x100000000, %r9       # imm = 0x100000000
movq 0x8(%rsp), %rdi
jmp 0x16f30
movq 0x2730ff(%rip), %rbx    # 0x289fe0
movq (%rbx), %rdi
incl %r15d
leaq 0x218b52(%rip), %rsi    # 0x22fa40
movl %r15d, %edx
movl 0x18(%rsp), %ecx
xorl %eax, %eax
callq 0x22b0
movq (%rbx), %rdi
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
movzbl 0x12(%r14), %r8d
leaq 0x218b51(%rip), %rsi    # 0x22fa66
xorl %eax, %eax
callq 0x22b0
movq 0x8(%rsp), %rdi
movabsq $0x100000000, %r9       # imm = 0x100000000
movq 0x10(%rsp), %r10
movl 0x10(%r10), %eax
cmpq %rax, %r12
jb 0x16d16
movq 0x38(%rsp), %rcx
incl %ecx
movq %rcx, %rax
movq 0x30(%rsp), %rsi
cmpq %rcx, (%rsi)
ja 0x16ce6
movq 0x273084(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x21935a(%rip), %rsi    # 0x2302c0
leaq 0x218bc4(%rip), %rdx    # 0x22fb31
xorl %eax, %eax
callq 0x22b0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq