// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Overlaps.cpp
// Function: worker_for_ctg_trans_cc(void*, long, int)
static void worker_for_ctg_trans_cc(void *data, long i, int tid) // callback for kt_for()
{
    kv_u_trans_t *ta = (kv_u_trans_t*)data;
    u_trans_t *a = NULL, *r_a = NULL, *mz, *cz;
    uint32_t n, r_n, id = i, k, l, z;

    a = u_trans_a(*ta, id); n = u_trans_n(*ta, id);
    for (k = 1, l = 0; k <= n; k++) {
        if(k == n || a[l].tn != a[k].tn) {
            if(k > l) {
                get_u_trans_spec(ta, a[l].tn, a[l].qn, &r_a, &r_n);
                assert(r_n > 0);
                if(id > a[l].tn) {
                    l = k; continue;
                }

                mz = cz = NULL; 
                for (z = l; z < k; z++) {
                    cz = &(a[z]); cz->del = 1;
                    if((mz) && (mz->f == 1) && (cz->f != 1)) continue;
                    if((!mz) || ((cz->f == 1) && (mz->f != 1)) || ((cz->f == mz->f) && ((mz->nw < cz->nw) || ((mz->nw == cz->nw) && ((mz->qe - mz->qs) < (cz->qe - cz->qs)))))) {
                        mz = cz; 
                    }
                }
                for (z = 0; z < r_n; z++) {
                    cz = &(r_a[z]); cz->del = 1;
                    if((mz) && (mz->f == 1) && (cz->f != 1)) continue;
                    if((!mz) || ((cz->f == 1) && (mz->f != 1)) || ((cz->f == mz->f) && ((mz->nw < cz->nw) || ((mz->nw == cz->nw) && ((mz->qe - mz->qs) < (cz->qe - cz->qs)))))) {
                        mz = cz; 
                    }
                }

                assert(mz);
                mz->del = 0;
            }
            l = k;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq $0x0, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movq 0x28(%rdi), %rax
movq %rsi, 0x18(%rsp)
movl %esi, %ecx
movq (%rax,%rcx,8), %r15
testl %r15d, %r15d
je 0xdbc53
movq %r15, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rbp
shlq $0x4, %rbp
movq 0x8(%rsp), %rax
addq 0x10(%rax), %rbp
movl $0x1, %r12d
xorl %eax, %eax
movl %r12d, %ebx
cmpl %r15d, %r12d
je 0xdbacd
movl %eax, %ecx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movl 0x14(%rbp,%rcx), %ecx
leaq (%rbx,%rbx,2), %rdx
shlq $0x4, %rdx
cmpl 0x14(%rbp,%rdx), %ecx
jne 0xdbacd
movl %eax, %ecx
jmp 0xdbc45
movl %r12d, %ecx
cmpl %eax, %r12d
jbe 0xdbc45
movl %eax, %eax
movq %rax, 0x20(%rsp)
leaq (%rax,%rax,2), %r14
shlq $0x4, %r14
movl 0x8(%rbp,%r14), %edx
movq %rbp, %r13
movl 0x14(%rbp,%r14), %ebp
movq 0x8(%rsp), %rdi
movl %ebp, %esi
leaq 0x10(%rsp), %rcx
leaq 0x4(%rsp), %r8
callq 0xcba40
cmpl $0x0, 0x4(%rsp)
je 0xdbc62
movl %r12d, %ecx
cmpl 0x18(%rsp), %ebp
movq %r13, %rbp
jb 0xdbc45
addq %rbp, %r14
subq 0x20(%rsp), %rbx
xorl %eax, %eax
movb 0x28(%r14), %cl
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, 0x28(%r14)
testq %rax, %rax
je 0xdbb69
movb 0x28(%rax), %dl
movl %edx, %esi
andb $0x3f, %sil
movl %ecx, %edi
andb $0x3f, %dil
cmpb $0x1, %sil
jne 0xdbb5d
cmpb $0x1, %dil
jne 0xdbb6c
cmpb $0x1, %dil
jne 0xdbb77
cmpb $0x1, %sil
je 0xdbb77
movq %r14, %rax
addq $0x30, %r14
decq %rbx
jne 0xdbb30
jmp 0xdbba9
xorb %cl, %dl
testb $0x3f, %dl
jne 0xdbb6c
movsd 0x20(%rax), %xmm0
movsd 0x20(%r14), %xmm1
ucomisd %xmm0, %xmm1
ja 0xdbb69
ucomisd %xmm1, %xmm0
jne 0xdbb6c
jp 0xdbb6c
movl 0x4(%rax), %ecx
subl (%rax), %ecx
movl 0x4(%r14), %edx
subl (%r14), %edx
cmpl %edx, %ecx
jb 0xdbb69
jmp 0xdbb6c
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x10(%rsp), %rsi
movb 0x28(%rsi,%rcx), %dil
movl %edi, %r8d
orb $-0x80, %r8b
movb %r8b, 0x28(%rsi,%rcx)
movb 0x28(%rax), %r8b
movl %r8d, %r9d
andb $0x3f, %r9b
movl %edi, %r10d
andb $0x3f, %r10b
cmpb $0x1, %r9b
jne 0xdbbe1
cmpb $0x1, %r10b
jne 0xdbbfe
cmpb $0x1, %r10b
jne 0xdbbf5
cmpb $0x1, %r9b
je 0xdbbf5
addq %rcx, %rsi
movq %rsi, %rax
jmp 0xdbbfe
xorb %dil, %r8b
testb $0x3f, %r8b
je 0xdbc10
incq %rdx
movl 0x4(%rsp), %esi
addq $0x30, %rcx
cmpq %rsi, %rdx
jb 0xdbbad
jmp 0xdbc3e
movsd 0x20(%rax), %xmm0
movsd 0x20(%rsi,%rcx), %xmm1
ucomisd %xmm0, %xmm1
ja 0xdbbed
ucomisd %xmm1, %xmm0
jne 0xdbbfe
jp 0xdbbfe
movl 0x4(%rax), %edi
subl (%rax), %edi
movl 0x4(%rsi,%rcx), %r8d
subl (%rsi,%rcx), %r8d
cmpl %r8d, %edi
jb 0xdbbed
jmp 0xdbbfe
andb $0x7f, 0x28(%rax)
movl %r12d, %ecx
incl %r12d
movl %ecx, %eax
cmpl %r15d, %r12d
jbe 0xdbaa2
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x15d5ad(%rip), %rdi    # 0x239216
leaq 0x15a221(%rip), %rsi    # 0x235e91
leaq 0x15d5a7(%rip), %rcx    # 0x23921e
movl $0x550a, %edx           # imm = 0x550A
callq 0x2110