// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: worker_clean_usg(void*, long, int)
static void worker_clean_usg(void *data, long i, int tid) // callback for kt_for()
{
    usg_t *g = (usg_t *)data; usg_seq_t *z = g->a + i; uint32_t k, m, l, srt; 
    usg_arc_warp *x; usg_arc_mm_warp *y;
    if(z->del) z->arc[0].n = z->arc[1].n = 0;

    x = &(z->arc[0]); y = &(z->arc_mm[0]);
    for (k = m = srt = 0; k < x->n; k++) {
        if(x->a[k].del) continue;
        x->a[m] = x->a[k]; x->a[m].idx = 0;
        if(m > 0 && x->a[m].v < x->a[m-1].v) srt = 1;
        m++;
    }
    x->n = m; if(srt) radix_sort_usg_arc_srt(x->a, x->a + x->n);

    radix_sort_usg_arc_mm_srt(y->a, y->a + y->n); k = l = m = 0;
    while (k < y->n && l < x->n) {
        if(y->a[k].v < x->a[l].v) {
            k++;
        } else if(y->a[k].v > x->a[l].v) {
            l++;
        } else {
            y->a[m].v = y->a[k].v;
            if(m > 0 && y->a[m].v == y->a[m-1].v) {
                x->a[l].idx++;
            } else {
                x->a[l].idx = m; x->a[l].idx <<= 32; x->a[l].idx++;
            }
            m++; k++;
        }
    }
    y->n = m;    



    x = &(z->arc[1]); y = &(z->arc_mm[1]);
    for (k = m = srt = 0; k < x->n; k++) {
        if(x->a[k].del) continue;
        x->a[m] = x->a[k]; x->a[m].idx = 0;
        if(m > 0 && x->a[m].v < x->a[m-1].v) srt = 1;
        m++;
    }
    x->n = m; if(srt) radix_sort_usg_arc_srt(x->a, x->a + x->n);
    
    radix_sort_usg_arc_mm_srt(y->a, y->a + y->n); k = l = m = 0;
    while (k < y->n && l < x->n) {
        if(y->a[k].v < x->a[l].v) {
            k++;
        } else if(y->a[k].v > x->a[l].v) {
            l++;
        } else {
            y->a[m].v = y->a[k].v;
            if(m > 0 && y->a[m].v == y->a[m-1].v) {
                x->a[l].idx++;
            } else {
                x->a[l].idx = m; x->a[l].idx <<= 32; x->a[l].idx++;
            }
            m++; k++;
        }
    }
    y->n = m;    

}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rdi), %rax
imulq $0x78, %rsi, %rcx
leaq (%rax,%rcx), %rbx
cmpb $0x0, 0x70(%rax,%rcx)
je 0x208309
xorl %eax, %eax
movq %rax, 0x28(%rbx)
movq %rax, 0x10(%rbx)
xorl %esi, %esi
cmpq $0x0, 0x10(%rbx)
je 0x208387
movl $0x1, %eax
movl $0x1, %edx
xorl %edi, %edi
xorl %ecx, %ecx
movq 0x20(%rbx), %r8
shlq $0x5, %rdi
cmpl $0x0, 0xc(%r8,%rdi)
js 0x208374
addq %r8, %rdi
movl %ecx, %r9d
shlq $0x5, %r9
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups %xmm1, 0x10(%r8,%r9)
movups %xmm0, (%r8,%r9)
movq 0x20(%rbx), %rdi
movq $0x0, 0x18(%rdi,%r9)
testl %ecx, %ecx
je 0x208372
movl 0x8(%rdi,%r9), %r8d
leal -0x1(%rcx), %r9d
shlq $0x5, %r9
cmpl 0x8(%rdi,%r9), %r8d
cmovbl %eax, %esi
incl %ecx
movl %edx, %edi
incl %edx
cmpq %rdi, 0x10(%rbx)
ja 0x208320
testl %esi, %esi
movl %ecx, %esi
sete %al
jmp 0x208389
movb $0x1, %al
movq %rsi, 0x10(%rbx)
testb %al, %al
jne 0x2083a1
movq 0x20(%rbx), %rdi
shlq $0x5, %rsi
addq %rdi, %rsi
callq 0x1e3e5b
movq 0x40(%rbx), %rax
movq 0x50(%rbx), %rdi
leaq (%rax,%rax,2), %rax
leaq (%rdi,%rax,4), %rsi
callq 0x1e4075
movq 0x40(%rbx), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x208433
movq 0x10(%rbx), %rsi
xorl %r10d, %r10d
xorl %edx, %edx
xorl %edi, %edi
movl %eax, %r8d
cmpq %r8, %rsi
jbe 0x208431
movq 0x20(%rbx), %r9
movq 0x50(%rbx), %r11
leaq (%r10,%r10,2), %r10
movl (%r11,%r10,4), %r10d
shlq $0x5, %r8
cmpl 0x8(%r9,%r8), %r10d
jb 0x208427
jbe 0x2083f5
incl %eax
jmp 0x208429
movl %edx, %r14d
leaq (%r14,%r14,2), %r15
movl %r10d, (%r11,%r15,4)
testl %edx, %edx
je 0x208419
leal -0x1(%rdx), %r15d
leaq (%r15,%r15,2), %r15
cmpl (%r11,%r15,4), %r10d
jne 0x208419
incq 0x18(%r9,%r8)
jmp 0x208425
shlq $0x20, %r14
incq %r14
movq %r14, 0x18(%r9,%r8)
incl %edx
incl %edi
movl %edi, %r10d
cmpq %r10, %rcx
ja 0x2083cc
movl %edx, %eax
movq %rax, 0x40(%rbx)
xorl %esi, %esi
cmpq $0x0, 0x28(%rbx)
je 0x2084b5
movl $0x1, %eax
movl $0x1, %edx
xorl %edi, %edi
xorl %ecx, %ecx
movq 0x38(%rbx), %r8
shlq $0x5, %rdi
cmpl $0x0, 0xc(%r8,%rdi)
js 0x2084a2
addq %r8, %rdi
movl %ecx, %r9d
shlq $0x5, %r9
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups %xmm1, 0x10(%r8,%r9)
movups %xmm0, (%r8,%r9)
movq 0x38(%rbx), %rdi
movq $0x0, 0x18(%rdi,%r9)
testl %ecx, %ecx
je 0x2084a0
movl 0x8(%rdi,%r9), %r8d
leal -0x1(%rcx), %r9d
shlq $0x5, %r9
cmpl 0x8(%rdi,%r9), %r8d
cmovbl %eax, %esi
incl %ecx
movl %edx, %edi
incl %edx
cmpq %rdi, 0x28(%rbx)
ja 0x20844e
testl %esi, %esi
movl %ecx, %esi
sete %al
jmp 0x2084b7
movb $0x1, %al
movq %rsi, 0x28(%rbx)
testb %al, %al
jne 0x2084cf
movq 0x38(%rbx), %rdi
shlq $0x5, %rsi
addq %rdi, %rsi
callq 0x1e3e5b
movq 0x58(%rbx), %rax
movq 0x68(%rbx), %rdi
leaq (%rax,%rax,2), %rax
leaq (%rdi,%rax,4), %rsi
callq 0x1e4075
movq 0x58(%rbx), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x208561
movq 0x28(%rbx), %rsi
xorl %r10d, %r10d
xorl %edx, %edx
xorl %edi, %edi
movl %eax, %r8d
cmpq %r8, %rsi
jbe 0x20855f
movq 0x38(%rbx), %r9
movq 0x68(%rbx), %r11
leaq (%r10,%r10,2), %r10
movl (%r11,%r10,4), %r10d
shlq $0x5, %r8
cmpl 0x8(%r9,%r8), %r10d
jb 0x208555
jbe 0x208523
incl %eax
jmp 0x208557
movl %edx, %r14d
leaq (%r14,%r14,2), %r15
movl %r10d, (%r11,%r15,4)
testl %edx, %edx
je 0x208547
leal -0x1(%rdx), %r15d
leaq (%r15,%r15,2), %r15
cmpl (%r11,%r15,4), %r10d
jne 0x208547
incq 0x18(%r9,%r8)
jmp 0x208553
shlq $0x20, %r14
incq %r14
movq %r14, 0x18(%r9,%r8)
incl %edx
incl %edi
movl %edi, %r10d
cmpq %r10, %rcx
ja 0x2084fa
movl %edx, %eax
movq %rax, 0x58(%rbx)
popq %rbx
popq %r14
popq %r15
retq