// File: /workspace/github_c_makefile_star2_O1/lh3[P]minigraph/gfa-aug.c
// Function: gfa_augment
void gfa_augment(gfa_t *g, int32_t n_ins, const gfa_ins_t *ins, int32_t n_ctg, const char *const* name, const char *const* seq)
{
	int32_t i, j, k, *scnt, *soff, n_ctg_seg, n_old_seg, n_seg;
	gfa_split_t *sp;
	gfa_seg_t *seg;
	char buf[16];
	uint64_t t, n_old_arc = g->n_arc, *ins_side, *oldcnt;

	if (n_ins <= 0 || n_ctg <= 0) return;

	// set soff[]
	GFA_CALLOC(scnt, g->n_seg);
	for (i = 0; i < n_ins; ++i)
		++scnt[ins[i].v[0]>>1], ++scnt[ins[i].v[1]>>1];
	GFA_MALLOC(soff, g->n_seg + 1);
	for (j = 1, soff[0] = 0; j <= g->n_seg; ++j)
		soff[j] = soff[j-1] + scnt[j-1];

	// populate sp[]
	GFA_MALLOC(sp, soff[g->n_seg]);
	GFA_BZERO(scnt, g->n_seg);
	for (i = 0, n_ctg_seg = 0; i < n_ins; ++i) {
		const gfa_ins_t *p = &ins[i];
		for (k = 0; k < 2; ++k) {
			uint32_t vlen = g->seg[p->v[k]>>1].len;
			gfa_split_t *q = &sp[soff[p->v[k]>>1] + scnt[p->v[k]>>1]];
			q->ins = i, q->end = k;
			q->side = (p->v[k]&1? vlen - p->voff[k] : p->voff[k]) << 1 | ((p->v[k]&1) ^ k);
			assert(q->side != (0<<1|0) && q->side != (vlen<<1|1)); // not possible to link such sides
			++scnt[p->v[k]>>1];
		}
		if (p->coff[1] > p->coff[0])
			++n_ctg_seg;
	}
	free(scnt);

	// sort sp[]
	for (j = 0, n_old_seg = 0; j < g->n_seg; ++j)
		if (soff[j+1] - soff[j] > 1)
			radix_sort_split(&sp[soff[j]], &sp[soff[j+1]]);

	// precompute the number of segments after split
	for (j = 0, n_old_seg = 0; j < g->n_seg; ++j) {
		int32_t i0;
		for (i0 = soff[j], i = i0 + 1, k = 0; i <= soff[j+1]; ++i)
			if (i == soff[j+1] || sp[i0].side>>1 != sp[i].side>>1) {
				if (sp[i0].side>>1 != 0 && sp[i0].side>>1 != g->seg[j].len) // otherwise no new segment will be created
					++k;
				i0 = i;
			}
		n_old_seg += k + 1;
	}

	// compute ins_side[] and split old segments
	n_seg = n_old_seg + n_ctg_seg;
	GFA_CALLOC(seg, n_seg);
	GFA_CALLOC(ins_side, n_ins);
	GFA_MALLOC(oldcnt, g->n_seg);
	for (j = 0, k = 0; j < g->n_seg; ++j) {
		int32_t i0, l, off = 0, k0 = k;
		gfa_seg_t *s = &g->seg[j];
		gfa_seg_t *t = &seg[k]; // this is so far a placeholder
		// create the first half of a new segment
		snprintf(buf, 15, "s%d", k + 1);
		t->name = gfa_strdup(buf);
		t->snid = s->snid, t->soff = s->soff, t->rank = s->rank;
		// iterate over splits
		for (i0 = soff[j], i = i0 + 1; i <= soff[j+1]; ++i) {
			if (i == soff[j+1] || sp[i].side>>1 != sp[i0].side>>1) {
				gfa_split_t *q0 = &sp[i0];
				for (l = i0; l < i; ++l) {
					gfa_split_t *q = &sp[l];
					int32_t shift = q->end == 0? 32 : 0; // first end on the higher 32 bits
					int32_t side = q->side & 1;
					int32_t which = q->side>>1 == 0? 0 : side; // special-casing when q->side==1, because no new segment created in this case
					ins_side[q->ins] |= (uint64_t)((uint32_t)(k + which) << 1 | (side^q->end)) << shift;
				}
				if (q0->side>>1 != 0 && q0->side>>1 != g->seg[j].len) { // create a new segment
					t->len = (q0->side>>1) - off;
					GFA_MALLOC(t->seq, t->len + 1);
					memcpy(t->seq, &s->seq[off], t->len);
					t->seq[t->len] = 0;
					off += t->len;
					t = &seg[++k]; // create a new segment
					snprintf(buf, 15, "s%d", k + 1);
					t->name = gfa_strdup(buf);
					t->snid = s->snid, t->soff = s->soff + off, t->rank = s->rank;
				}
				i0 = i;
			}
		}
		// finish the last segment
		t->len = s->len - off;
		GFA_MALLOC(t->seq, t->len + 1);
		memcpy(t->seq, &s->seq[off], t->len);
		t->seq[t->len] = 0;
		++k;
		oldcnt[j] = (uint64_t)k0 << 32 | (k - k0);
		// add new arcs between newly created segments
		for (i = 0; i < k - k0 - 1; ++i)
			create_first_arc(g, seg, (uint32_t)(k0+i)<<1, (uint32_t)(k0+i+1)<<1, s->rank);
	}
	assert(k == n_old_seg);
	free(soff);
	free(sp);

	// update existing g->arc[]
	for (t = 0; t < n_old_arc; ++t) {
		gfa_arc_t *a = &g->arc[t];
		uint32_t v = a->v_lv >> 32;
		uint32_t off = oldcnt[v>>1]>>32, cnt = (uint32_t)oldcnt[v>>1];
		v = (v&1) == 0? (off+cnt-1)<<1 : off<<1 | 1;
		a->v_lv = (uint64_t)v << 32 | seg[v>>1].len;
		off = oldcnt[a->w>>1]>>32, cnt = (uint32_t)oldcnt[a->w>>1];
		a->w = (a->w&1) == 0? off<<1 : (off+cnt-1)<<1 | 1;
	}
	free(oldcnt);

	// create newly inserted segments
	for (i = 0, k = n_old_seg; i < n_ins; ++i) {
		const gfa_ins_t *p = &ins[i];
		if (p->coff[0] < p->coff[1]) { // not a pure deletion
			gfa_seg_t *t = &seg[k];
			snprintf(buf, 15, "s%d", k + 1);
			t->name = gfa_strdup(buf);
			GFA_MALLOC(t->seq, p->coff[1] - p->coff[0] + 1);
			for (j = 0; j < p->coff[1] - p->coff[0]; ++j)
				t->seq[j] = seq[p->ctg][p->coff[0] + j];
			t->seq[j] = 0;
			t->len = j;
			t->snid = gfa_sseq_add(g, name[p->ctg]);
			t->soff = p->coff[0];
			t->rank = g->max_rank + 1; // TODO: to deal with SN/SO/SR tags somewhere
			gfa_sseq_update(g, t);
			create_first_arc(g, seg, ins_side[i]>>32, (uint32_t)k<<1, t->rank);
			create_first_arc(g, seg, (uint32_t)k<<1, (uint32_t)ins_side[i], t->rank);
			++k;
		} else { // a pure deletion
			create_first_arc(g, seg, ins_side[i]>>32, (uint32_t)ins_side[i], g->max_rank + 1);
		}
	}
	free(ins_side);

	// update *g
	for (j = 0; j < g->n_seg; ++j) {
		free(g->seg[j].name);
		free(g->seg[j].seq);
		free(g->seg[j].aux.aux);
	}
	free(g->seg);
	g->seg = seg, g->n_seg = g->m_seg = n_seg;
	++g->max_rank;
	GFA_REALLOC(g->link_aux, g->m_arc);
	GFA_BZERO(&g->link_aux[n_old_arc], g->m_arc - n_old_arc);
	gfa_arc_sort(g);
	gfa_arc_index(g);
	gfa_fix_multi(g);
	// k = gfa_fix_symm(g); assert(k == 0); // for debugging; the graph should be symmetric
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %r8, 0x98(%rsp)
testl %esi, %esi
setle %al
testl %ecx, %ecx
setle %cl
orb %al, %cl
jne 0x98ee
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r12
movq %r9, 0x90(%rsp)
movq 0x40(%rdi), %rax
movq %rax, 0x40(%rsp)
movl 0x4(%rdi), %r13d
movl $0x4, %esi
movq %r13, %rdi
callq 0x21e0
movq %rax, %r14
movl %ebp, %ecx
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rax
movq %rcx, 0x50(%rsp)
addq %rcx, %rax
xorl %ecx, %ecx
movl (%rbx,%rcx), %edx
shrl %edx
incl (%r14,%rdx,4)
movl 0x4(%rbx,%rcx), %edx
shrl %edx
incl (%r14,%rdx,4)
addq $0x1c, %rcx
cmpq %rcx, %rax
jne 0x8f73
leal 0x1(%r13), %edi
shlq $0x2, %rdi
callq 0x2280
movl $0x0, (%rax)
testq %r13, %r13
je 0x8fc2
leal 0x1(%r13), %esi
movl (%rax), %ecx
decq %rsi
xorl %edx, %edx
addl (%r14,%rdx,4), %ecx
movl %ecx, 0x4(%rax,%rdx,4)
incq %rdx
cmpq %rdx, %rsi
jne 0x8fb2
movq %rax, 0x10(%rsp)
movslq (%rax,%r13,4), %rdi
shlq $0x3, %rdi
callq 0x2280
movq %rax, 0x8(%rsp)
shlq $0x2, %r13
movq %r14, %rdi
xorl %esi, %esi
movq %r13, %rdx
xorl %r13d, %r13d
callq 0x2180
movl %ebp, 0x74(%rsp)
testl %ebp, %ebp
movq %rbx, 0x48(%rsp)
jle 0x90c6
movq 0x10(%r12), %rax
leaq 0x8(%rbx), %rcx
xorl %edx, %edx
xorl %r13d, %r13d
leaq (%rdx,%rdx,8), %rsi
leaq (%rsi,%rsi,2), %rsi
addq %rbx, %rsi
addq %rdx, %rsi
movl %edx, %edi
xorl %r8d, %r8d
movl -0x8(%rcx,%r8,4), %r10d
movl %r10d, %r9d
shrl %r9d
movq %r9, %r11
shlq $0x6, %r11
movl (%rax,%r11), %ebx
movq 0x10(%rsp), %r11
movslq (%r11,%r9,4), %r15
movslq (%r14,%r9,4), %r11
addq %r11, %r15
movq 0x8(%rsp), %rbp
movl %edi, 0x4(%rbp,%r15,8)
andl $0x1, %r10d
jne 0x905b
movl (%rcx,%r8,4), %ebp
jmp 0x9061
movl %ebx, %ebp
subl (%rcx,%r8,4), %ebp
addl %ebp, %ebp
xorl %r8d, %r10d
addl %ebp, %r10d
movq 0x8(%rsp), %rbp
movl %r10d, (%rbp,%r15,8)
je 0x9900
leal 0x1(,%rbx,2), %ebx
cmpl %ebx, %r10d
je 0x9900
incl %r11d
movl %r11d, (%r14,%r9,4)
incq %r8
addl $0x80000000, %edi       # imm = 0x80000000
cmpq $0x1, %r8
je 0x901f
movl 0x14(%rsi), %edi
xorl %r8d, %r8d
cmpl 0x10(%rsi), %edi
setg %r8b
addl %r8d, %r13d
incq %rdx
addq $0x1c, %rcx
cmpq 0x50(%rsp), %rdx
movq 0x48(%rsp), %rbx
jne 0x900c
movq %r14, %rdi
callq 0x2040
movl 0x4(%r12), %eax
testl %eax, %eax
movq 0x10(%rsp), %rsi
je 0x9114
xorl %ebx, %ebx
movslq 0x4(%rsi,%rbx,4), %rax
movslq (%rsi,%rbx,4), %rcx
movl %eax, %edx
subl %ecx, %edx
cmpl $0x2, %edx
jl 0x9107
movq 0x8(%rsp), %rdx
leaq (%rdx,%rcx,8), %rdi
leaq (%rdx,%rax,8), %rsi
callq 0x8ee5
movq 0x10(%rsp), %rsi
incq %rbx
movl 0x4(%r12), %eax
cmpq %rax, %rbx
jb 0x90de
movl %eax, %ebp
movl $0x0, %ecx
movq %rcx, 0x28(%rsp)
testl %eax, %eax
movq %r12, 0x38(%rsp)
je 0x91ed
movq 0x8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x20(%rsp)
xorl %ecx, %ecx
movq $0x0, 0x28(%rsp)
movq 0x10(%rsp), %rdx
movl (%rdx,%rcx,4), %esi
movslq 0x4(%rdx,%rcx,4), %rdx
movl $0x0, %r8d
cmpl %edx, %esi
jge 0x91d2
movslq %esi, %r8
subq %r8, %rdx
leaq -0x1(%rdx), %rdi
leal 0x1(%rsi), %r9d
movq 0x20(%rsp), %rax
leaq (%rax,%r8,8), %r10
xorl %r11d, %r11d
movq %rcx, %rbx
shlq $0x6, %rbx
xorl %r8d, %r8d
movslq %esi, %r14
cmpq %r11, %rdi
je 0x919c
movl (%r10,%r11,8), %r15d
movq 0x8(%rsp), %rax
xorl (%rax,%r14,8), %r15d
cmpl $0x2, %r15d
jb 0x91ca
movq 0x8(%rsp), %rax
movl (%rax,%r14,8), %r14d
leaq (%r9,%r11), %rsi
cmpl $0x1, %r14d
jbe 0x91ca
shrl %r14d
movq 0x10(%r12), %r15
xorl %r12d, %r12d
cmpl (%r15,%rbx), %r14d
setne %r12b
addl %r12d, %r8d
movq 0x38(%rsp), %r12
incq %r11
cmpq %r11, %rdx
jne 0x9181
incq %rcx
movq 0x28(%rsp), %rdx
addl %r8d, %edx
incl %edx
movq %rdx, 0x28(%rsp)
cmpq %rbp, %rcx
jne 0x9146
addl 0x28(%rsp), %r13d
movl %r13d, 0x70(%rsp)
movslq %r13d, %rdi
movl $0x40, %esi
callq 0x21e0
movq %rax, 0x18(%rsp)
movl $0x8, %esi
movq 0x50(%rsp), %rdi
callq 0x21e0
movq %rax, %r14
shlq $0x3, %rbp
movq %rbp, %rdi
callq 0x2280
movq %rax, 0x78(%rsp)
cmpl $0x0, 0x4(%r12)
movl $0x0, %eax
je 0x95b7
movq 0x8(%rsp), %rax
addq $0x4, %rax
movq %rax, 0xb8(%rsp)
xorl %ebx, %ebx
xorl %eax, %eax
movq %r14, 0xb0(%rsp)
movl %eax, %edx
movq 0x10(%r12), %rax
movq %rax, 0x30(%rsp)
movq %rbx, %r13
shlq $0x6, %r13
addq %r13, %rax
movq %rax, 0x20(%rsp)
movq %rdx, 0x58(%rsp)
movslq %edx, %rax
movq %rax, %r15
shlq $0x6, %r15
movq 0x18(%rsp), %r12
leaq (%r12,%r15), %rcx
movq %rcx, 0x68(%rsp)
movq %rax, 0xa0(%rsp)
leal 0x1(%rax), %ecx
movl $0xf, %esi
leaq 0x80(%rsp), %rbp
movq %rbp, %rdi
leaq 0x1f293(%rip), %rdx     # 0x28547
xorl %eax, %eax
callq 0x2140
movq %rbp, %rdi
callq 0x4b60
movq %rax, 0x18(%r12,%r15)
movq 0x30(%rsp), %rcx
movl 0x8(%rcx,%r13), %eax
movl %eax, 0x8(%r12,%r15)
movl 0xc(%rcx,%r13), %eax
movl %eax, 0xc(%r12,%r15)
movq %r13, 0xc0(%rsp)
movl 0x10(%rcx,%r13), %eax
movl %eax, 0x10(%r12,%r15)
movq 0x10(%rsp), %rdi
movl (%rdi,%rbx,4), %eax
movl 0x4(%rdi,%rbx,4), %ecx
movq %rbx, 0xa8(%rsp)
leaq 0x1(%rbx), %rdx
movq %rdx, 0x60(%rsp)
cmpl %ecx, %eax
jge 0x94e6
movslq %eax, %r12
leal 0x1(%rax), %ebx
movq $0x0, 0x30(%rsp)
movq 0x58(%rsp), %rbp
xorl %r15d, %r15d
movq 0x20(%rsp), %r9
movq 0x60(%rsp), %r13
movq %r12, %rsi
incq %r12
movslq %eax, %rdx
cmpl %r12d, %ecx
je 0x935d
movq 0x8(%rsp), %r8
movl (%r8,%rdx,8), %ecx
xorl (%r8,%r12,8), %ecx
cmpl $0x2, %ecx
jb 0x94d5
cmpq %rdx, %rsi
jl 0x93be
movq 0xb8(%rsp), %rax
leaq (%rax,%rdx,8), %rax
movl %ebx, %esi
subl %edx, %esi
xorl %edi, %edi
movl -0x4(%rax,%rdi,8), %r8d
movl (%rax,%rdi,8), %r9d
testl %r9d, %r9d
setns %cl
movl %r9d, %r10d
shrl $0x1f, %r10d
movl %r8d, %r11d
andl $0x1, %r11d
cmpl $0x2, %r8d
movl %r11d, %r8d
cmovbl %r15d, %r8d
addl %ebp, %r8d
xorl %r10d, %r11d
leal (%r11,%r8,2), %r8d
shlb $0x5, %cl
shlq %cl, %r8
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
orq %r8, (%r14,%r9,8)
incq %rdi
cmpl %edi, %esi
jne 0x9374
movq 0x8(%rsp), %rax
movl (%rax,%rdx,8), %r15d
cmpl $0x2, %r15d
jb 0x93e7
shrl %r15d
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq 0xc0(%rsp), %rcx
cmpl (%rax,%rcx), %r15d
jne 0x93fc
movl %r12d, %eax
movq 0x10(%rsp), %rdi
xorl %r15d, %r15d
movq 0x20(%rsp), %r9
jmp 0x94d5
movq 0x30(%rsp), %r14
subl %r14d, %r15d
movq 0x68(%rsp), %r13
movl %r15d, (%r13)
leal 0x1(%r15), %eax
movslq %eax, %rdi
callq 0x2280
movq %rax, 0x20(%r13)
movslq %r14d, %r14
movq 0x20(%rsp), %rcx
movq 0x20(%rcx), %rsi
addq %r14, %rsi
movslq %r15d, %rdx
movq %rax, %rdi
callq 0x2230
movq 0x20(%r13), %rax
movslq (%r13), %rcx
movb $0x0, (%rax,%rcx)
addl (%r13), %r14d
movslq %ebp, %rcx
incl %ebp
movq %rcx, %r15
shlq $0x6, %r15
movq 0x18(%rsp), %r13
leaq (%r15,%r13), %rax
addq $0x40, %rax
movq %rax, 0x68(%rsp)
addl $0x2, %ecx
movl $0xf, %esi
leaq 0x80(%rsp), %rdi
leaq 0x1f0cb(%rip), %rdx     # 0x28547
xorl %eax, %eax
callq 0x2140
leaq 0x80(%rsp), %rdi
callq 0x4b60
movq 0x20(%rsp), %r9
movq %rax, 0x58(%r15,%r13)
movl 0x8(%r9), %eax
movl %eax, 0x48(%r15,%r13)
movl 0xc(%r9), %eax
movq %r14, 0x30(%rsp)
addl %r14d, %eax
movq 0xb0(%rsp), %r14
movl %eax, 0x4c(%r15,%r13)
movl 0x10(%r9), %eax
movl %eax, 0x50(%r15,%r13)
movq 0x60(%rsp), %r13
movl %r12d, %eax
movq 0x10(%rsp), %rdi
xorl %r15d, %r15d
movslq (%rdi,%r13,4), %rcx
incl %ebx
cmpq %rcx, %r12
jl 0x9339
jmp 0x94f9
movq $0x0, 0x30(%rsp)
movq 0x58(%rsp), %rbp
movq 0x20(%rsp), %r9
movslq (%r9), %r15
movslq 0x30(%rsp), %rbx
subq %rbx, %r15
movq 0x68(%rsp), %r12
movl %r15d, (%r12)
movq %r15, %rdi
incq %rdi
movq %r9, %r13
callq 0x2280
movq %rax, 0x20(%r12)
addq 0x20(%r13), %rbx
movslq %r15d, %rdx
movq 0x18(%rsp), %r15
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2230
movq 0x20(%r12), %rax
movslq (%r12), %rcx
movb $0x0, (%rax,%rcx)
leal 0x1(%rbp), %ecx
movq 0xa0(%rsp), %rdx
movq %rdx, %rax
shlq $0x20, %rax
movl %ecx, 0x20(%rsp)
subl %edx, %ecx
movslq %ecx, %rcx
orq %rcx, %rax
movq 0x78(%rsp), %rdx
movq 0xa8(%rsp), %rsi
movq %rax, (%rdx,%rsi,8)
cmpl $0x2, %ecx
movq 0x38(%rsp), %r12
movq 0x58(%rsp), %rdx
jl 0x95a0
subl %edx, %ebp
addl %edx, %edx
leal 0x2(%rdx), %ebx
movl 0x10(%r13), %r8d
movq %r12, %rdi
movq %r15, %rsi
movl %ebx, %ecx
callq 0x993e
movl %ebx, %edx
decl %ebp
jne 0x9586
movl 0x4(%r12), %eax
movq 0x60(%rsp), %rbx
cmpq %rax, %rbx
movl 0x20(%rsp), %eax
jb 0x925a
movq 0x28(%rsp), %rbp
cmpl %ebp, %eax
movq 0x48(%rsp), %r15
movl 0x74(%rsp), %ebx
jne 0x991f
movq 0x10(%rsp), %rdi
callq 0x2040
movq 0x8(%rsp), %rdi
callq 0x2040
cmpq $0x0, 0x40(%rsp)
movq 0x78(%rsp), %r9
je 0x9679
movq 0x48(%r12), %rax
addq $0x8, %rax
movq 0x40(%rsp), %rcx
movq -0x8(%rax), %rdi
movq %rdi, %rdx
shrq $0x21, %rdx
movq (%r9,%rdx,8), %rsi
movq %rsi, %rdx
shrq $0x20, %rdx
btq $0x20, %rdi
jb 0x9628
addl %esi, %edx
leal -0x2(,%rdx,2), %edx
jmp 0x962f
leal 0x1(,%rdx,2), %edx
movq %rdx, %rsi
shlq $0x20, %rsi
shrl %edx
shlq $0x6, %rdx
movq 0x18(%rsp), %rdi
movslq (%rdi,%rdx), %rdx
orq %rsi, %rdx
movq %rdx, -0x8(%rax)
movl (%rax), %edx
movl %edx, %esi
shrl %esi
movq (%r9,%rsi,8), %rsi
movq %rsi, %rdi
shrq $0x20, %rdi
leal (%rdi,%rdi), %r8d
addl %edi, %esi
testb $0x1, %dl
leal -0x1(%rsi,%rsi), %edx
cmovel %r8d, %edx
movl %edx, (%rax)
addq $0x20, %rax
decq %rcx
jne 0x9600
movq %r9, %rdi
callq 0x2040
testl %ebx, %ebx
jle 0x9823
xorl %r13d, %r13d
leaq (,%r13,8), %rax
addq %r13, %rax
leaq (%rax,%rax,2), %rbx
addq %r13, %rbx
movl 0x10(%r15,%rbx), %eax
cmpl 0x14(%r15,%rbx), %eax
jge 0x97f5
addq %r15, %rbx
movq %rbp, 0x28(%rsp)
movslq %ebp, %rcx
movq %rcx, %rbp
shlq $0x6, %rbp
movq 0x18(%rsp), %rax
leaq (%rax,%rbp), %r15
incl %ecx
xorl %r12d, %r12d
movl $0xf, %esi
leaq 0x80(%rsp), %rdi
leaq 0x1ee65(%rip), %rdx     # 0x28547
movq %rcx, 0x8(%rsp)
xorl %eax, %eax
callq 0x2140
leaq 0x80(%rsp), %rdi
callq 0x4b60
movq 0x18(%rsp), %rcx
movq %rax, 0x18(%rcx,%rbp)
movl 0x14(%rbx), %eax
subl 0x10(%rbx), %eax
incl %eax
movslq %eax, %rdi
callq 0x2280
movq 0x18(%rsp), %rcx
movq %rax, 0x20(%rcx,%rbp)
movl 0x10(%rbx), %eax
cmpl %eax, 0x14(%rbx)
jle 0x975d
xorl %r12d, %r12d
movq 0x90(%rsp), %rdx
movslq 0x18(%rbx), %rcx
movq (%rdx,%rcx,8), %rcx
addl %r12d, %eax
cltq
movb (%rcx,%rax), %al
movq 0x20(%r15), %rcx
movb %al, (%rcx,%r12)
incq %r12
movslq 0x14(%rbx), %rcx
movslq 0x10(%rbx), %rax
subq %rax, %rcx
cmpq %rcx, %r12
jl 0x9732
movq 0x20(%r15), %rax
movl %r12d, %ecx
movb $0x0, (%rax,%rcx)
movl %r12d, (%r15)
movslq 0x18(%rbx), %rax
movq 0x98(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq 0x38(%rsp), %r12
movq %r12, %rdi
callq 0x506c
movl %eax, 0x8(%r15)
movl 0x10(%rbx), %eax
movl %eax, 0xc(%r15)
movl 0x8(%r12), %eax
incl %eax
movl %eax, 0x10(%r15)
movq %r12, %rdi
movq %r15, %rsi
callq 0x5264
movq (%r14,%r13,8), %rdx
movq %rdx, 0x10(%rsp)
shrq $0x20, %rdx
movq 0x28(%rsp), %rbp
addl %ebp, %ebp
movl 0x10(%r15), %r8d
movq %r12, %rdi
movq 0x18(%rsp), %rbx
movq %rbx, %rsi
movl %ebp, %ecx
callq 0x993e
movl 0x10(%r15), %r8d
movq %r12, %rdi
movq %rbx, %rsi
movl %ebp, %edx
movq 0x10(%rsp), %rcx
callq 0x993e
movq 0x8(%rsp), %rbp
movq 0x48(%rsp), %r15
jmp 0x9815
movq (%r14,%r13,8), %rcx
movq %rcx, %rdx
shrq $0x20, %rdx
movl 0x8(%r12), %r8d
incl %r8d
movq %r12, %rdi
movq 0x18(%rsp), %rsi
callq 0x993e
incq %r13
cmpq 0x50(%rsp), %r13
jne 0x968c
movq %r14, %rdi
callq 0x2040
cmpl $0x0, 0x4(%r12)
je 0x9876
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x10(%r12), %rax
movq 0x18(%rax,%rbx), %rdi
callq 0x2040
movq 0x10(%r12), %rax
movq 0x20(%rax,%rbx), %rdi
callq 0x2040
movq 0x10(%r12), %rax
movq 0x38(%rax,%rbx), %rdi
callq 0x2040
incq %r14
movl 0x4(%r12), %eax
addq $0x40, %rbx
cmpq %rax, %r14
jb 0x9838
movq 0x10(%r12), %rdi
callq 0x2040
movq 0x18(%rsp), %rax
movq %rax, 0x10(%r12)
movl 0x70(%rsp), %eax
movl %eax, (%r12)
movl %eax, 0x4(%r12)
incl 0x8(%r12)
movq 0x38(%r12), %rsi
movq 0x50(%r12), %rdi
shlq $0x4, %rsi
callq 0x22b0
movq %rax, 0x50(%r12)
movq 0x40(%rsp), %rcx
movq %rcx, %rdi
shlq $0x4, %rdi
addq %rax, %rdi
movq 0x38(%r12), %rdx
subq %rcx, %rdx
shlq $0x4, %rdx
xorl %esi, %esi
callq 0x2180
movq %r12, %rdi
callq 0x555c
movq %r12, %rdi
callq 0x55e1
movq %r12, %rdi
callq 0x5e20
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1ec89(%rip), %rdi     # 0x28590
leaq 0x1ec3d(%rip), %rsi     # 0x2854b
leaq 0x1eca9(%rip), %rcx     # 0x285be
movl $0x3f, %edx
callq 0x2160
leaq 0x1ed01(%rip), %rdi     # 0x28627
leaq 0x1ec1e(%rip), %rsi     # 0x2854b
leaq 0x1ec8a(%rip), %rcx     # 0x285be
movl $0x89, %edx
callq 0x2160