// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/hic.cpp
// Function: get_related_bub_nodes(kvec_t_u32_warp*, bubble_type*, pdq*, asg_t*, unsigned int*, unsigned int, unsigned int, unsigned char*)
void get_related_bub_nodes(kvec_t_u32_warp* broken, bubble_type* bub, pdq* pq, asg_t *unitig_g, 
                                        uint32_t *pre, uint32_t src, uint32_t dest, uint8_t *bsg_idx)
{
    uint32_t j_i, pre_id, adjecent;
    src ^= 1;
    get_shortest_path(src, pq, unitig_g, pre);
            
    for (j_i = 0; j_i < pq->dis.n; j_i++)
    {
        if(pq->dis.a[j_i] == (uint64_t)-1) continue;
        ///if(IF_HOM(j_i>>1, *bub)) continue;
        if((j_i>>1) == (src>>1)) continue;
        if((dest != (uint32_t)-1) && ((j_i>>1) == (dest>>1))) continue;

        pre_id = pre[j_i];
        adjecent = 0;
        while (pre_id != src)
        { 
            if(((dest != (uint32_t)-1) && ((pre_id>>1) == (dest>>1))) 
                                                || ((pre_id>>1) == (src>>1)))
            {
                adjecent = 1;
                break;
            }
            pre_id = pre[pre_id];
        }
        
        if(adjecent == 0)
        {
            if(broken->a.n == 0 || (broken->a.n > 0 && (j_i>>1) != (broken->a.a[broken->a.n - 1]>>1)))
            {
                if(bsg_idx && bsg_idx[(j_i>>1)])
                {
                    broken->a.n = 0;
                    return;
                }
                kv_push(uint32_t, broken->a, j_i);
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %ebx
movq %r8, %r14
movq %rdx, %r12
movq %rdi, %r15
movl %r9d, %ebp
xorl $0x1, %ebp
movl %ebp, %edi
movq %rdx, %rsi
movq %rcx, %rdx
movq %r8, %rcx
callq 0x13be4a
cmpq $0x0, 0x30(%r12)
je 0x146544
movq %r15, %r8
movq 0x58(%rsp), %r9
movl 0x50(%rsp), %r13d
shrl %ebx
movl %r13d, %r10d
shrl %r10d
xorl %r15d, %r15d
movq %r8, 0x10(%rsp)
movl %r10d, 0xc(%rsp)
movq 0x40(%r12), %rax
cmpq $-0x1, (%rax,%r15,8)
je 0x146536
cmpl $-0x1, %r13d
setne %cl
movl %r15d, %eax
shrl %eax
cmpl %r10d, %eax
sete %dl
cmpl %ebx, %eax
je 0x146536
andb %dl, %cl
jne 0x146536
movl (%r14,%r15,4), %ecx
cmpl %ebp, %ecx
je 0x1464c5
cmpl $-0x1, %r13d
setne %dl
movl %ecx, %esi
xorl %r13d, %esi
cmpl $0x2, %esi
setb %sil
movl %ecx, %edi
shrl %edi
cmpl %ebx, %edi
je 0x146536
andb %sil, %dl
jne 0x146536
movl %ecx, %ecx
movl (%r14,%rcx,4), %ecx
jmp 0x146499
movq (%r8), %rcx
testq %rcx, %rcx
je 0x1464db
movq 0x10(%r8), %rdx
movl -0x4(%rdx,%rcx,4), %edx
shrl %edx
cmpl %edx, %eax
je 0x146536
testq %r9, %r9
je 0x1464e7
cmpb $0x0, (%r9,%rax)
jne 0x146553
movq 0x8(%r8), %rax
cmpq %rax, %rcx
jne 0x146524
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r8)
movq 0x10(%r8), %rdi
shlq $0x2, %rsi
callq 0x2370
movl 0xc(%rsp), %r10d
movq 0x58(%rsp), %r9
movq 0x10(%rsp), %r8
movq %rax, 0x10(%r8)
movq (%r8), %rax
movq 0x10(%r8), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r8)
movl %r15d, (%rcx,%rax,4)
incl %r15d
cmpq %r15, 0x30(%r12)
ja 0x146463
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, (%r8)
jmp 0x146544