// File: /workspace/github_c_makefile_star2_O1/ToniWestbrook[P]paladin/bwamem.c
// Function: mem_chain
mem_chain_v mem_chain(const mem_opt_t *opt, const bwt_t *bwt, const bntseq_t *bns, int len, const uint8_t *seq, void *buf)
{
	int i, b, e, l_rep;
	int64_t l_pac = bns->l_pac;
	mem_chain_v chain;
	kbtree_t(chn) *tree;
	smem_aux_t *aux;

	kv_init(chain);
	if (len < opt->min_seed_len) return chain; // if the query is shorter than the seed length, no match
	tree = kb_init(chn, KB_DEFAULT_SIZE);

	aux = buf? (smem_aux_t*)buf : smem_aux_init();

	mem_collect_intv(opt, bwt, len, seq, aux);

	for (i = 0, b = e = l_rep = 0; i < aux->mem.n; ++i) { // compute frac_rep
		bwtintv_t *p = &aux->mem.a[i];
		int sb = (p->info>>32), se = (uint32_t)p->info;
		if (p->x[2] <= opt->max_occ) continue;
		if (sb > e) l_rep += e - b, b = sb, e = se;
		else e = e > se? e : se;
	}
	l_rep += e - b;
	for (i = 0; i < aux->mem.n; ++i) {
		bwtintv_t *p = &aux->mem.a[i];
		int step, count, slen = (uint32_t)p->info - (p->info>>32); // seed length
		int64_t k;
		step = p->x[2] > opt->max_occ? p->x[2] / opt->max_occ : 1;
		for (k = count = 0; k < p->x[2] && count < opt->max_occ; k += step, ++count) {
			mem_chain_t tmp, *lower, *upper;
			mem_seed_t s;
			int rid, to_add = 0;
			s.rbeg = tmp.pos = bwt_sa(bwt, p->x[0] + k); // this is the base coordinate in the forward-reverse reference
			s.qbeg = p->info>>32;
			s.score= s.len = slen;
			rid = bns_intv2rid(bns, s.rbeg, s.rbeg + s.len);
			if (rid < 0) continue; // bridging multiple reference sequences or the forward-reverse boundary; TODO: split the seed; don't discard it!!!
			if (kb_size(tree)) {
				kb_intervalp(chn, tree, &tmp, &lower, &upper); // find the closest chain
				if (!lower || !test_and_merge(opt, l_pac, lower, &s, rid)) to_add = 1;
			} else to_add = 1;
			if (to_add) { // add the seed as a new chain
				tmp.n = 1; tmp.m = 4;
				tmp.seeds = calloc(tmp.m, sizeof(mem_seed_t));
				tmp.seeds[0] = s;
				tmp.rid = rid;
				tmp.is_alt = !!bns->anns[rid].is_alt;
				kb_putp(chn, tree, &tmp);
			}
		}
	}
	if (buf == 0) smem_aux_destroy(aux);

	kv_resize(mem_chain_t, chain, kb_size(tree));

	#define traverse_func(p_) (chain.a[chain.n++] = *(p_))
	__kb_traverse(mem_chain_t, tree, traverse_func);
	#undef traverse_func

	for (i = 0; i < chain.n; ++i) chain.a[i].frac_rep = (float)l_rep / len;
	logMessage(__func__, LOG_LEVEL_DEBUG, "* fraction of repetitive seeds: %.3f\n", (float)l_rep / len);

	kb_destroy(chn, tree);
	return chain;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r9, 0x10(%rsp)
movq %rdx, 0x48(%rsp)
movq %rdi, %rax
movq %rcx, 0x78(%rsp)
movq (%rcx), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq %rsi, 0x20(%rsp)
cmpl %r8d, 0x78(%rsi)
jg 0x150d4
movl %r8d, %ebx
movq %rcx, 0x70(%rsp)
movq %rax, 0x68(%rsp)
movq 0xf0(%rsp), %r14
movl $0x200, %edi            # imm = 0x200
callq 0x14212
movq %rax, 0x18(%rsp)
movq %r14, %r9
testq %r14, %r14
jne 0x14530
callq 0x1f0da
movq %rax, %r9
movq 0x20(%rsp), %rcx
movl 0x48(%rcx), %eax
andl $0x40, %eax
cmpl $0x1, %eax
movl $0x2, %eax
sbbl $0x0, %eax
movl %eax, 0x38(%rsp)
xorps %xmm0, %xmm0
cvtsi2ssl 0x78(%rcx), %xmm0
mulss 0x84(%rcx), %xmm0
movss %xmm0, 0x60(%rsp)
movq $0x0, (%r9)
testl %ebx, %ebx
movl %ebx, 0x34(%rsp)
movq %r9, 0x28(%rsp)
movq 0x10(%rsp), %rdx
jle 0x1468d
leaq 0x18(%r9), %r12
leaq 0x30(%r9), %rax
movq %rax, 0x50(%rsp)
xorl %r15d, %r15d
leaq 0x14b0e(%rip), %rbp     # 0x290a2
movslq %r15d, %rax
cmpb $0x15, (%rdx,%rax)
ja 0x14675
movq 0x50(%rsp), %rax
movq %rax, (%rsp)
movq 0x48(%rsp), %rdi
movl %ebx, %esi
movl %r15d, %ecx
movl 0x38(%rsp), %r8d
movq %r12, %r9
callq 0xfafe
movl %eax, %r15d
cmpq $0x0, (%r12)
je 0x1467a
xorl %r13d, %r13d
xorl %ebx, %ebx
movq 0x28(%rsp), %r9
movq 0x28(%r9), %r14
movq 0x18(%r14,%r13), %rax
movq %rax, %rcx
shrq $0x20, %rcx
subl %ecx, %eax
movq 0x20(%rsp), %rcx
cmpl %eax, 0x78(%rcx)
jg 0x1465e
movq 0x8(%r9), %rax
cmpq %rax, (%r9)
jne 0x14637
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r9)
movq 0x10(%r9), %rdi
shlq $0x5, %rsi
leaq 0x141af(%rip), %rdx     # 0x287d0
movl $0xc9, %ecx
movq %rbp, %r8
callq 0x22d64
movq 0x28(%rsp), %r9
movq %rax, 0x10(%r9)
addq %r13, %r14
movq (%r9), %rax
movq 0x10(%r9), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r9)
shlq $0x5, %rax
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rcx,%rax)
movups %xmm0, (%rcx,%rax)
incq %rbx
addq $0x20, %r13
cmpq %rbx, (%r12)
ja 0x145d9
movl 0x34(%rsp), %ebx
jmp 0x1467f
incl %r15d
jmp 0x14684
movq 0x28(%rsp), %r9
movq 0x10(%rsp), %rdx
cmpl %ebx, %r15d
jl 0x14594
movq (%r9), %rbx
testl %ebx, %ebx
jle 0x147eb
xorps %xmm0, %xmm0
cvtss2sd 0x60(%rsp), %xmm0
addsd 0x110f7(%rip), %xmm0    # 0x257a0
cvttsd2si %xmm0, %ebp
leaq 0x18(%r9), %r15
leaq 0x30(%r9), %rax
movq %rax, 0x38(%rsp)
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
xorl %r13d, %r13d
movq 0x10(%r9), %rdx
movq %r13, %rsi
shlq $0x5, %rsi
movq 0x18(%rdx,%rsi), %rax
movq %rax, %rcx
shrq $0x20, %rcx
movl %eax, %edi
subl %ecx, %edi
cmpl %ebp, %edi
jl 0x147df
addq %rsi, %rdx
movq 0x10(%rdx), %r8
movq 0x20(%rsp), %rdx
movslq 0x88(%rdx), %rdx
cmpq %rdx, %r8
ja 0x147df
addl %eax, %ecx
sarl %ecx
incl %r8d
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
movq 0x48(%rsp), %rdi
movl 0x34(%rsp), %esi
movq 0x10(%rsp), %rdx
movq %r15, %r9
callq 0xfafe
movq 0x28(%rsp), %r9
cmpq $0x0, (%r15)
je 0x147df
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x28(%r9), %rax
movq 0x18(%rax,%r14), %rax
movl %eax, %ecx
shrq $0x20, %rax
subq %rax, %rcx
movq 0x20(%rsp), %rax
movslq 0x78(%rax), %rax
cmpq %rax, %rcx
jb 0x147cf
movq 0x8(%r9), %rax
cmpq %rax, (%r9)
jne 0x147a3
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r9)
movq 0x10(%r9), %rdi
shlq $0x5, %rsi
leaq 0x14047(%rip), %rdx     # 0x287d0
movl $0xd8, %ecx
leaq 0x1490d(%rip), %r8      # 0x290a2
callq 0x22d64
movq 0x28(%rsp), %r9
movq %rax, 0x10(%r9)
movq (%r9), %rax
movq 0x10(%r9), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r9)
shlq $0x5, %rax
movq 0x28(%r9), %rdx
movupd (%rdx,%r14), %xmm0
movups 0x10(%rdx,%r14), %xmm1
movups %xmm1, 0x10(%rcx,%rax)
movupd %xmm0, (%rcx,%rax)
incq %r12
addq $0x20, %r14
cmpq %r12, (%r15)
ja 0x1473d
incq %r13
cmpq %rbx, %r13
jne 0x146c3
movl 0x34(%rsp), %r13d
testl %r13d, %r13d
movq 0x10(%rsp), %rdx
jle 0x148e1
movq 0x20(%rsp), %rax
cmpq $0x0, 0x30(%rax)
je 0x148e1
xorl %ebp, %ebp
leaq 0x80(%rsp), %rbx
movl $0x2, %r14d
leaq 0x13fab(%rip), %r15     # 0x287d0
leaq 0x14876(%rip), %r12     # 0x290a2
movslq %ebp, %rax
cmpb $0x15, (%rdx,%rax)
ja 0x148d6
movq 0x20(%rsp), %rax
movl 0x30(%rax), %r9d
movl 0x78(%rax), %r8d
movq %rbx, (%rsp)
movq 0x48(%rsp), %rdi
movl %r13d, %esi
movl %ebp, %ecx
callq 0xfb15
movq 0x28(%rsp), %r9
movl %eax, %ebp
cmpq $0x0, 0x90(%rsp)
je 0x148cf
movq 0x8(%r9), %rax
cmpq %rax, (%r9)
jne 0x148a4
leaq (%rax,%rax), %rsi
testq %rax, %rax
cmoveq %r14, %rsi
movq %rsi, 0x8(%r9)
movq 0x10(%r9), %rdi
shlq $0x5, %rsi
movq %r15, %rdx
movl $0xe3, %ecx
movq %r12, %r8
callq 0x22d64
movq 0x28(%rsp), %r9
movq %rax, 0x10(%r9)
movq (%r9), %rax
movq 0x10(%r9), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r9)
shlq $0x5, %rax
movups 0x80(%rsp), %xmm0
movups 0x90(%rsp), %xmm1
movups %xmm1, 0x10(%rcx,%rax)
movups %xmm0, (%rcx,%rax)
movq 0x10(%rsp), %rdx
jmp 0x148d8
incl %ebp
cmpl %r13d, %ebp
jl 0x1482c
movq (%r9), %rdi
movq 0x10(%r9), %rsi
callq 0x13d10
movq 0x28(%rsp), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x1495f
movq 0x10(%rdi), %rcx
movq 0x20(%rsp), %rdx
movslq 0x8c(%rdx), %rdx
addq $0x18, %rcx
xorl %esi, %esi
xorl %r11d, %r11d
xorl %r8d, %r8d
cmpq %rdx, -0x8(%rcx)
jbe 0x14946
movq (%rcx), %r9
movq %r9, %r10
shrq $0x20, %r10
cmpl %r10d, %r11d
jge 0x1493c
addl %r8d, %r11d
subl %esi, %r11d
movl %r11d, %r8d
movl %r9d, %r11d
movl %r10d, %esi
jmp 0x14946
cmpl %r9d, %r11d
cmovgl %r11d, %r9d
movl %r9d, %r11d
addq $0x20, %rcx
decq %rax
jne 0x14916
subl %esi, %r11d
addl %r8d, %r11d
xorps %xmm0, %xmm0
cvtsi2ss %r11d, %xmm0
jmp 0x14962
xorps %xmm0, %xmm0
movss %xmm0, 0x44(%rsp)
cmpq $0x0, (%rdi)
je 0x14dbb
xorl %ecx, %ecx
movq 0x10(%rdi), %r15
movq %rcx, 0xa8(%rsp)
shlq $0x5, %rcx
movq 0x10(%r15,%rcx), %rax
movq 0x18(%r15,%rcx), %rdi
movq 0x20(%rsp), %rdx
movslq 0x8c(%rdx), %rsi
movl $0x1, %edx
movq %rdx, 0x50(%rsp)
cmpq %rsi, %rax
jbe 0x149b5
xorl %edx, %edx
divq %rsi
cltq
movq %rax, 0x50(%rsp)
addq %rcx, %r15
cmpq $0x0, 0x10(%r15)
je 0x14da2
movq %rdi, %rcx
movq %rdi, %rax
shrq $0x20, %rax
subq %rax, %rcx
movq %rcx, 0x58(%rsp)
movslq %ecx, %rax
movq %rax, 0xb0(%rsp)
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %r15, 0x60(%rsp)
movq 0x20(%rsp), %rax
cmpl 0x8c(%rax), %ebx
jge 0x14da2
movq (%r15), %rsi
addq %r14, %rsi
movq 0x48(%rsp), %rdi
callq 0xecc2
movq %rax, %r12
movq %rax, 0x98(%rsp)
movl 0x1c(%r15), %eax
movq %rax, 0x10(%rsp)
movq 0xb0(%rsp), %rax
leaq (%r12,%rax), %r15
movq 0x78(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1120c
testl %eax, %eax
js 0x14d8c
movl %eax, %ebp
movq %r12, 0x38(%rsp)
movq 0x18(%rsp), %r11
cmpl $0x0, 0x20(%r11)
je 0x14c70
movq (%r11), %rax
xorl %r13d, %r13d
testq %rax, %rax
je 0x14b22
xorl %esi, %esi
movl (%rax), %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl $0x2, %ecx
jb 0x14ae4
movl %ecx, %edx
sarl %edx
testl %edx, %edx
jle 0x14aaf
leaq 0x4(%rax), %rsi
xorl %edi, %edi
movl %edx, %r8d
leal (%rdi,%r8), %r9d
sarl %r9d
movslq %r9d, %r10
leaq (%r10,%r10,4), %r10
cmpq %r12, 0x18(%rsi,%r10,8)
jl 0x14aa2
movl %r9d, %r8d
jmp 0x14aa8
incl %r9d
movl %r9d, %edi
cmpl %r8d, %edi
jl 0x14a88
jmp 0x14ab1
xorl %edi, %edi
cmpl %edx, %edi
jne 0x14abe
decl %edx
movl $0x1, %esi
jmp 0x14ae4
movslq %edi, %rdx
leaq (%rdx,%rdx,4), %rdx
movq 0x1c(%rax,%rdx,8), %rdx
xorl %esi, %esi
xorl %r8d, %r8d
cmpq %r12, %rdx
setl %sil
setg %r8b
subl %r8d, %esi
movl %esi, %edx
sarl $0x1f, %edx
addl %edi, %edx
movl %edx, %edi
leaq (%rdi,%rdi,4), %rdi
leaq (%rax,%rdi,8), %rdi
addq $0x4, %rdi
testl %edx, %edx
js 0x14afa
testl %esi, %esi
je 0x14b1f
testl %edx, %edx
cmovnsq %rdi, %r13
testb $0x1, %cl
je 0x14b22
movslq 0xc(%r11), %rcx
addq %rcx, %rax
movslq %edx, %rcx
movq 0x8(%rax,%rcx,8), %rax
testq %rax, %rax
jne 0x14a6b
jmp 0x14b22
movq %rdi, %r13
testq %r13, %r13
je 0x14c70
cmpl %ebp, 0xc(%r13)
jne 0x14c70
movq 0x20(%r13), %rdi
movslq (%r13), %rax
leaq (%rax,%rax,2), %rsi
movl -0x10(%rdi,%rsi,8), %edx
movslq -0xc(%rdi,%rsi,8), %rcx
movq -0x18(%rdi,%rsi,8), %rsi
movq 0x10(%rsp), %r8
cmpl %r8d, 0x8(%rdi)
jg 0x14b87
leal (%rcx,%rdx), %r8d
movq 0x58(%rsp), %r9
movq 0x10(%rsp), %r10
addl %r10d, %r9d
cmpl %r8d, %r9d
jg 0x14b87
movq 0x38(%rsp), %r8
cmpq (%rdi), %r8
jl 0x14b87
leaq (%rsi,%rcx), %r8
cmpq %r8, %r15
jle 0x14d8c
movq 0x70(%rsp), %r8
cmpq %r8, %rsi
jge 0x14b9b
cmpq %r8, %r12
jl 0x14bae
jmp 0x14c70
cmpq %r8, %r12
jl 0x14bae
movq 0x70(%rsp), %r8
cmpq %r8, (%rdi)
jl 0x14c70
subq %rsi, %r12
js 0x14c70
movq 0x10(%rsp), %rsi
subl %edx, %esi
movslq %esi, %rdx
movq %rdx, %r8
subq %r12, %r8
movq 0x20(%rsp), %rsi
movslq 0x24(%rsi), %rsi
cmpq %rsi, %r8
jg 0x14c70
movq %r12, %r8
subq %rdx, %r8
cmpq %rsi, %r8
jg 0x14c70
subq %rcx, %rdx
movq 0x20(%rsp), %rsi
movslq 0x90(%rsi), %rsi
cmpq %rsi, %rdx
jge 0x14c70
subq %rcx, %r12
cmpq %rsi, %r12
jge 0x14c70
movl 0x4(%r13), %ecx
cmpl %ecx, %eax
jne 0x14c39
addl %ecx, %ecx
movl %ecx, 0x4(%r13)
movslq %ecx, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
leaq 0x13bac(%rip), %rdx     # 0x287d0
movl $0x11a, %ecx            # imm = 0x11A
leaq 0x14483(%rip), %r8      # 0x290b3
callq 0x22d64
movq %rax, 0x20(%r13)
movq 0x20(%r13), %rax
movslq (%r13), %rcx
leal 0x1(%rcx), %edx
movl %edx, (%r13)
leaq (%rcx,%rcx,2), %rcx
movq 0x38(%rsp), %rdx
movq %rdx, (%rax,%rcx,8)
movq 0x10(%rsp), %rdx
movl %edx, 0x8(%rax,%rcx,8)
movq 0x58(%rsp), %rdx
movl %edx, 0xc(%rax,%rcx,8)
movl %edx, 0x10(%rax,%rcx,8)
jmp 0x14d8c
movabsq $0x400000001, %rax      # imm = 0x400000001
movq %rax, 0x80(%rsp)
movl $0x4, %edi
movl $0x18, %esi
leaq 0x13b3d(%rip), %r12     # 0x287d0
movq %r12, %rdx
movl $0x174, %ecx            # imm = 0x174
leaq 0x13bbe(%rip), %r8      # 0x28860
callq 0x22cb4
movq 0x18(%rsp), %rdi
movq %rax, 0xa0(%rsp)
movq 0x38(%rsp), %rcx
movq %rcx, (%rax)
movq 0x10(%rsp), %rcx
movl %ecx, 0x8(%rax)
movq 0x58(%rsp), %rcx
movl %ecx, 0xc(%rax)
movl %ecx, 0x10(%rax)
movl %ebp, 0x8c(%rsp)
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
movl %ebp, %ecx
leaq (%rcx,%rcx,4), %rcx
xorl %edx, %edx
cmpl $0x0, 0x14(%rax,%rcx,8)
setne %dl
shll $0x1f, %edx
movl 0x90(%rsp), %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %eax
orl %edx, %eax
movl %eax, 0x90(%rsp)
incl 0x20(%rdi)
movq (%rdi), %r15
movl (%r15), %eax
sarl %eax
movl 0x1c(%rdi), %ecx
leal -0x1(,%rcx,2), %ecx
cmpl %ecx, %eax
jne 0x14d7c
incl 0x24(%rdi)
movslq 0x10(%rdi), %rsi
movl $0x1, %edi
movq %r12, %rdx
movl $0x108, %ecx            # imm = 0x108
leaq 0x14385(%rip), %r8      # 0x290c2
callq 0x22cb4
movq %rax, %r12
movq 0x18(%rsp), %rax
movq %r12, (%rax)
movl $0x1, (%r12)
movq 0x18(%rsp), %rax
movslq 0xc(%rax), %rax
movq %r15, (%r12,%rax)
movq 0x18(%rsp), %rdi
movq %r12, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x1f14f
movq 0x18(%rsp), %rdi
movq %r12, %r15
movq %r15, %rsi
leaq 0x80(%rsp), %rdx
callq 0x1f2b8
addq 0x50(%rsp), %r14
incl %ebx
movq 0x60(%rsp), %r15
cmpq 0x10(%r15), %r14
jb 0x149ea
movq 0xa8(%rsp), %rcx
incq %rcx
movq 0x28(%rsp), %rdi
cmpq %rcx, (%rdi)
ja 0x14974
cmpq $0x0, 0xf0(%rsp)
jne 0x14dcb
callq 0x150e6
movq 0x18(%rsp), %r14
movslq 0x20(%r14), %rax
movq 0x68(%rsp), %r12
movq %rax, 0x8(%r12)
movq 0x10(%r12), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,4), %rsi
leaq 0x139de(%rip), %rbx     # 0x287d0
leaq 0x13a67(%rip), %r15     # 0x28860
movq %rbx, %rdx
movl $0x17e, %ecx            # imm = 0x17E
movq %r15, %r8
callq 0x22d64
movq %rax, 0x10(%r12)
movl $0x8, %edi
movl $0x10, %esi
movq %rbx, %rdx
movl $0x181, %ecx            # imm = 0x181
movq %r15, %r8
callq 0x22cb4
movq %r14, %r11
movq (%r14), %rcx
movq %rcx, (%rax)
movl $0x0, 0x8(%rax)
movl $0x8, %r14d
movq %rax, %rdx
movl 0x34(%rsp), %r13d
movq (%rdx), %rsi
movq %rdx, %rcx
testq %rsi, %rsi
je 0x14edc
movl (%rsi), %edx
sarl %edx
cmpl %edx, 0x8(%rcx)
jg 0x14edc
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x4, %rdx
leal -0x1(%r14), %esi
movslq %esi, %rsi
cmpq %rsi, %rdx
jne 0x14eae
leal (%r14,%r14), %ebp
movslq %ebp, %rsi
shlq $0x4, %rsi
movq %rax, %rdi
movq %rbx, %rdx
movl $0x181, %ecx            # imm = 0x181
movq %r15, %r8
callq 0x22d64
movq 0x18(%rsp), %r11
shlq $0x21, %r14
sarq $0x21, %r14
shlq $0x4, %r14
leaq (%rax,%r14), %rcx
addq $-0x10, %rcx
movl %ebp, %r14d
movl $0x0, 0x18(%rcx)
movq (%rcx), %rdx
testb $0x1, (%rdx)
jne 0x14ec1
xorl %esi, %esi
jmp 0x14ed0
movslq 0xc(%r11), %rsi
addq %rsi, %rdx
movslq 0x8(%rcx), %rsi
movq (%rdx,%rsi,8), %rsi
addq $0x10, %rcx
movq %rsi, (%rcx)
jmp 0x14e4c
leaq -0x10(%rcx), %rdx
cmpq %rax, %rdx
jb 0x14f3c
movq (%rdx), %rsi
testq %rsi, %rsi
je 0x14f34
movslq -0x8(%rcx), %rdi
movl (%rsi), %r8d
sarl %r8d
cmpl %r8d, %edi
jge 0x14f34
movq (%r12), %r8
movq 0x10(%r12), %r9
leaq 0x1(%r8), %r10
movq %r10, (%r12)
leaq (%r8,%r8,4), %r8
leaq (%rdi,%rdi,4), %rdi
movq 0x24(%rsi,%rdi,8), %r10
movq %r10, 0x20(%r9,%r8,8)
movups 0x4(%rsi,%rdi,8), %xmm0
movups 0x14(%rsi,%rdi,8), %xmm1
movups %xmm1, 0x10(%r9,%r8,8)
movups %xmm0, (%r9,%r8,8)
incl -0x8(%rcx)
jmp 0x14e46
movq %rax, %rdi
callq 0x3390
movq (%r12), %rax
testq %rax, %rax
movss 0x44(%rsp), %xmm2
je 0x14f78
xorps %xmm1, %xmm1
cvtsi2ss %r13d, %xmm1
movaps %xmm2, %xmm0
divss %xmm1, %xmm0
movq 0x10(%r12), %rcx
addq $0x14, %rcx
movss %xmm0, (%rcx)
addq $0x28, %rcx
decq %rax
jne 0x14f6b
xorps %xmm0, %xmm0
cvtsi2ss %r13d, %xmm0
divss %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtss2sd %xmm2, %xmm0
leaq 0x138ce(%rip), %rbx     # 0x28860
leaq 0x138d1(%rip), %rdx     # 0x2886a
movq %rbx, %rdi
movl $0x4, %esi
movb $0x1, %al
callq 0xdbeb
leaq 0x13821(%rip), %rdx     # 0x287d0
movl $0x8, %edi
movl $0x8, %esi
movl $0x187, %ecx            # imm = 0x187
movq %rbx, %r8
callq 0x22cb4
movq %rax, %r12
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, (%r12)
movq %r12, %rbp
addq $0x8, %rbp
movl $0x8, %r14d
addq $-0x8, %rbp
movq (%rbp), %r13
testq %r13, %r13
je 0x14ff6
testb $0x1, (%r13)
jne 0x1500f
movq %r13, %rdi
callq 0x3390
leaq -0x8(%rbp), %rax
cmpq %r12, %rbp
movq %rax, %rbp
jne 0x14fe6
jmp 0x150bd
cmpl $0x0, (%r13)
movq 0x18(%rsp), %rdx
js 0x150ac
movq $-0x1, %r15
movslq 0xc(%rdx), %rax
addq %r13, %rax
cmpq $0x0, 0x8(%rax,%r15,8)
je 0x15098
movq %rbp, %rax
subq %r12, %rax
sarq $0x3, %rax
movslq %r14d, %rcx
cmpq %rcx, %rax
jne 0x15084
leal (%r14,%r14), %ebx
movslq %ebx, %rsi
shlq $0x3, %rsi
movq %r12, %rdi
leaq 0x13774(%rip), %rdx     # 0x287d0
movl $0x187, %ecx            # imm = 0x187
leaq 0x137f8(%rip), %r8      # 0x28860
callq 0x22d64
movq 0x18(%rsp), %rdx
movq %rax, %r12
shlq $0x21, %r14
sarq $0x21, %r14
leaq (%rax,%r14,8), %rbp
movl %ebx, %r14d
movslq 0xc(%rdx), %rax
addq %r13, %rax
movq 0x8(%rax,%r15,8), %rax
movq %rax, (%rbp)
addq $0x8, %rbp
movl (%r13), %eax
sarl %eax
cltq
incq %r15
cmpq %rax, %r15
jl 0x15026
movq %r13, %rdi
callq 0x3390
cmpq %r12, %rbp
jne 0x14fe2
movq 0x18(%rsp), %rdi
callq 0x3390
movq %r12, %rdi
callq 0x3390
movq 0x68(%rsp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq