// File: /workspace/github_cpp_makefile_star2_O1/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 %rsi, -0x8(%rsp)
testq %rdx, %rdx
je 0x221aeb
movq %rcx, -0x28(%rsp)
movq %r8, -0x20(%rsp)
movq 0x280(%rdi), %rax
movq %rax, -0x10(%rsp)
movq 0x288(%rdi), %rax
movq %rax, -0x18(%rsp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %r14d, %r14d
xorl %eax, %eax
xorl %r10d, %r10d
movq %r10, %rcx
movq %rax, %rsi
movl %ebx, %r12d
movq -0x8(%rsp), %rax
movq (%rax,%r14,8), %rbx
movq %rbx, %r13
shrq %r13
movq -0x10(%rsp), %rax
movl (%rax,%r13,4), %r10d
addq %rcx, %r10
movq -0x18(%rsp), %rax
movl (%rax,%r13,4), %eax
addq %rsi, %rax
cmpl $-0x1, %r12d
je 0x221ad3
movq 0x260(%rdi), %r15
movl %r12d, %ecx
shrl %ecx
leaq (%rcx,%rcx,2), %r9
testb $0x1, %r12b
jne 0x22199c
leaq (%r15,%r9,8), %rcx
movq (%rcx), %r8
decq %r8
jmp 0x22199f
xorl %r8d, %r8d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
leaq (%r13,%r13,2), %r13
movl %ebx, %ebp
andl $0x1, %ebp
jne 0x2219b6
xorl %ecx, %ecx
jmp 0x2219c0
leaq (%r15,%r13,8), %rcx
movq (%rcx), %rcx
decq %rcx
movq 0x10(%r15,%r9,8), %rsi
shlq $0x4, %r8
movl (%rsi,%r8), %r11d
movl %r11d, %r9d
shrl %r9d
movq 0x208(%rdi), %r8
cmpq %r9, %r8
jbe 0x221ad3
movq 0x10(%r15,%r13,8), %rsi
shlq $0x4, %rcx
movl (%rsi,%rcx), %r13d
movl %r13d, %ecx
shrl %ecx
cmpq %rcx, %r8
jbe 0x221ad3
movq 0x278(%rdi), %r8
movq 0x20(%r8), %r15
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
cmpl $0x0, (%r15,%r9,8)
js 0x221abd
cmpl $0x0, (%r15,%rcx,8)
js 0x221abd
andl $0x1, %r12d
xorl %r12d, %r11d
movq 0x28(%r8), %rcx
movl %r11d, %r9d
movq (%rcx,%r9,8), %r9
movq %r9, %rcx
shlq $0x20, %rcx
setne %cl
je 0x221abd
xorl %ebp, %r13d
movq 0x8(%r8), %r8
movq %r9, %r11
shrq $0x20, %r11
leaq (%r11,%r11,2), %r11
leaq (%r8,%r11,8), %r12
cmpl %r13d, 0x8(%r12)
jne 0x221a64
xorl %r8d, %r8d
jmp 0x221a90
movl %r9d, %ecx
leaq (%r8,%r11,8), %r11
addq $0x20, %r11
leaq -0x1(%rcx), %r9
xorl %r8d, %r8d
cmpq %r8, %r9
je 0x221abd
leaq 0x18(%r11), %r15
incq %r8
cmpl %r13d, (%r11)
movq %r15, %r11
jne 0x221a76
cmpq %rcx, %r8
setb %cl
testb %cl, %cl
je 0x221abd
leaq (%r8,%r8,2), %rcx
movzwl 0x10(%r12,%rcx,8), %ecx
andl $0x3fff, %ecx           # imm = 0x3FFF
xorl %esi, %esi
cmpw $0x2, %cx
sete %sil
xorl $0x3, %esi
cmpw $0x3, %cx
movl $0x1, %ecx
cmovel %ecx, %esi
xorl %ecx, %ecx
cmpl $0x2, %esi
sete %cl
addq %rcx, %r10
xorl %ecx, %ecx
cmpl $0x3, %esi
sete %cl
addq %rcx, %rax
incq %r14
cmpq %rdx, %r14
jne 0x221940
movq -0x20(%rsp), %r8
movq -0x28(%rsp), %rcx
jmp 0x221af0
xorl %r10d, %r10d
xorl %eax, %eax
testq %rcx, %rcx
je 0x221af8
movl %r10d, (%rcx)
testq %r8, %r8
je 0x221b00
movl %eax, (%r8)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq