// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Overlaps.cpp
// Function: kt_u_trans_t_simple_symm(kv_u_trans_t*, unsigned int, unsigned int)
void kt_u_trans_t_simple_symm(kv_u_trans_t *ta, uint32_t un, uint32_t symm_add)
{
    u_trans_t *a = NULL, *r_a = NULL, *p = NULL;
    uint32_t k, n, m;
    n = ta->n;
    for (k = 0; k < n; k++)
    {
        if(ta->a[k].del || ta->a[k].qn > ta->a[k].tn) continue;
        get_u_trans_spec(ta, ta->a[k].tn, ta->a[k].qn, &r_a, NULL);
        a = &(ta->a[k]); 
        if(!r_a || r_a->del)
        {
            if(symm_add) kv_pushp(u_trans_t, *ta, &r_a);
            else
            {
                a->del = 1; 
                continue;
            }
        }
        else
        {
            if(r_a->nw > a->nw) 
            {
                p = a;
                a = r_a;
                r_a = p;
            }
        }
        (*r_a) = (*a);
        r_a->qn = a->tn; r_a->qs = a->ts; r_a->qe = a->te;
        r_a->tn = a->qn; r_a->ts = a->qs; r_a->te = a->qe;
    }
    
    for (k = m = 0; k < ta->n; ++k)
    {
        if(ta->a[k].del) continue;
        ta->a[m] = ta->a[k];
        m++;
    }
    ta->n = m;
    kt_u_trans_t_idx(ta, un);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, 0x14(%rsp)
movq %rdi, %r14
movq $0x0, 0x8(%rsp)
movl (%rdi), %eax
testq %rax, %rax
je 0xcb74f
movl %edx, %ebp
shlq $0x4, %rax
leaq (%rax,%rax,2), %r13
xorl %ebx, %ebx
movq 0x10(%r14), %r12
cmpb $0x0, 0x28(%r12,%rbx)
js 0xcb742
movl 0x8(%r12,%rbx), %edx
movl 0x14(%r12,%rbx), %esi
cmpl %esi, %edx
ja 0xcb742
leaq (%r12,%rbx), %r15
movq %r14, %rdi
leaq 0x8(%rsp), %rcx
xorl %r8d, %r8d
callq 0xca79c
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0xcb6a1
cmpb $0x0, 0x28(%rax)
js 0xcb6a1
movsd 0x20(%rax), %xmm0
ucomisd 0x20(%r12,%rbx), %xmm0
jbe 0xcb6f5
movq %r15, 0x8(%rsp)
movq %rax, %r15
jmp 0xcb6f5
testl %ebp, %ebp
je 0xcb73d
movq 0x8(%r14), %rax
cmpq %rax, (%r14)
jne 0xcb6da
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x8(%r14)
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rsi
movq %r12, %rdi
callq 0x2370
movq %rax, 0x10(%r14)
movq (%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, (%r14)
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
addq 0x10(%r14), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movl 0x14(%r15), %ecx
movl %ecx, 0x8(%rax)
movl 0xc(%r15), %ecx
movl %ecx, (%rax)
movl 0x10(%r15), %ecx
movl %ecx, 0x4(%rax)
movl 0x8(%r15), %ecx
movl %ecx, 0x14(%rax)
movl (%r15), %ecx
movl %ecx, 0xc(%rax)
movl 0x4(%r15), %ecx
movl %ecx, 0x10(%rax)
jmp 0xcb742
orb $-0x80, 0x28(%r15)
addq $0x30, %rbx
cmpq %rbx, %r13
jne 0xcb643
xorl %eax, %eax
cmpq $0x0, (%r14)
je 0xcb7a4
movl $0x1, %ecx
xorl %esi, %esi
movq 0x10(%r14), %rdx
leaq (%rsi,%rsi,2), %rsi
shlq $0x4, %rsi
cmpb $0x0, 0x28(%rdx,%rsi)
js 0xcb799
addq %rdx, %rsi
movl %eax, %edi
leaq (%rdi,%rdi,2), %rdi
shlq $0x4, %rdi
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movups 0x20(%rsi), %xmm2
movups %xmm2, 0x20(%rdx,%rdi)
movups %xmm1, 0x10(%rdx,%rdi)
movups %xmm0, (%rdx,%rdi)
incl %eax
movl %ecx, %esi
incl %ecx
cmpq %rsi, (%r14)
ja 0xcb75e
movl %eax, %eax
movq %rax, (%r14)
movq %r14, %rdi
movl 0x14(%rsp), %esi
callq 0xc405a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq