// File: /workspace/github_c_makefile_star2_O2/lh3[P]miniprot/nasw-sse.c
// Function: ns_global_gs16b
void ns_global_gs16b(void *km, const char *ns, int32_t nl, const char *as, int32_t al, const ns_opt_t *opt, const uint8_t *ss, ns_rst_t *r)
{
	typedef int16_t ns_int_t;
	const int32_t ssize = sizeof(ns_int_t), vsize = 16 / ssize;
	const ns_int_t neg_inf = (ns_int_t)(1 << (8*ssize - 1));
	NS_GEN_VAR(epi16)
	NS_GEN_PREPARE(epi16)
	NS_GEN_INIT1(epi16)

	if (tb == 0) {
		int32_t max_sc = INT32_MIN, max_sc_log = INT32_MIN, tmp_sc, tmp_sc_log, end_sc, max_i = -1, pen_len = al * 3;
		for (i = 2; i < nl; ++i) {
			__m128i max;
			NS_GEN_INIT2(epi16)
			max = _mm_set1_epi16(neg_inf);
			for (j = 0; j < slen; ++j) {
				__m128i h, t, u, v;
				// H(i-3,j-1) + s(i,j)
				u = _mm_load_si128(H3 + j - 1);
				v = _mm_load_si128(S + j);
				h = _mm_adds_epi16(u, v);
				// I(i,j) = max{ H(i,j-1) - q, I(i,j-1) } - e
				t = _mm_subs_epi16(last_h, go);
				t = _mm_max_epi16(t, I);
				I = _mm_subs_epi16(t, ge);
				h = _mm_max_epi16(h, I);
				// D(i,j) = max{ H(i-3,j) - q, D(i-3,j) } - e
				u = _mm_load_si128(H3 + j);
				v = _mm_load_si128(D3 + j);
				t = _mm_max_epi16(_mm_subs_epi16(u, go), v);
				t = _mm_subs_epi16(t, gei);
				_mm_store_si128(D + j, t);
				h = _mm_max_epi16(h, t);
				// A(i,j) = max{ H(i-1,j)   - r - d(i-1), A(i-1,j) }
				u = _mm_subs_epi16(_mm_load_si128(H1 + j), io);
				v = _mm_load_si128(A + j);
				t = _mm_subs_epi16(u, dim1);
				t = _mm_max_epi16(t, v);
				_mm_store_si128(A + j, t);
				h = _mm_max_epi16(h, _mm_subs_epi16(t, ai));
				// B(i,j) = max{ H(i-1,j-1) - r - d(i),   B(i-1,j) }
				u = _mm_subs_epi16(_mm_load_si128(H1 + j - 1), io);
				v = _mm_load_si128(B + j);
				t = _mm_subs_epi16(u, di);
				t = _mm_max_epi16(t, v);
				_mm_store_si128(B + j, t);
				h = _mm_max_epi16(h, _mm_subs_epi16(t, aim2));
				// C(i,j) = max{ H(i-1,j-1) - r - d(i+1), C(i-1,j) }
				v = _mm_load_si128(C + j);
				t = _mm_subs_epi16(u, dip1);
				t = _mm_max_epi16(t, v);
				_mm_store_si128(C + j, t);
				h = _mm_max_epi16(h, _mm_subs_epi16(t, aim1));
				// H(i-1,j-1)-f and H(i-2,j-1)-f
				t = _mm_subs_epi16(_mm_load_si128(H1 + j), fs);
				h = _mm_max_epi16(h, t);
				t = _mm_subs_epi16(_mm_load_si128(H2 + j), fs);
				h = _mm_max_epi16(h, t);
				// H(i-1,j)-f and H(i-2,j)-f
				t = _mm_subs_epi16(_mm_load_si128(H1 + j - 1), fs);
				h = _mm_max_epi16(h, t);
				t = _mm_subs_epi16(_mm_load_si128(H2 + j - 1), fs);
				h = _mm_max_epi16(h, t);
				// save H
				max = _mm_max_epi16(max, h);
				_mm_store_si128(H + j, h);
				last_h = h;
			}
			I = _mm_max_epi16(_mm_subs_epi16(last_h, goe), _mm_subs_epi16(I, ge));
			for (k = 0; k < vsize; ++k) { // lazy-F loop
				I = _mm_insert_epi16(_mm_slli_si128(I, sizeof(ns_int_t)), neg_inf, 0);
				for (j = 0; j < slen; ++j) {
					__m128i h;
					h = _mm_load_si128(H + j);
					h = _mm_max_epi16(h, I);
					max = _mm_max_epi16(max, h);
					_mm_store_si128(H + j, h);
					h = _mm_subs_epi16(h, goe);
					I = _mm_subs_epi16(I, ge);
					if (ns_le_epi16(I, h)) break;
				}
				if (j < slen) break;
			}
			tmp_sc = ns_max_8(max);
			end_sc = *((ns_int_t*)&H[(al-1)%slen] + (al-1)/slen) + opt->end_bonus;
			tmp_sc = tmp_sc > end_sc? tmp_sc : end_sc;
			tmp_sc_log = tmp_sc - (i - pen_len < 2? 0 : (int32_t)(opt->ie_coef * ns_log2(i - pen_len) + .5f));
			if (tmp_sc_log > max_sc_log) {
				max_sc = tmp_sc, max_sc_log = tmp_sc_log, max_i = i;
				memcpy(&Hmax[-1], &H[-1], (slen + 1) * 16);
			}
			tmp = H3, H3 = H2, H2 = H1, H1 = H, H = tmp;
			tmp = D3, D3 = D2, D2 = D1, D1 = D, D = tmp;
			if (max_sc_log - tmp_sc_log > opt->xdrop) break;
		}
		if (is_ext) {
			for (j = 0; j < al; ++j) {
				int32_t sc = *((ns_int_t*)&Hmax[j%slen] + j/slen);
				if (j == al - 1) sc += opt->end_bonus;
				if (sc == max_sc) break;
			}
			assert(j < al);
			r->nt_len = max_i + 1, r->aa_len = j + 1, r->score = max_sc;
		}
	} else {
		for (i = 2; i < nl; ++i) {
			__m128i *tbi = tb + i * slen;
			NS_GEN_INIT2(epi16)
			for (j = 0; j < slen; ++j) {
				__m128i h, t, u, v, y, z;
				// H(i-3,j-1) + s(i,j)
				y = _mm_setzero_si128();
				z = _mm_setzero_si128();
				u = _mm_load_si128(H3 + j - 1);
				v = _mm_load_si128(S + j);
				h = _mm_adds_epi16(u, v);
				// I(i,j) = max{ H(i,j-1) - q, I(i,j-1) } - e
				t = _mm_subs_epi16(last_h, go);
				z = _mm_or_si128(z, _mm_and_si128(_mm_cmpgt_epi16(I, t), _mm_set1_epi16(1<<4)));
				t = _mm_max_epi16(t, I);
				I = _mm_subs_epi16(t, ge);
				y = ns_select(_mm_cmpgt_epi16(I, h), _mm_set1_epi16(1), y);
				h = _mm_max_epi16(h, I);
				// D(i,j) = max{ H(i-3,j) - q, D(i-3,j) } - e
				u = _mm_subs_epi16(_mm_load_si128(H3 + j), go);
				v = _mm_load_si128(D3 + j);
				z = _mm_or_si128(z, _mm_and_si128(_mm_cmpgt_epi16(v, u), _mm_set1_epi16(1<<5)));
				t = _mm_max_epi16(u, v);
				t = _mm_subs_epi16(t, gei);
				_mm_store_si128(D + j, t);
				y = ns_select(_mm_cmpgt_epi16(t, h), _mm_set1_epi16(2), y);
				h = _mm_max_epi16(h, t);
				// A(i,j) = max{ H(i-1,j)   - r - d(i-1), A(i-1,j) }
				u = _mm_subs_epi16(_mm_load_si128(H1 + j), io);
				v = _mm_load_si128(A + j);
				t = _mm_subs_epi16(u, dim1);
				z = _mm_or_si128(z, _mm_and_si128(_mm_cmpgt_epi16(v, t), _mm_set1_epi16(1<<6)));
				t = _mm_max_epi16(t, v);
				_mm_store_si128(A + j, t);
				t = _mm_subs_epi16(t, ai);
				y = ns_select(_mm_cmpgt_epi16(t, h), _mm_set1_epi16(3), y);
				h = _mm_max_epi16(h, t);
				// B(i,j) = max{ H(i-1,j-1) - r - d(i),   B(i-1,j) }
				u = _mm_subs_epi16(_mm_load_si128(H1 + j - 1), io);
				v = _mm_load_si128(B + j);
				t = _mm_subs_epi16(u, di);
				z = _mm_or_si128(z, _mm_and_si128(_mm_cmpgt_epi16(v, t), _mm_set1_epi16(1<<7)));
				t = _mm_max_epi16(t, v);
				_mm_store_si128(B + j, t);
				t = _mm_subs_epi16(t, aim2);
				y = ns_select(_mm_cmpgt_epi16(t, h), _mm_set1_epi16(4), y);
				h = _mm_max_epi16(h, t);
				// C(i,j) = max{ H(i-1,j-1) - r - d(i+1), C(i-1,j) }
				v = _mm_load_si128(C + j);
				t = _mm_subs_epi16(u, dip1);
				z = _mm_or_si128(z, _mm_and_si128(_mm_cmpgt_epi16(v, t), _mm_set1_epi16(1<<8)));
				t = _mm_max_epi16(t, v);
				_mm_store_si128(C + j, t);
				t = _mm_subs_epi16(t, aim1);
				y = ns_select(_mm_cmpgt_epi16(t, h), _mm_set1_epi16(5), y);
				h = _mm_max_epi16(h, t);
				// H(i-1,j-1)-f and H(i-2,j-1)-f
				t = _mm_subs_epi16(_mm_load_si128(H1 + j), fs);
				y = ns_select(_mm_cmpgt_epi16(t, h), _mm_set1_epi16(6), y);
				h = _mm_max_epi16(h, t);
				t = _mm_subs_epi16(_mm_load_si128(H2 + j), fs);
				y = ns_select(_mm_cmpgt_epi16(t, h), _mm_set1_epi16(7), y);
				h = _mm_max_epi16(h, t);
				// H(i-1,j)-f and H(i-2,j)-f
				t = _mm_subs_epi16(_mm_load_si128(H1 + j - 1), fs);
				y = ns_select(_mm_cmpgt_epi16(t, h), _mm_set1_epi16(8), y);
				h = _mm_max_epi16(h, t);
				t = _mm_subs_epi16(_mm_load_si128(H2 + j - 1), fs);
				y = ns_select(_mm_cmpgt_epi16(t, h), _mm_set1_epi16(9), y);
				h = _mm_max_epi16(h, t);
				// save H and traceback
				z = _mm_or_si128(z, y);
				_mm_store_si128(tbi + j, z);
				_mm_store_si128(H + j, h);
				last_h = h;
			}
			I = _mm_max_epi16(_mm_subs_epi16(last_h, goe), _mm_subs_epi16(I, ge));
			for (k = 0; k < vsize; ++k) { // lazy-F loop
				I = _mm_insert_epi16(_mm_slli_si128(I, sizeof(ns_int_t)), neg_inf, 0);
				for (j = 0; j < slen; ++j) {
					__m128i h, z;
					z = _mm_load_si128(tbi + j);
					h = _mm_load_si128(H + j);
					z = _mm_or_si128(z, _mm_and_si128(_mm_cmpgt_epi16(I, h), _mm_set1_epi16(1<<9)));
					h = _mm_max_epi16(h, I);
					_mm_store_si128(tbi + j, z);
					_mm_store_si128(H + j, h);
					h = _mm_subs_epi16(h, goe);
					I = _mm_subs_epi16(I, ge);
					if (ns_le_epi16(I, h)) break;
				}
				if (j < slen) break;
			}
			//printf("[%d:%d]\t", i, k); for (j = 0; j < al; ++j) printf("%d\t", *((ns_int_t*)&H[0] + j)); putchar('\n');
			tmp = H3, H3 = H2, H2 = H1, H1 = H, H = tmp;
			tmp = D3, D3 = D2, D2 = D1, D1 = D, D = tmp;
		}
	}
	if (!is_ext) r->score = *((ns_int_t*)&H1[(al-1)%slen] + (al-1)/slen);
	kfree(km, mem_H);
	kfree(km, mem_ap);
	kfree(km, nas);
	if (tb) {
		ns_backtrack(km, vsize, tb, nl, al, &r->cigar, &r->n_cigar, &r->m_cigar);
		kfree(km, mem_tb);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %r9, %rbx
movl %r8d, %r14d
movl %edx, %ebp
movq 0x1c8(%rsp), %r9
movq 0x1c0(%rsp), %r10
movl (%rbx), %r11d
leal 0x7(%r14), %eax
pushq $0x8
popq %r8
cltd
idivl %r8d
movq %rax, 0x10(%rsp)
andq $0x0, 0x130(%rsp)
andl $0x0, (%r9)
movq %rdi, %r13
movl %ebp, 0x8(%r9)
movl %r14d, 0xc(%r9)
movq %r9, 0xb0(%rsp)
movl $0x80000000, 0x10(%r9)  # imm = 0x80000000
leaq 0x128(%rsp), %rax
movl %r11d, 0x2c(%rsp)
testb $0x2, %r11b
movl %ebp, 0x28(%rsp)
leaq 0xd0(%rsp), %r11
leaq 0x138(%rsp), %r15
movl %ebp, %edx
movl %r14d, %r8d
movq %rbx, %r9
jne 0x7be2
pushq %rax
pushq %r11
pushq %r15
pushq %r10
callq 0x8ecc
jmp 0x7bee
pushq %rax
pushq %r11
pushq %r15
pushq %r10
callq 0x8b6c
addq $0x20, %rsp
movq %rax, 0x70(%rsp)
movslq 0x1c(%rbx), %rsi
movslq 0x10(%rsp), %r15
imulq %r15, %rsi
leaq 0x168(%rsp), %rdx
movq %r13, %rdi
callq 0x9184
movq %rax, %r8
movslq 0x1c(%rbx), %rax
leal (,%r15,8), %ecx
movslq %ecx, %rcx
movq %r14, 0x58(%rsp)
movslq %r14d, %rdx
xorl %esi, %esi
testl %r15d, %r15d
movl $0x0, %r12d
cmovgl %r15d, %r12d
testl %eax, %eax
movl $0x0, %edi
cmovgl %eax, %edi
movq %r8, 0x118(%rsp)
movq %rbx, 0x18(%rsp)
cmpq %rdi, %rsi
je 0x7cab
movq %rsi, %r9
imulq %rax, %r9
addq 0x40(%rbx), %r9
xorl %r10d, %r10d
cmpq %r12, %r10
je 0x7ca1
movq 0x138(%rsp), %r11
movq %r10, %rbx
cmpq %rcx, %rbx
jge 0x7c9c
movw $0x8000, %bp            # imm = 0x8000
cmpq %rdx, %rbx
jge 0x7c8f
movzbl (%r11,%rbx), %r14d
movsbl (%r9,%r14), %ebp
movw %bp, (%r8)
addq $0x2, %r8
addq %r15, %rbx
jmp 0x7c77
incq %r10
jmp 0x7c67
incq %rsi
movq 0x18(%rsp), %rbx
jmp 0x7c54
movl 0x4(%rbx), %ecx
movq %rcx, (%rsp)
movl 0x8(%rbx), %eax
movq %rax, 0x88(%rsp)
addl %ecx, %eax
movl %eax, 0xe0(%rsp)
movss 0xc(%rbx), %xmm0
movaps %xmm0, 0x90(%rsp)
movss 0x10(%rbx), %xmm0
movaps %xmm0, 0xf0(%rsp)
movq %r15, %r14
shlq $0x4, %r14
leal 0x1(%r15), %ebp
leal (%rbp,%rbp,4), %eax
imull $0x7, %r15d, %ecx
addl %eax, %ecx
movq %rcx, 0x100(%rsp)
movslq %ecx, %rsi
leaq 0x160(%rsp), %rdx
movq %r13, 0x60(%rsp)
movq %r13, %rdi
callq 0x9184
movq %rax, %r11
leal 0x2(,%r15,2), %eax
movslq %eax, %r13
shlq $0x4, %r13
movq %rbp, 0x30(%rsp)
leal (%rbp,%rbp,2), %eax
movslq %eax, %r9
shlq $0x4, %r9
leal 0x4(,%r15,4), %eax
cltq
shlq $0x4, %rax
movq %rax, 0x8(%rsp)
addq %r11, %rax
movq %rax, 0x158(%rsp)
leaq 0x10(%r14,%rax), %rax
movq %rax, 0x20(%rsp)
leaq (%rax,%r14), %rax
movq %rax, 0x80(%rsp)
leaq (%rax,%r14), %rax
movq %rax, 0x78(%rsp)
leaq (%rax,%r14), %rax
movd (%rsp), %xmm0
movq %rax, (%rsp)
leaq (%rax,%r14), %rax
movd 0x88(%rsp), %xmm1
movq %rax, 0x88(%rsp)
movq %r14, 0x68(%rsp)
addq %rax, %r14
movd 0xe0(%rsp), %xmm2
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
pshuflw $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0,4,5,6,7]
pshuflw $0x0, 0x90(%rsp), %xmm3 # xmm3 = mem[0,0,0,0,4,5,6,7]
pshuflw $0x0, 0xf0(%rsp), %xmm4 # xmm4 = mem[0,0,0,0,4,5,6,7]
testb $0x6, 0x2c(%rsp)
jne 0x7e6e
movl (%rbx), %ecx
movl $0x0, %eax
andl $0x1, %ecx
movq %rbx, %r10
je 0x7e73
movq 0x10(%rsp), %rax
imull 0x28(%rsp), %eax
movslq %eax, %rsi
leaq 0x130(%rsp), %rdx
movq 0x60(%rsp), %rdi
movq %r11, %rbx
movq %r9, %rbp
movdqa %xmm0, 0x90(%rsp)
movdqa %xmm1, 0xf0(%rsp)
movdqa %xmm2, 0xe0(%rsp)
movdqa %xmm3, 0x40(%rsp)
movdqa %xmm4, 0xa0(%rsp)
callq 0x9184
movdqa 0xa0(%rsp), %xmm4
movdqa 0x40(%rsp), %xmm3
movdqa 0xe0(%rsp), %xmm2
movdqa 0xf0(%rsp), %xmm1
movdqa 0x90(%rsp), %xmm0
movq %rbp, %r9
movq %rbx, %r11
movq 0x18(%rsp), %r10
jmp 0x7e73
xorl %eax, %eax
movq %rbx, %r10
leaq 0x10(%r11), %rbx
leaq (%r11,%r13), %rcx
movq %rcx, 0x40(%rsp)
leaq (%r11,%r9), %rsi
movq 0x68(%rsp), %rdi
leaq (%r14,%rdi), %r8
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movdqa %xmm0, 0xf0(%rsp)
pshufd $0x0, %xmm1, %xmm14     # xmm14 = xmm1[0,0,0,0]
pshufd $0x0, %xmm2, %xmm13     # xmm13 = xmm2[0,0,0,0]
pshufd $0x0, %xmm3, %xmm0      # xmm0 = xmm3[0,0,0,0]
movdqa %xmm0, 0xe0(%rsp)
pshufd $0x0, %xmm4, %xmm0      # xmm0 = xmm4[0,0,0,0]
movdqa %xmm0, 0x90(%rsp)
leaq 0x10(%r11,%rdi), %rdx
leaq 0x20(%r11,%rdi), %rbp
leaq 0x10(%r11,%r13), %r13
leaq 0x10(%r11,%r9), %r9
movq 0x8(%rsp), %rcx
leaq (%r11,%rcx), %rdi
addq $0x10, %rdi
movq %rdi, 0x140(%rsp)
movq 0x100(%rsp), %rdi
testl %edi, %edi
movl $0x0, %ecx
cmovlel %ecx, %edi
shlq $0x4, %rdi
movdqa 0xaba5(%rip), %xmm11    # 0x12ab0
cmpq %rcx, %rdi
je 0x7f1c
movdqa %xmm11, (%r11,%rcx)
addq $0x10, %rcx
jmp 0x7f0b
andw $0x0, (%rsi)
xorl %esi, %esi
subw 0x10(%r10), %si
movq %rax, 0x110(%rsp)
xorl %edi, %edi
movq 0x40(%rsp), %rax
movw %si, (%rax)
subw 0x10(%r10), %di
movw %di, (%rdx)
movq 0x110(%rsp), %rax
movslq 0x28(%rsp), %rcx
movq %rcx, 0x120(%rsp)
testq %rax, %rax
movdqa %xmm14, 0x100(%rsp)
movdqa %xmm13, 0x170(%rsp)
je 0x84e6
pushq $0x2
popq %rdx
movq 0xd0(%rsp), %rcx
movq %rcx, 0xc8(%rsp)
movq 0x128(%rsp), %rcx
movq %rcx, 0xc0(%rsp)
movq 0x10(%rsp), %rcx
decl %ecx
movslq %ecx, %rcx
shlq $0x4, %r12
shlq $0x5, %r15
addq %rax, %r15
leaq 0x10(%r12), %rax
shlq $0x4, %rcx
movq %rcx, 0xb8(%rsp)
movq 0x20(%rsp), %rcx
movq (%rsp), %rsi
cmpq 0x120(%rsp), %rdx
jge 0x84cc
movq %r9, %r10
movq %rsi, %r11
movq %rcx, 0x20(%rsp)
movq 0x70(%rsp), %rcx
movzbl (%rcx,%rdx), %edi
movdqa 0x90(%rsp), %xmm13
cmpl $0x14, %edi
je 0x7ffb
movdqa %xmm14, %xmm13
movq 0xc8(%rsp), %rcx
movsbl -0x1(%rcx,%rdx), %esi
movsbl (%rcx,%rdx), %r9d
movl %r9d, 0xa0(%rsp)
movsbl 0x1(%rcx,%rdx), %ecx
movl %ecx, 0x40(%rsp)
movq 0xc0(%rsp), %rcx
movsbl (%rcx,%rdx), %r9d
movl %r9d, (%rsp)
movsbl -0x1(%rcx,%rdx), %r9d
movl %r9d, 0x8(%rsp)
movsbl -0x2(%rcx,%rdx), %ecx
movq %rdx, 0x18(%rsp)
cmpq $0x3, %rdx
jb 0x80a1
movl %ecx, 0x30(%rsp)
movq 0xb8(%rsp), %rcx
movdqa (%r10,%rcx), %xmm0
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movl $0x8000, %edx           # imm = 0x8000
pinsrw $0x0, %edx, %xmm0
movdqa %xmm0, -0x10(%r10)
movdqa (%r13,%rcx), %xmm0
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, %edx, %xmm0
movdqa %xmm0, -0x10(%r13)
movdqa (%rbp,%rcx), %xmm0
movl 0x30(%rsp), %ecx
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, %edx, %xmm0
movdqa %xmm0, -0x10(%rbp)
imull 0x10(%rsp), %edi
movslq %edi, %rdi
shlq $0x4, %rdi
addq 0x118(%rsp), %rdi
movd %esi, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm14     # xmm14 = xmm0[0,0,0,0]
movd 0xa0(%rsp), %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm15     # xmm15 = xmm0[0,0,0,0]
incq 0x18(%rsp)
movd 0x40(%rsp), %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
movd (%rsp), %xmm1
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movd 0x8(%rsp), %xmm2
pshuflw $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
movd %ecx, %xmm3
pshuflw $0x0, %xmm3, %xmm3      # xmm3 = xmm3[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm3, %xmm3      # xmm3 = xmm3[0,0,0,0]
xorl %r9d, %r9d
movdqa %xmm11, %xmm6
movq 0x20(%rsp), %rcx
movq 0x88(%rsp), %rdx
cmpq %r9, %r12
je 0x83f3
movdqa -0x10(%r10,%r9), %xmm7
movdqa (%r10,%r9), %xmm12
paddsw (%rdi,%r9), %xmm7
movdqa 0xf0(%rsp), %xmm8
psubsw %xmm8, %xmm11
movdqa %xmm6, %xmm4
pcmpgtw %xmm11, %xmm4
pand 0xa955(%rip), %xmm4     # 0x12ac0
pmaxsw %xmm6, %xmm11
psubsw 0x100(%rsp), %xmm11
movdqa %xmm11, %xmm5
pcmpgtw %xmm7, %xmm5
pmaxsw %xmm11, %xmm7
psubsw %xmm8, %xmm12
movdqa (%r11,%r9), %xmm9
movdqa %xmm12, %xmm10
pmaxsw %xmm9, %xmm10
psubsw %xmm13, %xmm10
movdqa %xmm10, %xmm6
pcmpgtw %xmm7, %xmm6
movdqa %xmm6, %xmm8
pandn %xmm5, %xmm8
pcmpgtw %xmm12, %xmm9
pand 0xa90d(%rip), %xmm9     # 0x12ad0
por %xmm4, %xmm9
movdqa %xmm10, (%rcx,%r9)
pand 0xa90a(%rip), %xmm6     # 0x12ae0
psrlw $0xf, %xmm8
por %xmm6, %xmm8
pmaxsw %xmm7, %xmm10
movdqa (%rbp,%r9), %xmm4
movdqa 0xe0(%rsp), %xmm12
psubsw %xmm12, %xmm4
psubsw %xmm14, %xmm4
movdqa (%rdx,%r9), %xmm5
movdqa %xmm5, %xmm7
pcmpgtw %xmm4, %xmm7
pand 0xa8d9(%rip), %xmm7     # 0x12af0
por %xmm9, %xmm7
pmaxsw %xmm5, %xmm4
movdqa %xmm4, (%rdx,%r9)
psubsw %xmm1, %xmm4
movdqa %xmm4, %xmm5
pcmpgtw %xmm10, %xmm5
movdqa %xmm5, %xmm6
pandn %xmm8, %xmm6
psrlw $0xe, %xmm5
por %xmm6, %xmm5
pmaxsw %xmm10, %xmm4
movdqa -0x10(%rbp,%r9), %xmm8
psubsw %xmm12, %xmm8
movdqa (%r14,%r9), %xmm9
movdqa %xmm8, %xmm6
psubsw %xmm15, %xmm6
movdqa %xmm9, %xmm10
pcmpgtw %xmm6, %xmm10
pmaxsw %xmm9, %xmm6
movdqa %xmm6, (%r14,%r9)
psubsw %xmm3, %xmm6
movdqa %xmm6, %xmm9
pcmpgtw %xmm4, %xmm9
movdqa %xmm9, %xmm12
pandn %xmm5, %xmm12
pand 0xa864(%rip), %xmm10    # 0x12b00
pand 0xa86b(%rip), %xmm9     # 0x12b10
por %xmm12, %xmm9
pmaxsw %xmm4, %xmm6
movdqa (%r8,%r9), %xmm5
psubsw %xmm0, %xmm8
movdqa %xmm5, %xmm4
pcmpgtw %xmm8, %xmm4
pand 0xa856(%rip), %xmm4     # 0x12b20
por %xmm10, %xmm4
por %xmm7, %xmm4
pmaxsw %xmm5, %xmm8
movdqa %xmm8, (%r8,%r9)
psubsw %xmm2, %xmm8
movdqa %xmm8, %xmm5
pcmpgtw %xmm6, %xmm5
movdqa %xmm5, %xmm7
pandn %xmm9, %xmm7
pand 0xa833(%rip), %xmm5     # 0x12b30
por %xmm7, %xmm5
pmaxsw %xmm6, %xmm8
movdqa (%rbp,%r9), %xmm7
movdqa 0x90(%rsp), %xmm10
psubsw %xmm10, %xmm7
movdqa %xmm7, %xmm6
pcmpgtw %xmm8, %xmm6
movdqa %xmm6, %xmm9
pandn %xmm5, %xmm9
pand 0xa809(%rip), %xmm6     # 0x12b40
por %xmm9, %xmm6
pmaxsw %xmm8, %xmm7
movdqa (%r13,%r9), %xmm5
psubsw %xmm10, %xmm5
movdqa %xmm5, %xmm8
pcmpgtw %xmm7, %xmm8
movdqa %xmm8, %xmm9
pandn %xmm6, %xmm9
movdqa -0x10(%rbp,%r9), %xmm6
psrlw $0xd, %xmm8
por %xmm9, %xmm8
pmaxsw %xmm7, %xmm5
psubsw %xmm10, %xmm6
movdqa %xmm6, %xmm7
pcmpgtw %xmm5, %xmm7
movdqa %xmm7, %xmm9
pandn %xmm8, %xmm9
movdqa -0x10(%r13,%r9), %xmm8
pand 0xa7b3(%rip), %xmm7     # 0x12b50
por %xmm9, %xmm7
pmaxsw %xmm5, %xmm6
psubsw %xmm10, %xmm8
movdqa %xmm8, %xmm5
pcmpgtw %xmm6, %xmm5
movdqa %xmm5, %xmm9
pandn %xmm7, %xmm9
pand 0xa79a(%rip), %xmm5     # 0x12b60
por %xmm9, %xmm5
por %xmm4, %xmm5
pmaxsw %xmm6, %xmm8
movdqa %xmm5, (%r15,%r9)
movdqa %xmm11, %xmm6
movdqa %xmm8, (%rbx,%r9)
addq $0x10, %r9
movdqa %xmm8, %xmm11
jmp 0x812f
movdqa 0x170(%rsp), %xmm2
psubsw %xmm2, %xmm11
movdqa 0x100(%rsp), %xmm14
psubsw %xmm14, %xmm6
pmaxsw %xmm11, %xmm6
xorl %edi, %edi
movdqa 0xa690(%rip), %xmm11    # 0x12ab0
movdqa 0xa748(%rip), %xmm3     # 0x12b70
cmpl $0x8, %edi
je 0x848f
pslldq $0x2, %xmm6             # xmm6 = zero,zero,xmm6[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movl $0x8000, %ecx           # imm = 0x8000
pinsrw $0x0, %ecx, %xmm6
xorl %ecx, %ecx
leaq 0x10(%rcx), %rdx
cmpq %rdx, %rax
je 0x848b
movdqa (%rbx,%rcx), %xmm0
movdqa %xmm6, %xmm1
pcmpgtw %xmm0, %xmm1
pand %xmm3, %xmm1
por (%r15,%rcx), %xmm1
pmaxsw %xmm6, %xmm0
movdqa %xmm1, (%r15,%rcx)
movdqa %xmm0, (%rbx,%rcx)
psubsw %xmm2, %xmm0
psubsw %xmm14, %xmm6
movdqa %xmm6, %xmm1
pcmpgtw %xmm0, %xmm1
pmovmskb %xmm1, %esi
movq %rdx, %rcx
testl %esi, %esi
jne 0x843e
jmp 0x848f
incl %edi
jmp 0x8428
addq 0x68(%rsp), %r15
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rcx
movq %rcx, 0x78(%rsp)
movq 0x20(%rsp), %rcx
movq %rcx, 0x80(%rsp)
movq %r11, %rcx
movq %r13, %r9
movq %rbp, %r13
movq %rbx, %rbp
movq %r10, %rbx
movq 0x18(%rsp), %rdx
jmp 0x7fc5
movq %rbp, %r15
movq 0x58(%rsp), %rbx
movq 0xb0(%rsp), %r14
movq 0x60(%rsp), %r12
jmp 0x8a83
movq 0x58(%rsp), %rcx
imull $-0x3, %ecx, %eax
movq %rax, 0x68(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x128(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0x10(%rsp), %rdx
leal -0x1(%rdx), %eax
movslq %eax, %rsi
leal -0x1(%rcx), %eax
movl %eax, 0xa0(%rsp)
movq 0x30(%rsp), %rax
shll $0x4, %eax
cltq
movq %rax, 0x148(%rsp)
shlq $0x4, %r12
imulq $0x70, %r15, %rax
leal (,%rdx,4), %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rax, %rcx
leaq (%r11,%rcx), %rax
addq $0x50, %rax
movq %rax, 0x30(%rsp)
leaq 0x10(%r12), %rax
movq %rax, 0xb8(%rsp)
movl $0x80000000, 0x8(%rsp)  # imm = 0x80000000
pushq $-0x1
popq %rax
movl %eax, 0x38(%rsp)
pushq $0x2
popq %rdi
shlq $0x4, %rsi
movq %rsi, 0x150(%rsp)
movl $0x80000000, 0x3c(%rsp) # imm = 0x80000000
movq (%rsp), %rsi
cmpq 0x120(%rsp), %rdi
jge 0x89ff
movq %rbx, %r15
movq %r9, %rbx
movq %rsi, (%rsp)
movq 0x70(%rsp), %rax
movzbl (%rax,%rdi), %eax
movdqa 0x90(%rsp), %xmm1
cmpl $0x14, %eax
je 0x85cb
movdqa %xmm14, %xmm1
movq 0xc8(%rsp), %rdx
movsbl -0x1(%rdx,%rdi), %esi
movsbl (%rdx,%rdi), %ecx
movsbl 0x1(%rdx,%rdi), %r10d
movq 0xc0(%rsp), %rdx
movsbl (%rdx,%rdi), %r9d
movsbl -0x1(%rdx,%rdi), %r8d
movsbl -0x2(%rdx,%rdi), %edx
movq %rdi, %r11
cmpq $0x3, %rdi
jb 0x8658
movq 0x150(%rsp), %rdi
movdqa (%rbx,%rdi), %xmm0
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movl %edx, 0x40(%rsp)
movl $0x8000, %edx           # imm = 0x8000
pinsrw $0x0, %edx, %xmm0
movdqa %xmm0, -0x10(%rbx)
movdqa (%r13,%rdi), %xmm0
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, %edx, %xmm0
movdqa %xmm0, -0x10(%r13)
movdqa (%rbp,%rdi), %xmm0
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
pinsrw $0x0, %edx, %xmm0
movl 0x40(%rsp), %edx
movdqa %xmm0, -0x10(%rbp)
imull 0x10(%rsp), %eax
movslq %eax, %rdi
shlq $0x4, %rdi
addq 0x118(%rsp), %rdi
movd %esi, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm3      # xmm3 = xmm0[0,0,0,0]
movd %ecx, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm4      # xmm4 = xmm0[0,0,0,0]
leaq 0x1(%r11), %rax
movq %rax, 0x40(%rsp)
movd %r10d, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm5      # xmm5 = xmm0[0,0,0,0]
movd %r9d, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm6      # xmm6 = xmm0[0,0,0,0]
movd %r8d, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm7      # xmm7 = xmm0[0,0,0,0]
movd %edx, %xmm0
pshuflw $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm0, %xmm8      # xmm8 = xmm0[0,0,0,0]
xorl %edx, %edx
movdqa 0xa3d9(%rip), %xmm0     # 0x12ab0
movdqa %xmm0, %xmm10
movdqa %xmm0, %xmm2
movq 0x18(%rsp), %r10
movl 0xa0(%rsp), %eax
movq 0x30(%rsp), %r8
movq 0xb8(%rsp), %r9
movq (%rsp), %rcx
cmpq %rdx, %r12
je 0x8839
movdqa -0x10(%rbx,%rdx), %xmm9
movdqa (%rbx,%rdx), %xmm11
paddsw (%rdi,%rdx), %xmm9
movdqa 0xf0(%rsp), %xmm12
psubsw %xmm12, %xmm10
pmaxsw %xmm10, %xmm2
psubsw %xmm14, %xmm2
pmaxsw %xmm2, %xmm9
psubsw %xmm12, %xmm11
pmaxsw (%rcx,%rdx), %xmm11
psubsw %xmm1, %xmm11
movq 0x20(%rsp), %rsi
movdqa %xmm11, (%rsi,%rdx)
pmaxsw %xmm9, %xmm11
movdqa (%rbp,%rdx), %xmm10
movdqa 0xe0(%rsp), %xmm12
psubsw %xmm12, %xmm10
psubsw %xmm3, %xmm10
movq 0x88(%rsp), %rsi
pmaxsw (%rsi,%rdx), %xmm10
movdqa %xmm10, (%rsi,%rdx)
psubsw %xmm6, %xmm10
pmaxsw %xmm11, %xmm10
movdqa -0x10(%rbp,%rdx), %xmm9
psubsw %xmm12, %xmm9
movdqa %xmm9, %xmm11
psubsw %xmm4, %xmm11
pmaxsw (%r14,%rdx), %xmm11
movdqa %xmm11, (%r14,%rdx)
psubsw %xmm5, %xmm9
pmaxsw (%r8,%rdx), %xmm9
psubsw %xmm8, %xmm11
movdqa %xmm9, (%r8,%rdx)
psubsw %xmm7, %xmm9
pmaxsw %xmm11, %xmm9
pmaxsw %xmm10, %xmm9
movdqa (%rbp,%rdx), %xmm10
movdqa 0x90(%rsp), %xmm15
psubsw %xmm15, %xmm10
movdqa (%r13,%rdx), %xmm11
psubsw %xmm15, %xmm11
pmaxsw %xmm10, %xmm11
movdqa -0x10(%rbp,%rdx), %xmm12
psubsw %xmm15, %xmm12
pmaxsw %xmm11, %xmm12
movdqa -0x10(%r13,%rdx), %xmm10
psubsw %xmm15, %xmm10
pmaxsw %xmm12, %xmm10
pmaxsw %xmm9, %xmm10
pmaxsw %xmm10, %xmm0
movdqa %xmm10, (%r15,%rdx)
addq $0x10, %rdx
jmp 0x86fd
psubsw %xmm13, %xmm10
psubsw %xmm14, %xmm2
pmaxsw %xmm10, %xmm2
xorl %edi, %edi
cmpl $0x8, %edi
je 0x88a2
pslldq $0x2, %xmm2             # xmm2 = zero,zero,xmm2[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movl $0x8000, %edx           # imm = 0x8000
pinsrw $0x0, %edx, %xmm2
xorl %edx, %edx
leaq 0x10(%rdx), %rsi
cmpq %rsi, %r9
je 0x889e
movdqa (%r15,%rdx), %xmm1
pmaxsw %xmm2, %xmm1
pmaxsw %xmm1, %xmm0
movdqa %xmm1, (%r15,%rdx)
psubsw %xmm13, %xmm1
psubsw %xmm14, %xmm2
movdqa %xmm2, %xmm3
pcmpgtw %xmm1, %xmm3
pmovmskb %xmm3, %r8d
movq %rsi, %rdx
testl %r8d, %r8d
jne 0x8860
jmp 0x88a2
incl %edi
jmp 0x884a
cltd
idivl 0x10(%rsp)
movdqa %xmm0, %xmm1
psrldq $0x8, %xmm1             # xmm1 = xmm1[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero
pmaxsw %xmm0, %xmm1
movdqa %xmm1, %xmm0
psrldq $0x4, %xmm0             # xmm0 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
pmaxsw %xmm1, %xmm0
movdqa %xmm0, %xmm1
psrldq $0x2, %xmm1             # xmm1 = xmm1[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
pmaxsw %xmm0, %xmm1
movd %xmm1, %esi
movslq %edx, %rdx
shlq $0x4, %rdx
addq %r15, %rdx
cltq
movswl (%rdx,%rax,2), %edi
addl 0x18(%r10), %edi
movswl %si, %eax
cmpl %edi, %eax
cmovgl %eax, %edi
movq 0x68(%rsp), %rax
leal (%rax,%r11), %edx
xorl %eax, %eax
cmpl $0x2, %edx
jl 0x8957
cvtsi2ss %edx, %xmm0
movd %xmm0, %eax
movl %eax, %edx
shrl $0x17, %edx
addl $-0x80, %edx
cvtsi2ss %rdx, %xmm0
andl $0x7fffff, %eax         # imm = 0x7FFFFF
orl $0x3f800000, %eax       # imm = 0x3F800000
movd %eax, %xmm1
movdqa %xmm1, %xmm2
mulss 0xa333(%rip), %xmm2     # 0x12c60
addss 0xa32f(%rip), %xmm2     # 0x12c64
mulss %xmm1, %xmm2
addss 0xa327(%rip), %xmm2     # 0x12c68
addss %xmm0, %xmm2
mulss 0x3c(%r10), %xmm2
addss 0xa319(%rip), %xmm2     # 0x12c6c
cvttss2si %xmm2, %eax
movl %edi, %edx
subl %eax, %edx
cmpl 0x8(%rsp), %edx
jle 0x89bb
leaq -0x10(%r15), %rsi
movl %edi, 0x3c(%rsp)
movq 0x158(%rsp), %rdi
movl %edx, 0xdc(%rsp)
movq 0x148(%rsp), %rdx
movq %r11, 0x8(%rsp)
callq 0x21f0
movl 0xdc(%rsp), %edx
movq (%rsp), %rcx
movq 0x18(%rsp), %r10
movdqa 0x170(%rsp), %xmm13
movdqa 0x100(%rsp), %xmm14
movq 0x8(%rsp), %rax
movl %eax, 0x38(%rsp)
movl %edx, 0x8(%rsp)
movl 0x8(%rsp), %eax
subl %edx, %eax
movq 0x40(%rsp), %rdi
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
movq %rdx, 0x78(%rsp)
movq 0x20(%rsp), %rdx
movq %rdx, 0x80(%rsp)
movq %rcx, 0x20(%rsp)
movq %r13, %r9
movq %rbp, %r13
movq %r15, %rbp
cmpl 0x14(%r10), %eax
jle 0x8597
jmp 0x8a02
movq %rbp, %r15
testb $0x6, 0x2c(%rsp)
je 0x8a8f
xorl %ecx, %ecx
movq 0x58(%rsp), %rbx
testl %ebx, %ebx
movl $0x0, %r8d
cmovgl %ebx, %r8d
movq 0xb0(%rsp), %r14
movq 0x60(%rsp), %r12
movq 0x140(%rsp), %rsi
movl 0xa0(%rsp), %edi
movl 0x3c(%rsp), %r9d
cmpl %ecx, %r8d
je 0x8b4d
movl %ecx, %eax
cltd
idivl 0x10(%rsp)
shlq $0x4, %rdx
addq %rsi, %rdx
cltq
movswl (%rdx,%rax,2), %eax
cmpl %ecx, %edi
jne 0x8a66
addl 0x18(%r10), %eax
cmpl %r9d, %eax
je 0x8a6f
incl %ecx
jmp 0x8a41
movl 0x38(%rsp), %eax
incl %eax
movl %eax, 0x8(%r14)
incl %ecx
movl %ecx, 0xc(%r14)
movl %r9d, 0x10(%r14)
testb $0x6, 0x2c(%rsp)
jne 0x8ac1
leal -0x1(%rbx), %eax
jmp 0x8aa8
movq 0x58(%rsp), %rbx
movq 0xb0(%rsp), %r14
movq 0x60(%rsp), %r12
movl 0xa0(%rsp), %eax
cltd
idivl 0x10(%rsp)
movslq %edx, %rcx
shlq $0x4, %rcx
addq %r15, %rcx
cltq
movswl (%rcx,%rax,2), %eax
movl %eax, 0x10(%r14)
movq 0x160(%rsp), %rsi
movq %r12, %rdi
callq 0x736b
movq 0x168(%rsp), %rsi
movq %r12, %rdi
callq 0x736b
movq %r12, %rdi
movq 0x70(%rsp), %rsi
callq 0x736b
movq 0x110(%rsp), %rdx
testq %rdx, %rdx
je 0x8b3b
leaq 0x18(%r14), %r9
leaq 0x4(%r14), %rax
pushq $0x8
popq %rsi
movq %r12, %rdi
movl 0x28(%rsp), %ecx
movl %ebx, %r8d
pushq %rax
pushq %r14
callq 0x91a2
popq %rax
popq %rcx
movq 0x130(%rsp), %rsi
movq %r12, %rdi
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x736b
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa144(%rip), %rdi      # 0x12c98
leaq 0xa144(%rip), %rsi      # 0x12c9f
leaq 0xa148(%rip), %rcx      # 0x12caa
movl $0x1b9, %edx            # imm = 0x1B9
callq 0x2150