// File: chhylp123[P]hifiasm/hic.cpp
// Function: update_bub_b_s_idx(bubble_type*)
void update_bub_b_s_idx(bubble_type* bub) 
{
    memset(bub->b_s_idx.a, -1, bub->b_s_idx.n * sizeof(uint64_t));
    uint32_t i, v, beg, sink, n_bub = bub->num.n - 1;
    for (i = 0; i < n_bub; i++)
    {
        get_bubbles(bub, i, &beg, &sink, NULL, NULL, NULL);

        if(beg != (uint32_t)-1)
        {
            v = beg>>1;
            if(bub->b_s_idx.a[v] == (uint64_t)-1)
            {
                bub->b_s_idx.a[v] <<= 32;
                bub->b_s_idx.a[v] |= i;
            }
            else if((bub->b_s_idx.a[v] & 0xffffffff00000000) == 0xffffffff00000000)
            {
                bub->b_s_idx.a[v] <<= 32;
                bub->b_s_idx.a[v] |= i;
            }
        }

        

        if(sink != (uint32_t)-1)
        {
            v = sink>>1;
            if(bub->b_s_idx.a[v] == (uint64_t)-1)
            {
                bub->b_s_idx.a[v] <<= 32;
                bub->b_s_idx.a[v] |= i;
            }
            else if((bub->b_s_idx.a[v] & 0xffffffff00000000) == 0xffffffff00000000)
            {
                bub->b_s_idx.a[v] <<= 32;
                bub->b_s_idx.a[v] |= i;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdx
shlq $0x3, %rdx
movl $0xff, %esi
callq 0x2100
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
subq $0x1, %rax
movl %eax, -0x1c(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x1c6ed6
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, %esi
leaq -0x14(%rbp), %rdx
leaq -0x18(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r9d
movq %r9, %r8
movq $0x0, (%rsp)
callq 0x1c4b20
cmpl $-0x1, -0x14(%rbp)
je 0x1c6e14
movl -0x14(%rbp), %eax
shrl %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x10(%rbp), %ecx
cmpq $-0x1, (%rax,%rcx,8)
jne 0x1c6db7
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x10(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x10(%rbp), %ecx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x1c6e12
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rcx
movl -0x10(%rbp), %eax
movl %eax, %edx
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
andq (%rcx,%rdx,8), %rax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jne 0x1c6e10
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x10(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x10(%rbp), %ecx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x1c6e12
jmp 0x1c6e14
cmpl $-0x1, -0x18(%rbp)
je 0x1c6ec6
movl -0x18(%rbp), %eax
shrl %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x10(%rbp), %ecx
cmpq $-0x1, (%rax,%rcx,8)
jne 0x1c6e69
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x10(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x10(%rbp), %ecx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x1c6ec4
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rcx
movl -0x10(%rbp), %eax
movl %eax, %edx
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
andq (%rcx,%rdx,8), %rax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jne 0x1c6ec2
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x10(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
shlq $0x20, %rdx
movq %rdx, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movl -0x10(%rbp), %ecx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x1c6ec4
jmp 0x1c6ec6
jmp 0x1c6ec8
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1c6d30
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)