// File: /workspace/github_c_makefile_star2_O3/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
pushq %rax
testl %esi, %esi
jle 0xa2d5
movq %rdx, %rbx
movq %rdi, %r14
movl %esi, %r15d
xorl %r12d, %r12d
leaq 0x1e564(%rip), %r13     # 0x2868d
leaq 0x280c0(%rip), %r11     # 0x321f0
xorl %ebp, %ebp
leaq (%r12,%r12,8), %rax
leaq (%rax,%rax,2), %rdi
addq %rbx, %rdi
addq %r12, %rdi
movq 0x10(%r14), %rsi
movb $0x1, %al
xorl %ecx, %ecx
movl (%rdi,%rcx,4), %r8d
movl 0x8(%rdi,%rcx,4), %r9d
movl %r8d, %edx
shrl %edx
shlq $0x6, %rdx
movl (%rsi,%rdx), %edx
andl $0x1, %r8d
movl %edx, %r10d
subl %r9d, %r10d
testl %r8d, %r8d
cmovel %r9d, %r10d
addl %r10d, %r10d
xorl %r8d, %ecx
orl %r10d, %ecx
je 0xa2b0
leal 0x1(,%rdx,2), %edx
cmpl %edx, %ecx
je 0xa2b0
movl $0x1, %ecx
testb $0x1, %al
movl $0x0, %eax
jne 0xa148
movl (%rdi), %edx
movl 0x4(%rdi), %eax
cmpl %eax, %edx
je 0xa28e
movl 0x14(%rdi), %ecx
cmpl 0x10(%rdi), %ecx
jne 0xa28e
movl 0x8(%rdi), %r8d
testl %r8d, %r8d
je 0xa1ce
movl %edx, %ecx
shrl %ecx
shlq $0x6, %rcx
cmpl (%rsi,%rcx), %r8d
jne 0xa28e
movl 0xc(%rdi), %r9d
testl %r9d, %r9d
je 0xa1eb
movl %eax, %ecx
shrl %ecx
shlq $0x6, %rcx
addq %rsi, %rcx
cmpl (%rcx), %r9d
jne 0xa28e
xorl %ecx, %ecx
testl %r9d, %r9d
setne %r9b
xorl %r10d, %r10d
testl %r8d, %r8d
sete %r10b
xorl %edx, %r10d
movq 0x58(%r14), %rdx
movq (%rdx,%r10,8), %r10
movq %r10, %rdx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
andq %r8, %rdx
je 0xa28e
movb %r9b, %cl
xorl %eax, %ecx
movq 0x48(%r14), %rax
shrq $0x20, %r10
shlq $0x5, %r10
leaq (%rax,%r10), %r8
movq %r8, (%rsp)
addq %rax, %r10
addq $0x8, %r10
xorl %r11d, %r11d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
xorl %r13d, %r13d
xorl %r8d, %r8d
cmpl %ecx, (%r10)
sete %r8b
cmovel %r11d, %r9d
addl %r8d, %r13d
incq %r11
addq $0x20, %r10
cmpq %r11, %rdx
jne 0xa243
cmpl $0x1, %r13d
leaq 0x1e422(%rip), %r13     # 0x2868d
leaq 0x27f7e(%rip), %r11     # 0x321f0
jne 0xa28e
movl %r9d, %ecx
shlq $0x5, %rcx
movq (%rsp), %rdx
addq %rcx, %rdx
cmpq %rax, %rdx
leaq 0x1e413(%rip), %rdx     # 0x2869f
jns 0xa2b3
movslq %ebp, %rax
incl %ebp
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rax, %rcx
movups (%rdi), %xmm0
movups 0xc(%rdi), %xmm1
movups %xmm1, 0xc(%rbx,%rcx)
movups %xmm0, (%rbx,%rcx)
jmp 0xa2b9
movq %r13, %rdx
cmpl $0x2, (%r11)
jge 0xa2c7
incq %r12
cmpq %r15, %r12
jne 0xa132
jmp 0xa2d7
callq 0x255a
leaq 0x27f1d(%rip), %r11     # 0x321f0
jmp 0xa2b9
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq