// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movq %rdx, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xcf02
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x30(%rbp)
cmpl $0x2, -0x30(%rbp)
jge 0xcdaf
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
movslq -0x30(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl (%rax,%rcx,4), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xcd5e
movl -0x44(%rbp), %eax
movq -0x40(%rbp), %rcx
movslq -0x30(%rbp), %rdx
subl 0x8(%rcx,%rdx,4), %eax
movl %eax, -0x4c(%rbp)
jmp 0xcd6d
movq -0x40(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl 0x8(%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
shll %eax
movq -0x40(%rbp), %rcx
movslq -0x30(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
andl $0x1, %ecx
xorl -0x30(%rbp), %ecx
orl %ecx, %eax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
je 0xcd9d
movl -0x48(%rbp), %eax
movl -0x44(%rbp), %ecx
shll %ecx
orl $0x1, %ecx
cmpl %ecx, %eax
jne 0xcd9f
jmp 0xcdaf
jmp 0xcda1
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xcd0a
cmpl $0x2, -0x30(%rbp)
jne 0xcdcb
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xcf10
cmpl $0x0, %eax
je 0xceb0
leaq 0x3840e(%rip), %rax     # 0x451e0
cmpl $0x2, (%rax)
jl 0xceae
movq 0x38216(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
movl -0x30(%rbp), %edx
leaq 0x2f892(%rip), %rcx     # 0x3c681
leaq 0x2f879(%rip), %rax     # 0x3c66f
cmpl $0x2, %edx
cmovneq %rax, %rcx
movq -0x40(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x2f87b(%rip), %rax     # 0x3c68c
movsbl (%rax,%rdx), %r8d
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rdx
movl (%rdx), %edx
shrl %edx
movl %edx, %edx
shlq $0x6, %rdx
addq %rdx, %rax
movq 0x18(%rax), %r9
movq -0x40(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x2f844(%rip), %rax     # 0x3c68c
movsbl (%rax,%rdx), %r14d
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rdx
movl 0x4(%rdx), %edx
shrl %edx
movl %edx, %edx
shlq $0x6, %rdx
addq %rdx, %rax
movq 0x18(%rax), %rbx
movq -0x40(%rbp), %rax
movl 0x18(%rax), %r11d
movq -0x40(%rbp), %rax
movl 0x10(%rax), %r10d
movq -0x40(%rbp), %rax
movl 0x14(%rax), %eax
leaq 0x2f78f(%rip), %rsi     # 0x3c618
leaq 0x2f7d0(%rip), %rdx     # 0x3c660
movl %r14d, (%rsp)
movq %rbx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x0, %al
callq 0x2210
jmp 0xcef4
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x34(%rbp)
movslq %ecx, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq -0x28(%rbp), %rcx
movslq -0x2c(%rbp), %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xcce4
movl -0x34(%rbp), %eax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop