// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq %rsp, %rdx
movq %rdi, (%rdx)
movq %rsi, 0x8(%rdx)
leaq 0x26adcc(%rip), %rax    # 0x295758
movl 0x7c(%rax), %edi
movl 0x4(%rbx), %ecx
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
andq %r14, %rcx
leaq 0x1c66f9(%rip), %rsi    # 0x1f109b
callq 0x108f2c
movl 0x14(%rbx), %eax
xorl %r8d, %r8d
movl $0x0, %ecx
andq %r14, %rax
je 0x2aaa4
movq 0x20(%rbx), %rdx
xorl %esi, %esi
pushq $0x1
popq %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
cmpl $0x0, (%rdx,%rsi,8)
js 0x2aa98
incl %ecx
movq 0x8(%rbx), %r9
movq 0x28(%rbx), %r10
movq %rsi, %r11
shlq $0x4, %r11
movq (%r10,%r11), %r11
testl %r11d, %r11d
je 0x2aa26
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 0x2aa1d
movzwl (%r11,%r15), %ebp
testw $0x3fff, %bp            # imm = 0x3FFF
jne 0x2aa95
addq $0x18, %r15
cmpq %r15, %r14
jne 0x2aa09
leaq (%rsi,%rsi), %r11
movq 0x8(%r10,%r11,8), %r10
testl %r10d, %r10d
je 0x2aa8d
movq %r10, %r11
shrq $0x20, %r11
movl %r10d, %r10d
imulq $0x18, %r11, %r11
addq %r11, %r9
addq $0x10, %r9
movq %r10, %r11
negq %r11
movb $0x1, %bpl
movq %rdi, %r14
cmpl $0x0, -0x4(%r9)
js 0x2aa68
movzwl (%r9), %r15d
testw $0x3fff, %r15w          # imm = 0x3FFF
jne 0x2aa83
cmpq %r10, %r14
setb %bpl
addq $0x18, %r9
leaq (%r11,%r14), %r15
incq %r15
incq %r14
cmpq $0x1, %r15
jne 0x2aa55
movzbl %bpl, %r9d
andl $0x1, %r9d
jmp 0x2aa90
xorl %r9d, %r9d
addl %r9d, %r8d
jmp 0x2aa98
incl %r8d
incq %rsi
cmpq %rax, %rsi
jne 0x2a9c9
movq 0x26a535(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x21aad2(%rip), %rsi    # 0x245587
leaq 0x21ab01(%rip), %rdx    # 0x2455bd
xorl %eax, %eax
callq 0x22b0
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq