// File: /workspace/github_cpp_makefile_star2_O1/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 0x7419e
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 0x73fb3
incl %r9d
jmp 0x7418b
jbe 0x73fbc
incl %ebx
jmp 0x7418b
movl %r9d, %esi
movl %r9d, %eax
movl %r9d, %r14d
cmpq %rdx, %rsi
jae 0x73fee
leaq (%rsi,%rsi,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %rsi, %rdi
cmpl %r10d, 0xc(%r13,%rdi)
jne 0x73feb
incl %eax
movq %rax, %rsi
movl %eax, %r14d
cmpq %rdx, %rax
jb 0x73fca
jmp 0x73fee
movl %eax, %r14d
movl %ebx, %eax
cmpq %r8, %rax
jae 0x74188
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 0x7417e
addq %rcx, %r15
movl 0x8(%rsp), %eax
movl %eax, %ebp
cmpl %r14d, %eax
jae 0x74150
movl 0x8(%rsp), %eax
movl %eax, %ebp
leal 0x1(%rbp), %eax
movl $0x1, %edx
cmpl %r14d, %eax
jae 0x74107
movl %eax, %ecx
leaq (%rcx,%rcx,8), %rsi
leaq (%rsi,%rsi,2), %rsi
addq %rcx, %rsi
movl (%r13,%rsi), %ecx
movl %ebp, %edi
leaq (%rdi,%rdi,8), %r8
leaq (%r8,%r8,2), %r8
addq %rdi, %r8
movl (%r13,%r8), %edi
cmpl %edi, %ecx
jne 0x74107
addq %r13, %rsi
addq %r13, %r8
movl 0xc(%rsi), %r9d
cmpl 0xc(%r8), %r9d
jne 0x74107
movl 0x18(%rsi), %esi
movl 0x18(%r8), %r8d
movl %r8d, %r9d
xorl %esi, %r9d
js 0x74107
movl $0x3fffffff, %r9d       # imm = 0x3FFFFFFF
andq %r9, %rsi
andq %r9, %r8
leal 0x1(%r8), %r9d
cmpl %r9d, %esi
jne 0x74107
movq 0x18(%rsp), %r9
movq (%r9), %r9
leaq (%rdi,%rdi,2), %r10
cmpq %r8, 0x8(%r9,%r10,8)
jbe 0x74107
leaq (%rcx,%rcx,2), %rdi
cmpq %rsi, 0x8(%r9,%rdi,8)
jbe 0x74107
leaq (%r9,%r10,8), %rcx
movq (%rcx), %rcx
shlq $0x5, %r8
movb 0x1c(%rcx,%r8), %cl
testb $0x20, %cl
je 0x74107
leaq (%r9,%rdi,8), %rdx
movq (%rdx), %rdx
shlq $0x5, %rsi
movb 0x1c(%rdx,%rsi), %sil
andb $0x1f, %cl
andb $0x3f, %sil
xorb $0x21, %sil
xorl %edx, %edx
orb %cl, %sil
sete %cl
je 0x74100
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 0x1b1430(%rip), %xmm0   # 0x225568
movq %r15, %rcx
callq 0x73d3b
testq %rax, %rax
jne 0x74150
incl %ebp
cmpl %r14d, %ebp
jb 0x74031
cmpl %r14d, %ebp
jae 0x74161
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 0x74003
movl %r14d, %r9d
movq 0x10(%rsp), %rdx
jmp 0x7418b
movl %r14d, %r9d
movl %r9d, %esi
cmpq %rdx, %rsi
jae 0x7419e
movl %ebx, %eax
cmpq %r8, %rax
jb 0x73f87
xorl %eax, %eax
testq %r8, %r8
je 0x741ee
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 0x741e1
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 0x741ad
movl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq