// File: chhylp123[P]hifiasm/rcut.cpp
// Function: filter_ovlp_by_mc(ma_ug_t*, asg_t*, unsigned int, hap_overlaps_list*, mc_match_t*, signed char*)
void filter_ovlp_by_mc(ma_ug_t *ug, asg_t *read_g, uint32_t uID, hap_overlaps_list* ha, mc_match_t *ma, 
int8_t *s)
{
	mc_edge_t *o = pt_a(*ma, uID);
	uint32_t n = pt_n(*ma, uID), k, qn, tn;
	hap_overlaps *p = NULL;
	int index;

	for (k = 0; k < n; ++k)
	{
		qn = ma_x(o[k]); tn = ma_y(o[k]); p = NULL;
		if((s[qn]*s[tn])!=-1) continue;
		index = get_specific_hap_overlap(&(ha->x[qn]), qn, tn);
		if(index != -1 && ha->x[qn].a.a[index].score == (long long)o[k].w)
		{
			p = &(ha->x[qn].a.a[index]);
		}
		else
		{
			index = get_specific_hap_overlap(&(ha->x[tn]), tn, qn);
			if(index != -1 && ha->x[tn].a.a[index].score == (long long)o[k].w)
			{
				p = &(ha->x[tn].a.a[index]);
			}
		}
		if(!p) fprintf(stderr, "ERROR\n");
		p->status = FLIP;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x28(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x14(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x3c(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jae 0x226ab1
movq -0x38(%rbp), %rax
movl -0x40(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0x44(%rbp)
movq -0x38(%rbp), %rax
movl -0x40(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x30(%rbp), %rax
movl -0x44(%rbp), %ecx
movsbl (%rax,%rcx), %eax
movq -0x30(%rbp), %rcx
movl -0x48(%rbp), %edx
movsbl (%rcx,%rdx), %ecx
imull %ecx, %eax
cmpl $-0x1, %eax
je 0x226969
jmp 0x226aa3
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movl -0x44(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
callq 0x17a150
movl %eax, -0x54(%rbp)
cmpl $-0x1, -0x54(%rbp)
je 0x2269f4
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x44(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x54(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq -0x38(%rbp), %rcx
movl -0x40(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
cvttsd2si 0x8(%rcx), %rcx
cmpq %rcx, %rax
jne 0x2269f4
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x44(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x54(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
jmp 0x226a7c
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movl -0x48(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movl -0x48(%rbp), %esi
movl -0x44(%rbp), %edx
callq 0x17a150
movl %eax, -0x54(%rbp)
cmpl $-0x1, -0x54(%rbp)
je 0x226a7a
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x48(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x54(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq -0x38(%rbp), %rcx
movl -0x40(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
cvttsd2si 0x8(%rcx), %rcx
cmpq %rcx, %rax
jne 0x226a7a
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl -0x48(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x54(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
jmp 0x226a7c
cmpq $0x0, -0x50(%rbp)
jne 0x226a9b
movq 0x19d556(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x16301b(%rip), %rsi    # 0x389aaf
movb $0x0, %al
callq 0x22a0
movq -0x50(%rbp), %rax
movb $0x4, 0x2(%rax)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x226906
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)