// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: worker_renew_u2g_cov(void*, long, int)
static void worker_renew_u2g_cov(void *data, long i, int tid) // callback for kt_for()
{
    ul_resolve_t *uidx = (ul_resolve_t *)data; 
    integer_t *buf = &(uidx->str_b.buf[tid]);
    ma_utg_t *iu = &(uidx->uovl.i_ug->u.a[i]);
    uint64_t z, ri, k, ul_n, ug_n, *a, a_n; ma_ug_t *raw = uidx->l1_ug;
    ul_cov_t *idx = &(uidx->uovl.cc); 

    idx->uc[i] = idx->raw_uc[i] = idx->hc[i] = ul_n = ug_n = 0; buf->u.n = buf->o.n = 0;
    for (z = 0; z < iu->n; z++) {
        ri = iu->a[z]>>33;
        if(ulg_type(uidx->uovl, ri)) {///ul
            clc_contain(uidx, ulg_id(uidx->uovl, ri), 1, buf); ul_n++;
        } else {///ug node
            clc_contain(uidx, ulg_id(uidx->uovl, ri), 0, buf); 
            ug_n += raw->u.a[ulg_id(uidx->uovl, ri)].n;///HiFi reads occ
        }
    }
    idx->raw_uc[i] = ul_n;

    ///buf->o: UL contained reads
    ///buf->u: HiFi reads
    if(buf->o.n > 0) {
        a = buf->o.a; a_n = buf->o.n;
        radix_sort_srt64(a, a + a_n);
        for (z = 0, k = 1; k <= a_n; k++) {
            if(k == a_n || a[z] != a[k]) {
                ul_n++; z = k;
            }
        }
    }
    if(buf->u.n > 0) {
        a = buf->u.a; a_n = buf->u.n;
        radix_sort_srt64(a, a + a_n);
        for (z = 0, k = 1; k <= a_n; k++) {
            if(k == a_n || a[z] != a[k]) {
                ug_n++; z = k;
            }
        }
    }
    idx->uc[i] = ul_n; idx->hc[i] = ug_n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rax
movq %rax, 0x20(%rsp)
movq 0x1d8(%rdi), %rax
movslq %edx, %rcx
imulq $0x328, %rcx, %rdi      # imm = 0x328
movq 0x230(%r14), %rdx
imulq $0x28, %rsi, %r15
addq 0x10(%rdx), %r15
movq 0x250(%r14), %rdx
andl $0x0, (%rdx,%rsi,4)
movq 0x258(%r14), %rdx
andl $0x0, (%rdx,%rsi,4)
movq 0x248(%r14), %rdx
movq %rsi, 0x18(%rsp)
andl $0x0, (%rdx,%rsi,4)
leaq (%rax,%rdi), %rcx
andq $0x0, 0x78(%rax,%rdi)
andq $0x0, 0x90(%rax,%rdi)
pushq $0x1
popq %r12
xorl %ebx, %ebx
movl $0x0, 0xc(%rsp)
xorl %ebp, %ebp
movq %rcx, 0x10(%rsp)
movl 0x10(%r15), %eax
cmpq %rax, %rbp
jae 0x1d95e3
movq 0x18(%r15), %rax
movq (%rax,%rbp,8), %r13
shrq $0x21, %r13
movq %r13, %rsi
subq 0x208(%r14), %rsi
jae 0x1d95a0
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x1d88b8
incq %rbx
jmp 0x1d95d9
movq %r14, %rdi
xorl %edx, %edx
callq 0x1d88b8
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x208(%r14), %rcx
cmpq %rcx, %r13
movl $0x0, %edx
cmovbq %rdx, %rcx
subq %rcx, %r13
imulq $0x28, %r13, %rcx
movl 0xc(%rsp), %edx
addl 0x10(%rax,%rcx), %edx
movl %edx, 0xc(%rsp)
incq %rbp
movq 0x10(%rsp), %rcx
jmp 0x1d956c
movq 0x258(%r14), %rax
movq 0x18(%rsp), %rbp
movl %ebx, (%rax,%rbp,4)
movq 0x78(%rcx), %r15
testq %r15, %r15
je 0x1d963a
movq 0x88(%rcx), %r13
leaq (,%r15,8), %rsi
addq %r13, %rsi
movq %r13, %rdi
callq 0x1a3def
xorl %eax, %eax
cmpq %r15, %r12
ja 0x1d9635
je 0x1d962a
movq (%r13,%rax,8), %rcx
cmpq (%r13,%r12,8), %rcx
je 0x1d9630
incq %rbx
movq %r12, %rax
incq %r12
jmp 0x1d9617
movq 0x10(%rsp), %rcx
movq 0x90(%rcx), %r12
testq %r12, %r12
je 0x1d967b
movq 0xa0(%rcx), %r15
leaq (%r15,%r12,8), %rsi
movq %r15, %rdi
callq 0x1a3def
pushq $0x1
popq %rax
xorl %ecx, %ecx
cmpq %r12, %rax
ja 0x1d967b
je 0x1d966f
movq (%r15,%rcx,8), %rdx
cmpq (%r15,%rax,8), %rdx
je 0x1d9676
incl 0xc(%rsp)
movq %rax, %rcx
incq %rax
jmp 0x1d965e
movq 0x248(%r14), %rax
movl %ebx, (%rax,%rbp,4)
movq 0x250(%r14), %rax
movl 0xc(%rsp), %ecx
movl %ecx, (%rax,%rbp,4)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq