// File: /workspace/github_c_makefile_star2_O0/ToniWestbrook[P]paladin/ksw.c
// Function: ksw_i16
kswr_t ksw_i16(kswq_t *q, int tlen, const uint8_t *target, int _o_del, int _e_del, int _o_ins, int _e_ins, int xtra) // the first gap costs -(_o+_e)
{
	int slen, i, m_b, n_b, te = -1, gmax = 0, minsc, endsc;
	uint64_t *b;
	__m128i zero, oe_del, e_del, oe_ins, e_ins, *H0, *H1, *E, *Hmax;
	kswr_t r;

#define __max_8(ret, xx) do { \
		(xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 8)); \
		(xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 4)); \
		(xx) = _mm_max_epi16((xx), _mm_srli_si128((xx), 2)); \
    	(ret) = _mm_extract_epi16((xx), 0); \
	} while (0)

	// initialization
	r = g_defr;
	minsc = (xtra&KSW_XSUBO)? xtra&0xffff : 0x10000;
	endsc = (xtra&KSW_XSTOP)? xtra&0xffff : 0x10000;
	m_b = n_b = 0; b = 0;
	zero = _mm_set1_epi32(0);
	oe_del = _mm_set1_epi16(_o_del + _e_del);
	e_del = _mm_set1_epi16(_e_del);
	oe_ins = _mm_set1_epi16(_o_ins + _e_ins);
	e_ins = _mm_set1_epi16(_e_ins);
	H0 = q->H0; H1 = q->H1; E = q->E; Hmax = q->Hmax;
	slen = q->slen;
	for (i = 0; i < slen; ++i) {
		_mm_store_si128(E + i, zero);
		_mm_store_si128(H0 + i, zero);
		_mm_store_si128(Hmax + i, zero);
	}
	// the core loop
	for (i = 0; i < tlen; ++i) {
		int j, k, imax;
		__m128i e, t, h, f = zero, max = zero, *S = q->qp + target[i] * slen; // s is the 1st score vector
		h = _mm_load_si128(H0 + slen - 1); // h={2,5,8,11,14,17,-1,-1} in the above example
		h = _mm_slli_si128(h, 2);
		for (j = 0; LIKELY(j < slen); ++j) {
			h = _mm_adds_epi16(h, *S++);
			e = _mm_load_si128(E + j);
			h = _mm_max_epi16(h, e);
			h = _mm_max_epi16(h, f);
			max = _mm_max_epi16(max, h);
			_mm_store_si128(H1 + j, h);
			e = _mm_subs_epu16(e, e_del);
			t = _mm_subs_epu16(h, oe_del);
			e = _mm_max_epi16(e, t);
			_mm_store_si128(E + j, e);
			f = _mm_subs_epu16(f, e_ins);
			t = _mm_subs_epu16(h, oe_ins);
			f = _mm_max_epi16(f, t);
			h = _mm_load_si128(H0 + j);
		}
		for (k = 0; LIKELY(k < 16); ++k) {
			f = _mm_slli_si128(f, 2);
			for (j = 0; LIKELY(j < slen); ++j) {
				h = _mm_load_si128(H1 + j);
				h = _mm_max_epi16(h, f);
				_mm_store_si128(H1 + j, h);
				h = _mm_subs_epu16(h, oe_ins);
				f = _mm_subs_epu16(f, e_ins);
				if(UNLIKELY(!_mm_movemask_epi8(_mm_cmpgt_epi16(f, h)))) goto end_loop8;
			}
		}
end_loop8:
		__max_8(imax, max);
		if (imax >= minsc) {
			if (n_b == 0 || (int32_t)b[n_b-1] + 1 != i) {
				if (n_b == m_b) {
					m_b = m_b? m_b<<1 : 8;
					b = (uint64_t*)realloc(b, 8 * m_b);
				}
				b[n_b++] = (uint64_t)imax<<32 | i;
			} else if ((int)(b[n_b-1]>>32) < imax) b[n_b-1] = (uint64_t)imax<<32 | i; // modify the last
		}
		if (imax > gmax) {
			gmax = imax; te = i;
			for (j = 0; LIKELY(j < slen); ++j)
				_mm_store_si128(Hmax + j, _mm_load_si128(H1 + j));
			if (gmax >= endsc) break;
		}
		S = H1; H1 = H0; H0 = S;
	}
	r.score = gmax; r.te = te;
	{
		int max = -1, tmp, low, high, qlen = slen * 8;
		uint16_t *t = (uint16_t*)Hmax;
		for (i = 0, r.qe = -1; i < qlen; ++i, ++t)
			if ((int)*t > max) max = *t, r.qe = i / 8 + i % 8 * slen;
			else if ((int)*t == max && (tmp = i / 8 + i % 8 * slen) < r.qe) r.qe = tmp; 
		if (b) {
			i = (r.score + q->max - 1) / q->max;
			low = te - i; high = te + i;
			for (i = 0; i < n_b; ++i) {
				int e = (int32_t)b[i];
				if ((e < low || e > high) && (int)(b[i]>>32) > r.score2)
					r.score2 = b[i]>>32, r.te2 = e;
			}
		}
	}
	free(b);
	return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x560, %rsp            # imm = 0x560
