// File: chhylp123[P]hifiasm/hic.cpp
// Function: update_bubble_weight(bub_sort_vec*, unsigned int, kv_u_trans_t*, unsigned char*, unsigned int)
void update_bubble_weight(bub_sort_vec* w_stack, uint32_t idx, kv_u_trans_t *ta, uint8_t* vis, uint32_t flag_cur)
{
    w_stack->a[idx].used = 1;
    uint32_t k, m, uid = w_stack->a[idx].p_id>>1;
    u_trans_t *e = u_trans_a(*ta, uid);
    uint32_t e_n = u_trans_n(*ta, uid);
    for (k = 0; k < e_n; k++)
    {
        if(e[k].del) continue;
        if(vis[e[k].tn] != flag_cur) continue;
        for (m = 0; m < w_stack->n; m++)
        {
            if(e[k].tn == (w_stack->a[m].p_id>>1)) break;
        }
        if(m >= w_stack->n) continue;
        if(w_stack->a[m].used) continue;
        w_stack->a[m].weight += (e[k].nw>=0?e[k].nw:-e[k].nw);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movb $0x1, 0x20(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0xc(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shrq %rax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x30(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x30(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jae 0x1fe032
movq -0x38(%rbp), %rax
movl -0x28(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movb 0x28(%rax), %al
shrb $0x7, %al
cmpb $0x0, %al
je 0x1fdeff
jmp 0x1fe024
movq -0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
movl -0x28(%rbp), %edx
imulq $0x30, %rdx, %rdx
addq %rdx, %rcx
movl 0x14(%rcx), %ecx
movzbl (%rax,%rcx), %eax
cmpl -0x24(%rbp), %eax
je 0x1fdf22
jmp 0x1fe024
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x1fdf73
movq -0x38(%rbp), %rax
movl -0x28(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movl -0x2c(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
shrq %rcx
cmpq %rcx, %rax
jne 0x1fdf66
jmp 0x1fdf73
jmp 0x1fdf68
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1fdf29
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jb 0x1fdf85
jmp 0x1fe024
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpb $0x0, 0x20(%rax)
je 0x1fdfa1
jmp 0x1fe024
movq -0x38(%rbp), %rax
movl -0x28(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x1fdfd7
movq -0x38(%rbp), %rax
movl -0x28(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x1fe006
movq -0x38(%rbp), %rax
movl -0x28(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x20(%rax), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x48(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x2c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x1fded6
popq %rbp
retq
nopw %cs:(%rax,%rax)