// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: integer_containment_purge(ul_resolve_t*, unsigned int, ul2ul_item_t*, ul2ul_idx_t*, unsigned int)
void integer_containment_purge(ul_resolve_t *uidx, uint32_t qid, ul2ul_item_t *q, ul2ul_idx_t *ul2, uint32_t keep_raw_utg)
{
    if(q->is_del) return;
    uint64_t k; int32_t r; ul2ul_item_t *t; ul2ul_t *z; assert(qid == q->id);
    for (k = 0; k < q->cn; k++) {
        if(q->a[k].is_del || q->a[k].is_ct) continue;
        t = get_ul_ovlp(ul2, ulg_id(*ul2, q->a[k].hid), ulg_type(*ul2, q->a[k].hid));
        assert(t);
        if(t->is_del) continue;
        r = integer_hit2arc(&(q->a[k]), ulg_len(*uidx, qid), ulg_len(*uidx, q->a[k].hid), 
        ulg_occ(*uidx, qid), ulg_occ(*uidx, q->a[k].hid), qid, q->a[k].hid, 0, NULL);
        // assert(r != MA_HT_INT);
        if (r == MA_HT_QCONT) {
            q->a[k].is_ct = 1;
            z = get_ul_o(ul2, ulg_id(*ul2, q->a[k].hid), ulg_type(*ul2, q->a[k].hid), ulg_id(*ul2, qid), ulg_type(*ul2, qid));
            assert(z && (!z->is_del) && (!z->is_ct)); z->is_ct = 1;
            if((!keep_raw_utg) || ulg_type(*ul2, qid)) integer_node_del(ul2, qid, 1);
        } else if (r == MA_HT_TCONT) {
            q->a[k].is_ct = 1;
            z = get_ul_o(ul2, ulg_id(*ul2, q->a[k].hid), ulg_type(*ul2, q->a[k].hid), ulg_id(*ul2, qid), ulg_type(*ul2, qid));
            assert(z && (!z->is_del) && (!z->is_ct)); z->is_ct = 1;
            if((!keep_raw_utg) || ulg_type(*ul2, q->a[k].hid)) integer_node_del(ul2, q->a[k].hid, 1);
        }
    }

    // if(ulg_type(*ul2, k)) {
    //     for (k = 0; k < q->cn; k++) {
    //         if((!(q->a[k].is_del)) && (!(q->a[k].is_ct))) break;
    //     }
    //     if(k >= q->cn) q->is_del = 1;
    // }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, 0x1c(%rsp)
movq %rcx, 0x10(%rsp)
movl %esi, 0x4(%rsp)
movq %rdi, 0x40(%rsp)
movl 0x18(%rdx), %eax
testl %eax, %eax
js 0x207a7a
cmpl 0x4(%rsp), %eax
jne 0x207ae6
movq %rdx, %r15
cmpl $0x0, 0x1c(%rdx)
je 0x207a7a
movl 0x4(%rsp), %eax
imulq $0x58, %rax, %rcx
movq %rcx, 0x30(%rsp)
movq %rax, 0x8(%rsp)
shlq $0x5, %rax
movq %rax, 0x28(%rsp)
xorl %ebx, %ebx
xorl %ebp, %ebp
movq (%r15), %rax
movb 0x24(%rax,%rbx), %cl
cmpb $0x3f, %cl
ja 0x207953
movl (%rax,%rbx), %edi
movq 0x10(%rsp), %rsi
movq 0x30(%rsi), %rdx
movl (%rdx,%rdi,4), %edx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
cmpq %r8, %rdx
je 0x207a89
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x207a89
shlq $0x5, %rdx
cmpl $0x0, 0x18(%rsi,%rdx)
js 0x207953
movq 0x40(%rsp), %r11
movq 0x208(%r11), %r9
movq 0x8(%rsp), %rdx
subq %r9, %rdx
jae 0x207720
movq 0x30(%r11), %rdx
movq 0x48(%rdx), %rdx
movq 0x30(%rsp), %rsi
movl 0x18(%rdx,%rsi), %r8d
jmp 0x207738
movq 0x18(%r11), %rsi
movq 0x10(%rsi), %rsi
leaq (%rdx,%rdx,4), %rdx
movl (%rsi,%rdx,8), %r8d
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %r8d
movq %rdi, %rdx
subq %r9, %rdx
jae 0x207753
movq 0x30(%r11), %rdx
movq 0x48(%rdx), %rdx
imulq $0x58, %rdi, %rsi
movl 0x18(%rdx,%rsi), %r10d
jmp 0x20776b
movq 0x18(%r11), %rsi
movq 0x10(%rsi), %rsi
leaq (%rdx,%rdx,4), %rdx
movl (%rsi,%rdx,8), %r10d
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %r10d
movl $0x1, %r14d
movl $0x1, %esi
cmpq %r9, 0x8(%rsp)
jae 0x207793
movq 0x1d0(%r11), %rdx
movq 0x28(%rsp), %rsi
movl 0x18(%rdx,%rsi), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
cmpq %r9, %rdi
jae 0x2077af
movq 0x1d0(%r11), %rdx
shlq $0x5, %rdi
movl 0x18(%rdx,%rdi), %r14d
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movl %r10d, %edi
testb %cl, %cl
movq %r14, 0x20(%rsp)
movq %rsi, 0x38(%rsp)
je 0x2077d2
movl 0xc(%rax,%rbx), %r13d
movl 0x10(%rax,%rbx), %r11d
subq %r11, %rdi
movq %r13, %r10
jmp 0x2077e5
movl 0xc(%rax,%rbx), %r13d
movl 0x10(%rax,%rbx), %r11d
subq %r11, %rdi
movq %rdi, %r10
movq %r13, %rdi
movl %r8d, %edx
movl 0x4(%rax,%rbx), %esi
cmpq %rsi, %rdi
movq %rsi, %r8
cmovlq %rdi, %r8
movl 0x8(%rax,%rbx), %r14d
movq %rdx, %r12
subq %r14, %r12
cmpq %r10, %r12
movq %r10, %r9
cmovlq %r12, %r9
testq %r8, %r8
jg 0x207953
testq %r9, %r9
jg 0x207953
cmpq %rdi, %rsi
jg 0x2078bd
cmpq %r10, %r12
jg 0x2078bd
orb $-0x80, %cl
movb %cl, 0x24(%rax,%rbx)
movq (%r15), %rax
movl (%rax,%rbx), %esi
movq 0x10(%rsp), %rdi
movq 0x18(%rdi), %rax
xorl %edx, %edx
cmpq %rsi, %rax
movl %eax, %ecx
movl $0x0, %r9d
cmoval %r9d, %ecx
seta %dl
subl %ecx, %esi
xorl %r8d, %r8d
cmpq 0x8(%rsp), %rax
cmoval %r9d, %eax
seta %r8b
movl 0x4(%rsp), %ecx
subl %eax, %ecx
callq 0x2064dd
testq %rax, %rax
je 0x207aa8
movb 0x24(%rax), %cl
cmpb $0x40, %cl
jae 0x207aa8
orb $-0x80, %cl
movb %cl, 0x24(%rax)
movq 0x8(%rsp), %rsi
cmpl $0x0, 0x1c(%rsp)
je 0x207944
movq 0x8(%rsp), %rcx
movq %rcx, %rsi
movq 0x10(%rsp), %rax
cmpq %rcx, 0x18(%rax)
ja 0x207944
jmp 0x207953
cmpq %rdi, %rsi
jl 0x20796c
cmpq %r10, %r12
jl 0x20796c
orb $-0x80, %cl
movb %cl, 0x24(%rax,%rbx)
movq (%r15), %rax
movl (%rax,%rbx), %esi
movq 0x10(%rsp), %r14
movq 0x18(%r14), %rax
xorl %edx, %edx
cmpq %rsi, %rax
movl %eax, %ecx
movl $0x0, %edi
cmoval %edi, %ecx
seta %dl
subl %ecx, %esi
xorl %r8d, %r8d
cmpq 0x8(%rsp), %rax
cmoval %edi, %eax
seta %r8b
movl 0x4(%rsp), %ecx
subl %eax, %ecx
movq %r14, %rdi
callq 0x2064dd
testq %rax, %rax
je 0x207ac7
movb 0x24(%rax), %cl
cmpb $0x40, %cl
jae 0x207ac7
orb $-0x80, %cl
movb %cl, 0x24(%rax)
movq (%r15), %rax
movl (%rax,%rbx), %esi
cmpl $0x0, 0x1c(%rsp)
je 0x207944
cmpq %rsi, 0x18(%r14)
jbe 0x207953
movl $0x1, %edx
movq 0x10(%rsp), %rdi
callq 0x20758d
incq %rbp
movl 0x1c(%r15), %eax
addq $0x28, %rbx
cmpq %rax, %rbp
jb 0x2076ad
jmp 0x207a7a
addq %r14, %r10
subq %r10, %rdx
movq %rsi, %r10
subq %rdi, %r10
cmovleq %rdx, %r10
addq %r8, %r9
subq %rsi, %r14
addq %r9, %r14
js 0x207953
movl %r11d, %edx
addq %rdx, %r9
movl %r13d, %edx
cmpq %rdx, %r9
jl 0x207953
movq %r10, %r13
testb %cl, %cl
je 0x2079af
movl 0x1c(%rax,%rbx), %r10d
movl 0x20(%rax,%rbx), %edx
movq 0x20(%rsp), %r9
subq %rdx, %r9
jmp 0x2079c3
movl 0x1c(%rax,%rbx), %edx
movl 0x20(%rax,%rbx), %r8d
movq 0x20(%rsp), %r10
subq %r8, %r10
movq %rdx, %r9
movl 0x14(%rax,%rbx), %r11d
movl 0x18(%rax,%rbx), %edx
movq 0x38(%rsp), %r12
subq %rdx, %r12
cmpq %r11, %r9
movq %r11, %r8
cmovlq %r9, %r8
cmpq %r10, %r12
movq %r10, %rdx
cmovlq %r12, %rdx
testq %r8, %r8
jg 0x207953
testq %rdx, %rdx
jg 0x207953
movq %r9, %r14
movq %r12, %r9
movq %r13, %r12
cmpq %r11, %r14
jle 0x207a11
cmpq %r10, %r9
jl 0x20782f
cmpq %r11, %r14
jge 0x207a1f
cmpq %r10, %r9
jg 0x2078cf
cmpq %r11, %r14
jne 0x207a42
cmpq %r10, %r9
jne 0x207a42
cmpl $-0x3, %r12d
je 0x2078cf
cmpl $-0x2, %r12d
je 0x20782f
jmp 0x207953
cmpq %r10, %r9
setg %r8b
setge %r9b
cmpq %rdi, %rsi
setg %dl
cmpq %r11, %r14
setl %sil
setne %dil
orb %r8b, %dil
movl %edi, %r8d
notb %r8b
testb %r9b, %r8b
jne 0x207a29
xorb %dil, %sil
xorb %sil, %dl
je 0x207953
jmp 0x207a29
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2e4e0(%rip), %rdi     # 0x235f70
leaq 0x3db72(%rip), %rsi     # 0x245609
leaq 0x3fc36(%rip), %rcx     # 0x2476d4
movl $0x1b07, %edx           # imm = 0x1B07
callq 0x2110
leaq 0x3fc87(%rip), %rdi     # 0x247736
leaq 0x3db53(%rip), %rsi     # 0x245609
leaq 0x3fc17(%rip), %rcx     # 0x2476d4
movl $0x1b0f, %edx           # imm = 0x1B0F
callq 0x2110
leaq 0x3fc68(%rip), %rdi     # 0x247736
leaq 0x3db34(%rip), %rsi     # 0x245609
leaq 0x3fbf8(%rip), %rcx     # 0x2476d4
movl $0x1b14, %edx           # imm = 0x1B14
callq 0x2110
leaq 0x3fbda(%rip), %rdi     # 0x2476c7
leaq 0x3db15(%rip), %rsi     # 0x245609
leaq 0x3fbd9(%rip), %rcx     # 0x2476d4
movl $0x1b03, %edx           # imm = 0x1B03
callq 0x2110