movq %rdi, -0x540(%rbp)
movq %rdi, %rax
movq %rax, -0x538(%rbp)
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rsi, -0x3f0(%rbp)
movl %edx, -0x3f4(%rbp)
movq %rcx, -0x400(%rbp)
movl %r8d, -0x404(%rbp)
movl %r9d, -0x408(%rbp)
movl $0xffffffff, -0x41c(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x420(%rbp)
movq 0x7cfa(%rip), %rax      # 0x3b4dc
movq %rax, (%rdi)
movq 0x7cf8(%rip), %rax      # 0x3b4e4
movq %rax, 0x8(%rdi)
movq 0x7cf5(%rip), %rax      # 0x3b4ec
movq %rax, 0x10(%rdi)
movl 0x7cf3(%rip), %eax      # 0x3b4f4
movl %eax, 0x18(%rdi)
movl 0x20(%rbp), %eax
andl $0x40000, %eax          # imm = 0x40000
cmpl $0x0, %eax
je 0x33821
movl 0x20(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x544(%rbp)
jmp 0x3382e
movl $0x10000, %eax          # imm = 0x10000
movl %eax, -0x544(%rbp)
jmp 0x3382e
movl -0x544(%rbp), %eax
movl %eax, -0x424(%rbp)
movl 0x20(%rbp), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
je 0x33857
movl 0x20(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x548(%rbp)
jmp 0x33864
movl $0x10000, %eax          # imm = 0x10000
movl %eax, -0x548(%rbp)
jmp 0x33864
movl -0x548(%rbp), %eax
movl %eax, -0x428(%rbp)
movl $0x0, -0x418(%rbp)
movl $0x0, -0x414(%rbp)
movq $0x0, -0x430(%rbp)
movl $0x0, -0x3e4(%rbp)
movl -0x3e4(%rbp), %eax
movl %eax, -0x84(%rbp)
movl %eax, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
movl %eax, -0x90(%rbp)
movd -0x84(%rbp), %xmm0
movd -0x88(%rbp), %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movd -0x8c(%rbp), %xmm2
movd -0x90(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movaps %xmm0, -0xa0(%rbp)
movaps -0xa0(%rbp), %xmm0
movaps %xmm0, -0x440(%rbp)
movl -0x404(%rbp), %eax
movl -0x408(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x2c2(%rbp)
movw -0x2c2(%rbp), %ax
movw %ax, -0x550(%rbp)
movw %ax, -0x62(%rbp)
movw %ax, -0x64(%rbp)
movw %ax, -0x66(%rbp)
movw %ax, -0x68(%rbp)
movw %ax, -0x6a(%rbp)
movw %ax, -0x6c(%rbp)
movw %ax, -0x6e(%rbp)
movw %ax, -0x70(%rbp)
movzwl -0x62(%rbp), %eax
movd %eax, %xmm1
movzwl -0x64(%rbp), %eax
movd %eax, %xmm0
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
movzwl -0x66(%rbp), %eax
movd %eax, %xmm2
movzwl -0x68(%rbp), %eax
movd %eax, %xmm1
punpcklwd %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movzwl -0x6a(%rbp), %eax
movd %eax, %xmm0
movzwl -0x6c(%rbp), %eax
movd %eax, %xmm2
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
movzwl -0x6e(%rbp), %eax
movd %eax, %xmm3
movzwl -0x70(%rbp), %eax
movd %eax, %xmm0
punpcklwd %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movaps %xmm0, -0x80(%rbp)
movaps -0x80(%rbp), %xmm0
movaps %xmm0, -0x450(%rbp)
movw -0x408(%rbp), %ax
movw %ax, -0x2c4(%rbp)
movw -0x2c4(%rbp), %ax
movw %ax, -0x54e(%rbp)
movw %ax, -0x42(%rbp)
movw %ax, -0x44(%rbp)
movw %ax, -0x46(%rbp)
movw %ax, -0x48(%rbp)
movw %ax, -0x4a(%rbp)
movw %ax, -0x4c(%rbp)
movw %ax, -0x4e(%rbp)
movw %ax, -0x50(%rbp)
movzwl -0x42(%rbp), %eax
movd %eax, %xmm1
movzwl -0x44(%rbp), %eax
movd %eax, %xmm0
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
movzwl -0x46(%rbp), %eax
movd %eax, %xmm2
movzwl -0x48(%rbp), %eax
movd %eax, %xmm1
punpcklwd %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movzwl -0x4a(%rbp), %eax
movd %eax, %xmm0
movzwl -0x4c(%rbp), %eax
movd %eax, %xmm2
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
movzwl -0x4e(%rbp), %eax
movd %eax, %xmm3
movzwl -0x50(%rbp), %eax
movd %eax, %xmm0
punpcklwd %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movaps %xmm0, -0x60(%rbp)
movaps -0x60(%rbp), %xmm0
movaps %xmm0, -0x460(%rbp)
movl 0x10(%rbp), %eax
movl 0x18(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x2c6(%rbp)
movw -0x2c6(%rbp), %ax
movw %ax, -0x54c(%rbp)
movw %ax, -0x22(%rbp)
movw %ax, -0x24(%rbp)
movw %ax, -0x26(%rbp)
movw %ax, -0x28(%rbp)
movw %ax, -0x2a(%rbp)
movw %ax, -0x2c(%rbp)
movw %ax, -0x2e(%rbp)
movw %ax, -0x30(%rbp)
movzwl -0x22(%rbp), %eax
movd %eax, %xmm1
movzwl -0x24(%rbp), %eax
movd %eax, %xmm0
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
movzwl -0x26(%rbp), %eax
movd %eax, %xmm2
movzwl -0x28(%rbp), %eax
movd %eax, %xmm1
punpcklwd %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movzwl -0x2a(%rbp), %eax
movd %eax, %xmm0
movzwl -0x2c(%rbp), %eax
movd %eax, %xmm2
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
movzwl -0x2e(%rbp), %eax
movd %eax, %xmm3
movzwl -0x30(%rbp), %eax
movd %eax, %xmm0
punpcklwd %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movaps %xmm0, -0x40(%rbp)
movaps -0x40(%rbp), %xmm0
movaps %xmm0, -0x470(%rbp)
movw 0x18(%rbp), %ax
movw %ax, -0x2c8(%rbp)
movw -0x2c8(%rbp), %ax
movw %ax, -0x54a(%rbp)
movw %ax, -0x2(%rbp)
movw %ax, -0x4(%rbp)
movw %ax, -0x6(%rbp)
movw %ax, -0x8(%rbp)
movw %ax, -0xa(%rbp)
movw %ax, -0xc(%rbp)
movw %ax, -0xe(%rbp)
movw %ax, -0x10(%rbp)
movzwl -0x2(%rbp), %eax
movd %eax, %xmm1
movzwl -0x4(%rbp), %eax
movd %eax, %xmm0
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
movzwl -0x6(%rbp), %eax
movd %eax, %xmm2
movzwl -0x8(%rbp), %eax
movd %eax, %xmm1
punpcklwd %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movzwl -0xa(%rbp), %eax
movd %eax, %xmm0
movzwl -0xc(%rbp), %eax
movd %eax, %xmm2
punpcklwd %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3]
movzwl -0xe(%rbp), %eax
movd %eax, %xmm3
movzwl -0x10(%rbp), %eax
movd %eax, %xmm0
punpcklwd %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
movdqa %xmm0, -0x20(%rbp)
movdqa -0x20(%rbp), %xmm0
movdqa %xmm0, -0x480(%rbp)
movq -0x3f0(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x488(%rbp)
movq -0x3f0(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x490(%rbp)
movq -0x3f0(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x498(%rbp)
movq -0x3f0(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x4a0(%rbp)
movq -0x3f0(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x40c(%rbp)
movl $0x0, -0x410(%rbp)
movl -0x410(%rbp), %eax
cmpl -0x40c(%rbp), %eax
jge 0x33ce1
movq -0x498(%rbp), %rax
movslq -0x410(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movdqa -0x440(%rbp), %xmm0
movq %rax, -0x310(%rbp)
movdqa %xmm0, -0x320(%rbp)
movdqa -0x320(%rbp), %xmm0
movq -0x310(%rbp), %rax
movdqa %xmm0, (%rax)
movq -0x488(%rbp), %rax
movslq -0x410(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movdqa -0x440(%rbp), %xmm0
movq %rax, -0x328(%rbp)
movdqa %xmm0, -0x340(%rbp)
movdqa -0x340(%rbp), %xmm0
movq -0x328(%rbp), %rax
movdqa %xmm0, (%rax)
movq -0x4a0(%rbp), %rax
movslq -0x410(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movdqa -0x440(%rbp), %xmm0
movq %rax, -0x348(%rbp)
movdqa %xmm0, -0x360(%rbp)
movdqa -0x360(%rbp), %xmm0
movq -0x348(%rbp), %rax
movdqa %xmm0, (%rax)
movl -0x410(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x410(%rbp)
jmp 0x33bfe
movl $0x0, -0x410(%rbp)
movl -0x410(%rbp), %eax
cmpl -0x3f4(%rbp), %eax
jge 0x34608
movaps -0x440(%rbp), %xmm0
movaps %xmm0, -0x4f0(%rbp)
movaps -0x440(%rbp), %xmm0
movaps %xmm0, -0x500(%rbp)
movq -0x3f0(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x400(%rbp), %rcx
movslq -0x410(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movl -0x40c(%rbp), %edx
imull %edx, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x508(%rbp)
movq -0x488(%rbp), %rax
movslq -0x40c(%rbp), %rcx
shlq $0x4, %rcx
leaq -0x10(%rax,%rcx), %rax
movq %rax, -0x2e8(%rbp)
movq -0x2e8(%rbp), %rax
movaps (%rax), %xmm0
movaps %xmm0, -0x4e0(%rbp)
movaps -0x4e0(%rbp), %xmm0
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movdqa %xmm0, -0x4e0(%rbp)
movl $0x0, -0x4a4(%rbp)
movl -0x4a4(%rbp), %eax
cmpl -0x40c(%rbp), %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x34116
movdqa -0x4e0(%rbp), %xmm1
movq -0x508(%rbp), %rax
movq %rax, %rcx
addq $0x10, %rcx
movq %rcx, -0x508(%rbp)
movdqa (%rax), %xmm0
movdqa %xmm1, -0x2b0(%rbp)
movdqa %xmm0, -0x2c0(%rbp)
movdqa -0x2b0(%rbp), %xmm0
movdqa -0x2c0(%rbp), %xmm1
paddsw %xmm1, %xmm0
movdqa %xmm0, -0x4e0(%rbp)
movq -0x498(%rbp), %rax
movslq -0x4a4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x2f0(%rbp)
movq -0x2f0(%rbp), %rax
movdqa (%rax), %xmm0
movdqa %xmm0, -0x4c0(%rbp)
movdqa -0x4e0(%rbp), %xmm1
movdqa -0x4c0(%rbp), %xmm0
movdqa %xmm1, -0x190(%rbp)
movdqa %xmm0, -0x1a0(%rbp)
movdqa -0x190(%rbp), %xmm0
movdqa -0x1a0(%rbp), %xmm1
pmaxsw %xmm1, %xmm0
movdqa %xmm0, -0x4e0(%rbp)
movdqa -0x4e0(%rbp), %xmm1
movdqa -0x4f0(%rbp), %xmm0
movdqa %xmm1, -0x1b0(%rbp)
movdqa %xmm0, -0x1c0(%rbp)
movdqa -0x1b0(%rbp), %xmm0
movdqa -0x1c0(%rbp), %xmm1
pmaxsw %xmm1, %xmm0
movdqa %xmm0, -0x4e0(%rbp)
movdqa -0x500(%rbp), %xmm1
movdqa -0x4e0(%rbp), %xmm0
movdqa %xmm1, -0x1d0(%rbp)
movdqa %xmm0, -0x1e0(%rbp)
movdqa -0x1d0(%rbp), %xmm0
movdqa -0x1e0(%rbp), %xmm1
pmaxsw %xmm1, %xmm0
movdqa %xmm0, -0x500(%rbp)
movq -0x490(%rbp), %rax
movslq -0x4a4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movdqa -0x4e0(%rbp), %xmm0
movq %rax, -0x368(%rbp)
movdqa %xmm0, -0x380(%rbp)
movdqa -0x380(%rbp), %xmm0
movq -0x368(%rbp), %rax
movdqa %xmm0, (%rax)
movdqa -0x4c0(%rbp), %xmm1
movdqa -0x460(%rbp), %xmm0
movdqa %xmm1, -0xd0(%rbp)
movdqa %xmm0, -0xe0(%rbp)
movdqa -0xd0(%rbp), %xmm0
movdqa -0xe0(%rbp), %xmm1
psubusw %xmm1, %xmm0
movdqa %xmm0, -0x4c0(%rbp)
movdqa -0x4e0(%rbp), %xmm1
movdqa -0x450(%rbp), %xmm0
movdqa %xmm1, -0xf0(%rbp)
movdqa %xmm0, -0x100(%rbp)
movdqa -0xf0(%rbp), %xmm0
movdqa -0x100(%rbp), %xmm1
psubusw %xmm1, %xmm0
movdqa %xmm0, -0x4d0(%rbp)
movdqa -0x4c0(%rbp), %xmm1
movdqa -0x4d0(%rbp), %xmm0
movdqa %xmm1, -0x1f0(%rbp)
movdqa %xmm0, -0x200(%rbp)
movdqa -0x1f0(%rbp), %xmm0
movdqa -0x200(%rbp), %xmm1
pmaxsw %xmm1, %xmm0
movdqa %xmm0, -0x4c0(%rbp)
movq -0x498(%rbp), %rax
movslq -0x4a4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movdqa -0x4c0(%rbp), %xmm0
movq %rax, -0x388(%rbp)
movdqa %xmm0, -0x3a0(%rbp)
movdqa -0x3a0(%rbp), %xmm0
movq -0x388(%rbp), %rax
movdqa %xmm0, (%rax)
movdqa -0x4f0(%rbp), %xmm1
movdqa -0x480(%rbp), %xmm0
movdqa %xmm1, -0x110(%rbp)
movdqa %xmm0, -0x120(%rbp)
movdqa -0x110(%rbp), %xmm0
movdqa -0x120(%rbp), %xmm1
psubusw %xmm1, %xmm0
movdqa %xmm0, -0x4f0(%rbp)
movdqa -0x4e0(%rbp), %xmm1
movdqa -0x470(%rbp), %xmm0
movdqa %xmm1, -0x130(%rbp)
movdqa %xmm0, -0x140(%rbp)
movdqa -0x130(%rbp), %xmm0
movdqa -0x140(%rbp), %xmm1
psubusw %xmm1, %xmm0
movdqa %xmm0, -0x4d0(%rbp)
movdqa -0x4f0(%rbp), %xmm1
movdqa -0x4d0(%rbp), %xmm0
movdqa %xmm1, -0x210(%rbp)
movdqa %xmm0, -0x220(%rbp)
movdqa -0x210(%rbp), %xmm0
movdqa -0x220(%rbp), %xmm1
pmaxsw %xmm1, %xmm0
movdqa %xmm0, -0x4f0(%rbp)
movq -0x488(%rbp), %rax
movslq -0x4a4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x2f8(%rbp)
movq -0x2f8(%rbp), %rax
movdqa (%rax), %xmm0
movdqa %xmm0, -0x4e0(%rbp)
movl -0x4a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4a4(%rbp)
jmp 0x33d9d
movl $0x0, -0x4a8(%rbp)
cmpl $0x10, -0x4a8(%rbp)
setl %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x34305
movaps -0x4f0(%rbp), %xmm0
pslldq $0x2, %xmm0             # xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
movdqa %xmm0, -0x4f0(%rbp)
movl $0x0, -0x4a4(%rbp)
movl -0x4a4(%rbp), %eax
cmpl -0x40c(%rbp), %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x342ef
movq -0x490(%rbp), %rax
movslq -0x4a4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x300(%rbp)
movq -0x300(%rbp), %rax
movaps (%rax), %xmm0
movaps %xmm0, -0x4e0(%rbp)
movaps -0x4e0(%rbp), %xmm1
movaps -0x4f0(%rbp), %xmm0
movaps %xmm1, -0x230(%rbp)
movaps %xmm0, -0x240(%rbp)
movaps -0x230(%rbp), %xmm0
movaps -0x240(%rbp), %xmm1
pmaxsw %xmm1, %xmm0
movaps %xmm0, -0x4e0(%rbp)
movq -0x490(%rbp), %rax
movslq -0x4a4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movaps -0x4e0(%rbp), %xmm0
movq %rax, -0x3a8(%rbp)
movaps %xmm0, -0x3c0(%rbp)
movaps -0x3c0(%rbp), %xmm0
movq -0x3a8(%rbp), %rax
movaps %xmm0, (%rax)
movaps -0x4e0(%rbp), %xmm1
movaps -0x470(%rbp), %xmm0
movaps %xmm1, -0x150(%rbp)
movaps %xmm0, -0x160(%rbp)
movaps -0x150(%rbp), %xmm0
movaps -0x160(%rbp), %xmm1
psubusw %xmm1, %xmm0
movaps %xmm0, -0x4e0(%rbp)
movaps -0x4f0(%rbp), %xmm1
movaps -0x480(%rbp), %xmm0
movaps %xmm1, -0x170(%rbp)
movaps %xmm0, -0x180(%rbp)
movaps -0x170(%rbp), %xmm0
movaps -0x180(%rbp), %xmm1
psubusw %xmm1, %xmm0
movaps %xmm0, -0x4f0(%rbp)
movaps -0x4f0(%rbp), %xmm1
movaps -0x4e0(%rbp), %xmm0
movaps %xmm1, -0xb0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps -0xb0(%rbp), %xmm0
movaps -0xc0(%rbp), %xmm1
pcmpgtw %xmm1, %xmm0
movdqa %xmm0, -0x2e0(%rbp)
movdqa -0x2e0(%rbp), %xmm0
pmovmskb %xmm0, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x342d9
jmp 0x34307
jmp 0x342db
movl -0x4a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4a4(%rbp)
jmp 0x34159
jmp 0x342f1
movl -0x4a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4a8(%rbp)
jmp 0x34120
jmp 0x34307
jmp 0x34309
movaps -0x500(%rbp), %xmm1
movaps %xmm1, %xmm0
psrldq $0x8, %xmm0             # xmm0 = xmm0[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero
movaps %xmm1, -0x250(%rbp)
movaps %xmm0, -0x260(%rbp)
movaps -0x250(%rbp), %xmm0
movaps -0x260(%rbp), %xmm1
pmaxsw %xmm1, %xmm0
movaps %xmm0, -0x500(%rbp)
movaps -0x500(%rbp), %xmm1
movaps %xmm1, %xmm0
psrldq $0x4, %xmm0             # xmm0 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],zero,zero,zero,zero
movaps %xmm1, -0x270(%rbp)
movaps %xmm0, -0x280(%rbp)
movaps -0x270(%rbp), %xmm0
movaps -0x280(%rbp), %xmm1
pmaxsw %xmm1, %xmm0
movaps %xmm0, -0x500(%rbp)
movaps -0x500(%rbp), %xmm1
movaps %xmm1, %xmm0
psrldq $0x2, %xmm0             # xmm0 = xmm0[2,3,4,5,6,7,8,9,10,11,12,13,14,15],zero,zero
movaps %xmm1, -0x290(%rbp)
movaps %xmm0, -0x2a0(%rbp)
movaps -0x290(%rbp), %xmm0
movaps -0x2a0(%rbp), %xmm1
pmaxsw %xmm1, %xmm0
movaps %xmm0, -0x500(%rbp)
movl -0x500(%rbp), %eax
movzwl %ax, %eax
movl %eax, -0x4ac(%rbp)
movl -0x4ac(%rbp), %eax
cmpl -0x424(%rbp), %eax
jl 0x344f6
cmpl $0x0, -0x418(%rbp)
je 0x343fb
movq -0x430(%rbp), %rax
movl -0x418(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
addl $0x1, %eax
cmpl -0x410(%rbp), %eax
je 0x344a3
movl -0x418(%rbp), %eax
cmpl -0x414(%rbp), %eax
jne 0x3446d
cmpl $0x0, -0x414(%rbp)
je 0x34422
movl -0x414(%rbp), %eax
shll %eax
movl %eax, -0x554(%rbp)
jmp 0x3442f
movl $0x8, %eax
movl %eax, -0x554(%rbp)
jmp 0x3442f
movl -0x554(%rbp), %eax
movl %eax, -0x414(%rbp)
movq -0x430(%rbp), %rdi
movl -0x414(%rbp), %eax
shll $0x3, %eax
movslq %eax, %rsi
leaq 0x70a3(%rip), %rdx      # 0x3b4f8
movl $0x12f, %ecx            # imm = 0x12F
leaq 0x70ae(%rip), %r8       # 0x3b50f
callq 0x31d40
movq %rax, -0x430(%rbp)
movslq -0x4ac(%rbp), %rdx
shlq $0x20, %rdx
movslq -0x410(%rbp), %rax
orq %rax, %rdx
movq -0x430(%rbp), %rax
movl -0x418(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x418(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x344f4
movq -0x430(%rbp), %rax
movl -0x418(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
cmpl -0x4ac(%rbp), %eax
jge 0x344f2
movslq -0x4ac(%rbp), %rdx
shlq $0x20, %rdx
movslq -0x410(%rbp), %rax
orq %rax, %rdx
movq -0x430(%rbp), %rax
movl -0x418(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x344f4
jmp 0x344f6
movl -0x4ac(%rbp), %eax
cmpl -0x420(%rbp), %eax
jle 0x345ca
movl -0x4ac(%rbp), %eax
movl %eax, -0x420(%rbp)
movl -0x410(%rbp), %eax
movl %eax, -0x41c(%rbp)
movl $0x0, -0x4a4(%rbp)
movl -0x4a4(%rbp), %eax
cmpl -0x40c(%rbp), %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x345b8
movq -0x4a0(%rbp), %rax
movslq -0x4a4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x490(%rbp), %rcx
movslq -0x4a4(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq %rcx, -0x308(%rbp)
movq -0x308(%rbp), %rcx
movdqa (%rcx), %xmm0
movq %rax, -0x3c8(%rbp)
movdqa %xmm0, -0x3e0(%rbp)
movdqa -0x3e0(%rbp), %xmm0
movq -0x3c8(%rbp), %rax
movdqa %xmm0, (%rax)
movl -0x4a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4a4(%rbp)
jmp 0x3452a
movl -0x420(%rbp), %eax
cmpl -0x428(%rbp), %eax
jl 0x345c8
jmp 0x34608
jmp 0x345ca
movq -0x490(%rbp), %rax
movq %rax, -0x508(%rbp)
movq -0x488(%rbp), %rax
movq %rax, -0x490(%rbp)
movq -0x508(%rbp), %rax
movq %rax, -0x488(%rbp)
movl -0x410(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x410(%rbp)
jmp 0x33ceb
movq -0x540(%rbp), %rax
movl -0x420(%rbp), %ecx
movl %ecx, (%rax)
movl -0x41c(%rbp), %ecx
movl %ecx, 0x4(%rax)
movl $0xffffffff, -0x50c(%rbp) # imm = 0xFFFFFFFF
movl -0x40c(%rbp), %ecx
shll $0x3, %ecx
movl %ecx, -0x51c(%rbp)
movq -0x4a0(%rbp), %rcx
movq %rcx, -0x528(%rbp)
movl $0x0, -0x410(%rbp)
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movl -0x410(%rbp), %eax
cmpl -0x51c(%rbp), %eax
jge 0x3474e
movq -0x528(%rbp), %rax
movzwl (%rax), %eax
cmpl -0x50c(%rbp), %eax
jle 0x346bf
movq -0x528(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0x50c(%rbp)
movl -0x410(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x410(%rbp), %eax
movl $0x8, %esi
cltd
idivl %esi
movq -0x540(%rbp), %rax
imull -0x40c(%rbp), %edx
addl %edx, %ecx
movl %ecx, 0x8(%rax)
jmp 0x34726
movq -0x528(%rbp), %rax
movzwl (%rax), %eax
cmpl -0x50c(%rbp), %eax
jne 0x34724
movq -0x540(%rbp), %rcx
movl -0x410(%rbp), %eax
movl $0x8, %esi
cltd
idivl %esi
movl %eax, -0x558(%rbp)
movl -0x410(%rbp), %eax
movl $0x8, %esi
cltd
idivl %esi
movl -0x558(%rbp), %eax
imull -0x40c(%rbp), %edx
addl %edx, %eax
movl %eax, -0x510(%rbp)
cmpl 0x8(%rcx), %eax
jge 0x34724
movq -0x540(%rbp), %rax
movl -0x510(%rbp), %ecx
movl %ecx, 0x8(%rax)
jmp 0x34726
jmp 0x34728
movl -0x410(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x410(%rbp)
movq -0x528(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x528(%rbp)
jmp 0x34658
cmpq $0x0, -0x430(%rbp)
je 0x34860
movq -0x540(%rbp), %rax
movl (%rax), %eax
movq -0x3f0(%rbp), %rcx
movzbl 0xa(%rcx), %ecx
addl %ecx, %eax
subl $0x1, %eax
movq -0x3f0(%rbp), %rcx
movzbl 0xa(%rcx), %ecx
cltd
idivl %ecx
movl %eax, -0x410(%rbp)
movl -0x41c(%rbp), %eax
subl -0x410(%rbp), %eax
movl %eax, -0x514(%rbp)
movl -0x41c(%rbp), %eax
addl -0x410(%rbp), %eax
movl %eax, -0x518(%rbp)
movl $0x0, -0x410(%rbp)
movl -0x410(%rbp), %eax
cmpl -0x418(%rbp), %eax
jge 0x3485e
movq -0x430(%rbp), %rax
movslq -0x410(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x52c(%rbp)
movl -0x52c(%rbp), %eax
cmpl -0x514(%rbp), %eax
jl 0x347fd
movl -0x52c(%rbp), %eax
cmpl -0x518(%rbp), %eax
jle 0x34848
movq -0x540(%rbp), %rcx
movq -0x430(%rbp), %rax
movslq -0x410(%rbp), %rdx
movq (%rax,%rdx,8), %rax
shrq $0x20, %rax
cmpl 0xc(%rcx), %eax
jle 0x34848
movq -0x540(%rbp), %rax
movq -0x430(%rbp), %rcx
movslq -0x410(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
movl %ecx, 0xc(%rax)
movl -0x52c(%rbp), %ecx
movl %ecx, 0x10(%rax)
jmp 0x3484a
movl -0x410(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x410(%rbp)
jmp 0x347b7
jmp 0x34860
movq -0x430(%rbp), %rdi
callq 0x3380
movq -0x538(%rbp), %rax
addq $0x560, %rsp            # imm = 0x560
popq %rbp
retq
nopl (%rax)