// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: update_sg_uo(asg_t*, ma_hit_t_alloc*)
void update_sg_uo(asg_t *g, ma_hit_t_alloc *src)
{
	sset_aux s; s.g = g; s.src = src;
	kt_for(asm_opt.thread_num, update_sg_uo_t, &s, g->n_arc);
    uint32_t k, z, nv, occ_a = 0, occ_n = 0; asg_arc_t *av = NULL;
    for (k = 0; k < g->n_seq; k++) {
        if(g->seq[k].del) continue;
        occ_n++;

        av = asg_arc_a(g, (k<<1)); nv = asg_arc_n(g, (k<<1));
        for (z = 0; z < nv; z++) {
            if(av[z].del || av[z].ou == 0) continue;
            break;
        }
        if(z < nv) {
            occ_a++;
            continue;
        }

        av = asg_arc_a(g, ((k<<1)+1)); nv = asg_arc_n(g, ((k<<1)+1));
        for (z = 0; z < nv; z++) {
            if(av[z].del || av[z].ou == 0) continue;
            break;
        }
        if(z < nv) {
            occ_a++;
        }
    }

    fprintf(stderr, "[M::%s::] ==> # gfa reads:%u, # covered gfa reads:%u\n", __func__, occ_n, occ_a);

    // asg_arc_t *e; uint32_t v, w;
    // for (k = 0; k < g->n_arc; k++) {
    //     e = &(g->arc[k]);
    //     v = e->v^1; w = (e->ul>>32)^1;
    //     av = asg_arc_a(g, v); nv = asg_arc_n(g, v);
    //     for (z = 0; z < nv; z++) {
    //         if(av[z].v == w) break;
    //     }
    //     if(z >= nv || av[z].ou != e->ou) fprintf(stderr, "[M::%s::asymmetry]\n", __func__);
    // }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rdx
movq %rdi, (%rdx)
movq %rsi, 0x8(%rdx)
leaq 0x25f343(%rip), %rax    # 0x28a758
movl 0x7c(%rax), %edi
movl 0x4(%rbx), %ecx
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
andq %r14, %rcx
leaq 0x1bb0d0(%rip), %rsi    # 0x1e64fb
callq 0x1047b4
movl 0x14(%rbx), %eax
xorl %r8d, %r8d
movl $0x0, %ecx
andq %r14, %rax
je 0x2b52c
movq 0x20(%rbx), %rdx
xorl %esi, %esi
pushq $0x1
popq %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
cmpl $0x0, (%rdx,%rsi,8)
js 0x2b520
incl %ecx
movq 0x8(%rbx), %r9
movq 0x28(%rbx), %r10
movq %rsi, %r11
shlq $0x4, %r11
movq (%r10,%r11), %r11
testl %r11d, %r11d
je 0x2b4af
movq %r11, %r14
shrq $0x20, %r14
movl %r11d, %r15d
imulq $0x18, %r14, %r11
addq %r9, %r11
addq $0x10, %r11
imulq $0x18, %r15, %r14
xorl %r15d, %r15d
cmpl $0x0, -0x4(%r11,%r15)
js 0x2b4a6
movzwl (%r11,%r15), %ebp
testw $0x3fff, %bp            # imm = 0x3FFF
jne 0x2b51d
addq $0x18, %r15
cmpq %r15, %r14
jne 0x2b492
leaq (%rsi,%rsi), %r11
movq 0x8(%r10,%r11,8), %r11
movq %r11, %r10
shlq $0x20, %r10
setne %r10b
je 0x2b510
movq %r11, %r14
shrq $0x20, %r14
movl %r11d, %r11d
imulq $0x18, %r14, %r14
addq %r14, %r9
addq $0x10, %r9
movq %r11, %r14
negq %r14
movq %rdi, %r15
cmpl $0x0, -0x4(%r9)
js 0x2b4f5
movzwl (%r9), %ebp
testw $0x3fff, %bp            # imm = 0x3FFF
jne 0x2b510
cmpq %r11, %r15
setb %r10b
addq $0x18, %r9
leaq (%r14,%r15), %r12
incq %r12
incq %r15
cmpq $0x1, %r12
jne 0x2b4e3
movzbl %r10b, %r9d
andl $0x1, %r9d
addl %r9d, %r8d
jmp 0x2b520
incl %r8d
incq %rsi
cmpq %rax, %rsi
jne 0x2b452
movq 0x25eaad(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x20dd66(%rip), %rsi    # 0x2392a3
leaq 0x20dd95(%rip), %rdx    # 0x2392d9
xorl %eax, %eax
callq 0x22b0
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq