// File: /workspace/github_cpp_makefile_star2_O1/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, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
movq 0x28(%rdi), %rax
movq %rsi, 0x20(%rsp)
movl %esi, %ecx
movq (%rax,%rcx,8), %r13
testl %r13d, %r13d
je 0xda7e0
movq %r13, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rbp
shlq $0x4, %rbp
movq 0x10(%rsp), %rax
addq 0x10(%rax), %rbp
movl $0x1, %r15d
xorl %eax, %eax
movl %r15d, %r12d
cmpl %r13d, %r15d
je 0xda645
movl %eax, %ecx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movl 0x14(%rbp,%rcx), %ecx
leaq (%r12,%r12,2), %rdx
shlq $0x4, %rdx
cmpl 0x14(%rbp,%rdx), %ecx
jne 0xda645
movl %eax, %ecx
jmp 0xda7d2
movl %r15d, %ecx
cmpl %eax, %r15d
jbe 0xda7d2
movl %eax, %ebx
leaq (%rbx,%rbx,2), %r14
shlq $0x4, %r14
movl 0x8(%rbp,%r14), %edx
movl 0x14(%rbp,%r14), %esi
movq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rcx
leaq 0xc(%rsp), %r8
callq 0xca79c
cmpl $0x0, 0xc(%rsp)
je 0xda7ef
addq %rbp, %r14
movl %r15d, %ecx
movq 0x20(%rsp), %rax
cmpl %eax, 0x14(%r14)
jb 0xda7d2
leaq (%rbx,%rbx,2), %rcx
shlq $0x4, %rcx
addq %rbp, %rcx
subq %rbx, %r12
xorl %eax, %eax
movb 0x28(%rcx), %dl
movl %edx, %esi
orb $-0x80, %sil
movb %sil, 0x28(%rcx)
testq %rax, %rax
je 0xda6e4
movb 0x28(%rax), %sil
movl %esi, %edi
andb $0x3f, %dil
movl %edx, %r8d
andb $0x3f, %r8b
cmpb $0x1, %dil
jne 0xda6d8
cmpb $0x1, %r8b
jne 0xda6e7
cmpb $0x1, %r8b
jne 0xda6f2
cmpb $0x1, %dil
je 0xda6f2
movq %rcx, %rax
addq $0x30, %rcx
decq %r12
jne 0xda6a9
jmp 0xda723
xorb %dl, %sil
testb $0x3f, %sil
jne 0xda6e7
movsd 0x20(%rax), %xmm0
movsd 0x20(%rcx), %xmm1
ucomisd %xmm0, %xmm1
ja 0xda6e4
ucomisd %xmm1, %xmm0
jne 0xda6e7
jp 0xda6e7
movl 0x4(%rax), %edx
subl (%rax), %edx
movl 0x4(%rcx), %esi
subl (%rcx), %esi
cmpl %esi, %edx
jb 0xda6e4
jmp 0xda6e7
cmpl $0x0, 0xc(%rsp)
je 0xda7c6
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x18(%rsp), %rsi
movb 0x28(%rsi,%rcx), %dil
movl %edi, %r8d
orb $-0x80, %r8b
movb %r8b, 0x28(%rsi,%rcx)
testq %rax, %rax
je 0xda777
movb 0x28(%rax), %r8b
movl %r8d, %r9d
andb $0x3f, %r9b
movl %edi, %r10d
andb $0x3f, %r10b
cmpb $0x1, %r9b
jne 0xda76b
cmpb $0x1, %r10b
jne 0xda77d
cmpb $0x1, %r10b
jne 0xda78f
cmpb $0x1, %r9b
je 0xda78f
addq %rcx, %rsi
movq %rsi, %rax
incq %rdx
movl 0xc(%rsp), %esi
addq $0x30, %rcx
cmpq %rsi, %rdx
jb 0xda732
jmp 0xda7c6
xorb %dil, %r8b
testb $0x3f, %r8b
jne 0xda77d
movsd 0x20(%rax), %xmm0
movsd 0x20(%rsi,%rcx), %xmm1
ucomisd %xmm0, %xmm1
ja 0xda777
ucomisd %xmm1, %xmm0
jne 0xda77d
jp 0xda77d
movl 0x4(%rax), %edi
subl (%rax), %edi
movl 0x4(%rsi,%rcx), %r8d
subl (%rsi,%rcx), %r8d
cmpl %r8d, %edi
jb 0xda777
jmp 0xda77d
testq %rax, %rax
je 0xda80e
andb $0x7f, 0x28(%rax)
movl %r15d, %ecx
incl %r15d
movl %ecx, %eax
cmpl %r13d, %r15d
jbe 0xda61a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x152830(%rip), %rdi    # 0x22d026
leaq 0x14f4a4(%rip), %rsi    # 0x229ca1
leaq 0x15282a(%rip), %rcx    # 0x22d02e
movl $0x550a, %edx           # imm = 0x550A
callq 0x2110
leaq 0x152849(%rip), %rdi    # 0x22d05e
leaq 0x14f485(%rip), %rsi    # 0x229ca1
leaq 0x15280b(%rip), %rcx    # 0x22d02e
movl $0x551f, %edx           # imm = 0x551F
callq 0x2110