// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: get_bridges(ul_resolve_t*, unsigned long*, unsigned long, unsigned int*, unsigned int*)
inline void get_bridges(ul_resolve_t *uidx, uint64_t *v_a, uint64_t v_n, uint32_t *w_occ, uint32_t *am_occ)
{
    ul_bg_t *bg = &(uidx->uovl.bg); uint64_t k, w, am, l; uint32_t uv, uw, bv, bw; 
    for (k = w = am = 0, uv = uw = (uint32_t)-1; k < v_n; k++) {
        w += bg->w_n[v_a[k]>>1]; am += bg->a_n[v_a[k]>>1]; uw = v_a[k];
        if(uv != (uint32_t)-1) {
            bv = uidx->uovl.cc.iug_a[uv>>1].a[((uv&1)?(0):(uidx->uovl.cc.iug_a[uv>>1].n-1))].v; if(uv&1) bv ^= 1;
            bw = uidx->uovl.cc.iug_a[uw>>1].a[((uw&1)?(uidx->uovl.cc.iug_a[uw>>1].n-1):(0))].v; if(uw&1) bw ^= 1;
            if((ulg_type(uidx->uovl, (bv>>1))) && (ulg_type(uidx->uovl, (bw>>1)))) {
                l = get_bg_flag(uidx, bv, bw);
                if(l == bg_wrong) w++;
                if(l == bg_ambiguous) am++;
            }
        }
        uv = uw;
    }
    if(w_occ) *w_occ = w;
    if(am_occ) *am_occ = am;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, -0x18(%rsp)
movq %rcx, -0x20(%rsp)
testq %rdx, %rdx
je 0x22d182
movq 0x280(%rdi), %rax
movq %rax, -0x8(%rsp)
movq 0x288(%rdi), %rax
movq %rax, -0x10(%rsp)
xorl %ebx, %ebx
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
xorl %eax, %eax
xorl %r9d, %r9d
movl %r14d, %ebp
movq (%rsi,%rbx,8), %r14
movq %r14, %r12
shrq %r12
movq -0x8(%rsp), %rcx
addl (%rcx,%r12,4), %r9d
movq -0x10(%rsp), %rcx
addl (%rcx,%r12,4), %eax
cmpl $-0x1, %ebp
je 0x22d174
movq 0x260(%rdi), %r13
movl %ebp, %ecx
shrl %ecx
leaq (%rcx,%rcx,2), %r15
testb $0x1, %bpl
jne 0x22d067
leaq (,%r15,8), %rcx
addq %r13, %rcx
movq (%rcx), %r10
decq %r10
jmp 0x22d06a
xorl %r10d, %r10d
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
leaq (%r12,%r12,2), %r8
movl %r14d, %r12d
andl $0x1, %r12d
jne 0x22d082
xorl %ecx, %ecx
jmp 0x22d093
leaq (,%r8,8), %rcx
addq %r13, %rcx
movq (%rcx), %rcx
decq %rcx
movq 0x10(%r13,%r15,8), %r11
shlq $0x4, %r10
movl (%r11,%r10), %r15d
movl %r15d, %r10d
shrl %r10d
movq 0x208(%rdi), %r11
cmpq %r10, %r11
jbe 0x22d174
movq 0x10(%r13,%r8,8), %r8
shlq $0x4, %rcx
movl (%r8,%rcx), %r13d
movl %r13d, %r8d
shrl %r8d
cmpq %r8, %r11
jbe 0x22d174
movq 0x278(%rdi), %rcx
movq 0x20(%rcx), %r11
cmpl $0x0, (%r11,%r10,8)
js 0x22d174
cmpl $0x0, (%r11,%r8,8)
js 0x22d174
andl $0x1, %ebp
xorl %ebp, %r15d
movq 0x28(%rcx), %r8
movl %r15d, %r10d
movq (%r8,%r10,8), %r8
movq %r8, %r15
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
andq %r10, %r15
je 0x22d174
xorl %r12d, %r13d
movq 0x8(%rcx), %rcx
shrq $0x20, %r8
leaq (%r8,%r8,2), %r8
leaq (%rcx,%r8,8), %r10
addq $0x10, %r10
shlq $0x3, %r15
leaq (%r15,%r15,2), %r12
xorl %r15d, %r15d
cmpl %r13d, -0x8(%r10,%r15)
je 0x22d146
addq $0x18, %r15
cmpq %r15, %r12
jne 0x22d134
jmp 0x22d174
leaq (%rcx,%r8,8), %rcx
movzwl 0x10(%r15,%rcx), %ecx
andl $0x3fff, %ecx           # imm = 0x3FFF
cmpw $0x3, %cx
je 0x22d174
xorl %r8d, %r8d
xorl %r10d, %r10d
cmpw $0x2, %cx
setne %r8b
sete %r10b
addl %r10d, %r9d
addl %r8d, %eax
incq %rbx
cmpq %rdx, %rbx
jne 0x22d017
jmp 0x22d187
xorl %r9d, %r9d
xorl %eax, %eax
movq -0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x22d194
movl %r9d, (%rcx)
movq -0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x22d1a0
movl %eax, (%rcx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq