// File: /workspace/github_c_makefile_star2_O1/nh13[P]ksw/src/ksw2/ksw2_extd.c
// Function: ksw_extd
void ksw_extd(void *km, int qlen, const uint8_t *query, int tlen, const uint8_t *target, int8_t m, const int8_t *mat,
			  int8_t gapo, int8_t gape, int8_t gapo2, int8_t gape2, int w, int zdrop, int flag, ksw_extz_t *ez)
{
	eh_t *eh;
	int8_t *qp; // query profile
	int32_t i, j, k, max_j = 0, gapoe = gapo + gape, gapoe2 = gapo2 + gape2, n_col, *off = 0, with_cigar = !(flag&KSW_EZ_SCORE_ONLY);
	uint8_t *z = 0; // backtrack matrix; in each cell: f<<4|e<<2|h; in principle, we can halve the memory, but backtrack will be more complex

	ksw_reset_extz(ez);

	// allocate memory
	if (w < 0) w = tlen > qlen? tlen : qlen;
	n_col = qlen < 2*w+1? qlen : 2*w+1; // maximum #columns of the backtrack matrix
	qp = (int8_t*)kmalloc(km, qlen * m);
	eh = (eh_t*)kcalloc(km, qlen + 1, sizeof(eh_t));
	if (with_cigar) {
		z = (uint8_t*)kmalloc(km, (size_t)n_col * tlen);
		off = (int32_t*)kcalloc(km, tlen, 4);
	}

	// 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 = -gapoe - gapoe, eh[0].e2 = -gapoe2 - gapoe2;
	for (j = 1; j <= qlen && j <= w; ++j) {
		int tmp;
		eh[j].h = -(gapo + gape * j) > -(gapo2 + gape2 * j)? -(gapo + gape * j) : -(gapo2 + gape2 * j);
		tmp = -(gapoe + gape * j) > -(gapoe2 + gape2 * j)? -(gapoe + gape * j) : -(gapoe2 + gape2 * j);
		eh[j].e = tmp - gapoe;
		eh[j].e2 = tmp - gapoe2;
	}
	for (; j <= qlen; ++j) eh[j].h = eh[j].e = eh[j].e2 = KSW_NEG_INF; // everything is -inf outside the band

	// DP loop
	for (i = 0; i < tlen; ++i) { // target sequence is in the outer loop
		int32_t f, f2, h1, st, en, max = KSW_NEG_INF, tmp;
		int8_t *q = &qp[target[i] * qlen];
		st = i > w? i - w : 0;
		en = i + w < qlen - 1? i + w : qlen - 1;
		tmp = -(gapoe + gape * i) > -(gapoe2 + gape2 * i)? -(gapoe + gape * i) : -(gapoe2 + gape2 * i);
		h1 = st > 0? KSW_NEG_INF : tmp;
		f  = st > 0? KSW_NEG_INF : tmp - gapoe;
		f2 = st > 0? KSW_NEG_INF : tmp - gapoe2;
		if (!with_cigar) {
			for (j = st; j <= en; ++j) {
				eh_t *p = &eh[j];
				int32_t h = p->h, h2, e = p->e, e2 = p->e2;
				p->h = h1;
				h += q[j];
				h = h >= e?  h : e;
				h = h >= f?  h : f;
				h = h >= e2? h : e2;
				h = h >= f2? h : f2;
				h1 = h;
				max_j = max > h? max_j : j;
				max   = max > h? max   : h;
				h -= gapoe;
				e -= gape;
				e  = e > h? e : h;
				p->e = e;
				f -= gape;
				f  = f > h? f : h;
				h2 = h1 - gapoe2;
				e2-= gape2;
				e2 = e2 > h2? e2 : h2;
				p->e2 = e2;
				f2-= gape2;
				f2 = f2 > h2? f2 : h2;
			}
		} else if (!(flag&KSW_EZ_RIGHT)) {
			uint8_t *zi = &z[(long)i * n_col];
			off[i] = st;
			for (j = st; j <= en; ++j) {
				eh_t *p = &eh[j];
				int32_t h = p->h, h2, e = p->e, e2 = p->e2;
				uint8_t d; // direction
				p->h = h1;
				h += q[j];
				d = h >= e?  0 : 1;
				h = h >= e?  h : e;
				d = h >= f?  d : 2;
				h = h >= f?  h : f;
				d = h >= e2? d : 3;
				h = h >= e2? h : e2;
				d = h >= f2? d : 4;
				h = h >= f2? h : f2;
				h1 = h;
				max_j = max > h? max_j : j;
				max   = max > h? max   : h;
				h -= gapoe;
				e -= gape;
				d |= e > h? 1<<3 : 0;
				e  = e > h? e    : h;
				p->e = e;
				f -= gape;
				d |= f > h? 1<<4 : 0; // if we want to halve the memory, use one bit only, instead of two
				f  = f > h? f    : h;
				h2 = h1 - gapoe2;
				e2-= gape2;
				d |= e2 > h2? 1<<5 : 0;
				e2 = e2 > h2? e2 : h2;
				p->e2 = e2;
				f2-= gape2;
				d |= f2 > h2? 1<<6 : 0;
				f2 = f2 > h2? f2 : h2;
				zi[j - st] = d; // z[i,j] keeps h for the current cell and e/f for the next cell
			}
		} else {
			uint8_t *zi = &z[(long)i * n_col];
			off[i] = st;
			for (j = st; j <= en; ++j) {
				eh_t *p = &eh[j];
				int32_t h = p->h, h2, e = p->e, e2 = p->e2;
				uint8_t d; // direction
				p->h = h1;
				h += q[j];
				d = h > e?  0 : 1;
				h = h > e?  h : e;
				d = h > f?  d : 2;
				h = h > f?  h : f;
				d = h > e2? d : 3;
				h = h > e2? h : e2;
				d = h > f2? d : 4;
				h = h > f2? h : f2;
				h1 = h;
				max_j = max > h? max_j : j;
				max   = max > h? max   : h;
				h -= gapoe;
				e -= gape;
				d |= e >= h? 1<<3 : 0;
				e  = e >= h? e    : h;
				p->e = e;
				f -= gape;
				d |= f >= h? 1<<4 : 0; // if we want to halve the memory, use one bit only, instead of two
				f  = f >= h? f    : h;
				h2 = h1 - gapoe2;
				e2-= gape2;
				d |= e2 >= h2? 1<<5 : 0;
				e2 = e2 >= h2? e2 : h2;
				p->e2 = e2;
				f2-= gape2;
				d |= f2 >= h2? 1<<6 : 0;
				f2 = f2 >= h2? f2 : h2;
				zi[j - st] = d; // z[i,j] keeps h for the current cell and e/f for the next cell
			}
		}
		eh[j].h = h1, eh[j].e = KSW_NEG_INF;
		// update ez
		if (en == qlen - 1 && eh[qlen].h > ez->mqe)
			ez->mqe = eh[qlen].h, ez->mqe_t = i;
		if (i == tlen - 1)
			ez->mte = max, ez->mte_q = max_j;
		if (ksw_apply_zdrop(ez, 0, max, i, max_j, zdrop, gape2)) break;
		if (i == tlen - 1 && en == qlen - 1)
			ez->score = eh[qlen].h;
	}
	kfree(km, qp); kfree(km, eh);
	if (with_cigar) {
		int rev_cigar = !!(flag & KSW_EZ_REV_CIGAR);
		if (!ez->zdropped && !(flag&KSW_EZ_EXTZ_ONLY))
			ksw_backtrack(km, 0, rev_cigar, 0, z, off, 0, n_col, tlen-1, qlen-1, &ez->m_cigar, &ez->n_cigar, &ez->cigar);
		else if (ez->max_t >= 0 && ez->max_q >= 0)
			ksw_backtrack(km, 0, rev_cigar, 0, z, off, 0, n_col, ez->max_t, ez->max_q, &ez->m_cigar, &ez->n_cigar, &ez->cigar);
		kfree(km, z); kfree(km, off);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %r8, 0xf0(%rsp)
movl %ecx, %r8d
movq %rdx, %rbx
movl %esi, %r14d
movq 0x170(%rsp), %rdx
movl 0x168(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x160(%rsp), %eax
movl %eax, 0x5c(%rsp)
movq 0x130(%rsp), %r13
movl 0x158(%rsp), %eax
movsbl 0x148(%rsp), %ecx
movq %rcx, 0x48(%rsp)
movsbl 0x150(%rsp), %r12d
movsbl 0x138(%rsp), %ecx
movq %rcx, 0x40(%rsp)
movsbl 0x140(%rsp), %ecx
movq %rcx, 0x50(%rsp)
movabsq $-0x3fffffff00000001, %rcx # imm = 0xC0000000FFFFFFFF
movq %rcx, 0x18(%rdx)
movq %rcx, 0x10(%rdx)
movq %rcx, 0x8(%rdx)
movq %r8, 0x60(%rsp)
cmpl %esi, %r8d
movl %esi, %ecx
cmovgl %r8d, %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
movl $0x0, 0x24(%rdx)
movq %rcx, 0x88(%rsp)
leal 0x1(,%rcx,2), %ebp
cmpl %esi, %ebp
cmovgel %esi, %ebp
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rdx, 0xa8(%rsp)
movq %rax, (%rdx)
movl %r9d, 0x38(%rsp)
movl %r9d, %eax
imull %esi, %eax
movslq %eax, %rsi
movq %rdi, %r15
callq 0x1fbb36
movq %rax, 0x90(%rsp)
movq %r14, 0x68(%rsp)
leal 0x1(%r14), %eax
movq %r15, %r14
movslq %eax, %rsi
movl $0xc, %edx
movq %r15, %rdi
callq 0x1fbc8d
movq 0x60(%rsp), %rcx
movq %rax, 0xb0(%rsp)
testb $0x1, 0x1c(%rsp)
movq %r15, 0xc0(%rsp)
movl %ebp, 0x58(%rsp)
jne 0x1fbe90
movslq %ebp, %rsi
movslq %ecx, %r15
imulq %r15, %rsi
movq %r14, %rdi
callq 0x1fbb36
movq %rax, 0x20(%rsp)
movl $0x4, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x1fbc8d
movq %rax, 0x28(%rsp)
jmp 0x1fbea2
movq $0x0, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x50(%rsp), %r14
movq 0x40(%rsp), %rbp
leal (%r14,%rbp), %eax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
addl %r12d, %eax
movq %rax, 0x8(%rsp)
movl 0x38(%rsp), %eax
testb %al, %al
movq 0x68(%rsp), %r11
movq 0xb0(%rsp), %r15
jle 0x1fbf1d
movl %eax, %eax
movl %r11d, %ecx
xorl %edx, %edx
xorl %esi, %esi
testl %r11d, %r11d
jle 0x1fbf15
movq %rdx, %rdi
imulq %rax, %rdi
addq %r13, %rdi
movslq %esi, %r8
addq 0x90(%rsp), %r8
xorl %r9d, %r9d
movzbl (%rbx,%r9), %r10d
movb (%rdi,%r10), %r10b
movb %r10b, (%r8,%r9)
incq %r9
cmpq %r9, %rcx
jne 0x1fbefd
addl %r9d, %esi
incq %rdx
cmpq %rax, %rdx
jne 0x1fbee0
movl $0x0, (%r15)
movq 0x10(%rsp), %rbx
leal (%rbx,%rbx), %eax
negl %eax
movl %eax, 0x4(%r15)
movq 0x8(%rsp), %r13
leal (,%r13,2), %eax
negl %eax
movl %eax, 0x8(%r15)
movq 0x88(%rsp), %rdx
cmpl %edx, %r11d
cmovll %r11d, %edx
testl %edx, %edx
jle 0x1fbfc3
incl %edx
movq 0x48(%rsp), %rax
leal (%rax,%r12,2), %ecx
leal (%rbp,%r14,2), %esi
leaq 0x14(%r15), %rdi
movl $0x1, %eax
movl %ebx, %r8d
movl %r13d, %r9d
cmpl %r8d, %r9d
movl %r8d, %r10d
cmovll %r9d, %r10d
negl %r10d
movl %r10d, -0x8(%rdi)
cmpl %esi, %ecx
movl %esi, %r10d
cmovll %ecx, %r10d
negl %r10d
movl %r10d, %r11d
subl %ebx, %r11d
movl %r11d, -0x4(%rdi)
subl %r13d, %r10d
movl %r10d, (%rdi)
incq %rax
addl %r12d, %ecx
addl %r12d, %r9d
addl %r14d, %esi
addl %r14d, %r8d
addq $0xc, %rdi
cmpq %rax, %rdx
jne 0x1fbf77
movq 0x68(%rsp), %r11
jmp 0x1fbfc8
movl $0x1, %eax
cmpl %r11d, %eax
movq 0x60(%rsp), %rsi
jg 0x1fc001
movl %eax, %ecx
decl %eax
leaq (%rcx,%rcx,2), %rcx
leaq (%r15,%rcx,4), %rcx
addq $0x8, %rcx
movabsq $-0x3fffffff40000000, %rdx # imm = 0xC0000000C0000000
movl $0xc0000000, (%rcx)     # imm = 0xC0000000
movq %rdx, -0x8(%rcx)
incl %eax
addq $0xc, %rcx
cmpl %r11d, %eax
jl 0x1fbfec
testl %esi, %esi
jle 0x1fc5ce
movq 0x88(%rsp), %rsi
leal (%rsi,%rsi), %eax
leal -0x1(%r11), %edi
movslq %r11d, %rcx
leaq (%rcx,%rcx,2), %rdx
leaq (%r15,%rdx,4), %rdx
movq %rdx, 0xa0(%rsp)
movq 0x60(%rsp), %rdx
leal -0x1(%rdx), %r10d
movl %esi, %r8d
movq %r8, 0xe0(%rsp)
movl %edi, 0x9c(%rsp)
movslq %edi, %r14
movl %edx, %edx
movq %rdx, 0xd0(%rsp)
movslq %esi, %rdx
movq %rdx, %rdi
notq %rdi
movq %rdi, 0x80(%rsp)
negl %esi
movl %esi, 0x98(%rsp)
shlq $0x2, %rdx
leaq (%rdx,%rdx,2), %rdx
negq %rdx
addq %r15, %rdx
addq $0x8, %rdx
movq %rdx, 0x78(%rsp)
cltq
incq %rax
cmpq %rcx, %rax
cmovgeq %rcx, %rax
movq %rax, 0xc8(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x70(%rsp)
xorl %ebp, %ebp
xorl %edi, %edi
movq %r12, 0x48(%rsp)
movq %r10, 0xe8(%rsp)
movq %r14, 0xd8(%rsp)
movq 0x88(%rsp), %rcx
movl %ecx, %eax
subl %ebp, %eax
movl %ebp, %esi
cmovgl %ecx, %esi
negl %eax
movl %esi, %r9d
addl 0x98(%rsp), %r9d
movq 0xf0(%rsp), %rcx
movzbl (%rcx,%rbp), %ecx
imull %r11d, %ecx
movslq %ecx, %r14
addq 0x90(%rsp), %r14
movq 0xe0(%rsp), %rcx
cmpq %rcx, %rbp
movl $0x0, %edx
cmovbel %edx, %eax
leaq (%rcx,%rbp), %rdx
movl 0x9c(%rsp), %ecx
cmpl %ecx, %edx
movq %rdx, 0xb8(%rsp)
cmovll %edx, %ecx
leaq (,%rsi,4), %r8
movl %ebp, %r10d
imull %r12d, %r10d
addl %r13d, %r10d
movl %ebp, %edx
imull 0x50(%rsp), %edx
addl %ebx, %edx
cmpl %edx, %r10d
cmovll %r10d, %edx
negl %edx
movl %edx, %r10d
subl %ebx, %r10d
movl %edx, %ebx
subl %r13d, %ebx
testl %eax, %eax
movl $0xc0000000, %r15d      # imm = 0xC0000000
cmovgl %r15d, %edx
cmovgl %r15d, %r10d
leaq (%r8,%r8,2), %r11
cmovgl %r15d, %ebx
movl 0x1c(%rsp), %r15d
testb $0x1, %r15b
movq %rbp, 0x30(%rsp)
jne 0x1fc2a1
movq 0x28(%rsp), %r8
movl %eax, (%r8,%rbp,4)
movl $0xc0000000, %r13d      # imm = 0xC0000000
testb $0x2, %r15b
jne 0x1fc35a
cmpl %ecx, %eax
jg 0x1fc362
movq 0x80(%rsp), %r8
addq %rsi, %r8
addq 0x78(%rsp), %r11
cltq
movslq %ecx, %rcx
movq %rcx, 0x40(%rsp)
movq 0x70(%rsp), %rcx
subq %rax, %rcx
movq %rcx, 0x38(%rsp)
movl -0x8(%r11), %eax
movl -0x4(%r11), %esi
movl (%r11), %ecx
movl %edx, -0x8(%r11)
movsbl 0x1(%r14,%r8), %edx
addl %eax, %edx
xorl %eax, %eax
cmpl %esi, %edx
cmovlel %esi, %edx
setl %al
cmpl %r10d, %edx
cmovlel %r10d, %edx
movl $0x2, %ebp
cmovll %ebp, %eax
cmpl %ecx, %edx
cmovlel %ecx, %edx
movl $0x3, %ebp
cmovll %ebp, %eax
cmpl %ebx, %edx
cmovlel %ebx, %edx
movl $0x4, %ebp
cmovll %ebp, %eax
cmpl %edx, %r13d
cmovlel %r9d, %edi
cmovlel %edx, %r13d
movl %edx, %ebp
subl 0x10(%rsp), %ebp
movq 0x50(%rsp), %r12
subl %r12d, %esi
cmpl %ebp, %esi
setg %r15b
cmovlel %ebp, %esi
shlb $0x3, %r15b
orb %al, %r15b
movl %esi, -0x4(%r11)
subl %r12d, %r10d
movq 0x48(%rsp), %r12
cmpl %ebp, %r10d
setg %al
cmovlel %ebp, %r10d
shlb $0x4, %al
movl %edx, %esi
subl 0x8(%rsp), %esi
subl %r12d, %ecx
cmpl %esi, %ecx
cmovlel %esi, %ecx
movl %ecx, (%r11)
setg %cl
shlb $0x5, %cl
subl %r12d, %ebx
cmpl %esi, %ebx
cmovlel %esi, %ebx
setg %sil
orb %al, %cl
orb %r15b, %cl
shlb $0x6, %sil
orb %sil, %cl
movq 0x38(%rsp), %rax
movb %cl, 0x1(%rax,%r8)
incq %r8
incl %r9d
addq $0xc, %r11
cmpq 0x40(%rsp), %r8
jl 0x1fc1c2
jmp 0x1fc365
movl $0xc0000000, %r13d      # imm = 0xC0000000
cmpl %ecx, %eax
jg 0x1fc362
movq 0x80(%rsp), %rax
addq %rsi, %rax
addq 0x78(%rsp), %r11
movslq %ecx, %rsi
movl -0x8(%r11), %r15d
movl -0x4(%r11), %r8d
movl (%r11), %ecx
movl %edx, -0x8(%r11)
movsbl 0x1(%r14,%rax), %edx
addl %r15d, %edx
cmpl %r8d, %edx
cmovlel %r8d, %edx
cmpl %r10d, %edx
jg 0x1fc2e9
movl %r10d, %edx
cmpl %ecx, %edx
movq 0x50(%rsp), %rbp
jg 0x1fc2f4
movl %ecx, %edx
cmpl %ebx, %edx
cmovlel %ebx, %edx
cmpl %edx, %r13d
cmovlel %r9d, %edi
cmovlel %edx, %r13d
movl %edx, %r15d
subl 0x10(%rsp), %r15d
subl %ebp, %r8d
cmpl %r15d, %r8d
jg 0x1fc317
movl %r15d, %r8d
movl %r8d, -0x4(%r11)
subl %ebp, %r10d
cmpl %r15d, %r10d
cmovlel %r15d, %r10d
movl %edx, %r8d
subl 0x8(%rsp), %r8d
subl %r12d, %ecx
cmpl %r8d, %ecx
jg 0x1fc338
movl %r8d, %ecx
movl %ecx, (%r11)
subl %r12d, %ebx
cmpl %r8d, %ebx
cmovlel %r8d, %ebx
incq %rax
incl %r9d
addq $0xc, %r11
cmpq %rsi, %rax
jl 0x1fc2c2
jmp 0x1fc365
cmpl %ecx, %eax
jle 0x1fc4bc
movl %eax, %r9d
movslq %r9d, %rax
leaq (%rax,%rax,2), %rax
movq 0xb0(%rsp), %r15
movl %edx, (%r15,%rax,4)
movl $0xc0000000, 0x4(%r15,%rax,4) # imm = 0xC0000000
movq 0xd8(%rsp), %r14
cmpq %r14, 0xb8(%rsp)
movq 0xa8(%rsp), %r9
movq 0x30(%rsp), %rbp
jl 0x1fc3b8
movq 0xa0(%rsp), %rax
movl (%rax), %eax
cmpl 0xc(%r9), %eax
jle 0x1fc3b8
movl %eax, 0xc(%r9)
movl %ebp, 0x10(%r9)
movq 0xe8(%rsp), %r10
cmpq %r10, %rbp
movq 0x68(%rsp), %r11
jne 0x1fc3d2
movl %r13d, 0x14(%r9)
movl %edi, 0x18(%r9)
movl (%r9), %eax
movl %eax, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
subl %r13d, %edx
jge 0x1fc3fe
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %r13d, %eax
movl %eax, (%r9)
movl %ebp, 0x8(%r9)
movl %edi, 0x4(%r9)
jmp 0x1fc407
movslq 0x8(%r9), %rsi
cmpq %rsi, %rbp
jge 0x1fc468
xorl %ecx, %ecx
movq 0x10(%rsp), %rbx
movq 0x8(%rsp), %r13
cmpq %r10, %rbp
setne %al
cmpq %r14, 0xb8(%rsp)
setl %dl
orb %cl, %dl
orb %al, %dl
jne 0x1fc438
movq 0xa0(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x1c(%r9)
incq %rbp
cmpq 0xd0(%rsp), %rbp
sete %al
orb %al, %cl
movq 0x70(%rsp), %rax
addq 0xc8(%rsp), %rax
movq %rax, 0x70(%rsp)
cmpb $0x1, %cl
jne 0x1fc0bb
jmp 0x1fc5ce
xorl %ecx, %ecx
cmpl $0x0, 0x5c(%rsp)
movq 0x10(%rsp), %rbx
movq 0x8(%rsp), %r13
js 0x1fc5c4
movl 0x4(%r9), %r8d
cmpl %edi, %r8d
movq 0x30(%rsp), %rbp
jg 0x1fc413
addl %edi, %esi
movl %ebp, %ecx
subl %esi, %ecx
addl %r8d, %ecx
movl %ecx, %esi
negl %esi
cmovsl %ecx, %esi
imull %r12d, %esi
addl 0x5c(%rsp), %esi
cmpl %esi, %edx
jle 0x1fc5c2
orl $0x80000000, %eax       # imm = 0x80000000
movl %eax, (%r9)
movb $0x1, %cl
jmp 0x1fc5c4
movq 0x80(%rsp), %r8
addq %rsi, %r8
addq 0x78(%rsp), %r11
cltq
movslq %ecx, %rcx
movq %rcx, 0x40(%rsp)
movq 0x70(%rsp), %rcx
subq %rax, %rcx
movq %rcx, 0x38(%rsp)
movl -0x8(%r11), %eax
movl -0x4(%r11), %esi
movl (%r11), %ecx
movl %edx, -0x8(%r11)
movsbl 0x1(%r14,%r8), %edx
addl %eax, %edx
xorl %eax, %eax
cmpl %esi, %edx
cmovlel %esi, %edx
setle %al
cmpl %r10d, %edx
cmovlel %r10d, %edx
movl $0x2, %ebp
cmovlel %ebp, %eax
cmpl %ecx, %edx
cmovlel %ecx, %edx
movl $0x3, %ebp
cmovlel %ebp, %eax
cmpl %ebx, %edx
cmovlel %ebx, %edx
movl $0x4, %ebp
cmovlel %ebp, %eax
cmpl %edx, %r13d
cmovlel %r9d, %edi
cmovlel %edx, %r13d
movl %edx, %ebp
subl 0x10(%rsp), %ebp
movq 0x50(%rsp), %r12
subl %r12d, %esi
cmpl %ebp, %esi
setge %r15b
cmovlel %ebp, %esi
shlb $0x3, %r15b
orb %al, %r15b
movl %esi, -0x4(%r11)
subl %r12d, %r10d
movq 0x48(%rsp), %r12
cmpl %ebp, %r10d
setge %al
cmovlel %ebp, %r10d
shlb $0x4, %al
movl %edx, %esi
subl 0x8(%rsp), %esi
subl %r12d, %ecx
cmpl %esi, %ecx
cmovlel %esi, %ecx
movl %ecx, (%r11)
setge %cl
shlb $0x5, %cl
subl %r12d, %ebx
cmpl %esi, %ebx
cmovlel %esi, %ebx
setge %sil
orb %al, %cl
orb %r15b, %cl
shlb $0x6, %sil
orb %sil, %cl
movq 0x38(%rsp), %rax
movb %cl, 0x1(%rax,%r8)
incq %r8
incl %r9d
addq $0xc, %r11
cmpq 0x40(%rsp), %r8
jl 0x1fc4e3
jmp 0x1fc365
xorl %ecx, %ecx
movq 0x30(%rsp), %rbp
jmp 0x1fc413
movq 0xc0(%rsp), %rbx
movq %rbx, %rdi
movq 0x90(%rsp), %rsi
callq 0x1fb9e5
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1fb9e5
movl 0x1c(%rsp), %ecx
testb $0x1, %cl
jne 0x1fc64c
movq 0xa8(%rsp), %r11
leaq 0x24(%r11), %rax
movl %ecx, %esi
shrl $0x7, %esi
andl $0x1, %esi
testb $0x40, %cl
jne 0x1fc65e
cmpl $0x0, (%r11)
js 0x1fc65e
movq 0x60(%rsp), %r9
decl %r9d
movq 0x68(%rsp), %r14
decl %r14d
leaq 0x20(%r11), %r10
addq $0x28, %r11
movq %rbx, %rdi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
movl 0x58(%rsp), %r8d
pushq %r11
pushq %rax
pushq %r10
pushq %r14
jmp 0x1fc694
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x8(%r11), %r9d
testl %r9d, %r9d
movl 0x58(%rsp), %r8d
js 0x1fc69d
movl 0x4(%r11), %r10d
testl %r10d, %r10d
js 0x1fc69d
movq %r11, %r14
addq $0x20, %r11
addq $0x28, %r14
movq %rbx, %rdi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
pushq %r14
pushq %rax
pushq %r11
pushq %r10
callq 0x1fc6c8
addq $0x20, %rsp
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x1fb9e5
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1fb9e5