// File: /workspace/github_c_makefile_star2_O0/lh3[P]minigraph/gfa-aug.c
// Function: gfa_ins_shrink_semi
static int32_t gfa_ins_shrink_semi(const gfa_t *g, int32_t pen, uint32_t v, int32_t voff, int32_t coff, uint32_t vv, int32_t vend, int32_t cend, const char *seq)
{
	int32_t i, j, l, dir, score, max, max_l;
	if (cend == coff) return 0;
	dir = cend > coff? +1 : -1;
	for (i = coff, j = voff, l = max_l = 0, score = max = 0; i != cend; i += dir, j += dir) {
		int32_t cg, vlen = g->seg[v>>1].len;
		if (j == vlen || j == -1) break;
		if (vv == v && j == vend) break;
		++l;
		cg = (v&1) == 0? g->seg[v>>1].seq[j] : gfa_comp_table[(uint8_t)g->seg[v>>1].seq[vlen - 1 - j]];
		score += tolower(cg) == tolower(seq[i])? +1 : -pen;
		if (score > max) max = score, max_l = l;
		if (score < max - pen * pen) break; // X-drop
	}
	return max_l;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x20(%rbp), %rax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movl 0x18(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0xcb1b
movl $0x0, -0x4(%rbp)
jmp 0xccad
movl 0x18(%rbp), %edx
movl -0x20(%rbp), %esi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpl %esi, %edx
cmovgl %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x28(%rbp), %eax
cmpl 0x18(%rbp), %eax
je 0xcca7
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x18(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x48(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x48(%rbp), %eax
je 0xcb90
cmpl $-0x1, -0x2c(%rbp)
jne 0xcb95
jmp 0xcca7
movl -0x24(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0xcbaa
movl -0x2c(%rbp), %eax
cmpl 0x10(%rbp), %eax
jne 0xcbaa
jmp 0xcca7
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x18(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xcbe5
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x18(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movslq -0x2c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x4c(%rbp)
jmp 0xcc1f
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x18(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movl -0x48(%rbp), %ecx
subl $0x1, %ecx
subl -0x2c(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x385d8(%rip), %rax     # 0x451f0
movzbl (%rax,%rcx), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %edi
callq 0x2250
movl %eax, -0x50(%rbp)
movq 0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %edi
callq 0x2250
movl %eax, %ecx
movl -0x50(%rbp), %eax
cmpl %ecx, %eax
jne 0xcc54
movl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xcc5c
xorl %eax, %eax
subl -0x14(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jle 0xcc79
movl -0x38(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x38(%rbp), %eax
movl -0x3c(%rbp), %ecx
movl -0x14(%rbp), %edx
imull -0x14(%rbp), %edx
subl %edx, %ecx
cmpl %ecx, %eax
jge 0xcc8e
jmp 0xcca7
jmp 0xcc90
movl -0x34(%rbp), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x34(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0xcb5b
movl -0x40(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)