// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: integer_normalize_ovlp_purge(ul_resolve_t*, unsigned int, ul2ul_item_t*, ul2ul_idx_t*)
void integer_normalize_ovlp_purge(ul_resolve_t *uidx, uint32_t qid, ul2ul_item_t *o, ul2ul_idx_t *ul2)
{
    if(o->is_del) return;
    ul2ul_t *z; uint64_t k, is_del;
    for (k = is_del = 0; k < o->n; k++) {
        if(o->a[k].is_del) continue;
        z = get_ul_o(ul2, o->a[k].hid, 1, qid, 1);
        if((!z) || (z->is_del)) {
            o->a[k].is_del = 1; is_del++;
        } 
    }

    if(is_del) {
        for (k = o->cn = 0; k < o->n; k++) {
            if(o->a[k].is_del) o->a[k].hid |= ((uint32_t)(0x80000000));
            else o->cn++;
        }

        radix_sort_ul2ul_srt(o->a, o->a + o->n);

        for (k = 0; k < o->n; k++) {
            if(o->a[k].hid&((uint32_t)(0x80000000))) {
                o->a[k].hid -= ((uint32_t)(0x80000000));
            }
        }
    }

    if(o->cn == 0) o->is_del = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x33838b
jmp 0x33855f
movq $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x338445
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movb 0x24(%rax), %al
shrb $0x6, %al
andb $0x1, %al
cmpb $0x0, %al
je 0x3383ca
jmp 0x338434
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %esi
movl -0xc(%rbp), %ecx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x337160
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x33840b
movq -0x28(%rbp), %rax
movb 0x24(%rax), %al
shrb $0x6, %al
andb $0x1, %al
cmpb $0x0, %al
je 0x338432
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movb 0x24(%rax), %cl
andb $-0x41, %cl
orb $0x40, %cl
movb %cl, 0x24(%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x338434
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x33839b
cmpq $0x0, -0x38(%rbp)
je 0x33853f
movq -0x18(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x3384c4
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movb 0x24(%rax), %al
shrb $0x6, %al
andb $0x1, %al
cmpb $0x0, %al
je 0x3384a7
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, (%rax)
jmp 0x3384b4
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1c(%rax)
jmp 0x3384b6
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x338463
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
imulq $0x28, 0x8(%rax), %rax
addq %rax, %rsi
callq 0x30fc30
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x33853d
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x33852d
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %ecx
subl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, (%rax)
jmp 0x33852f
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x3384eb
jmp 0x33853f
movq -0x18(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x33855f
movq -0x18(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x18(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)