// File: /workspace/github_c_makefile_star2_O0/ToniWestbrook[P]paladin/bwt.c
// Function: bwt_seed_strategy1
int bwt_seed_strategy1(const bwt_t *bwt, int len, const uint8_t *q, int x, int min_len, int max_intv, bwtintv_t *mem)
{
	int i, c;
	bwtintv_t ik, ok[VALUE_DOMAIN];

	memset(mem, 0, sizeof(bwtintv_t));
	if (q[x] >= VALUE_DEFINED) return x + 1;
	//if (q[x] > 3) return x + 1;
	bwt_set_intv(bwt, q[x], ik); // the initial interval of a single base
	for (i = x + 1; i < len; ++i) { // forward search
		if (q[i] < VALUE_DEFINED) { // an amino acid
		c = VALUE_DEFINED - 1 - q[i]; // complement of q[i]
		bwt_extend(bwt, &ik, ok, 0);
		if (ok[c].x[2] < max_intv && i - x >= min_len) {
			*mem = ok[c];
			mem->info = (uint64_t)x<<32 | (i + 1);
			return i + 1;
		}
		ik = ok[c];
		} else return i + 1;
	}
	return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x460, %rsp            # imm = 0x460
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq 0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x3130
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x16, %eax
jl 0x15874
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x15a28
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movq 0x8(%rax,%rcx,8), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq 0x8(%rax,%rcx,8), %rax
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rdx
movslq -0x24(%rbp), %rsi
movzbl (%rdx,%rsi), %edx
movslq %edx, %rdx
subq 0x8(%rcx,%rdx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movzbl (%rcx,%rdx), %edx
movl $0x15, %ecx
subl %edx, %ecx
movslq %ecx, %rcx
movq 0x8(%rax,%rcx,8), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x15a22
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x16, %eax
jge 0x15a07
movq -0x20(%rbp), %rax
movslq -0x30(%rbp), %rcx
movzbl (%rax,%rcx), %ecx
movl $0x15, %eax
subl %ecx, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x460(%rbp), %rdx
leaq -0x58(%rbp), %rsi
xorl %ecx, %ecx
callq 0x14930
movslq -0x34(%rbp), %rcx
leaq -0x460(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rbp), %rcx
cmpq %rcx, %rax
jae 0x159d4
movl -0x30(%rbp), %eax
subl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jl 0x159d4
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rdx
leaq -0x460(%rbp), %rcx
shlq $0x5, %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)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movslq -0x24(%rbp), %rcx
shlq $0x20, %rcx
movl -0x30(%rbp), %eax
addl $0x1, %eax
cltq
orq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x15a28
movslq -0x34(%rbp), %rcx
leaq -0x460(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x58(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x50(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x48(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x15a12
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x15a28
jmp 0x15a14
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x15903
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x460, %rsp            # imm = 0x460
popq %rbp
retq
nopw %cs:(%rax,%rax)