// File: /workspace/github_c_makefile_star2_O2/lh3[P]minigraph/gfa-aug.c
// Function: gfa_ins_filter
int32_t gfa_ins_filter(const gfa_t *g, int32_t n_ins, gfa_ins_t *ins) // filter out impossible inserts
{
	int32_t i, k, n;
	for (i = 0, n = 0; i < n_ins; ++i) {
		gfa_ins_t *p = &ins[i];
		for (k = 0; k < 2; ++k) {
			uint32_t vlen = g->seg[p->v[k]>>1].len;
			uint32_t side = (p->v[k]&1? vlen - p->voff[k] : p->voff[k]) << 1 | ((p->v[k]&1) ^ k);
			if (side == (0<<1|0) || side == (vlen<<1|1))
				break;
		}
		if (k != 2 || check_multi(g, p)) { // multi-link may happen due to inconsistency between graph chaining and WFA alignment 
			if (gfa_verbose >= 2)
				fprintf(stderr, "[W::%s] %s between %c%s and %c%s derived from the %d-th query at %d-%d\n",
						__func__, k != 2? "impossible insert" : "multi-link",
						"><"[p->v[0]&1], g->seg[p->v[0]>>1].name, "><"[p->v[1]&1], g->seg[p->v[1]>>1].name, p->ctg, p->coff[0], p->coff[1]);
			continue;
		}
		ins[n++] = ins[i];
	}
	return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movl %esi, %r14d
xorl %eax, %eax
testl %esi, %esi
cmovlel %eax, %r14d
movq %rdi, %r15
leaq 0x8(%rdx), %r12
leaq 0x261b3(%rip), %r11     # 0x2e1f0
xorl %r13d, %r13d
xorl %ebp, %ebp
cmpq %r14, %r13
je 0x8259
imulq $0x1c, %r13, %rax
addq %rbx, %rax
movq 0x10(%r15), %r10
xorl %ecx, %ecx
cmpq $0x2, %rcx
je 0x8152
movl -0x8(%r12,%rcx,4), %edi
movl (%r12,%rcx,4), %esi
movl %edi, %edx
shrl %edx
shlq $0x6, %rdx
movl (%r10,%rdx), %edx
andl $0x1, %edi
movl %edx, %r8d
subl %esi, %r8d
testl %edi, %edi
cmovel %esi, %r8d
addl %r8d, %r8d
movl %ecx, %esi
xorl %edi, %esi
orl %r8d, %esi
je 0x80a0
incq %rcx
leal 0x1(,%rdx,2), %edx
cmpl %edx, %esi
jne 0x8058
leaq 0x1b5ef(%rip), %rcx     # 0x23696
cmpl $0x2, (%r11)
jl 0x824d
movq 0x25f40(%rip), %rdx     # 0x2dff8
movq (%rdx), %rdx
movq %rdx, 0x8(%rsp)
movl (%rax), %edx
movl 0x4(%rax), %r11d
movl %edx, %esi
andl $0x1, %esi
leaq 0x1b5e1(%rip), %rdi     # 0x236b3
movsbl (%rsi,%rdi), %r8d
shrl %edx
shlq $0x6, %rdx
movq 0x18(%r10,%rdx), %r9
movl %r11d, %edx
andl $0x1, %edx
movsbl (%rdx,%rdi), %edx
movq %rdx, (%rsp)
shrl %r11d
shlq $0x6, %r11
movl 0x18(%rax), %edx
movq %rdx, 0x20(%rsp)
movl 0x10(%rax), %edx
movq %rdx, 0x18(%rsp)
movl 0x14(%rax), %eax
movq %rax, 0x10(%rsp)
subq $0x8, %rsp
movq 0x10(%rsp), %rdi
leaq 0x1b520(%rip), %rsi     # 0x2363f
leaq 0x1b561(%rip), %rdx     # 0x23687
xorl %eax, %eax
pushq 0x18(%rsp)
pushq 0x28(%rsp)
pushq 0x38(%rsp)
pushq 0x18(%r10,%r11)
pushq 0x28(%rsp)
callq 0x2210
leaq 0x260a7(%rip), %r11     # 0x2e1f0
addq $0x30, %rsp
jmp 0x824d
movl (%rax), %esi
movl 0x4(%rax), %edx
cmpl %edx, %esi
je 0x8234
movl 0x14(%rax), %ecx
cmpl 0x10(%rax), %ecx
jne 0x8234
movl 0x8(%rax), %edi
testl %edi, %edi
je 0x8184
movl %esi, %ecx
shrl %ecx
shlq $0x6, %rcx
cmpl (%r10,%rcx), %edi
jne 0x8234
movl 0xc(%rax), %r8d
testl %r8d, %r8d
je 0x81a1
movl %edx, %ecx
shrl %ecx
shlq $0x6, %rcx
addq %r10, %rcx
cmpl (%rcx), %r8d
jne 0x8234
xorl %ecx, %ecx
testl %r8d, %r8d
setne %cl
xorl %r8d, %r8d
testl %edi, %edi
sete %r8b
xorl %esi, %r8d
xorl %edx, %ecx
movq 0x48(%r15), %rsi
movq 0x58(%r15), %rdx
movq (%rdx,%r8,8), %rdx
movl %edx, %edi
shrq $0x1b, %rdx
andq $-0x20, %rdx
leaq (%rsi,%rdx), %r8
movq %r8, (%rsp)
movq %rsi, 0x8(%rsp)
leaq (%rsi,%rdx), %r8
addq $0x8, %r8
xorl %r11d, %r11d
xorl %edx, %edx
pushq $-0x1
popq %r9
cmpq %r11, %rdi
je 0x8208
xorl %esi, %esi
cmpl %ecx, (%r8)
cmovel %r11d, %r9d
sete %sil
addl %esi, %edx
incq %r11
addq $0x20, %r8
jmp 0x81eb
cmpl $0x1, %edx
leaq 0x25fde(%rip), %r11     # 0x2e1f0
jne 0x8234
movl %r9d, %ecx
shlq $0x5, %rcx
movq (%rsp), %rdx
addq %rcx, %rdx
subq 0x8(%rsp), %rdx
leaq 0x1b47a(%rip), %rcx     # 0x236a8
jns 0x80a7
movslq %ebp, %rcx
incl %ebp
imulq $0x1c, %rcx, %rcx
movups (%rax), %xmm0
movups 0xc(%rax), %xmm1
movups %xmm1, 0xc(%rbx,%rcx)
movups %xmm0, (%rbx,%rcx)
incq %r13
addq $0x1c, %r12
jmp 0x8042
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq