// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: update_usg_t_threading(ul_resolve_t*, usg_t*, unsigned long*, unsigned long*, unsigned long, unsigned long*, unsigned int*, asg64_v*)
void update_usg_t_threading(ul_resolve_t *uidx, usg_t *ng, uint64_t *arcs, uint64_t *arcs_g, uint64_t arcs_gn, uint64_t *integ_seq, uint32_t *occ, asg64_v *b)
{
    uint64_t i, k, s, e, nvtx = ng->n<<1; memset(occ, 0, sizeof((*occ))*nvtx);
    for (i = 0; i < arcs_gn; i++) {///set cluster
        // prt = 0;
        s = arcs[((uint32_t)arcs_g[i])]>>32; e = ((uint32_t)arcs[((uint32_t)arcs_g[i])]); assert(s < e);
        for (k = s + 1; k < e; k++) {///note: here is [s, e]
            occ[integ_seq[k]]++; occ[integ_seq[k]^1]++; 
            // if((integ_seq[k]>>1) == 2736) prt = 1;
        }
        occ[integ_seq[s]]++; occ[integ_seq[e]^1]++;
        // if((integ_seq[s]>>1) == 2736) prt = 1;
        // if(((integ_seq[e]^1)>>1) == 2736) prt = 1;
        // if(occ[integ_seq[s]] > 1 || occ[integ_seq[e]^1] > 1) {
        //     fprintf(stderr, "s::utg%.6dl(%c)(occ::%u), e::utg%.6dl(%c)(occ::%u)\n", 
        //         (int32_t)(integ_seq[s]>>1)+1, "+-"[integ_seq[s]&1], occ[integ_seq[s]],
        //         (int32_t)((integ_seq[e]^1)>>1)+1, "+-"[((integ_seq[e]^1)&1)], occ[integ_seq[e]^1]);
        // }
        // if(prt) {
        //     fprintf(stderr, "[M::%s::] a_n::%lu\n", __func__, e + 1 - s);
        //     for (k = s; k <= e; k++) {
        //         fprintf(stderr, "utg%.6dl(%c)(hom::%u)\t", 
        //             (int32_t)(integ_seq[k]>>1)+1, "+-"[integ_seq[k]&1], 
        //             (IF_HOM((integ_seq[k]>>1), (*(uidx->bub)))));
        //     }
        //     fprintf(stderr, "\n");
        // }
    }

    for (i = 0; i < nvtx; i++) {
        if(!occ[i]) occ[i] = (uint32_t)-1;        
    }
    for (i = 0; i < arcs_gn; i++) {///arcs_g[]>>32 is the group id; (uint32_t)arcs_g[]
        s = arcs[((uint32_t)arcs_g[i])]>>32; e = ((uint32_t)arcs[((uint32_t)arcs_g[i])]); 
        update_usg_t_threading_0(uidx, ng, integ_seq + s, e + 1 - s, occ, b);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbx
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq 0x50(%rsp), %rbp
movq %rsi, 0x8(%rsp)
movq 0x8(%rsi), %r13
leaq (,%r13,8), %rdx
movq %rbp, %rdi
xorl %esi, %esi
callq 0x20e0
movq %r15, %r8
testq %r14, %r14
je 0x20f0a1
xorl %eax, %eax
movl (%r8,%rax,8), %ecx
movq (%r12,%rcx,8), %rdx
movl %edx, %ecx
shrq $0x20, %rdx
cmpq %rcx, %rdx
jae 0x20f121
leaq 0x1(%rdx), %rsi
cmpq %rcx, %rsi
jae 0x20f085
movq (%rbx,%rsi,8), %rdi
incl (%rbp,%rdi,4)
xorq $0x1, %rdi
incl (%rbp,%rdi,4)
incq %rsi
cmpq %rsi, %rcx
jne 0x20f06d
movq (%rbx,%rdx,8), %rdx
incl (%rbp,%rdx,4)
movq (%rbx,%rcx,8), %rcx
xorq $0x1, %rcx
incl (%rbp,%rcx,4)
incq %rax
cmpq %r14, %rax
jne 0x20f04d
addq %r13, %r13
je 0x20f0bf
xorl %eax, %eax
cmpl $0x0, (%rbp,%rax,4)
jne 0x20f0b7
movl $0xffffffff, (%rbp,%rax,4) # imm = 0xFFFFFFFF
incq %rax
cmpq %rax, %r13
jne 0x20f0a8
testq %r14, %r14
movq 0x8(%rsp), %r15
je 0x20f112
xorl %r13d, %r13d
movq %r14, 0x10(%rsp)
movl (%r8,%r13,8), %eax
movq (%r12,%rax,8), %rax
movl %eax, %ecx
shrq $0x20, %rax
leaq (%rbx,%rax,8), %rdx
subq %rax, %rcx
incq %rcx
movq %r15, %rsi
movq %r12, %r14
movq %r8, %r12
movq %rbp, %r8
movq 0x58(%rsp), %r9
callq 0x20e7c8
movq %r12, %r8
movq %r14, %r12
movq 0x10(%rsp), %r14
incq %r13
cmpq %r13, %r14
jne 0x20f0d1
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2d57c(%rip), %rdi     # 0x23c6a4
leaq 0x2a1f6(%rip), %rsi     # 0x239325
leaq 0x2d728(%rip), %rcx     # 0x23c85e
movl $0x30cb, %edx           # imm = 0x30CB
callq 0x2110