// File: /workspace/github_c_makefile_star2_O3/lh3[P]fermi-lite/bfc.c
// Function: bfc_ec1dir
static int bfc_ec1dir(bfc_ec1buf_t *e, const ecseq_t *seq, ecseq_t *ec, int start, int end, int *max_heap)
{
	echeap1_t z;
	int i, l, rv = -1, path[BFC_MAX_PATHS], n_paths = 0, min_path = -1, min_path_pen = INT_MAX, n_failures = 0;
	assert(end <= seq->n && end - start >= e->opt->k);
	e->heap.n = e->stack.n = 0;
	*max_heap = 0;
	memset(&z, 0, sizeof(echeap1_t));
	kv_resize(ecbase_t, *ec, seq->n);
	ec->n = seq->n;
	for (z.i = start, l = 0; z.i < end; ++z.i) {
		int c = seq->a[z.i].b;
		if (c < 4) {
			if (++l == e->opt->k) break;
			bfc_kmer_append(e->opt->k, z.x.x, c);
		} else l = 0, z.x = bfc_kmer_null;
	}
	assert(z.i < end); // before calling this function, there must be at least one solid k-mer
	z.k = -1;
	for (i = 0; i < BFC_EC_HIST; ++i) z.ecpos[i] = -1;
	for (i = 0; i < BFC_EC_HIST_HIGH; ++i) z.ecpos_high[i] = -1;
	kv_push(echeap1_t, e->heap, z);
	for (i = 0; i < seq->n; ++i) ec->a[i].b = seq->a[i].b, ec->a[i].ob = seq->a[i].ob;
	// exhaustive error correction
	while (1) {
		int stop = 0;
		*max_heap = *max_heap > 255? 255 : *max_heap > e->heap.n? *max_heap : e->heap.n;
		if (e->heap.n == 0) { // may happen when there is an uncorrectable "N"
			rv = -2;
			break;
		}
		z = e->heap.a[0];
		e->heap.a[0] = kv_pop(e->heap);
		ks_heapdown_ec(0, e->heap.n, e->heap.a);
		if (min_path >= 0 && z.tot_pen > min_path_pen + e->opt->max_path_diff) break;
		if (z.i - end > e->opt->max_end_ext) stop = 1;
		if (!stop) {
			ecbase_t *c = z.i < seq->n? &seq->a[z.i] : 0;
			int b, os = -1, fixed = 0, other_ext = 0, n_added = 0, added_cnt[4];
			bfc_penalty_t added[4];
			// test if the read extension alone is enough
			if (z.i > end) fixed = 1;
			if (c && c->b < 4) { // A, C, G or T
				bfc_kmer_t x = z.x;
				bfc_kmer_append(e->opt->k, x.x, c->b);
				os = bfc_ch_kmer_occ(e->ch, &x);
				if (c->q && (os&0xff) >= e->opt->min_cov + 1 && c->lcov >= e->opt->min_cov + 1) fixed = 1;
				else if (c->hcov > e->opt->k * .75) fixed = 1;
			}
			// extension
			for (b = 0; b < 4; ++b) {
				bfc_penalty_t pen;
				if (fixed && c && b != c->b) continue;
				if (c == 0 || b != c->b) {
					int s;
					bfc_kmer_t x = z.x;
					pen.ec = 0, pen.ec_high = 0, pen.absent = 0, pen.absent_high = 0, pen.b = b;
					if (c) { // not over the end
						if (c->q && z.ecpos_high[BFC_EC_HIST_HIGH-1] >= 0 && z.i - z.ecpos_high[BFC_EC_HIST_HIGH-1] < e->opt->win_multi_ec) continue; // no close highQ corrections
						if (z.ecpos[BFC_EC_HIST-1] >= 0 && z.i - z.ecpos[BFC_EC_HIST-1] < e->opt->win_multi_ec) continue; // no clustered corrections
					}
					bfc_kmer_append(e->opt->k, x.x, b);
					s = bfc_ch_kmer_occ(e->ch, &x);
					if (s < 0 || (s&0xff) < e->opt->min_cov) continue; // not solid
					//if (os >= 0 && (s&0xff) - (os&0xff) < 2) continue; // not sufficiently better than the read path
					pen.ec = c && c->b < 4? 1 : 0;
					pen.ec_high = pen.ec? c->oq : 0;
					pen.absent = 0;
					pen.absent_high = ((s>>8&0xff) < e->opt->min_cov);
					pen.b = b;
					added_cnt[n_added] = s;
					added[n_added++] = pen;
					++other_ext;
				} else {
					pen.ec = pen.ec_high = 0;
					pen.absent = (os < 0 || (os&0xff) < e->opt->min_cov);
					pen.absent_high = (os < 0 || (os>>8&0xff) < e->opt->min_cov);
					pen.b = b;
					added_cnt[n_added] = os;
					added[n_added++] = pen;
				}
			} // ~for(b)
			if (fixed == 0 && other_ext == 0) ++n_failures;
			if (n_failures > seq->n * 2) {
				rv = -3;
				break;
			}
			if (c || n_added == 1) {
				if (n_added > 1 && e->heap.n > e->opt->max_heap) { // to prevent heap explosion
					int min_b = -1, min = INT_MAX;
					for (b = 0; b < n_added; ++b) {
						int t = weighted_penalty(e->opt, added[b]);
						if (min > t) min = t, min_b = b;
					}
					buf_update(e, &z, added[min_b], added_cnt[min_b]);
				} else {
					for (b = 0; b < n_added; ++b)
						buf_update(e, &z, added[b], added_cnt[b]);
				}
			} else {
				if (n_added == 0)
					e->stack.a[z.k].tot_pen += e->opt->w_absent * (e->opt->max_end_ext - (z.i - end));
				stop = 1;
			}
		} // ~if(!stop)
		if (stop) {
			if (e->stack.a[z.k].tot_pen < min_path_pen)
				min_path_pen = e->stack.a[z.k].tot_pen, min_path = n_paths;
			path[n_paths++] = z.k;
			if (n_paths == BFC_MAX_PATHS) break;
		}
	} // ~while(1)
	// backtrack
	if (n_paths == 0) return rv;
	assert(min_path >= 0 && min_path < n_paths && e->stack.a[path[min_path]].tot_pen == min_path_pen);
	rv = buf_backtrack(e->stack.a, path[min_path], seq, ec);
	for (i = 0; i < ec->n; ++i) // mask out uncorrected regions
		if (i < start + e->opt->k || i >= end) ec->a[i].b = 4;
	return rv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rdx, %r15
movslq %r8d, %rdx
cmpq %rdx, (%rsi)
jb 0x6ec1
movl %r8d, %r13d
movl %ecx, %ebx
movq %rdi, %r11
movl %r8d, %eax
subl %ecx, %eax
movq (%rdi), %rcx
cmpl 0x8(%rcx), %eax
jl 0x6ec1
movq %r9, %r14
movq %rsi, %r12
xorl %eax, %eax
movq %rax, 0x28(%r11)
movq %rax, 0x10(%r11)
movl $0x0, (%r9)
movq %rax, 0xd0(%rsp)
pxor %xmm0, %xmm0
movdqa %xmm0, 0xc0(%rsp)
movdqa %xmm0, 0xb0(%rsp)
movdqa %xmm0, 0xa0(%rsp)
movdqa %xmm0, 0x90(%rsp)
movq (%rsi), %rax
cmpq %rax, 0x8(%r15)
movq %r11, 0x18(%rsp)
movq %rdx, 0xe0(%rsp)
jae 0x64bb
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x8(%r15)
movq 0x10(%r15), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x21c0
movq 0x18(%rsp), %r11
movq %rax, 0x10(%r15)
movq (%r12), %rax
movq %rax, (%r15)
cmpl %ebx, %r13d
jle 0x65b3
movslq %ebx, %rax
movq %rax, 0x108(%rsp)
leaq (,%rax,8), %rax
addq 0x10(%r12), %rax
xorl %edx, %edx
movzbl (%rax), %esi
andl $0x7, %esi
cmpb $0x3, %sil
ja 0x6583
incl %edx
movq (%r11), %rcx
movl 0x8(%rcx), %ecx
cmpl %ecx, %edx
je 0x65d2
movq $-0x1, %rdi
shlq %cl, %rdi
notq %rdi
movl %esi, %r8d
andl $0x1, %r8d
movq 0xb8(%rsp), %r9
movq 0xc0(%rsp), %r10
leaq (%r8,%r9,2), %r9
andq %rdi, %r9
movq %r9, 0xb8(%rsp)
shrl %esi
leaq (%rsi,%r10,2), %r9
andq %rdi, %r9
movq %r9, 0xc0(%rsp)
movq 0xc8(%rsp), %rdi
xorq $0x1, %r8
decb %cl
shlq %cl, %r8
shrq %rdi
orq %rdi, %r8
movq %r8, 0xc8(%rsp)
xorq $0x1, %rsi
shlq %cl, %rsi
movq 0xd0(%rsp), %rcx
shrq %rcx
orq %rcx, %rsi
movq %rsi, 0xd0(%rsp)
jmp 0x65a4
movups 0x16d06(%rip), %xmm0    # 0x1d290
leaq 0xb8(%rsp), %rcx
movups %xmm0, 0x10(%rcx)
movdqu 0x16ce2(%rip), %xmm0    # 0x1d280
movdqu %xmm0, (%rcx)
xorl %edx, %edx
incl %ebx
addq $0x8, %rax
cmpl %ebx, %r13d
jne 0x64e1
leaq 0x10f77(%rip), %rdi     # 0x17531
leaq 0x10f1e(%rip), %rsi     # 0x174df
leaq 0x10f1d(%rip), %rcx     # 0x174e5
movl $0x18f, %edx            # imm = 0x18F
callq 0x20e0
movl %ebx, 0x94(%rsp)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x98(%rsp)
movdqu %xmm0, 0xa8(%rsp)
movq 0x10(%r11), %rcx
cmpq 0x18(%r11), %rcx
jne 0x662d
leaq (%rcx,%rcx), %rax
testq %rcx, %rcx
movl $0x2, %ecx
cmovneq %rax, %rcx
movq %rcx, 0x18(%r11)
movq 0x20(%r11), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,8), %rsi
callq 0x21c0
movq 0x18(%rsp), %r11
movq %rax, 0x20(%r11)
movq 0x10(%r11), %rcx
jmp 0x6631
movq 0x20(%r11), %rax
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r11)
leaq (%rcx,%rcx,8), %rcx
leaq (%rax,%rcx,8), %rdi
leaq 0x90(%rsp), %rsi
movl $0x9, %ecx
rep  movsq (%rsi), %es:(%rdi)
cmpq $0x0, (%r12)
je 0x669f
xorl %eax, %eax
movq 0x10(%r12), %rcx
movb (%rcx,%rax,8), %cl
andb $0x7, %cl
movq 0x10(%r15), %rdx
movb (%rdx,%rax,8), %sil
andb $-0x8, %sil
orb %cl, %sil
movb %sil, (%rdx,%rax,8)
movq 0x10(%r12), %rcx
movb (%rcx,%rax,8), %cl
andb $0x70, %cl
movq 0x10(%r15), %rdx
movb (%rdx,%rax,8), %sil
andb $-0x71, %sil
orb %cl, %sil
movb %sil, (%rdx,%rax,8)
incq %rax
cmpq %rax, (%r12)
ja 0x665a
movl $0x7fffffff, 0xc(%rsp)  # imm = 0x7FFFFFFF
movl $0xffffffff, 0x10(%rsp) # imm = 0xFFFFFFFF
movq $0x0, 0x28(%rsp)
leaq 0x90(%rsp), %rbp
movl $0x0, 0x38(%rsp)
movq %r15, 0x68(%rsp)
movq %r12, 0x118(%rsp)
movq %r14, 0xe8(%rsp)
movl %r13d, 0x34(%rsp)
movslq (%r14), %rcx
cmpq $0xff, %rcx
jle 0x66f9
movq 0x10(%r11), %rdx
movl $0xff, %eax
jmp 0x6705
movq 0x10(%r11), %rdx
cmpq %rcx, %rdx
movl %edx, %eax
cmovbl %ecx, %eax
movl %eax, (%r14)
testq %rdx, %rdx
je 0x6d0c
movq 0x20(%r11), %rax
movl $0x9, %ecx
movq %rbp, %rdi
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
decq %rdx
movq %rdx, 0x10(%r11)
leaq (%rdx,%rdx,8), %rcx
leaq (%rax,%rcx,8), %rsi
movl $0x9, %ecx
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq 0x10(%r11), %rsi
movq 0x20(%r11), %rdx
xorl %edi, %edi
callq 0x5564
movq 0x18(%rsp), %r11
movq (%r11), %rax
cmpl $0x0, 0x10(%rsp)
js 0x676f
movl 0x30(%rax), %ecx
addl 0xc(%rsp), %ecx
cmpl %ecx, 0x90(%rsp)
jg 0x6d1f
movslq 0x94(%rsp), %rbx
movl %ebx, %ecx
subl %r13d, %ecx
cmpl 0x14(%rax), %ecx
jg 0x6cb8
cmpq %rbx, (%r12)
jbe 0x68ba
movq 0x10(%r12), %rcx
xorl %ebp, %ebp
cmpl %r13d, %ebx
setg %bpl
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x68c8
leaq (%rcx,%rbx,8), %r15
movb $0x1, %r8b
testb $0x4, (%r15)
jne 0x68ce
leaq 0xb8(%rsp), %rcx
movupd (%rcx), %xmm0
movupd 0x10(%rcx), %xmm1
movapd %xmm1, 0x50(%rsp)
movapd %xmm0, 0x40(%rsp)
movb 0x8(%rax), %cl
movzbl (%r15), %edx
movl %edx, %eax
andl $0x6, %eax
movq $-0x1, %rsi
shlq %cl, %rsi
notq %rsi
andl $0x1, %edx
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %r8
leaq (%rdx,%rdi,2), %rdi
andq %rsi, %rdi
movq %rdi, 0x40(%rsp)
addq %r8, %r8
shrl %eax
orq %rax, %r8
andq %rsi, %r8
movq %r8, 0x48(%rsp)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdi
xorq $0x1, %rdx
decb %cl
shlq %cl, %rdx
shrq %rsi
orq %rsi, %rdx
movq %rdx, 0x50(%rsp)
xorq $0x1, %rax
shlq %cl, %rax
shrq %rdi
orq %rdi, %rax
movq %rax, 0x58(%rsp)
movq 0x8(%r11), %rdi
leaq 0x40(%rsp), %rsi
callq 0x14d3a
movq 0x18(%rsp), %r11
testb $0x8, (%r15)
movq (%r11), %rdi
je 0x6882
movzbl %al, %ecx
movl 0x10(%rdi), %edx
cmpl %edx, %ecx
jle 0x6882
movzwl 0x2(%r15), %esi
andl $0x3f, %esi
movl $0x1, %ecx
cmpl %esi, %edx
jl 0x68b1
movzwl 0x2(%r15), %ecx
shrl $0x6, %ecx
andl $0x3f, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x8(%rdi), %xmm1
mulsd 0x10bfc(%rip), %xmm1    # 0x174a0
ucomisd %xmm1, %xmm0
movl %ebp, %ecx
jbe 0x68b1
movl $0x1, %ecx
movl %ecx, %ebp
movb $0x1, %r8b
movl %eax, %edx
jmp 0x68ce
xorl %ebp, %ebp
cmpl %r13d, %ebx
setg %bpl
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %r8d, %r8d
xorl %r15d, %r15d
movl %ebp, 0x74(%rsp)
andb %r8b, %bpl
movl 0xa0(%rsp), %eax
movl 0xb4(%rsp), %ecx
movl %ebx, %esi
movl %eax, 0x8c(%rsp)
subl %eax, %esi
movl %esi, 0x7c(%rsp)
movq %rbx, 0x110(%rsp)
movl %ebx, %eax
movl %ecx, 0x88(%rsp)
subl %ecx, %eax
movl %eax, 0x78(%rsp)
movl %edx, %ecx
movl $0xff, %eax
andl %eax, %ecx
movl %ecx, 0x84(%rsp)
movl %edx, %ecx
shrl $0x8, %ecx
andl %eax, %ecx
movl %ecx, 0x80(%rsp)
xorl %r12d, %r12d
xorl %r9d, %r9d
movl $0x0, 0x3c(%rsp)
xorl %r14d, %r14d
movb %bpl, 0xb(%rsp)
movl %edx, 0x24(%rsp)
testb %bpl, %bpl
je 0x6957
movzbl (%r15), %eax
andl $0x7, %eax
cmpl %eax, %r14d
je 0x6963
jmp 0x6b1f
testq %r15, %r15
je 0x6997
movzbl (%r15), %eax
andl $0x7, %eax
cmpl %eax, %r14d
jne 0x6997
testl %edx, %edx
js 0x6ad6
movq (%r11), %rax
movl 0x10(%rax), %eax
cmpl %eax, 0x84(%rsp)
setl %cl
shlb $0x2, %cl
cmpl %eax, 0x80(%rsp)
setl %al
shlb $0x3, %al
orb %cl, %al
jmp 0x6ad8
leaq 0xb8(%rsp), %rax
movupd (%rax), %xmm0
movupd 0x10(%rax), %xmm1
movapd %xmm1, 0x50(%rsp)
movapd %xmm0, 0x40(%rsp)
testb %r8b, %r8b
je 0x69fc
cmpl $0x0, 0x8c(%rsp)
setns %al
movb (%r15), %cl
shrb $0x3, %cl
andb %al, %cl
movq (%r11), %rax
cmpb $0x1, %cl
jne 0x69e1
movl 0x7c(%rsp), %ecx
cmpl 0x18(%rax), %ecx
jl 0x6b1f
movl %r9d, %r13d
cmpl $0x0, 0x88(%rsp)
js 0x6a02
movl 0x78(%rsp), %ecx
cmpl 0x18(%rax), %ecx
jge 0x6a02
jmp 0x6aad
movl %r9d, %r13d
movq (%r11), %rax
movq %r8, %rbp
movb 0x8(%rax), %cl
movq $-0x1, %rdx
shlq %cl, %rdx
notq %rdx
movl %r14d, %esi
andl $0x1, %esi
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rdi
leaq (%rsi,%rax,2), %rax
andq %rdx, %rax
movq %rax, 0x40(%rsp)
movl %r14d, %eax
shrl %eax
leaq (%rax,%rdi,2), %rdi
andq %rdx, %rdi
movq %rdi, 0x48(%rsp)
movq 0x50(%rsp), %rdx
shrq %rdx
xorq $0x1, %rsi
decb %cl
shlq %cl, %rsi
orq %rdx, %rsi
movq %rsi, 0x50(%rsp)
movq 0x58(%rsp), %rdx
xorq $0x1, %rax
shlq %cl, %rax
shrq %rdx
orq %rdx, %rax
movq %rax, 0x58(%rsp)
movq 0x8(%r11), %rdi
leaq 0x40(%rsp), %rsi
movq %r11, %rbx
callq 0x14d3a
testl %eax, %eax
js 0x6aa3
movzbl %al, %edx
movq (%rbx), %rcx
movl 0x10(%rcx), %ecx
cmpl %ecx, %edx
movq %rbx, %r11
movq %rbp, %r8
movl %r13d, %r9d
jge 0x6ab7
movl 0x24(%rsp), %edx
jmp 0x6ab0
movq %rbx, %r11
movq %rbp, %r8
movl 0x24(%rsp), %edx
movl %r13d, %r9d
movb 0xb(%rsp), %bpl
jmp 0x6b1f
testb %r8b, %r8b
movb 0xb(%rsp), %bpl
je 0x6aee
movb (%r15), %sil
testb $0x4, %sil
jne 0x6aee
shrb $0x6, %sil
andb $0x2, %sil
movb $0x1, %dl
jmp 0x6af2
movb $0xc, %al
addb %r12b, %al
movslq %r9d, %rcx
movl %edx, 0xf0(%rsp,%rcx,4)
incl %r9d
movb %al, 0x14(%rsp,%rcx)
jmp 0x6b1f
xorl %edx, %edx
xorl %esi, %esi
movzbl %ah, %edi
cmpl %ecx, %edi
setl %cl
shlb $0x3, %cl
orb %sil, %cl
addb %r12b, %dl
addb %cl, %dl
movslq %r9d, %rcx
movl %eax, 0xf0(%rsp,%rcx,4)
leal 0x1(%rcx), %r9d
movb %dl, 0x14(%rsp,%rcx)
incl 0x3c(%rsp)
movl 0x24(%rsp), %edx
incl %r14d
addb $0x10, %r12b
cmpl $0x4, %r14d
jne 0x6941
xorl %eax, %eax
movl 0x3c(%rsp), %ecx
orl %ecx, 0x74(%rsp)
sete %al
movl 0x38(%rsp), %edx
addl %eax, %edx
movslq %edx, %rax
movq 0x118(%rsp), %r12
movq (%r12), %rcx
addq %rcx, %rcx
cmpq %rax, %rcx
leaq 0x90(%rsp), %rbp
jb 0x6d13
cmpl $0x1, %r9d
sete %al
orb %al, %r8b
cmpb $0x1, %r8b
movl %edx, 0x38(%rsp)
jne 0x6c79
cmpl $0x2, %r9d
movl 0x34(%rsp), %r13d
jl 0x6c35
movq (%r11), %rsi
movslq 0x34(%rsi), %rax
cmpq %rax, 0x10(%r11)
jbe 0x6c3b
movl 0x20(%rsi), %eax
movl 0x24(%rsi), %ecx
movl 0x28(%rsi), %edx
movl 0x2c(%rsi), %esi
movl %r9d, %edi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
xorl %r10d, %r10d
movzbl 0x14(%rsp,%r10), %r11d
movl %r11d, %ebx
andl $0x1, %ebx
imull %eax, %ebx
movl %r11d, %ebp
shrl %ebp
andl $0x1, %ebp
imull %ecx, %ebp
addl %ebx, %ebp
movl %r11d, %ebx
shrl $0x2, %ebx
andl $0x1, %ebx
imull %edx, %ebx
shrl $0x3, %r11d
andl $0x1, %r11d
imull %esi, %r11d
addl %ebx, %r11d
addl %ebp, %r11d
cmpl %r11d, %r9d
cmovgl %r10d, %r8d
cmovgel %r11d, %r9d
incq %r10
cmpq %r10, %rdi
jne 0x6bbc
movslq %r8d, %rax
movl 0xf0(%rsp,%rax,4), %ecx
movzbl 0x14(%rsp,%rax), %edx
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
leaq 0x90(%rsp), %rbp
movq %rbp, %rsi
callq 0x76e4
movq %rbx, %r11
jmp 0x6c67
cmpl $0x1, %r9d
jne 0x6c67
movl %r9d, %ebx
xorl %r14d, %r14d
movl 0xf0(%rsp,%r14,4), %ecx
movzbl 0x14(%rsp,%r14), %edx
movq %r11, %rdi
movq %rbp, %rsi
callq 0x76e4
movq 0x18(%rsp), %r11
incq %r14
cmpq %r14, %rbx
jne 0x6c41
movq 0x68(%rsp), %r15
movq 0xe8(%rsp), %r14
jmp 0x66e2
testl %r9d, %r9d
movl 0x34(%rsp), %r13d
jne 0x6cab
movl %r13d, %eax
subl 0x110(%rsp), %eax
movq (%r11), %rcx
addl 0x14(%rcx), %eax
movq 0x38(%r11), %rdx
imull 0x28(%rcx), %eax
movslq 0x98(%rsp), %rcx
shlq $0x4, %rcx
addl %eax, 0x8(%rdx,%rcx)
movq 0x68(%rsp), %r15
movq 0xe8(%rsp), %r14
movq 0x38(%r11), %rax
movslq 0x98(%rsp), %rcx
movq %rcx, %rdx
shlq $0x4, %rdx
movl 0x8(%rax,%rdx), %eax
movl 0xc(%rsp), %edx
cmpl %edx, %eax
movl 0x10(%rsp), %esi
movq 0x28(%rsp), %rdi
cmovll %edi, %esi
movl %esi, 0x10(%rsp)
cmovll %eax, %edx
movl %edx, 0xc(%rsp)
movl %edi, %eax
incl %edi
movl %ecx, 0x120(%rsp,%rax,4)
movq %rdi, 0x28(%rsp)
cmpl $0x4, %edi
jne 0x66e2
movl $0x4, %ecx
jmp 0x6d31
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x6d24
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
movq 0x68(%rsp), %r15
jmp 0x6d24
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq 0x28(%rsp), %rcx
testl %ecx, %ecx
je 0x6eaf
movl 0x10(%rsp), %eax
cmpl %ecx, %eax
jae 0x6ee0
movq 0x38(%r11), %rbx
movl %eax, %eax
movslq 0x120(%rsp,%rax,4), %r14
movq %r14, %rax
shlq $0x4, %rax
movl 0xc(%rsp), %ecx
cmpl %ecx, 0x8(%rbx,%rax)
jne 0x6ee0
movq (%r12), %rcx
cmpq %rcx, 0x8(%r15)
jae 0x6dc4
decq %rcx
movq %rcx, %rax
shrq %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%r15)
movq 0x10(%r15), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x21c0
movq 0x18(%rsp), %r11
movq %rax, 0x10(%r15)
movq (%r12), %rcx
movq 0xe0(%rsp), %r9
movq %rcx, (%r15)
xorl %eax, %eax
testl %r14d, %r14d
js 0x6e6d
movl %r14d, %edx
shlq $0x4, %rdx
leaq (%rbx,%rdx), %rcx
movslq 0x4(%rbx,%rdx), %rdx
cmpq %rdx, (%r12)
jbe 0x6e5e
movb 0xc(%rcx), %sil
movq 0x10(%r15), %rdi
movb (%rdi,%rdx,8), %r8b
andb $0x7, %sil
andb $-0x8, %r8b
orb %sil, %r8b
movb %r8b, (%rdi,%rdx,8)
movzbl 0xd(%rcx), %esi
movq 0x10(%r15), %rdi
movzwl 0x2(%rdi,%rdx,8), %r8d
andl $0x1, %esi
shll $0xe, %esi
andl $0xffffbfff, %r8d       # imm = 0xFFFFBFFF
orl %esi, %r8d
movw %r8w, 0x2(%rdi,%rdx,8)
movzbl 0xd(%rcx), %esi
movq 0x10(%r15), %rdi
movzwl 0x2(%rdi,%rdx,8), %r8d
andl $-0x4, %esi
shll $0xd, %esi
andl $0x7fff, %r8d           # imm = 0x7FFF
orl %esi, %r8d
movw %r8w, 0x2(%rdi,%rdx,8)
movzbl 0xd(%rcx), %edx
btl $0x2, %edx
adcl $0x0, %eax
movl (%rcx), %r14d
testl %r14d, %r14d
jns 0x6dda
movq (%r15), %rcx
testq %rcx, %rcx
movq 0x108(%rsp), %rdi
je 0x6eaf
xorl %edx, %edx
cmpq %r9, %rdx
jge 0x6e90
movq (%r11), %rsi
movslq 0x8(%rsi), %rsi
addq %rdi, %rsi
cmpq %rsi, %rdx
jge 0x6ea7
movq 0x10(%r15), %rcx
movb (%rcx,%rdx,8), %sil
andb $-0x8, %sil
orb $0x4, %sil
movb %sil, (%rcx,%rdx,8)
movq (%r15), %rcx
incq %rdx
cmpq %rdx, %rcx
ja 0x6e7c
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x105ed(%rip), %rdi     # 0x174b5
leaq 0x10610(%rip), %rsi     # 0x174df
leaq 0x1060f(%rip), %rcx     # 0x174e5
movl $0x182, %edx            # imm = 0x182
callq 0x20e0
leaq 0x10654(%rip), %rdi     # 0x1753b
leaq 0x105f1(%rip), %rsi     # 0x174df
leaq 0x105f0(%rip), %rcx     # 0x174e5
movl $0x1f0, %edx            # imm = 0x1F0
callq 0x20e0