// File: /workspace/github_c_makefile_star2_O1/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
testl %esi, %esi
jle 0x9f01
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x10(%rdi), %rax
movq %rax, 0x10(%rsp)
movl %esi, %r12d
leaq 0x8(%rdx), %r13
xorl %r15d, %r15d
leaq 0x284ae(%rip), %r11     # 0x321f0
xorl %ebp, %ebp
movq %r12, 0x18(%rsp)
leaq (%r15,%r15,8), %rax
leaq (%rax,%rax,2), %rsi
addq %rbx, %rsi
addq %r15, %rsi
movq 0x10(%r14), %rcx
xorl %eax, %eax
movl -0x8(%r13,%rax,4), %edx
movl %edx, %edi
shrl %edi
shlq $0x6, %rdi
movl (%rcx,%rdi), %edi
andl $0x1, %edx
jne 0x9d79
movl (%r13,%rax,4), %r8d
jmp 0x9d81
movl %edi, %r8d
subl (%r13,%rax,4), %r8d
addl %r8d, %r8d
xorl %eax, %edx
addl %r8d, %edx
je 0x9da4
leal 0x1(,%rdi,2), %edi
cmpl %edi, %edx
je 0x9da4
incq %rax
cmpq $0x1, %rax
je 0x9d5d
movl $0x2, %eax
cmpl $0x2, %eax
jne 0x9ead
movl (%rsi), %ecx
movl 0x4(%rsi), %edx
cmpl %edx, %ecx
je 0x9ecf
movl 0x14(%rsi), %edi
cmpl 0x10(%rsi), %edi
jne 0x9ecf
movq 0x10(%r14), %r8
movl 0x8(%rsi), %edi
testl %edi, %edi
je 0x9de5
movl %ecx, %r9d
shrl %r9d
shlq $0x6, %r9
cmpl (%r8,%r9), %edi
jne 0x9ecf
movl 0xc(%rsi), %r9d
testl %r9d, %r9d
je 0x9e04
movl %edx, %r10d
shrl %r10d
shlq $0x6, %r10
addq %r10, %r8
cmpl (%r8), %r9d
jne 0x9ecf
xorl %r8d, %r8d
testl %r9d, %r9d
setne 0xf(%rsp)
xorl %r9d, %r9d
testl %edi, %edi
sete %r9b
xorl %ecx, %r9d
movq 0x48(%r14), %r11
movq 0x58(%r14), %rcx
movq (%rcx,%r9,8), %r9
movq %r9, %rdi
shrq $0x20, %rdi
shlq $0x5, %rdi
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
andq %r10, %r9
movq %r11, 0x20(%rsp)
je 0x9e8c
movb 0xf(%rsp), %cl
movb %cl, %r8b
xorl %edx, %r8d
leaq (%r11,%rdi), %rdx
addq $0x8, %rdx
xorl %r11d, %r11d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
xorl %ecx, %ecx
xorl %r12d, %r12d
cmpl %r8d, (%rdx)
sete %r12b
cmovel %r11d, %r10d
addl %r12d, %ecx
incq %r11
addq $0x20, %rdx
cmpq %r11, %r9
jne 0x9e5f
movl %r10d, %r10d
cmpl $0x1, %ecx
setne %cl
movq 0x18(%rsp), %r12
jmp 0x9e8e
movb $0x1, %cl
testb %cl, %cl
leaq 0x28359(%rip), %r11     # 0x321f0
movq 0x20(%rsp), %rcx
jne 0x9ecf
addq %rcx, %rdi
shlq $0x5, %r10
addq %rdi, %r10
subq %rcx, %r10
js 0x9ecf
cmpl $0x2, (%r11)
jl 0x9eef
xorl %edi, %edi
cmpl $0x2, %eax
sete %dil
movq 0x10(%rsp), %rdx
callq 0x25a7
leaq 0x28323(%rip), %r11     # 0x321f0
jmp 0x9eef
movslq %ebp, %rax
incl %ebp
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rax, %rcx
movups (%rsi), %xmm0
movups 0xc(%rsi), %xmm1
movups %xmm1, 0xc(%rbx,%rcx)
movups %xmm0, (%rbx,%rcx)
incq %r15
addq $0x1c, %r13
cmpq %r12, %r15
jne 0x9d49
jmp 0x9f03
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq