// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq -0x18(%rbp), %rcx
movb %al, -0x4d(%rbp)
jae 0x7b41b
movl -0x38(%rbp), %eax
cmpq -0x28(%rbp), %rax
setb %al
movb %al, -0x4d(%rbp)
movb -0x4d(%rbp), %al
testb $0x1, %al
jne 0x7b427
jmp 0x7b8aa
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq -0x20(%rbp), %rcx
movl -0x38(%rbp), %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jae 0x7b459
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x7b8a5
movq -0x20(%rbp), %rax
movl -0x38(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq -0x10(%rbp), %rcx
movl -0x34(%rbp), %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jae 0x7b48b
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x7b8a3
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x44(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq -0x18(%rbp), %rcx
movb %al, -0x4e(%rbp)
jae 0x7b4cf
movq -0x10(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
cmpl -0x44(%rbp), %eax
sete %al
movb %al, -0x4e(%rbp)
movb -0x4e(%rbp), %al
testb $0x1, %al
jne 0x7b4d8
jmp 0x7b4e5
jmp 0x7b4da
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x7b4a5
movl -0x34(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x38(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq -0x28(%rbp), %rcx
movb %al, -0x4f(%rbp)
jae 0x7b515
movq -0x20(%rbp), %rax
movl -0x38(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
cmpl -0x44(%rbp), %eax
sete %al
movb %al, -0x4f(%rbp)
movb -0x4f(%rbp), %al
testb $0x1, %al
jne 0x7b521
jmp 0x7b8a1
movl -0x3c(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x40(%rbp), %eax
jae 0x7b860
movl $0x1, -0x4c(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
cmpl -0x40(%rbp), %eax
jae 0x7b801
movq -0x10(%rbp), %rax
movl -0x48(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x7b801
movq -0x10(%rbp), %rax
movl -0x48(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jne 0x7b801
movq -0x10(%rbp), %rax
movl -0x48(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
shrl $0x1f, %eax
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
shrl $0x1f, %ecx
cmpl %ecx, %eax
jne 0x7b801
movq -0x10(%rbp), %rax
movl -0x48(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x7b801
movq -0x10(%rbp), %rax
movl -0x48(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
movq -0x10(%rbp), %rdx
movl -0x48(%rbp), %esi
imulq $0x1c, %rsi, %rsi
addq %rsi, %rdx
movl (%rdx), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jae 0x7b801
movq -0x10(%rbp), %rax
movl -0x48(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
movq -0x10(%rbp), %rdx
movl -0x48(%rbp), %esi
addl $0x1, %esi
movl %esi, %esi
imulq $0x1c, %rsi, %rsi
addq %rsi, %rdx
movl (%rdx), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jae 0x7b801
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
movl %ecx, %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movb 0x1c(%rax), %al
shrb $0x5, %al
andb $0x1, %al
cmpb $0x0, %al
je 0x7b801
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
addl $0x1, %edx
movl %edx, %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
addl $0x1, %edx
movl %edx, %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
movl %ecx, %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movb 0x1c(%rax), %al
shrb $0x5, %al
andb $0x1, %al
cmpb $0x0, %al
je 0x7b801
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
movl %ecx, %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movb 0x1c(%rax), %al
andb $0x1f, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x7b801
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
addl $0x1, %edx
movl %edx, %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movl -0x48(%rbp), %edx
addl $0x1, %edx
movl %edx, %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
movl %ecx, %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movb 0x1c(%rax), %al
andb $0x1f, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x7b801
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x48(%rbp), %eax
imulq $0x1c, %rax, %rax
addq %rax, %rsi
addq $0x1c, %rsi
movl -0x4c(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
subq %rcx, %rax
imulq $0x1c, %rax, %rax
addq %rax, %rsi
movl -0x4c(%rbp), %eax
movl %eax, %edx
movq -0x20(%rbp), %rcx
movl -0x38(%rbp), %eax
imulq $0x1c, %rax, %rax
addq %rax, %rcx
movsd 0x306a95(%rip), %xmm0   # 0x3822d8
callq 0x7afd0
cmpq $0x0, %rax
je 0x7b850
jmp 0x7b860
jmp 0x7b852
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x7b527
movl -0x48(%rbp), %eax
cmpl -0x40(%rbp), %eax
jae 0x7b891
movq -0x20(%rbp), %rax
movl -0x38(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
movq -0x20(%rbp), %rax
movl -0x38(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x7b893
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x7b4eb
jmp 0x7b8a3
jmp 0x7b8a5
jmp 0x7b3fe
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpq -0x28(%rbp), %rax
jae 0x7b924
movq -0x20(%rbp), %rax
movl -0x38(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, 0xc(%rax)
jne 0x7b8d7
jmp 0x7b919
movq -0x20(%rbp), %rcx
movl -0x38(%rbp), %eax
imulq $0x1c, %rax, %rax
addq %rax, %rcx
movq -0x20(%rbp), %rax
movl -0x4c(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0x4c(%rbp)
movl %edx, %edx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x7b8b8
movl -0x4c(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)