// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Correct.cpp
// Function: dedup_src_shared(ma_ug_t*, ul_ov_t*, unsigned long, ul_ov_t*, unsigned long, idx_emask_t*)
uint64_t dedup_src_shared(ma_ug_t *ug, ul_ov_t *ta, uint64_t tn, ul_ov_t *qa, uint64_t qn, idx_emask_t *mm)
{
    uint32_t ti, qi, ts, te, id, k, l;
    ti = qi = 0;
    while (ti < tn && qi < qn) {
        if (ta[ti].tn < qa[qi].tn) {
            ti++;
        } else if(qa[qi].tn < ta[ti].tn) {
            qi++;
        } else {///ta[ti].tn == qa[qi].tn
            id = ta[ti].tn;
            for (ts = ti; ti < tn && ta[ti].tn == id; ti++); te = ti;
            for (; qi < qn && qa[qi].tn == id; qi++) {
                for (k = ts; k < te; k++) {
                    l = 1; 
                    if(is_ul_ov_pe(ta, te, k, (*mm))) {
                        l++; k++;
                    }
                    if(is_cover_ul_ov_t(ug, 0.06, ta+k+1-l, l, &(qa[qi]))) break;
                }
                if(k < te) qa[qi].qn = qa[qi].tn = (uint32_t)-1;
            }
        }
    }
    for (qi = l = 0; qi < qn; qi++) {
        if(qa[qi].tn == (uint32_t)-1) continue;
        qa[l++] = qa[qi];
    }
    return l;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, 0x10(%rsp)
movq %rsi, %r13
movq %rdi, %rbp
leaq 0x1c(%rsi), %rax
movq %rax, 0x30(%rsp)
xorl %r9d, %r9d
xorl %r10d, %r10d
movl %r9d, %eax
imulq $0x1c, %rax, %rsi
addq %rcx, %rsi
addq $0xc, %rsi
movl %r10d, %edi
cmpq %rdx, %rdi
jae 0x41c78
cmpq %r8, %rax
jae 0x41c78
imulq $0x1c, %rdi, %rdi
movl 0xc(%r13,%rdi), %r14d
movl (%rsi), %edi
cmpl %edi, %r14d
jae 0x41afb
incl %r10d
jmp 0x41ad1
movl %r10d, %ebx
movq %r8, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movl %r10d, 0x8(%rsp)
jbe 0x41b19
incl %r9d
jmp 0x41ac3
movl %ebx, %eax
cmpq %rdx, %rax
jae 0x41c55
imulq $0x1c, %rax, %rax
cmpl %r14d, 0xc(%r13,%rax)
jne 0x41c55
incl %ebx
jmp 0x41b19
movl %r9d, 0xc(%rsp)
movl %r10d, %r12d
cmpl %ebx, %r12d
jae 0x41c2b
leal 0x1(%r12), %eax
cmpl %ebx, %eax
jae 0x41bc6
movl %eax, %ecx
imulq $0x1c, %rcx, %rcx
movl (%r13,%rcx), %edx
movl %r12d, %esi
imulq $0x1c, %rsi, %rsi
cmpl (%r13,%rsi), %edx
jne 0x41bc6
addq %r13, %rcx
addq %r13, %rsi
movl 0xc(%rcx), %edi
cmpl 0xc(%rsi), %edi
jne 0x41bc6
movl 0x18(%rcx), %ecx
movl 0x18(%rsi), %esi
movl %esi, %edi
xorl %ecx, %edi
js 0x41bc6
movl $0x3fffffff, %edi       # imm = 0x3FFFFFFF
andq %rdi, %rcx
andq %rdi, %rsi
leal 0x1(%rsi), %edi
cmpl %edi, %ecx
jne 0x41bc6
movq 0x10(%rsp), %rdi
movq (%rdi), %rdi
imulq $0x18, %rdx, %rdx
movq 0x8(%rdi,%rdx), %r8
cmpq %rsi, %r8
jbe 0x41bc6
cmpq %rcx, %r8
jbe 0x41bc6
addq %rdx, %rdi
movq (%rdi), %rdx
shlq $0x5, %rsi
movb 0x1c(%rdx,%rsi), %sil
testb $0x20, %sil
jne 0x41c02
pushq $0x1
popq %rdx
movl %r12d, %eax
imulq $0x1c, %rax, %rax
addq 0x30(%rsp), %rax
movq %rdx, %rcx
negq %rcx
imulq $0x1c, %rcx, %rsi
addq %rax, %rsi
movq %rbp, %rdi
movsd 0x1a19cb(%rip), %xmm0   # 0x1e35b8
movq %r15, %rcx
callq 0x4190b
testq %rax, %rax
jne 0x41c2b
incl %r12d
jmp 0x41b3f
shlq $0x5, %rcx
movb 0x1c(%rdx,%rcx), %cl
andb $0x1f, %sil
andb $0x3f, %cl
xorb $0x21, %cl
xorl %edx, %edx
orb %sil, %cl
sete %cl
je 0x41c21
movl %r12d, %eax
movb %cl, %dl
incq %rdx
movl %eax, %r12d
jmp 0x41bc9
cmpl %ebx, %r12d
jae 0x41c39
orl $-0x1, 0xc(%r15)
orl $-0x1, (%r15)
movl 0xc(%rsp), %r9d
incl %r9d
movq 0x28(%rsp), %r8
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rdx
movl 0x8(%rsp), %r10d
movl %r9d, %eax
cmpq %r8, %rax
jae 0x41c70
imulq $0x1c, %rax, %rax
leaq (%rcx,%rax), %r15
cmpl %r14d, 0xc(%rcx,%rax)
je 0x41b37
movl %ebx, %r10d
jmp 0x41ac3
xorl %edi, %edi
xorl %edx, %edx
movl %edi, %edi
movl %edx, %eax
cmpq %r8, %rdi
jae 0x41cad
imulq $0x1c, %rdi, %rsi
cmpl $-0x1, 0xc(%rcx,%rsi)
je 0x41ca9
addq %rcx, %rsi
incl %edx
imulq $0x1c, %rax, %rax
movups (%rsi), %xmm0
movups 0xc(%rsi), %xmm1
movups %xmm1, 0xc(%rcx,%rax)
movups %xmm0, (%rcx,%rax)
incl %edi
jmp 0x41c7c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq