// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/kstring.c
// Function: ksBM_prep
static int *ksBM_prep(const ubyte_t *pat, int m)
{
	int i, *suff, *prep, *bmGs, *bmBc;
	prep = (int*)calloc(m + 256, sizeof(int));
    if (!prep) return NULL;
	bmGs = prep; bmBc = prep + m;
	{ // preBmBc()
		for (i = 0; i < 256; ++i) bmBc[i] = m;
		for (i = 0; i < m - 1; ++i) bmBc[pat[i]] = m - i - 1;
	}
	suff = (int*)calloc(m, sizeof(int));
    if (!suff) { free(prep); return NULL; }
	{ // suffixes()
		int f = 0, g;
		suff[m - 1] = m;
		g = m - 1;
		for (i = m - 2; i >= 0; --i) {
			if (i > g && suff[i + m - 1 - f] < i - g)
				suff[i] = suff[i + m - 1 - f];
			else {
				if (i < g) g = i;
				f = i;
				while (g >= 0 && pat[g] == pat[g + m - 1 - f]) --g;
				suff[i] = f - g;
			}
		}
	}
	{ // preBmGs()
		int j = 0;
		for (i = 0; i < m; ++i) bmGs[i] = m;
		for (i = m - 1; i >= 0; --i)
			if (suff[i] == i + 1)
				for (; j < m - 1 - i; ++j)
					if (bmGs[j] == m)
						bmGs[j] = m - 1 - i;
		for (i = 0; i <= m - 2; ++i)
			bmGs[m - 1 - suff[i]] = m - 1 - i;
	}
	free(suff);
	return prep;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl -0x14(%rbp), %eax
addl $0x100, %eax            # imm = 0x100
movslq %eax, %rdi
movl $0x4, %esi
callq 0x42f0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xbb4c
movq $0x0, -0x8(%rbp)
jmp 0xbdf3
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x18(%rbp)
cmpl $0x100, -0x18(%rbp)     # imm = 0x100
jge 0xbb90
movl -0x14(%rbp), %edx
movq -0x38(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xbb6e
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xbbcb
movl -0x14(%rbp), %edx
subl -0x18(%rbp), %edx
subl $0x1, %edx
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq -0x18(%rbp), %rsi
movzbl (%rcx,%rsi), %ecx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xbb97
movslq -0x14(%rbp), %rdi
movl $0x4, %esi
callq 0x42f0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xbbfa
movq -0x28(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
jmp 0xbdf3
movl $0x0, -0x3c(%rbp)
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x14(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jl 0xbcfa
movl -0x18(%rbp), %eax
cmpl -0x40(%rbp), %eax
jle 0xbc7b
movq -0x20(%rbp), %rax
movl -0x18(%rbp), %ecx
addl -0x14(%rbp), %ecx
subl $0x1, %ecx
subl -0x3c(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl -0x18(%rbp), %ecx
subl -0x40(%rbp), %ecx
cmpl %ecx, %eax
jge 0xbc7b
movq -0x20(%rbp), %rax
movl -0x18(%rbp), %ecx
addl -0x14(%rbp), %ecx
subl $0x1, %ecx
subl -0x3c(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x20(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xbcea
movl -0x18(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0xbc89
movl -0x18(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x3c(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x40(%rbp)
movb %al, -0x45(%rbp)
jl 0xbcc5
movq -0x10(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x10(%rbp), %rcx
movl -0x40(%rbp), %edx
addl -0x14(%rbp), %edx
subl $0x1, %edx
subl -0x3c(%rbp), %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x45(%rbp)
movb -0x45(%rbp), %al
testb $0x1, %al
jne 0xbcce
jmp 0xbcd9
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xbc8f
movl -0x3c(%rbp), %edx
subl -0x40(%rbp), %edx
movq -0x20(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xbcec
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xbc26
movl $0x0, -0x44(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xbd29
movl -0x14(%rbp), %edx
movq -0x30(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xbd08
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jl 0xbd9f
movq -0x20(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0xbd92
jmp 0xbd4f
movl -0x44(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
subl -0x18(%rbp), %ecx
cmpl %ecx, %eax
jge 0xbd90
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x14(%rbp), %eax
jne 0xbd83
movl -0x14(%rbp), %edx
subl $0x1, %edx
subl -0x18(%rbp), %edx
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
jmp 0xbd85
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xbd4f
jmp 0xbd92
jmp 0xbd94
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xbd32
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jg 0xbde2
movl -0x14(%rbp), %edx
subl $0x1, %edx
subl -0x18(%rbp), %edx
movq -0x30(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movq -0x20(%rbp), %rsi
movslq -0x18(%rbp), %rdi
subl (%rsi,%rdi,4), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xbda6
movq -0x20(%rbp), %rdi
callq 0x45a0
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)