// File: 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
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %edi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x1cc080
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0x1df831
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x30(%rbp), %ecx
cmpq $-0x1, (%rax,%rcx,8)
jne 0x1df6a3
jmp 0x1df823
movl -0x30(%rbp), %eax
shrl %eax
movl -0x2c(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0x1df6b6
jmp 0x1df823
cmpl $-0x1, 0x10(%rbp)
je 0x1df6cf
movl -0x30(%rbp), %eax
shrl %eax
movl 0x10(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0x1df6cf
jmp 0x1df823
movq -0x28(%rbp), %rax
movl -0x30(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x2c(%rbp), %eax
je 0x1df725
cmpl $-0x1, 0x10(%rbp)
je 0x1df6ff
movl -0x34(%rbp), %eax
shrl %eax
movl 0x10(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
je 0x1df70d
movl -0x34(%rbp), %eax
shrl %eax
movl -0x2c(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0x1df716
movl $0x1, -0x38(%rbp)
jmp 0x1df725
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
jmp 0x1df6e3
cmpl $0x0, -0x38(%rbp)
jne 0x1df821
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x1df76c
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
jbe 0x1df81f
movl -0x30(%rbp), %eax
shrl %eax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x8(%rbp), %rdx
movq (%rdx), %rdx
subq $0x1, %rdx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
cmpl %ecx, %eax
je 0x1df81f
cmpq $0x0, 0x18(%rbp)
je 0x1df794
movq 0x18(%rbp), %rax
movl -0x30(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
cmpb $0x0, (%rax,%rcx)
je 0x1df794
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
jmp 0x1df831
jmp 0x1df796
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x1df7fe
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x1df7c3
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x40(%rbp)
jmp 0x1df7ce
movl $0x2, %eax
movq %rax, -0x40(%rbp)
jmp 0x1df7ce
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x30(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x1df81f
jmp 0x1df821
jmp 0x1df823
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1df67b
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)