// File: /workspace/github_c_makefile_star2_O0/lh3[P]miniprot/nasw-sse.c
// Function: ns_prep_seq
static uint8_t *ns_prep_seq(void *km, const char *ns, int32_t nl, const char *as, int32_t al, const ns_opt_t *opt, const uint8_t *ss, uint8_t **aas_, int8_t **donor_, int8_t **acceptor_)
{
	int32_t i, j;
	uint8_t *nas, *aas;
	int8_t *donor, *acceptor;
	nas = Kmalloc(km, uint8_t, nl + al + (nl + 1) * 2); // nas and aas are allocated together
	*aas_ = aas = nas + nl;
	*donor_ = donor = (int8_t*)aas + al, *acceptor_ = acceptor = donor + nl + 1;
	for (j = 0; j < al; ++j) // generate aas[]
		aas[j] = opt->aa20[(uint8_t)as[j]];
	for (i = 0; i < nl; ++i) // nt4 encoding of ns[] for computing donor[] and acceptor[]
		nas[i] = opt->nt4[(uint8_t)ns[i]];
	for (i = 0; i < nl + 1; ++i)
		donor[i] = acceptor[i] = opt->sp[3];
	for (i = 0; i < nl - 3; ++i) { // generate donor[]
		int32_t t = 3;
		if (nas[i+1] == 2 && nas[i+2] == 3) // GT.
			t = i + 3 < nl && (nas[i+3] == 0 || nas[i+3] == 2)? (nas[i] == 2? -1 : 4) : 0;
		else if (nas[i+1] == 2 && nas[i+2] == 1 && nas[i] == 2) t = 1; // GC.
		else if (nas[i+1] == 0 && nas[i+2] == 3) t = 2; // AT.
		donor[i] = t < 0? 0 : opt->sp[t];
	}
	for (i = 1; i < nl; ++i) { // generate acceptor[]
		int32_t t = 3, penY = 0;
		if (nas[i-1] == 0 && nas[i] == 2) { // .AG
			t = i >= 2 && (nas[i-2] == 1 || nas[i-2] == 3)? -1 : 0;
			for (j = i - 4; j >= 0 && j > i - 7; --j)
				if (nas[j] != 1 && nas[j] != 3) penY += opt->sp[5];
		} else if (nas[i-1] == 0 && nas[i] == 1) t = 2; // .AC
		acceptor[i] = t < 0? 0 : opt->sp[t];
		if (t == -1 || t == 0) acceptor[i] += penY;
	}
	if (ss) { // NB: ss[] uses the offset rule to specify a splice site; donor/acceptor[] uses a different rule. The ss[] way is better but too tricky to change now
		int32_t max_spsc = (opt->io + 1) / 2 - 1;
		for (i = 1; i < nl; ++i) {
			int32_t spsc = (int8_t)(ss[i]>>1) - (int8_t)NS_SPSC_OFFSET;
			if (spsc > max_spsc) spsc = max_spsc; // otherwise two strong signals may create an intron out of nothing
			if (ss[i] == 0xff) { // score not set
				donor[i-1] -= opt->sp_null_bonus;
				acceptor[i-1] -= opt->sp_null_bonus;
			} else if (ss[i]&1) { // acceptor
				acceptor[i-1] -= spsc;
			} else { // donor
				donor[i-1] -= spsc;
			}
		}
	}
	ns_prep_nas(ns, nl, opt, nas);
	return nas;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
addl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
shll %ecx
addl %ecx, %eax
movslq %eax, %rsi
shlq $0x0, %rsi
callq 0xaeb0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movslq -0x14(%rbp), %rax
addq %rax, %rcx
movq %rcx, -0x48(%rbp)
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rcx
movslq -0x24(%rbp), %rax
addq %rax, %rcx
movq %rcx, -0x50(%rbp)
movq 0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movslq -0x14(%rbp), %rax
addq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x58(%rbp)
movq 0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x10e88
movq -0x30(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x20(%rbp), %rcx
movslq -0x38(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movb (%rax,%rcx), %dl
movq -0x48(%rbp), %rax
movslq -0x38(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x10e53
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x10ec4
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rcx
movslq -0x34(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movb (%rax,%rcx), %dl
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x10e8f
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x10f02
movq -0x30(%rbp), %rax
movl 0x2c(%rax), %eax
movb %al, %dl
movq -0x58(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x50(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x10ecb
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jge 0x1106b
movl $0x3, -0x5c(%rbp)
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
jne 0x10fb4
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x3, %eax
jne 0x10fb4
movl -0x34(%rbp), %eax
addl $0x3, %eax
cmpl -0x14(%rbp), %eax
jge 0x10fa5
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x10f84
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
jne 0x10fa5
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %edx
movl $0x4, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x2, %edx
cmovel %ecx, %eax
movl %eax, -0x70(%rbp)
jmp 0x10fac
xorl %eax, %eax
movl %eax, -0x70(%rbp)
jmp 0x10fac
movl -0x70(%rbp), %eax
movl %eax, -0x5c(%rbp)
jmp 0x11031
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
jne 0x10ffa
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
jne 0x10ffa
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
jne 0x10ffa
movl $0x1, -0x5c(%rbp)
jmp 0x1102f
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x1102d
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x3, %eax
jne 0x1102d
movl $0x2, -0x5c(%rbp)
jmp 0x1102f
jmp 0x11031
cmpl $0x0, -0x5c(%rbp)
jge 0x1103e
xorl %eax, %eax
movl %eax, -0x74(%rbp)
jmp 0x1104d
movq -0x30(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movl 0x20(%rax,%rcx,4), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
movb %al, %dl
movq -0x50(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x10f09
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x1120c
movl $0x3, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x11180
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x2, %eax
jne 0x11180
xorl %eax, %eax
cmpl $0x2, -0x34(%rbp)
movb %al, -0x75(%rbp)
jl 0x11101
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %ecx
movb $0x1, %al
cmpl $0x1, %ecx
movb %al, -0x76(%rbp)
je 0x110fb
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x3, %eax
sete %al
movb %al, -0x76(%rbp)
movb -0x76(%rbp), %al
movb %al, -0x75(%rbp)
movb -0x75(%rbp), %dl
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x60(%rbp)
movl -0x34(%rbp), %eax
subl $0x4, %eax
movl %eax, -0x38(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x38(%rbp)
movb %al, -0x77(%rbp)
jl 0x11139
movl -0x38(%rbp), %eax
movl -0x34(%rbp), %ecx
subl $0x7, %ecx
cmpl %ecx, %eax
setg %al
movb %al, -0x77(%rbp)
movb -0x77(%rbp), %al
testb $0x1, %al
jne 0x11142
jmp 0x1117e
movq -0x40(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
je 0x11171
movq -0x40(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x3, %eax
je 0x11171
movq -0x30(%rbp), %rax
movl 0x34(%rax), %eax
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
jmp 0x11173
movl -0x38(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x1111d
jmp 0x111b0
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x111ae
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
jne 0x111ae
movl $0x2, -0x60(%rbp)
jmp 0x111b0
cmpl $0x0, -0x60(%rbp)
jge 0x111bd
xorl %eax, %eax
movl %eax, -0x7c(%rbp)
jmp 0x111cc
movq -0x30(%rbp), %rax
movslq -0x60(%rbp), %rcx
movl 0x20(%rax,%rcx,4), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movb %al, %dl
movq -0x58(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb %dl, (%rax,%rcx)
cmpl $-0x1, -0x60(%rbp)
je 0x111e8
cmpl $0x0, -0x60(%rbp)
jne 0x111fc
movl -0x64(%rbp), %esi
movq -0x58(%rbp), %rax
movslq -0x34(%rbp), %rcx
movsbl (%rax,%rcx), %edx
addl %esi, %edx
movb %dl, (%rax,%rcx)
jmp 0x111fe
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x11072
cmpq $0x0, 0x10(%rbp)
je 0x11312
movq -0x30(%rbp), %rax
movl 0xc(%rax), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
subl $0x1, %eax
movl %eax, -0x68(%rbp)
movl $0x1, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x11310
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
sarl %eax
movsbl %al, %eax
subl $0x40, %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x68(%rbp), %eax
jle 0x11267
movl -0x68(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xff, %eax
jne 0x112b6
movq -0x30(%rbp), %rax
movl 0x38(%rax), %esi
movq -0x50(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %edx
subl %esi, %edx
movb %dl, (%rax,%rcx)
movq -0x30(%rbp), %rax
movl 0x38(%rax), %esi
movq -0x58(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %edx
subl %esi, %edx
movb %dl, (%rax,%rcx)
jmp 0x11300
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x112e5
movl -0x6c(%rbp), %esi
movq -0x58(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %edx
subl %esi, %edx
movb %dl, (%rax,%rcx)
jmp 0x112fe
movl -0x6c(%rbp), %esi
movq -0x50(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %edx
subl %esi, %edx
movb %dl, (%rax,%rcx)
jmp 0x11300
jmp 0x11302
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x11236
jmp 0x11312
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x152a0
movq -0x40(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)