// File: /workspace/github_c_makefile_star2_O0/ToniWestbrook[P]paladin/ksw.c
// Function: ksw_global2
int ksw_global2(int qlen, const uint8_t *query, int tlen, const uint8_t *target, int m, const int8_t *mat, int o_del, int e_del, int o_ins, int e_ins, int w, int *n_cigar_, uint32_t **cigar_)
{
	eh_t *eh;
	int8_t *qp; // query profile
	int i, j, k, oe_del = o_del + e_del, oe_ins = o_ins + e_ins, score, n_col;
	uint8_t *z; // backtrack matrix; in each cell: f<<4|e<<2|h; in principle, we can halve the memory, but backtrack will be a little more complex
	if (n_cigar_) *n_cigar_ = 0;
	// allocate memory
	n_col = qlen < 2*w+1? qlen : 2*w+1; // maximum #columns of the backtrack matrix
	z = n_cigar_ && cigar_? malloc((long)n_col * tlen) : 0;
	qp = malloc(qlen * m);
	eh = calloc(qlen + 1, 8);
	// generate the query profile
	for (k = i = 0; k < m; ++k) {
		const int8_t *p = &mat[k * m];
		for (j = 0; j < qlen; ++j) qp[i++] = p[query[j]];
	}
	// fill the first row
	eh[0].h = 0; eh[0].e = MINUS_INF;
	for (j = 1; j <= qlen && j <= w; ++j)
		eh[j].h = -(o_ins + e_ins * j), eh[j].e = MINUS_INF;
	for (; j <= qlen; ++j) eh[j].h = eh[j].e = MINUS_INF; // everything is -inf outside the band
	// DP loop
	for (i = 0; LIKELY(i < tlen); ++i) { // target sequence is in the outer loop
		int32_t f = MINUS_INF, h1, beg, end, t;
		int8_t *q = &qp[target[i] * qlen];
		beg = i > w? i - w : 0;
		end = i + w + 1 < qlen? i + w + 1 : qlen; // only loop through [beg,end) of the query sequence
		h1 = beg == 0? -(o_del + e_del * (i + 1)) : MINUS_INF;
		if (n_cigar_ && cigar_) {
			uint8_t *zi = &z[(long)i * n_col];
			for (j = beg; LIKELY(j < end); ++j) {
				// At the beginning of the loop: eh[j] = { H(i-1,j-1), E(i,j) }, f = F(i,j) and h1 = H(i,j-1)
				// Cells are computed in the following order:
				//   M(i,j)   = H(i-1,j-1) + S(i,j)
				//   H(i,j)   = max{M(i,j), E(i,j), F(i,j)}
				//   E(i+1,j) = max{M(i,j)-gapo, E(i,j)} - gape
				//   F(i,j+1) = max{M(i,j)-gapo, F(i,j)} - gape
				// We have to separate M(i,j); otherwise the direction may not be recorded correctly.
				// However, a CIGAR like "10M3I3D10M" allowed by local() is disallowed by global().
				// Such a CIGAR may occur, in theory, if mismatch_penalty > 2*gap_ext_penalty + 2*gap_open_penalty/k.
				// In practice, this should happen very rarely given a reasonable scoring system.
				eh_t *p = &eh[j];
				int32_t h, m = p->h, e = p->e;
				uint8_t d; // direction
				p->h = h1;
				m += q[j];
				d = m >= e? 0 : 1;
				h = m >= e? m : e;
				d = h >= f? d : 2;
				h = h >= f? h : f;
				h1 = h;
				t = m - oe_del;
				e -= e_del;
				d |= e > t? 1<<2 : 0;
				e  = e > t? e    : t;
				p->e = e;
				t = m - oe_ins;
				f -= e_ins;
				d |= f > t? 2<<4 : 0; // if we want to halve the memory, use one bit only, instead of two
				f  = f > t? f    : t;
				zi[j - beg] = d; // z[i,j] keeps h for the current cell and e/f for the next cell
			}
		} else {
			for (j = beg; LIKELY(j < end); ++j) {
				eh_t *p = &eh[j];
				int32_t h, m = p->h, e = p->e;
				p->h = h1;
				m += q[j];
				h = m >= e? m : e;
				h = h >= f? h : f;
				h1 = h;
				t = m - oe_del;
				e -= e_del;
				e  = e > t? e : t;
				p->e = e;
				t = m - oe_ins;
				f -= e_ins;
				f  = f > t? f : t;
			}
		}
		eh[end].h = h1; eh[end].e = MINUS_INF;
	}
	score = eh[qlen].h;
	if (n_cigar_ && cigar_) { // backtrack
		int n_cigar = 0, m_cigar = 0, which = 0;
		uint32_t *cigar = 0, tmp;
		i = tlen - 1; k = (i + w + 1 < qlen? i + w + 1 : qlen) - 1; // (i,k) points to the last cell
		while (i >= 0 && k >= 0) {
			which = z[(long)i * n_col + (k - (i > w? i - w : 0))] >> (which<<1) & 3;
			if (which == 0)      cigar = push_cigar(&n_cigar, &m_cigar, cigar, 0, 1), --i, --k;
			else if (which == 1) cigar = push_cigar(&n_cigar, &m_cigar, cigar, 2, 1), --i;
			else                 cigar = push_cigar(&n_cigar, &m_cigar, cigar, 1, 1), --k;
		}
		if (i >= 0) cigar = push_cigar(&n_cigar, &m_cigar, cigar, 2, i + 1);
		if (k >= 0) cigar = push_cigar(&n_cigar, &m_cigar, cigar, 1, k + 1);
		for (i = 0; i < n_cigar>>1; ++i) // reverse CIGAR
			tmp = cigar[i], cigar[i] = cigar[n_cigar-1-i], cigar[n_cigar-1-i] = tmp;
		*n_cigar_ = n_cigar, *cigar_ = cigar;
	}
	free(eh); free(qp); free(z);
	return score;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movl 0x10(%rbp), %eax
addl 0x18(%rbp), %eax
movl %eax, -0x50(%rbp)
movl 0x20(%rbp), %eax
addl 0x28(%rbp), %eax
movl %eax, -0x54(%rbp)
cmpq $0x0, 0x38(%rbp)
je 0x357ab
movq 0x38(%rbp), %rax
movl $0x0, (%rax)
movl -0x4(%rbp), %eax
movl 0x30(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x357c5
movl -0x4(%rbp), %eax
movl %eax, -0xe0(%rbp)
jmp 0x357d3
movl 0x30(%rbp), %eax
shll %eax
addl $0x1, %eax
movl %eax, -0xe0(%rbp)
movl -0xe0(%rbp), %eax
movl %eax, -0x5c(%rbp)
cmpq $0x0, 0x38(%rbp)
je 0x35817
cmpq $0x0, 0x40(%rbp)
je 0x35817
movslq -0x5c(%rbp), %rdi
movslq -0x14(%rbp), %rax
imulq %rax, %rdi
leaq 0x5cfb(%rip), %rsi      # 0x3b4f8
movl $0x209, %edx            # imm = 0x209
leaq 0x5dbd(%rip), %rcx      # 0x3b5c6
callq 0x31ca0
movq %rax, -0xe8(%rbp)
jmp 0x35822
xorl %eax, %eax
movq %rax, -0xe8(%rbp)
jmp 0x35822
movq -0xe8(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x4(%rbp), %eax
imull -0x24(%rbp), %eax
movslq %eax, %rdi
leaq 0x5cba(%rip), %rsi      # 0x3b4f8
movl $0x20a, %edx            # imm = 0x20A
leaq 0x5d7c(%rip), %rcx      # 0x3b5c6
callq 0x31ca0
movq %rax, -0x40(%rbp)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
movl $0x8, %esi
leaq 0x5c90(%rip), %rdx      # 0x3b4f8
movl $0x20b, %ecx            # imm = 0x20B
leaq 0x5d52(%rip), %r8       # 0x3b5c6
callq 0x31bf0
movq %rax, -0x38(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x358f7
movq -0x30(%rbp), %rax
movl -0x4c(%rbp), %ecx
imull -0x24(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x358ea
movq -0x70(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq -0x48(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movb (%rax,%rcx), %dl
movq -0x40(%rbp), %rax
movl -0x44(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x44(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x358af
jmp 0x358ec
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3588b
movq -0x38(%rbp), %rax
movl $0x0, (%rax)
movq -0x38(%rbp), %rax
movl $0xc0000000, 0x4(%rax)  # imm = 0xC0000000
movl $0x1, -0x48(%rbp)
movl -0x48(%rbp), %ecx
xorl %eax, %eax
cmpl -0x4(%rbp), %ecx
movb %al, -0xe9(%rbp)
jg 0x35932
movl -0x48(%rbp), %eax
cmpl 0x30(%rbp), %eax
setle %al
movb %al, -0xe9(%rbp)
movb -0xe9(%rbp), %al
testb $0x1, %al
jne 0x3593e
jmp 0x35974
movl 0x20(%rbp), %eax
movl 0x28(%rbp), %ecx
imull -0x48(%rbp), %ecx
addl %ecx, %eax
xorl %edx, %edx
subl %eax, %edx
movq -0x38(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl $0xc0000000, 0x4(%rax,%rcx,8) # imm = 0xC0000000
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x35913
jmp 0x35976
movl -0x48(%rbp), %eax
cmpl -0x4(%rbp), %eax
jg 0x359a8
movq -0x38(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl $0xc0000000, 0x4(%rax,%rcx,8) # imm = 0xC0000000
movq -0x38(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl $0xc0000000, (%rax,%rcx,8) # imm = 0xC0000000
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x35976
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x14(%rbp), %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x35ed8
movl $0xc0000000, -0x74(%rbp) # imm = 0xC0000000
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x44(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
imull -0x4(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movl -0x44(%rbp), %eax
cmpl 0x30(%rbp), %eax
jle 0x35a07
movl -0x44(%rbp), %eax
subl 0x30(%rbp), %eax
movl %eax, -0xf0(%rbp)
jmp 0x35a11
xorl %eax, %eax
movl %eax, -0xf0(%rbp)
jmp 0x35a11
movl -0xf0(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x44(%rbp), %eax
addl 0x30(%rbp), %eax
addl $0x1, %eax
cmpl -0x4(%rbp), %eax
jge 0x35a39
movl -0x44(%rbp), %eax
addl 0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf4(%rbp)
jmp 0x35a42
movl -0x4(%rbp), %eax
movl %eax, -0xf4(%rbp)
movl -0xf4(%rbp), %eax
movl %eax, -0x80(%rbp)
cmpl $0x0, -0x7c(%rbp)
jne 0x35a6e
movl 0x10(%rbp), %ecx
movl 0x18(%rbp), %eax
movl -0x44(%rbp), %edx
addl $0x1, %edx
imull %edx, %eax
addl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0xf8(%rbp)
jmp 0x35a7b
movl $0xc0000000, %eax       # imm = 0xC0000000
movl %eax, -0xf8(%rbp)
jmp 0x35a7b
movl -0xf8(%rbp), %eax
movl %eax, -0x78(%rbp)
cmpq $0x0, 0x38(%rbp)
je 0x35d0c
cmpq $0x0, 0x40(%rbp)
je 0x35d0c
movq -0x68(%rbp), %rax
movslq -0x44(%rbp), %rcx
movslq -0x5c(%rbp), %rdx
imulq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x80(%rbp), %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x35d07
movq -0x38(%rbp), %rax
movslq -0x48(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0xac(%rbp)
movl -0x78(%rbp), %ecx
movq -0xa0(%rbp), %rax
movl %ecx, (%rax)
movq -0x90(%rbp), %rax
movslq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl -0xa8(%rbp), %eax
movl %eax, -0xa8(%rbp)
movl -0xa8(%rbp), %edx
movl -0xac(%rbp), %esi
movl $0x1, %eax
xorl %ecx, %ecx
cmpl %esi, %edx
cmovgel %ecx, %eax
movb %al, -0xad(%rbp)
movl -0xa8(%rbp), %eax
cmpl -0xac(%rbp), %eax
jl 0x35b6a
movl -0xa8(%rbp), %eax
movl %eax, -0xfc(%rbp)
jmp 0x35b76
movl -0xac(%rbp), %eax
movl %eax, -0xfc(%rbp)
movl -0xfc(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
cmpl -0x74(%rbp), %eax
jl 0x35b9c
movzbl -0xad(%rbp), %eax
movl %eax, -0x100(%rbp)
jmp 0x35ba9
movl $0x2, %eax
movl %eax, -0x100(%rbp)
jmp 0x35ba9
movl -0x100(%rbp), %eax
movb %al, -0xad(%rbp)
movl -0xa4(%rbp), %eax
cmpl -0x74(%rbp), %eax
jl 0x35bce
movl -0xa4(%rbp), %eax
movl %eax, -0x104(%rbp)
jmp 0x35bd7
movl -0x74(%rbp), %eax
movl %eax, -0x104(%rbp)
movl -0x104(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0xa8(%rbp), %eax
subl -0x50(%rbp), %eax
movl %eax, -0x84(%rbp)
movl 0x18(%rbp), %ecx
movl -0xac(%rbp), %eax
subl %ecx, %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %edx
movl -0x84(%rbp), %esi
xorl %ecx, %ecx
movl $0x4, %eax
cmpl %esi, %edx
cmovgl %eax, %ecx
movzbl -0xad(%rbp), %eax
orl %ecx, %eax
movb %al, -0xad(%rbp)
movl -0xac(%rbp), %eax
cmpl -0x84(%rbp), %eax
jle 0x35c4f
movl -0xac(%rbp), %eax
movl %eax, -0x108(%rbp)
jmp 0x35c5b
movl -0x84(%rbp), %eax
movl %eax, -0x108(%rbp)
movl -0x108(%rbp), %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0xa8(%rbp), %eax
subl -0x54(%rbp), %eax
movl %eax, -0x84(%rbp)
movl 0x28(%rbp), %ecx
movl -0x74(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %edx
movl -0x84(%rbp), %esi
xorl %ecx, %ecx
movl $0x20, %eax
cmpl %esi, %edx
cmovgl %eax, %ecx
movzbl -0xad(%rbp), %eax
orl %ecx, %eax
movb %al, -0xad(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x84(%rbp), %eax
jle 0x35ccb
movl -0x74(%rbp), %eax
movl %eax, -0x10c(%rbp)
jmp 0x35cd7
movl -0x84(%rbp), %eax
movl %eax, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
movl %eax, -0x74(%rbp)
movb -0xad(%rbp), %dl
movq -0x98(%rbp), %rax
movl -0x48(%rbp), %ecx
subl -0x7c(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x35aba
jmp 0x35eac
movl -0x7c(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x80(%rbp), %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x35eaa
movq -0x38(%rbp), %rax
movslq -0x48(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xc0(%rbp)
movq -0xb8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0xc4(%rbp)
movl -0x78(%rbp), %ecx
movq -0xb8(%rbp), %rax
movl %ecx, (%rax)
movq -0x90(%rbp), %rax
movslq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl -0xc0(%rbp), %eax
movl %eax, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
cmpl -0xc4(%rbp), %eax
jl 0x35da4
movl -0xc0(%rbp), %eax
movl %eax, -0x110(%rbp)
jmp 0x35db0
movl -0xc4(%rbp), %eax
movl %eax, -0x110(%rbp)
movl -0x110(%rbp), %eax
movl %eax, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
cmpl -0x74(%rbp), %eax
jl 0x35dd5
movl -0xbc(%rbp), %eax
movl %eax, -0x114(%rbp)
jmp 0x35dde
movl -0x74(%rbp), %eax
movl %eax, -0x114(%rbp)
movl -0x114(%rbp), %eax
movl %eax, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0xc0(%rbp), %eax
subl -0x50(%rbp), %eax
movl %eax, -0x84(%rbp)
movl 0x18(%rbp), %ecx
movl -0xc4(%rbp), %eax
subl %ecx, %eax
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
cmpl -0x84(%rbp), %eax
jle 0x35e2f
movl -0xc4(%rbp), %eax
movl %eax, -0x118(%rbp)
jmp 0x35e3b
movl -0x84(%rbp), %eax
movl %eax, -0x118(%rbp)
movl -0x118(%rbp), %eax
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %ecx
movq -0xb8(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0xc0(%rbp), %eax
subl -0x54(%rbp), %eax
movl %eax, -0x84(%rbp)
movl 0x28(%rbp), %ecx
movl -0x74(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x84(%rbp), %eax
jle 0x35e87
movl -0x74(%rbp), %eax
movl %eax, -0x11c(%rbp)
jmp 0x35e93
movl -0x84(%rbp), %eax
movl %eax, -0x11c(%rbp)
movl -0x11c(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x35d12
jmp 0x35eac
movl -0x78(%rbp), %edx
movq -0x38(%rbp), %rax
movslq -0x80(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movslq -0x80(%rbp), %rcx
movl $0xc0000000, 0x4(%rax,%rcx,8) # imm = 0xC0000000
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x359af
movq -0x38(%rbp), %rax
movslq -0x4(%rbp), %rcx
movl (%rax,%rcx,8), %eax
movl %eax, -0x58(%rbp)
cmpq $0x0, 0x38(%rbp)
je 0x361c9
cmpq $0x0, 0x40(%rbp)
je 0x361c9
movl $0x0, -0xc8(%rbp)
movl $0x0, -0xcc(%rbp)
movl $0x0, -0xd0(%rbp)
movq $0x0, -0xd8(%rbp)
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
addl 0x30(%rbp), %eax
addl $0x1, %eax
cmpl -0x4(%rbp), %eax
jge 0x35f4d
movl -0x44(%rbp), %eax
addl 0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
jmp 0x35f56
movl -0x4(%rbp), %eax
movl %eax, -0x120(%rbp)
movl -0x120(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x4c(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x44(%rbp)
movb %al, -0x121(%rbp)
jl 0x35f7d
cmpl $0x0, -0x4c(%rbp)
setge %al
movb %al, -0x121(%rbp)
movb -0x121(%rbp), %al
testb $0x1, %al
jne 0x35f8c
jmp 0x360cc
movq -0x68(%rbp), %rax
movq %rax, -0x138(%rbp)
movslq -0x44(%rbp), %rax
movslq -0x5c(%rbp), %rcx
imulq %rcx, %rax
movq %rax, -0x130(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x128(%rbp)
movl -0x44(%rbp), %eax
cmpl 0x30(%rbp), %eax
jle 0x35fc9
movl -0x44(%rbp), %eax
subl 0x30(%rbp), %eax
movl %eax, -0x13c(%rbp)
jmp 0x35fd3
xorl %eax, %eax
movl %eax, -0x13c(%rbp)
jmp 0x35fd3
movq -0x138(%rbp), %rax
movq -0x130(%rbp), %rcx
movl -0x128(%rbp), %edx
movl -0x13c(%rbp), %esi
subl %esi, %edx
movslq %edx, %rdx
addq %rdx, %rcx
movzbl (%rax,%rcx), %eax
movl -0xd0(%rbp), %ecx
shll %ecx
sarl %cl, %eax
andl $0x3, %eax
movl %eax, -0xd0(%rbp)
cmpl $0x0, -0xd0(%rbp)
jne 0x36052
movq -0xd8(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
leaq -0xcc(%rbp), %rsi
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x361f0
movq %rax, -0xd8(%rbp)
movl -0x44(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x4c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x360c7
cmpl $0x1, -0xd0(%rbp)
jne 0x36092
movq -0xd8(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
leaq -0xcc(%rbp), %rsi
movl $0x2, %ecx
movl $0x1, %r8d
callq 0x361f0
movq %rax, -0xd8(%rbp)
movl -0x44(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x360c5
movq -0xd8(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
leaq -0xcc(%rbp), %rsi
movl $0x1, %r8d
movl %r8d, %ecx
callq 0x361f0
movq %rax, -0xd8(%rbp)
movl -0x4c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x360c7
jmp 0x35f62
cmpl $0x0, -0x44(%rbp)
jl 0x36100
movq -0xd8(%rbp), %rdx
movl -0x44(%rbp), %r8d
addl $0x1, %r8d
leaq -0xc8(%rbp), %rdi
leaq -0xcc(%rbp), %rsi
movl $0x2, %ecx
callq 0x361f0
movq %rax, -0xd8(%rbp)
cmpl $0x0, -0x4c(%rbp)
jl 0x36134
movq -0xd8(%rbp), %rdx
movl -0x4c(%rbp), %r8d
addl $0x1, %r8d
leaq -0xc8(%rbp), %rdi
leaq -0xcc(%rbp), %rsi
movl $0x1, %ecx
callq 0x361f0
movq %rax, -0xd8(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl -0xc8(%rbp), %ecx
sarl %ecx
cmpl %ecx, %eax
jge 0x361af
movq -0xd8(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xdc(%rbp)
movq -0xd8(%rbp), %rax
movl -0xc8(%rbp), %ecx
subl $0x1, %ecx
subl -0x44(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0xd8(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0xdc(%rbp), %edx
movq -0xd8(%rbp), %rax
movl -0xc8(%rbp), %ecx
subl $0x1, %ecx
subl -0x44(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x3613b
movl -0xc8(%rbp), %ecx
movq 0x38(%rbp), %rax
movl %ecx, (%rax)
movq -0xd8(%rbp), %rcx
movq 0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rdi
callq 0x3380
movq -0x40(%rbp), %rdi
callq 0x3380
movq -0x68(%rbp), %rdi
callq 0x3380
movl -0x58(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq