// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/miniwfa.c
// Function: wf_stripe_shrink
static void wf_stripe_shrink(wf_stripe_t *wf, int32_t tl, int32_t ql)
{
	int32_t j, d;
	for (d = wf->lo; d <= wf->hi; ++d) {
		for (j = 0; j < wf->n; ++j) {
			wf_slice_t *p = &wf->a[(wf->top + 1 + j) % wf->n];
			if (d < p->lo || d > p->hi) continue;
			if (good_diag(d, p->H[d], tl, ql)) break;
			if (good_diag(d, p->E1[d], tl, ql) || good_diag(d, p->F1[d], tl, ql)) break;
			if (good_diag(d, p->E2[d], tl, ql) || good_diag(d, p->F2[d], tl, ql)) break;
		}
		if (j < wf->n) break; // stop when we see a "good diagonal" in the stripe
	}
	assert(d <= wf->hi); // should never happen
	wf->lo = d;
	for (d = wf->hi; d >= wf->lo; --d) {
		for (j = 0; j < wf->n; ++j) {
			wf_slice_t *p = &wf->a[(wf->top + 1 + j) % wf->n];
			if (d < p->lo || d > p->hi) continue;
			if (good_diag(d, p->H[d], tl, ql)) break;
			if (good_diag(d, p->E1[d], tl, ql) || good_diag(d, p->F1[d], tl, ql)) break;
			if (good_diag(d, p->E2[d], tl, ql) || good_diag(d, p->F2[d], tl, ql)) break;
		}
		if (j < wf->n) break;
	}
	assert(d >= wf->lo);
	wf->hi = d;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movslq 0x10(%rdi), %r8
movslq 0x14(%rdi), %r9
cmpl %r9d, %r8d
jg 0x1333d
movl %edx, %ecx
movl 0x8(%rdi), %r10d
leal 0x1(%r9), %ebp
testl %r10d, %r10d
jle 0x13331
movq 0x18(%rdi), %r11
movl 0x4(%rdi), %ebx
incl %ebx
xorl %r14d, %r14d
leal (%rbx,%r14), %eax
cltd
idivl %r10d
movslq %edx, %rax
imulq $0x38, %rax, %rax
movslq (%r11,%rax), %rdx
cmpq %rdx, %r8
jl 0x13325
addq %r11, %rax
movslq 0x4(%rax), %rdx
cmpq %rdx, %r8
jg 0x13325
movq 0x10(%rax), %rdx
movl (%rdx,%r8,4), %edx
cmpl $-0x1, %edx
setl %r15b
cmpl %esi, %edx
setge %r12b
orb %r15b, %r12b
jne 0x13268
addl %r8d, %edx
cmpl $-0x1, %edx
setge %r15b
cmpl %ecx, %edx
setl %dl
testb %dl, %r15b
jne 0x1335c
movq 0x18(%rax), %rdx
movl (%rdx,%r8,4), %edx
cmpl $-0x1, %edx
setl %r15b
cmpl %esi, %edx
setge %r12b
orb %r15b, %r12b
jne 0x1329a
addl %r8d, %edx
cmpl $-0x1, %edx
setge %r15b
cmpl %ecx, %edx
setl %dl
testb %dl, %r15b
jne 0x1335c
movq 0x28(%rax), %rdx
movl (%rdx,%r8,4), %edx
cmpl $-0x1, %edx
setl %r15b
cmpl %esi, %edx
setge %r12b
orb %r15b, %r12b
jne 0x132cc
addl %r8d, %edx
cmpl $-0x1, %edx
setge %r15b
cmpl %ecx, %edx
setl %dl
testb %dl, %r15b
jne 0x1335c
movq 0x20(%rax), %rdx
movl (%rdx,%r8,4), %edx
cmpl $-0x1, %edx
setl %r15b
cmpl %esi, %edx
setge %r12b
orb %r15b, %r12b
jne 0x132fa
addl %r8d, %edx
cmpl $-0x1, %edx
setge %r15b
cmpl %ecx, %edx
setl %dl
testb %dl, %r15b
jne 0x1335c
movq 0x30(%rax), %rax
movl (%rax,%r8,4), %eax
cmpl $-0x1, %eax
setl %dl
cmpl %esi, %eax
setge %r15b
orb %dl, %r15b
jne 0x13325
addl %r8d, %eax
cmpl $-0x1, %eax
setge %dl
cmpl %ecx, %eax
setl %al
testb %al, %dl
jne 0x1335c
incl %r14d
cmpl %r14d, %r10d
jne 0x1320a
incq %r8
cmpl %r8d, %ebp
jne 0x131f5
leaq 0x15c16(%rip), %rdi     # 0x28f5a
leaq 0x15a19(%rip), %rsi     # 0x28d64
leaq 0x15ac7(%rip), %rcx     # 0x28e19
movl $0x9d, %edx
callq 0x2160
movl %r8d, 0x10(%rdi)
cmpl %r8d, %r9d
jl 0x134a3
xorl %r14d, %r14d
leal (%rbx,%r14), %eax
cltd
idivl %r10d
movslq %edx, %rax
imulq $0x38, %rax, %rax
movslq (%r11,%rax), %rdx
cmpq %rdx, %r9
jl 0x13487
addq %r11, %rax
movslq 0x4(%rax), %rdx
cmpq %rdx, %r9
jg 0x13487
movq 0x10(%rax), %rdx
movl (%rdx,%r9,4), %edx
cmpl $-0x1, %edx
setl %bpl
cmpl %esi, %edx
setge %r15b
orb %bpl, %r15b
jne 0x133ca
addl %r9d, %edx
cmpl $-0x1, %edx
setge %bpl
cmpl %ecx, %edx
setl %dl
testb %dl, %bpl
jne 0x134c2
movq 0x18(%rax), %rdx
movl (%rdx,%r9,4), %edx
cmpl $-0x1, %edx
setl %bpl
cmpl %esi, %edx
setge %r15b
orb %bpl, %r15b
jne 0x133fc
addl %r9d, %edx
cmpl $-0x1, %edx
setge %bpl
cmpl %ecx, %edx
setl %dl
testb %dl, %bpl
jne 0x134c2
movq 0x28(%rax), %rdx
movl (%rdx,%r9,4), %edx
cmpl $-0x1, %edx
setl %bpl
cmpl %esi, %edx
setge %r15b
orb %bpl, %r15b
jne 0x1342e
addl %r9d, %edx
cmpl $-0x1, %edx
setge %bpl
cmpl %ecx, %edx
setl %dl
testb %dl, %bpl
jne 0x134c2
movq 0x20(%rax), %rdx
movl (%rdx,%r9,4), %edx
cmpl $-0x1, %edx
setl %bpl
cmpl %esi, %edx
setge %r15b
orb %bpl, %r15b
jne 0x1345c
addl %r9d, %edx
cmpl $-0x1, %edx
setge %bpl
cmpl %ecx, %edx
setl %dl
testb %dl, %bpl
jne 0x134c2
movq 0x30(%rax), %rax
movl (%rax,%r9,4), %eax
cmpl $-0x1, %eax
setl %dl
cmpl %esi, %eax
setge %bpl
orb %dl, %bpl
jne 0x13487
addl %r9d, %eax
cmpl $-0x1, %eax
setge %dl
cmpl %ecx, %eax
setl %al
testb %al, %dl
jne 0x134c2
incl %r14d
cmpl %r14d, %r10d
jne 0x1336c
leaq -0x1(%r9), %rax
cmpq %r8, %r9
movq %rax, %r9
jg 0x13369
leaq 0x159a6(%rip), %rdi     # 0x28e50
leaq 0x158b3(%rip), %rsi     # 0x28d64
leaq 0x15961(%rip), %rcx     # 0x28e19
movl $0xa9, %edx
callq 0x2160
movl %r9d, 0x14(%rdi)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq