// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/gfa-ed.c
// Function: gwf_prune
static int32_t gwf_prune(int32_t n_a, gwf_diag_t *a, uint32_t max_lag, int32_t bw_dyn)
{
	int32_t i, j, iq, dq, max_i = -1;
	uint32_t max_x = 0;
	gwf_diag_t *q;
	for (i = 0; i < n_a; ++i)
		if (a[i].xo>>1 > max_x)
			max_x = a[i].xo>>1, max_i = i;
	q = &a[max_i];
	iq = (int32_t)q->vd - GWF_DIAG_SHIFT + q->k;
	dq = (int32_t)(q->xo>>1) - iq - iq;
	for (i = j = 0; i < n_a; ++i) {
		gwf_diag_t *p = &a[i];
		int32_t ip = (int32_t)p->vd - GWF_DIAG_SHIFT + p->k;
		int32_t dp = (int32_t)(p->xo>>1) - ip - ip;
		int32_t w = dp > dq? dp - dq : dq - dp;
		if (bw_dyn >= 0 && w > bw_dyn) continue;
		if ((p->xo>>1) + max_lag < max_x) continue;
		a[j++] = *p;
	}
	return j;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x30(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x138f1
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
shrl %eax
cmpl -0x30(%rbp), %eax
jbe 0x138e4
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
shrl %eax
movl %eax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x138e6
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x138a6
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
subl $0x40000000, %eax       # imm = 0x40000000
movq -0x38(%rbp), %rcx
addl 0x8(%rcx), %eax
movl %eax, -0x24(%rbp)
movq -0x38(%rbp), %rax
movl 0x10(%rax), %eax
shrl %eax
subl -0x24(%rbp), %eax
subl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x13a07
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
subl $0x40000000, %eax       # imm = 0x40000000
movq -0x40(%rbp), %rcx
addl 0x8(%rcx), %eax
movl %eax, -0x44(%rbp)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
shrl %eax
subl -0x44(%rbp), %eax
subl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x28(%rbp), %eax
jle 0x13994
movl -0x48(%rbp), %eax
subl -0x28(%rbp), %eax
movl %eax, -0x50(%rbp)
jmp 0x1399d
movl -0x28(%rbp), %eax
subl -0x48(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x18(%rbp)
jl 0x139b3
movl -0x4c(%rbp), %eax
cmpl -0x18(%rbp), %eax
jle 0x139b3
jmp 0x139f9
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
shrl %eax
addl -0x14(%rbp), %eax
cmpl -0x30(%rbp), %eax
jae 0x139c6
jmp 0x139f9
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x20(%rbp)
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq -0x40(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1393a
movl -0x20(%rbp), %eax
popq %rbp
retq
nopl (%rax)