// File: /workspace/github_cpp_makefile_star2_O2/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 %edx, %ebp
movl %esi, 0x14(%rsp)
movq %rdi, %r14
leaq 0x8(%rsp), %rax
andq $0x0, (%rax)
movl (%rdi), %eax
imulq $0x30, %rax, %r13
xorl %ebx, %ebx
cmpq %rbx, %r13
je 0x90c2d
movq 0x10(%r14), %r12
cmpb $0x0, 0x28(%r12,%rbx)
js 0x90c24
movl 0x8(%r12,%rbx), %edx
movl 0x14(%r12,%rbx), %esi
cmpl %esi, %edx
ja 0x90c24
leaq (%r12,%rbx), %r15
movq %r14, %rdi
leaq 0x8(%rsp), %rcx
xorl %r8d, %r8d
callq 0x8feef
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
je 0x90b9b
cmpb $0x0, 0x28(%rcx)
js 0x90b9b
movsd 0x20(%rcx), %xmm0
ucomisd 0x20(%r12,%rbx), %xmm0
jbe 0x90bec
movq %r15, 0x8(%rsp)
movq %r15, %rax
movq %rcx, %r15
jmp 0x90bef
testl %ebp, %ebp
je 0x90be5
movq (%r14), %rax
cmpq 0x8(%r14), %rax
jne 0x90bd0
leaq (%rax,%rax), %rcx
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %rcx
movq %rcx, 0x8(%r14)
imulq $0x30, %rcx, %rsi
movq %r12, %rdi
callq 0x2370
movq %rax, %r12
movq %rax, 0x10(%r14)
movq (%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, (%r14)
imulq $0x30, %rax, %rax
addq %r12, %rax
movq %rax, 0x8(%rsp)
jmp 0x90bef
orb $-0x80, 0x28(%r15)
jmp 0x90c24
movq %rcx, %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)
movq 0xc(%r15), %rcx
movq %rcx, (%rax)
movl 0x8(%r15), %ecx
movl %ecx, 0x14(%rax)
movq (%r15), %rcx
movq %rcx, 0xc(%rax)
addq $0x30, %rbx
jmp 0x90b31
xorl %eax, %eax
xorl %ecx, %ecx
movl %eax, %eax
movl %ecx, %edx
cmpq %rax, (%r14)
jbe 0x90c6f
movq 0x10(%r14), %rsi
imulq $0x30, %rax, %rdi
cmpb $0x0, 0x28(%rsi,%rdi)
js 0x90c6b
addq %rsi, %rdi
imulq $0x30, %rdx, %rdx
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups 0x20(%rdi), %xmm2
movups %xmm2, 0x20(%rsi,%rdx)
movups %xmm1, 0x10(%rsi,%rdx)
movups %xmm0, (%rsi,%rdx)
incl %ecx
incl %eax
jmp 0x90c31
movq %rdx, (%r14)
movq %r14, %rdi
movl 0x14(%rsp), %esi
callq 0x88a31
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq