// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r14
pushq %rbx
movq (%rdi), %rax
imulq $0x78, %rsi, %rcx
leaq (%rax,%rcx), %rbx
cmpb $0x0, 0x70(%rax,%rcx)
je 0x1c5d26
andq $0x0, 0x28(%rbx)
andq $0x0, 0x10(%rbx)
xorl %eax, %eax
pushq $0x1
popq %rbp
xorl %edx, %edx
xorl %ecx, %ecx
movl %eax, %eax
movl %edx, %esi
cmpq %rax, 0x10(%rbx)
jbe 0x1c5d8d
movq 0x20(%rbx), %rdi
movq %rax, %r8
shlq $0x5, %r8
cmpl $0x0, 0xc(%rdi,%r8)
js 0x1c5d89
addq %rdi, %r8
shlq $0x5, %rsi
movups (%r8), %xmm0
movups 0x10(%r8), %xmm1
movups %xmm1, 0x10(%rdi,%rsi)
movups %xmm0, (%rdi,%rsi)
movq 0x20(%rbx), %rdi
andq $0x0, 0x18(%rdi,%rsi)
testl %edx, %edx
je 0x1c5d87
movl 0x8(%rdi,%rsi), %esi
leal -0x1(%rdx), %r8d
shlq $0x5, %r8
cmpl 0x8(%rdi,%r8), %esi
cmovbl %ebp, %ecx
incl %edx
incl %eax
jmp 0x1c5d2f
movq %rsi, 0x10(%rbx)
testl %ecx, %ecx
je 0x1c5da5
movq 0x20(%rbx), %rdi
shlq $0x5, %rsi
addq %rdi, %rsi
callq 0x1a408f
movq 0x50(%rbx), %rdi
imulq $0xc, 0x40(%rbx), %rsi
addq %rdi, %rsi
callq 0x1a42a8
movq 0x40(%rbx), %rax
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
movl %ecx, %ecx
imulq $0xc, %rcx, %r10
movl %edx, %edi
cmpq %rcx, %rax
jbe 0x1c5e26
movl %esi, %r8d
cmpq %r8, 0x10(%rbx)
jbe 0x1c5e26
movq 0x20(%rbx), %r9
movq 0x50(%rbx), %r11
movl (%r11,%r10), %r14d
shlq $0x5, %r8
cmpl 0x8(%r9,%r8), %r14d
jb 0x1c5e22
jbe 0x1c5df3
incl %esi
jmp 0x1c5dc6
imulq $0xc, %rdi, %r10
movl %r14d, (%r11,%r10)
testl %edx, %edx
je 0x1c5e14
leal -0x1(%rdx), %r10d
imulq $0xc, %r10, %r10
cmpl (%r11,%r10), %r14d
jne 0x1c5e14
incq 0x18(%r9,%r8)
jmp 0x1c5e20
shlq $0x20, %rdi
incq %rdi
movq %rdi, 0x18(%r9,%r8)
incl %edx
incl %ecx
jmp 0x1c5dc0
movq %rdi, 0x40(%rbx)
xorl %ecx, %ecx
xorl %edx, %edx
xorl %eax, %eax
movl %ecx, %ecx
movl %edx, %esi
cmpq %rcx, 0x28(%rbx)
jbe 0x1c5e8e
movq 0x38(%rbx), %rdi
movq %rcx, %r8
shlq $0x5, %r8
cmpl $0x0, 0xc(%rdi,%r8)
js 0x1c5e8a
addq %rdi, %r8
shlq $0x5, %rsi
movups (%r8), %xmm0
movups 0x10(%r8), %xmm1
movups %xmm1, 0x10(%rdi,%rsi)
movups %xmm0, (%rdi,%rsi)
movq 0x38(%rbx), %rdi
andq $0x0, 0x18(%rdi,%rsi)
testl %edx, %edx
je 0x1c5e88
movl 0x8(%rdi,%rsi), %esi
leal -0x1(%rdx), %r8d
shlq $0x5, %r8
cmpl 0x8(%rdi,%r8), %esi
cmovbl %ebp, %eax
incl %edx
incl %ecx
jmp 0x1c5e30
movq %rsi, 0x28(%rbx)
testl %eax, %eax
je 0x1c5ea6
movq 0x38(%rbx), %rdi
shlq $0x5, %rsi
addq %rdi, %rsi
callq 0x1a408f
movq 0x68(%rbx), %rdi
imulq $0xc, 0x58(%rbx), %rsi
addq %rdi, %rsi
callq 0x1a42a8
movq 0x58(%rbx), %rax
xorl %ecx, %ecx
xorl %edx, %edx
xorl %esi, %esi
movl %ecx, %ecx
imulq $0xc, %rcx, %r10
movl %edx, %edi
cmpq %rcx, %rax
jbe 0x1c5f27
movl %esi, %r8d
cmpq %r8, 0x28(%rbx)
jbe 0x1c5f27
movq 0x38(%rbx), %r9
movq 0x68(%rbx), %r11
movl (%r11,%r10), %ebp
shlq $0x5, %r8
cmpl 0x8(%r9,%r8), %ebp
jb 0x1c5f23
jbe 0x1c5ef4
incl %esi
jmp 0x1c5ec7
imulq $0xc, %rdi, %r10
movl %ebp, (%r11,%r10)
testl %edx, %edx
je 0x1c5f15
leal -0x1(%rdx), %r10d
imulq $0xc, %r10, %r10
cmpl (%r11,%r10), %ebp
jne 0x1c5f15
incq 0x18(%r9,%r8)
jmp 0x1c5f21
shlq $0x20, %rdi
incq %rdi
movq %rdi, 0x18(%r9,%r8)
incl %edx
incl %ecx
jmp 0x1c5ec1
movq %rdi, 0x58(%rbx)
popq %rbx
popq %r14
popq %rbp
retq