// File: chhylp123[P]hifiasm/Purge_Dups.cpp
// Function: filter_ovlp_scg(hap_overlaps_list*, unsigned long*, R_to_U*, ma_ug_t*, spg_t*)
void filter_ovlp_scg(hap_overlaps_list* ha, uint64_t* ps_idx, R_to_U* ruIndex, ma_ug_t *rug, spg_t *scg)
{
    uint32_t i, k, v, *ma = NULL, mn, luid;
    ma_utg_v *pp = &(scg->ug->u);
    kvec_t(uint32_t) vv; kv_init(vv);
    for (i = 0; i < scg->idx.n; i++){
        ma = scg->dst.a + (scg->idx.a[i]>>32);
        mn = (uint64_t)scg->idx.a[i];
        if(mn < 2) continue;
        for (k = 0, vv.n = 0; k < mn; k++){
            luid = seed_uid(&(pp->a[ma[k]>>1]), ps_idx, ruIndex, rug);
            if(luid == (uint32_t)-1) {
                fprintf(stderr, "ERROR-scg\n");
                continue;
            }
            kv_push(uint32_t, vv, luid);
        }
        if(vv.n < 2) continue;
        filter_ovlp_vecs(ha, vv.a, vv.n);
    }

    for (v = 0; v < ha->num; v++){
        for (i = 0, k = 0; i < ha->x[v].a.n; i++){
            if(ha->x[v].a.a[i].status == DELETE) continue;
            ha->x[v].a.a[k++] = ha->x[v].a.a[i];
        }
        ha->x[v].a.n = k;
    }

    kv_destroy(vv);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x58(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x1849b9
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x28(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl -0x2c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x2c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x44(%rbp)
cmpl $0x2, -0x44(%rbp)
jae 0x1848b2
jmp 0x1849ab
movl $0x0, -0x30(%rbp)
movq $0x0, -0x68(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x44(%rbp), %eax
jae 0x18498f
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x40(%rbp), %rax
movl -0x30(%rbp), %ecx
movl (%rax,%rcx,4), %eax
shrl %eax
movl %eax, %eax
imulq $0x28, %rax, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x1843a0
movl %eax, -0x48(%rbp)
cmpl $-0x1, -0x48(%rbp)
jne 0x18491e
movq 0x23f6d5(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x205e45(%rip), %rsi    # 0x38a75a
movb $0x0, %al
callq 0x22a0
jmp 0x184981
jmp 0x184920
movq -0x68(%rbp), %rax
cmpq -0x60(%rbp), %rax
jne 0x184966
cmpq $0x0, -0x60(%rbp)
je 0x18493e
movq -0x60(%rbp), %rax
shlq %rax
movq %rax, -0x70(%rbp)
jmp 0x184949
movl $0x2, %eax
movq %rax, -0x70(%rbp)
jmp 0x184949
movq -0x70(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, -0x58(%rbp)
movl -0x48(%rbp), %edx
movq -0x58(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
movl %edx, (%rax,%rcx,4)
jmp 0x184981
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1848c1
cmpq $0x2, -0x68(%rbp)
jae 0x184998
jmp 0x1849ab
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x68(%rbp), %rax
movl %eax, %edx
callq 0x184660
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x18485e
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0x184aac
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movl -0x34(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
jae 0x184a85
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movzbl 0x2(%rax), %eax
cmpl $0x2, %eax
jne 0x184a25
jmp 0x184a77
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
movl -0x2c(%rbp), %eax
shlq $0x6, %rax
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movl -0x30(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp)
movl %eax, %eax
shlq $0x6, %rax
addq %rax, %rdi
movl $0x40, %edx
callq 0x2180
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1849de
movl -0x30(%rbp), %eax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x34(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1849c0
movq -0x58(%rbp), %rdi
callq 0x2210
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)