// File: /workspace/github_cpp_makefile_star2_O3/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, 0x18(%rsp)
movq %rsi, %r13
movq %rdi, 0x30(%rsp)
testq %rdx, %rdx
sete %al
testq %r8, %r8
sete %sil
orb %al, %sil
jne 0x73c5a
leaq 0x1c(%r13), %r12
xorl %eax, %eax
xorl %esi, %esi
xorl %r9d, %r9d
xorl %ebx, %ebx
movq %r8, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq %rdx, 0x10(%rsp)
leaq (%rsi,%rsi,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %rsi, %rdi
movl 0xc(%r13,%rdi), %r10d
leaq (%rax,%rax,8), %rsi
leaq (%rsi,%rsi,2), %rsi
addq %rax, %rsi
movl 0xc(%rcx,%rsi), %eax
cmpl %eax, %r10d
jae 0x73a7f
incl %r9d
jmp 0x73c47
jbe 0x73a88
incl %ebx
jmp 0x73c47
movl %r9d, %esi
movl %r9d, %eax
movl %r9d, %r14d
cmpq %rdx, %rsi
jae 0x73aba
leaq (%rsi,%rsi,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %rsi, %rdi
cmpl %r10d, 0xc(%r13,%rdi)
jne 0x73ab7
incl %eax
movq %rax, %rsi
movl %eax, %r14d
cmpq %rdx, %rax
jb 0x73a96
jmp 0x73aba
movl %eax, %r14d
movl %ebx, %eax
cmpq %r8, %rax
jae 0x73c44
movl %r9d, 0x8(%rsp)
movl %r10d, 0xc(%rsp)
leaq (%rax,%rax,8), %rdx
leaq (%rdx,%rdx,2), %r15
addq %rax, %r15
cmpl %r10d, 0xc(%rcx,%r15)
jne 0x73c3a
addq %rcx, %r15
movl 0x8(%rsp), %eax
movl %eax, %ebp
cmpl %r14d, %eax
jae 0x73c0c
movl 0x8(%rsp), %eax
movl %eax, %ebp
leal 0x1(%rbp), %eax
movl $0x1, %edx
cmpl %r14d, %eax
jae 0x73bc3
movl %eax, %ecx
leaq (%rcx,%rcx,8), %rsi
leaq (%rsi,%rsi,2), %rsi
addq %rcx, %rsi
movl (%r13,%rsi), %ecx
movl %ebp, %r8d
leaq (%r8,%r8,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %r8, %rdi
cmpl (%r13,%rdi), %ecx
jne 0x73bc3
addq %r13, %rsi
addq %r13, %rdi
movl 0xc(%rsi), %r8d
cmpl 0xc(%rdi), %r8d
jne 0x73bc3
movl 0x18(%rsi), %esi
movl 0x18(%rdi), %edi
movl %edi, %r8d
xorl %esi, %r8d
js 0x73bc3
movl $0x3fffffff, %r8d       # imm = 0x3FFFFFFF
andq %r8, %rsi
andq %r8, %rdi
leal 0x1(%rdi), %r8d
cmpl %r8d, %esi
jne 0x73bc3
movq 0x18(%rsp), %r8
movq (%r8), %r8
leaq (%rcx,%rcx,2), %rcx
movq 0x8(%r8,%rcx,8), %r9
cmpq %rdi, %r9
jbe 0x73bc3
cmpq %rsi, %r9
jbe 0x73bc3
leaq (%r8,%rcx,8), %rcx
movq (%rcx), %r8
shlq $0x5, %rdi
movb 0x1c(%r8,%rdi), %cl
testb $0x20, %cl
je 0x73bc3
shlq $0x5, %rsi
movb 0x1c(%r8,%rsi), %sil
andb $0x1f, %cl
andb $0x3f, %sil
xorb $0x21, %sil
xorl %edx, %edx
orb %cl, %sil
sete %cl
je 0x73bbc
movl %ebp, %eax
movb %cl, %dl
incq %rdx
movl %eax, %ebp
movl %ebp, %eax
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %r12, %rax
addq %rcx, %rax
movq %rdx, %rcx
negq %rcx
leaq (%rcx,%rcx,8), %rcx
leaq (%rcx,%rcx,2), %rsi
subq %rdx, %rsi
addq %rax, %rsi
movq 0x30(%rsp), %rdi
movsd 0x1bda74(%rip), %xmm0   # 0x231668
movq %r15, %rcx
callq 0x73841
testq %rax, %rax
jne 0x73c0c
incl %ebp
cmpl %r14d, %ebp
jb 0x73afd
cmpl %r14d, %ebp
jae 0x73c1d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0xc(%r15)
movl %eax, (%r15)
incl %ebx
movq %rbx, %rax
movq 0x28(%rsp), %r8
cmpq %r8, %rbx
movq 0x20(%rsp), %rcx
movl 0xc(%rsp), %r10d
jb 0x73acf
movl %r14d, %r9d
movq 0x10(%rsp), %rdx
jmp 0x73c47
movl %r14d, %r9d
movl %r9d, %esi
cmpq %rdx, %rsi
jae 0x73c5a
movl %ebx, %eax
cmpq %r8, %rax
jb 0x73a53
xorl %eax, %eax
testq %r8, %r8
je 0x73caa
movl $0x1, %r9d
xorl %edx, %edx
leaq (%rdx,%rdx,8), %rsi
leaq (%rsi,%rsi,2), %rsi
addq %rdx, %rsi
cmpl $-0x1, 0xc(%rcx,%rsi)
je 0x73c9d
addq %rcx, %rsi
movl %eax, %edx
incl %eax
leaq (%rdx,%rdx,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %rdx, %rdi
movups (%rsi), %xmm0
movups 0xc(%rsi), %xmm1
movups %xmm1, 0xc(%rcx,%rdi)
movups %xmm0, (%rcx,%rdi)
movl %r9d, %edx
incl %r9d
cmpq %r8, %rdx
jb 0x73c69
movl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq