// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/format.c
// Function: mg_write_gaf
void mg_write_gaf(kstring_t *s, const gfa_t *g, const mg_gchains_t *gs, int32_t n_seg, const int32_t *qlens, const char *qname, uint64_t flag, void *km)
{
	int32_t i, j, qlen, rev_sign = 0;
	s->l = 0;
	for (i = 0, qlen = 0; i < n_seg; ++i) qlen += qlens[i];
	if ((gs == 0 || gs->n_gc == 0) && (flag&MG_M_SHOW_UNMAP)) {
		mg_sprintf_lite(s, "%s", qname);
		if ((flag&MG_M_FRAG_MERGE) && n_seg == 2 && s->l > 2 && s->s[s->l-1] == '1' && s->s[s->l-2] == '/') s->l -= 2;
		mg_sprintf_lite(s, "\t%d\t0\t0\t*\t*\t0\t0\t0\t0\t0\t0\n", qlen);
		return;
	}
	if (gs == 0) return;
	for (i = 0; i < gs->n_gc; ++i) {
		const mg_gchain_t *p = &gs->gc[i];
		int32_t sign_pos, compact;
		if (p->id != p->parent && !(flag&MG_M_PRINT_2ND)) continue;
		if (p->cnt == 0) continue;
		mg_sprintf_lite(s, "%s", qname);
		if ((flag&MG_M_FRAG_MERGE) && n_seg == 2 && s->l > 2 && s->s[s->l-1] == '1' && s->s[s->l-2] == '/') s->l -= 2;
		mg_sprintf_lite(s, "\t%d\t%d\t%d\t+\t", qlen, p->qs, p->qe);
		assert(p->cnt > 0);
		sign_pos = s->l - 2;
		if (flag & MG_M_VERTEX_COOR) {
			compact = 0;
			for (j = 0; j < p->cnt; ++j) {
				const mg_llchain_t *q = &gs->lc[p->off + j];
				mg_sprintf_lite(s, "%c%s", "><"[q->v&1], g->seg[q->v>>1].name);
			}
		} else {
			int32_t last_pnid = -1, st = -1, en = -1, rev = -1;
			compact = flag&MG_M_NO_COMP_PATH? 0 : 1;
			for (j = 0; j < p->cnt; ++j) {
				const mg_llchain_t *q;
				const gfa_seg_t *t;
				assert(p->off + j < gs->n_lc);
				q = &gs->lc[p->off + j];
				t = &g->seg[q->v>>1];
				if (t->snid < 0) { // no stable ID; write the vertex coordinate
					compact = 0;
					if (last_pnid >= 0) mg_sprintf_lite(s, "%c%s:%d-%d", "><"[rev], g->sseq[last_pnid].name, st, en);
					last_pnid = -1, st = -1, en = -1, rev = -1;
					mg_sprintf_lite(s, "%c%s", "><"[q->v&1], g->seg[q->v>>1].name);
				} else {
					int cont = 0;
					if (last_pnid >= 0 && t->snid == last_pnid && (q->v&1) == rev) { // same stable sequence and same strand
						if (!(q->v&1)) { // forward strand
							if (t->soff == en)
								en = t->soff + t->len, cont = 1;
						} else { // reverse strand
							if (t->soff + t->len == st)
								st = t->soff, cont = 1;
						}
					}
					if (cont == 0) {
						if (last_pnid >= 0) compact = 0;
						if (last_pnid >= 0) mg_sprintf_lite(s, "%c%s:%d-%d", "><"[rev], g->sseq[last_pnid].name, st, en);
						last_pnid = t->snid, rev = q->v&1, st = t->soff, en = st + t->len;
					}
				}
			}
			if (last_pnid >= 0) {
				if (g->sseq[last_pnid].rank != 0 || g->sseq[last_pnid].min != 0)
					compact = 0;
				if (!compact) mg_sprintf_lite(s, "%c%s:%d-%d", "><"[rev], g->sseq[last_pnid].name, st, en);
			} else compact = 0;
		}
		if (compact) {
			int32_t rev = gs->lc[p->off].v&1;
			const gfa_seg_t *t = &g->seg[gs->lc[rev? p->off + p->cnt - 1 : p->off].v>>1];
			const gfa_sseq_t *ps = &g->sseq[t->snid];
			mg_sprintf_lite(s, "%s\t%d\t", ps->name, ps->max);
			if (rev) {
				rev_sign = 1;
				s->s[sign_pos] = '-';
				mg_sprintf_lite(s, "%d\t%d", t->soff + (p->plen - p->pe), t->soff + (p->plen - p->ps));
			} else {
				mg_sprintf_lite(s, "%d\t%d", t->soff + p->ps, t->soff + p->pe);
			}
		} else mg_sprintf_lite(s, "\t%d\t%d\t%d", p->plen, p->ps, p->pe);
		if (p->p) mg_sprintf_lite(s, "\t%d\t%d\t%d", p->p->mlen, p->p->blen, p->mapq);
		else mg_sprintf_lite(s, "\t%d\t%d\t%d", p->mlen, p->blen, p->mapq);
		mg_sprintf_lite(s, "\ttp:A:%c", p->id == p->parent? 'P' : 'S');
		if (p->p) mg_sprintf_lite(s, "\tNM:i:%d", p->p->blen - p->p->mlen);
		mg_sprintf_lite(s, "\tcm:i:%d\ts1:i:%d\ts2:i:%d", p->n_anchor, p->score, p->subsc);
		if (p->div >= 0.0f && p->div <= 1.0f) {
			char buf[16];
			if (p->div == 0.0f) buf[0] = '0', buf[1] = 0;
			else snprintf(buf, 16, "%.4f", p->div);
			mg_sprintf_lite(s, "\tdv:f:%s", buf);
		}
		if (n_seg > 1) {
			mg_sprintf_lite(s, "\tql:B:i");
			for (j = 0; j < n_seg; ++j) mg_sprintf_lite(s, ",%d", qlens[j]);
		}
		if (p->p) {
			mg_sprintf_lite(s, "\tcg:Z:");
			if (rev_sign)
				for (j = p->p->n_cigar - 1; j >= 0; --j)
					mg_sprintf_lite(s, "%d%c", (int32_t)(p->p->cigar[j]>>4), "MIDNSHP=XB"[p->p->cigar[j]&0xf]);
			else
				for (j = 0; j < p->p->n_cigar; ++j)
					mg_sprintf_lite(s, "%d%c", (int32_t)(p->p->cigar[j]>>4), "MIDNSHP=XB"[p->p->cigar[j]&0xf]);
		}
		if (p->ds.ds) {
			mg_sprintf_lite(s, "\tds:Z:");
			if (rev_sign) {
				const char *ds = p->ds.ds;
				int32_t i, j;
				for (i = p->ds.n_off - 1; i >= 0; --i) {
					int32_t off = p->ds.off[i], en;
					mg_sprintf_lite(s, "%c", ds[off]); // print the operator
					en = i < p->ds.n_off - 1? p->ds.off[i+1] : p->ds.len;
					if (ds[off] == ':') {
						for (j = off + 1; j < en; ++j)
							mg_sprintf_lite(s, "%c", ds[j]);
					} else if (ds[off] == '*') {
						for (j = off + 1; j < en; ++j)
							mg_sprintf_lite(s, "%c", gfa_comp_table[(uint8_t)ds[j]]);
					} else {
						for (j = en - 1; j >= off + 1; --j) {
							if (ds[j] == '[') mg_sprintf_lite(s, "]");
							else if (ds[j] == ']') mg_sprintf_lite(s, "[");
							else mg_sprintf_lite(s, "%c", gfa_comp_table[(uint8_t)ds[j]]);
						}
					}
				}
			} else {
				mg_sprintf_lite(s, "%s", p->ds.ds);
			}
		}
		mg_sprintf_lite(s, "\n");
		if ((mg_dbg_flag & MG_DBG_LCHAIN) || (flag & MG_M_WRITE_LCHAIN)) {
			char buf[16];
			for (j = 0; j < p->cnt; ++j) {
				const mg_llchain_t *lc = &gs->lc[p->off + j];
				mg_sprintf_lite(s, "*\t%c%s\t%d\t%d", "><"[lc->v&1], g->seg[lc->v>>1].name, g->seg[lc->v>>1].len, lc->cnt);
				if (lc->cnt > 0) {
					double div;
					int32_t q_span = (int32_t)(gs->a[lc->off].y>>32&0xff);
					int32_t n = (int32_t)(gs->a[lc->off + lc->cnt - 1].x>>32) - (int32_t)(gs->a[lc->off].x>>32) + 1;
					div = n == lc->cnt? 0.0 : (n > lc->cnt? log((double)n / lc->cnt) : log((double)lc->cnt / n)) / q_span;
					if (div == 0.0) buf[0] = '0', buf[1] = 0;
					else snprintf(buf, 16, "%.4f", div);
					mg_sprintf_lite(s, "\t%s", buf);
					mg_sprintf_lite(s, "\t%d\t%d", (int32_t)gs->a[lc->off].x + 1 - q_span, (int32_t)gs->a[lc->off + lc->cnt - 1].x + 1);
					mg_sprintf_lite(s, "\t%d\t%d", (int32_t)gs->a[lc->off].y + 1 - q_span, (int32_t)gs->a[lc->off + lc->cnt - 1].y + 1);
					if (flag & MG_M_WRITE_MZ) {
						int32_t i, last;
						last = (int32_t)gs->a[lc->off].x + 1 - q_span;
						mg_sprintf_lite(s, "\t%d\t", q_span);
						for (i = 1; i < lc->cnt; ++i) {
							int32_t x = (int32_t)gs->a[lc->off + i].x + 1 - q_span;
							if (i > 1) mg_sprintf_lite(s, ",");
							mg_sprintf_lite(s, "%d", x - last);
							last = x;
						}
						last = (int32_t)gs->a[lc->off].y + 1 - q_span;
						mg_sprintf_lite(s, "\t");
						for (i = 1; i < lc->cnt; ++i) {
							int32_t x = (int32_t)gs->a[lc->off + i].y + 1 - q_span;
							if (i > 1) mg_sprintf_lite(s, ",");
							mg_sprintf_lite(s, "%d", x - last);
							last = x;
						}
					}
				}
				mg_sprintf_lite(s, "\n");
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, 0x50(%rsp)
movq %rdx, %r15
movq %rsi, 0x28(%rsp)
movq %rdi, %rbx
movq 0xb0(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x0, (%rdi)
testl %ecx, %ecx
movl %ecx, 0x14(%rsp)
jle 0x20171
movl %ecx, %eax
xorl %ecx, %ecx
xorl %ebp, %ebp
addl (%r8,%rcx,4), %ebp
incq %rcx
cmpq %rcx, %rax
jne 0x20163
jmp 0x20173
xorl %ebp, %ebp
testq %r15, %r15
je 0x20cf7
movl 0x8(%r15), %eax
testl %eax, %eax
sete %cl
movq 0x20(%rsp), %rdx
shrl $0x14, %edx
testb %cl, %dl
jne 0x20d0e
testl %eax, %eax
jle 0x20cff
movq 0x20(%rsp), %rdx
testb %dl, %dl
sets %al
movl 0x14(%rsp), %ecx
cmpl $0x2, %ecx
sete %sil
andb %al, %sil
movb %sil, 0x13(%rsp)
xorl %eax, %eax
btl $0x15, %edx
setae %al
movl %eax, 0x44(%rsp)
movl %ecx, %eax
movq %rax, 0x70(%rsp)
leaq 0x84d5(%rip), %r13      # 0x286aa
xorl %r12d, %r12d
movl $0x0, 0x34(%rsp)
movq %r15, 0x18(%rsp)
movl %ebp, 0x40(%rsp)
movq %r8, 0x48(%rsp)
movq 0x18(%r15), %rdx
imulq $0x68, %r12, %rax
btl $0xd, 0x20(%rsp)
jb 0x2020b
movl 0x4(%rdx,%rax), %ecx
cmpl %ecx, (%rdx,%rax)
jne 0x20bff
addq %rax, %rdx
cmpl $0x0, 0xc(%rdx)
je 0x20bff
movq %rdx, 0x8(%rsp)
movq %rbx, %rdi
leaq 0x9e05(%rip), %rsi      # 0x2a02c
movq 0x50(%rsp), %rdx
xorl %eax, %eax
callq 0x1fd66
cmpb $0x0, 0x13(%rsp)
je 0x20259
movl (%rbx), %eax
cmpl $0x3, %eax
jb 0x20259
movq 0x8(%rbx), %rcx
leal -0x1(%rax), %edx
cmpb $0x31, (%rcx,%rdx)
jne 0x20259
addl $-0x2, %eax
cmpb $0x2f, (%rcx,%rax)
jne 0x20259
movl %eax, (%rbx)
movq 0x8(%rsp), %r14
movl 0x18(%r14), %ecx
movl 0x1c(%r14), %r8d
movq %rbx, %rdi
leaq 0x9c75(%rip), %rsi      # 0x29ee5
movl %ebp, %edx
xorl %eax, %eax
callq 0x1fd66
cmpl $0x0, 0xc(%r14)
jle 0x20d97
movq %r14, %r11
movq %r12, 0x58(%rsp)
btl $0xb, 0x20(%rsp)
jb 0x2046a
movl 0x8(%r11), %edi
cmpl 0xc(%r15), %edi
jge 0x20d78
movl (%rbx), %eax
addl $-0x2, %eax
movl %eax, 0x38(%rsp)
xorl %ebp, %ebp
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl 0x44(%rsp), %r12d
movq 0x20(%r15), %rax
movslq %edi, %rdx
movq 0x28(%rsp), %rdi
movq 0x10(%rdi), %r15
leaq (%rdx,%rdx,4), %rdx
leaq (%rax,%rdx,4), %r14
addq $0x8, %r14
movl (%r14), %edx
movl %edx, %edi
shrl %edi
movq %rdi, %r10
shlq $0x6, %r10
movl 0x8(%r15,%r10), %eax
testl %eax, %eax
js 0x20339
addq %r10, %r15
cmpl %ecx, %eax
jne 0x203c9
andl $0x1, %edx
cmpl %esi, %edx
jne 0x203d9
movl 0xc(%r15), %eax
testl %esi, %esi
je 0x203d2
movl (%r15), %edi
addl %eax, %edi
movl $0x1, %edx
cmpl %r8d, %edi
jne 0x203d9
jmp 0x20441
testl %ecx, %ecx
js 0x20374
movslq %esi, %rax
movsbl (%rax,%r13), %edx
movq 0x28(%rsp), %r15
movq 0x28(%r15), %rax
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rcx
movq %rbx, %rdi
leaq 0x9c3d(%rip), %rsi      # 0x29f9f
xorl %eax, %eax
callq 0x1fd66
movl (%r14), %edx
movq 0x10(%r15), %r15
movl %edx, %edi
shrl %edi
andl $0x1, %edx
movsbl (%rdx,%r13), %edx
shlq $0x6, %rdi
movq 0x18(%r15,%rdi), %rcx
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0x9bf2(%rip), %rsi      # 0x29f84
xorl %eax, %eax
callq 0x1fd66
incl %ebp
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %r11
cmpl 0xc(%r11), %ebp
movq 0x18(%rsp), %r15
jl 0x20450
jmp 0x20503
xorl %r13d, %r13d
testl %ecx, %ecx
jns 0x203e7
jmp 0x20428
xorl %edx, %edx
cmpl %r9d, %eax
je 0x2043b
testl %ecx, %ecx
movl $0x0, %eax
cmovnsl %eax, %r12d
movl %r12d, %r13d
movslq %esi, %rax
leaq 0x82b9(%rip), %rdx      # 0x286aa
movsbl (%rax,%rdx), %edx
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rax
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rcx
movq %rbx, %rdi
leaq 0x9b8d(%rip), %rsi      # 0x29f9f
xorl %eax, %eax
callq 0x1fd66
movq 0x8(%rsp), %r11
movl 0x8(%r15), %eax
movl (%r14), %edx
movl %r13d, %r12d
andl $0x1, %edx
movl 0xc(%r15), %r9d
movl %r9d, %r8d
movl %eax, %ecx
leaq 0x826f(%rip), %r13      # 0x286aa
addl (%r15), %r9d
movl %r8d, %eax
incl %ebp
movl 0xc(%r11), %edi
cmpl %edi, %ebp
movq 0x18(%rsp), %r15
jge 0x204bf
movl 0x8(%r11), %edi
addl %ebp, %edi
movl %edx, %esi
movl %eax, %r8d
cmpl 0xc(%r15), %edi
jl 0x202cc
jmp 0x20d78
xorl %r14d, %r14d
movq 0x20(%r15), %rax
movslq 0x8(%r11), %rcx
addq %r14, %rcx
leaq (%rcx,%rcx,4), %rcx
movl 0x8(%rax,%rcx,4), %eax
movl %eax, %ecx
andl $0x1, %ecx
movsbl (%rcx,%r13), %edx
movq 0x28(%rsp), %rcx
movq 0x10(%rcx), %rcx
shrl %eax
shlq $0x6, %rax
movq 0x18(%rcx,%rax), %rcx
movq %rbx, %rdi
leaq 0x9adc(%rip), %rsi      # 0x29f84
xorl %eax, %eax
callq 0x1fd66
movq 0x8(%rsp), %r11
incq %r14
cmpl 0xc(%r11), %r14d
jl 0x2046d
jmp 0x20503
testl %ecx, %ecx
js 0x20503
movq 0x28(%rsp), %rsi
movq 0x28(%rsi), %rsi
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
leaq (%rsi,%rcx,8), %rcx
cmpl $0x0, 0x10(%rcx)
je 0x20c14
movl %edx, %edx
movsbl (%rdx,%r13), %edx
movq (%rcx), %rcx
movq %rbx, %rdi
leaq 0x9aab(%rip), %rsi      # 0x29f9f
movl %eax, %r8d
xorl %eax, %eax
callq 0x1fd66
movq 0x8(%rsp), %r11
movl 0x20(%r11), %edx
movl 0x24(%r11), %ecx
movl 0x28(%r11), %r8d
movq %rbx, %rdi
leaq 0x9a98(%rip), %rsi      # 0x29fb1
xorl %eax, %eax
movq %r11, %r12
callq 0x1fd66
movl 0x14(%rsp), %ebp
movq 0x48(%rsp), %r15
movq 0x48(%r12), %rax
movzbl 0x44(%r12), %r8d
testq %rax, %rax
je 0x20544
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
jmp 0x2054e
movl 0x2c(%r12), %ecx
movl 0x30(%r12), %edx
movq %rbx, %rdi
leaq 0x9a59(%rip), %rsi      # 0x29fb1
xorl %eax, %eax
movq %r12, %r14
callq 0x1fd66
movl (%r12), %eax
xorl %ecx, %ecx
cmpl 0x4(%r12), %eax
setne %cl
leal (%rcx,%rcx,2), %edx
addl $0x50, %edx
movq %rbx, %rdi
leaq 0x9a3b(%rip), %rsi      # 0x29fbb
xorl %eax, %eax
callq 0x1fd66
movq 0x48(%r12), %rax
testq %rax, %rax
je 0x205ad
movl 0x8(%rax), %edx
subl 0x4(%rax), %edx
movq %rbx, %rdi
leaq 0x9a23(%rip), %rsi      # 0x29fc4
xorl %eax, %eax
callq 0x1fd66
movq 0x8(%rsp), %r14
movl 0x10(%r14), %edx
movl 0x14(%r14), %ecx
movl 0x3c(%r14), %r8d
movq %rbx, %rdi
leaq 0x9a0a(%rip), %rsi      # 0x29fcd
xorl %eax, %eax
callq 0x1fd66
movss 0x34(%r14), %xmm0
ucomiss 0x98b9(%rip), %xmm0     # 0x29e90
jb 0x20632
movss 0x956f(%rip), %xmm1     # 0x29b50
ucomiss %xmm0, %xmm1
jb 0x20632
ucomiss 0x98a3(%rip), %xmm0     # 0x29e90
jne 0x205ff
jp 0x205ff
movw $0x30, 0x60(%rsp)
leaq 0x60(%rsp), %r14
jmp 0x2061e
cvtss2sd %xmm0, %xmm0
movl $0x10, %esi
leaq 0x60(%rsp), %r14
movq %r14, %rdi
leaq 0x99cf(%rip), %rdx      # 0x29fe6
movb $0x1, %al
callq 0x2140
movq %rbx, %rdi
leaq 0x99c3(%rip), %rsi      # 0x29feb
movq %r14, %rdx
xorl %eax, %eax
callq 0x1fd66
cmpl $0x2, %ebp
movq 0x70(%rsp), %r12
leaq 0x99bb(%rip), %rbp      # 0x29ffc
jl 0x20670
movq %rbx, %rdi
leaq 0x99a7(%rip), %rsi      # 0x29ff4
xorl %eax, %eax
callq 0x1fd66
xorl %r14d, %r14d
movl (%r15,%r14,4), %edx
movq %rbx, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x1fd66
incq %r14
cmpq %r14, %r12
jne 0x20657
movq 0x8(%rsp), %rdx
cmpq $0x0, 0x48(%rdx)
leaq 0x998b(%rip), %r15      # 0x2a00c
leaq 0x997f(%rip), %r12      # 0x2a007
je 0x2072c
movq %rbx, %rdi
leaq 0x9968(%rip), %rsi      # 0x2a000
xorl %eax, %eax
callq 0x1fd66
movq 0x8(%rsp), %rdx
movq 0x48(%rdx), %rax
movl (%rax), %r14d
cmpl $0x0, 0x34(%rsp)
je 0x206ef
testl %r14d, %r14d
jle 0x2072c
incq %r14
movq 0x48(%rdx), %rax
movq 0x8(%rax,%r14,8), %rax
movq %rax, %rdx
shrq $0x4, %rdx
andl $0xf, %eax
movsbl (%rax,%r15), %ecx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1fd66
movq 0x8(%rsp), %rdx
decq %r14
cmpq $0x1, %r14
ja 0x206ba
jmp 0x2072c
testl %r14d, %r14d
jle 0x2072c
xorl %r14d, %r14d
movq 0x18(%rax,%r14,8), %rax
movq %rax, %rdx
shrq $0x4, %rdx
andl $0xf, %eax
movsbl (%rax,%r15), %ecx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1fd66
movq 0x8(%rsp), %rdx
incq %r14
movq 0x48(%rdx), %rax
movslq (%rax), %rcx
cmpq %rcx, %r14
jl 0x206f7
cmpq $0x0, 0x60(%rdx)
je 0x208d1
movq %rbx, %rdi
leaq 0x98d6(%rip), %rsi      # 0x2a017
xorl %eax, %eax
callq 0x1fd66
movq 0x8(%rsp), %rax
movq 0x60(%rax), %r12
cmpl $0x0, 0x34(%rsp)
je 0x208bd
movslq 0x54(%rax), %r15
testq %r15, %r15
jle 0x208d1
leaq 0x50(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq 0x58(%rax), %rax
movslq -0x4(%rax,%r15,4), %rbp
movsbl (%r12,%rbp), %edx
movq %rbx, %rdi
leaq 0x7d9c(%rip), %rsi      # 0x28526
xorl %eax, %eax
callq 0x1fd66
movq 0x8(%rsp), %rdx
movslq 0x54(%rdx), %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %r15
jge 0x207b0
leaq (,%r15,4), %rax
addq 0x58(%rdx), %rax
movslq (%rax), %r14
movzbl (%r12,%rbp), %ecx
leal 0x1(%rbp), %eax
cmpl $0x3a, %ecx
je 0x2080b
cmpl $0x2a, %ecx
jne 0x20843
cmpl %r14d, %eax
jge 0x2089e
movslq %eax, %r13
addq %r12, %r13
notl %ebp
addl %r14d, %ebp
xorl %r14d, %r14d
movzbl (%r13,%r14), %eax
leaq 0x11a17(%rip), %rcx     # 0x32200
movzbl (%rcx,%rax), %edx
movq %rbx, %rdi
leaq 0x7d2f(%rip), %rsi      # 0x28526
xorl %eax, %eax
callq 0x1fd66
incq %r14
cmpl %r14d, %ebp
jne 0x207dc
jmp 0x2089e
cmpl %r14d, %eax
jge 0x2089e
movslq %eax, %r13
addq %r12, %r13
notl %ebp
addl %r14d, %ebp
xorl %r14d, %r14d
movsbl (%r13,%r14), %edx
movq %rbx, %rdi
leaq 0x7cf4(%rip), %rsi      # 0x28526
xorl %eax, %eax
callq 0x1fd66
incq %r14
cmpl %r14d, %ebp
jne 0x20822
jmp 0x2089e
cmpl %eax, %r14d
jle 0x2089e
movslq %eax, %rbp
movzbl -0x1(%r12,%r14), %eax
cmpl $0x5d, %eax
je 0x20867
cmpl $0x5b, %eax
jne 0x2087a
movq %rbx, %rdi
leaq 0x9629(%rip), %rsi      # 0x29e8e
jmp 0x20871
movq %rbx, %rdi
leaq 0x92a2(%rip), %rsi      # 0x29b13
xorl %eax, %eax
callq 0x1fd66
jmp 0x20896
leaq 0x1197f(%rip), %rcx     # 0x32200
movzbl (%rcx,%rax), %edx
movq %rbx, %rdi
leaq 0x7c97(%rip), %rsi      # 0x28526
xorl %eax, %eax
callq 0x1fd66
decq %r14
cmpq %rbp, %r14
jg 0x2084b
leaq -0x1(%r15), %rax
cmpq $0x1, %r15
movq %rax, %r15
leaq 0x7dfa(%rip), %r13      # 0x286aa
movq 0x8(%rsp), %rax
jg 0x20772
jmp 0x208d1
movq %rbx, %rdi
leaq 0x9765(%rip), %rsi      # 0x2a02c
movq %r12, %rdx
xorl %eax, %eax
callq 0x1fd66
movq %rbx, %rdi
leaq 0x94ef(%rip), %rsi      # 0x29dca
xorl %eax, %eax
callq 0x1fd66
btl $0x17, 0x20(%rsp)
jb 0x20906
leaq 0x11d87(%rip), %rax     # 0x32678
movl (%rax), %eax
andl $0x8, %eax
jne 0x20906
movl 0x40(%rsp), %ebp
movq 0x18(%rsp), %r15
jmp 0x20bfa
movq 0x8(%rsp), %rax
cmpl $0x0, 0xc(%rax)
movq 0x18(%rsp), %r15
jle 0x20bf6
xorl %ecx, %ecx
movq 0x20(%r15), %r14
movslq 0x8(%rax), %rax
movl %ecx, 0x38(%rsp)
movslq %ecx, %rcx
addq %rax, %rcx
leaq (%rcx,%rcx,4), %r15
movl 0x4(%r14,%r15,4), %r9d
movl 0x8(%r14,%r15,4), %eax
movl %eax, %ecx
andl $0x1, %ecx
movsbl (%rcx,%r13), %edx
movq 0x28(%rsp), %rcx
movq 0x10(%rcx), %rsi
shrl %eax
shlq $0x6, %rax
movq 0x18(%rsi,%rax), %rcx
movl (%rsi,%rax), %r8d
movq %rbx, %rdi
leaq 0x96b6(%rip), %rsi      # 0x2a01e
xorl %eax, %eax
callq 0x1fd66
movslq 0x4(%r14,%r15,4), %rax
testq %rax, %rax
jle 0x20ba8
leaq (%r14,%r15,4), %rbp
movq 0x18(%rsp), %r14
movq 0x28(%r14), %rdx
movslq (%rbp), %rcx
movq %rcx, %rsi
shlq $0x4, %rsi
movzbl 0xc(%rdx,%rsi), %r12d
addq %rax, %rcx
shlq $0x4, %rcx
movl -0xc(%rdx,%rcx), %ecx
subl 0x4(%rdx,%rsi), %ecx
leal 0x1(%rcx), %edx
cmpl %eax, %edx
leaq 0x60(%rsp), %r15
je 0x209f5
cvtsi2sd %edx, %xmm0
cvtsi2sd %eax, %xmm1
cmpl %eax, %ecx
jge 0x209cc
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0x209d0
divsd %xmm1, %xmm0
callq 0x21a0
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
divsd %xmm1, %xmm0
ucomisd 0x94af(%rip), %xmm0     # 0x29e98
jne 0x20bdb
jp 0x20bdb
movw $0x30, 0x60(%rsp)
movq %rbx, %rdi
leaq 0x9625(%rip), %rsi      # 0x2a02b
movq %r15, %rdx
xorl %eax, %eax
callq 0x1fd66
movq 0x28(%r14), %rax
movslq (%rbp), %rcx
movslq 0x4(%rbp), %rsi
addq %rcx, %rsi
shlq $0x4, %rcx
movl (%rax,%rcx), %edx
subl %r12d, %edx
incl %edx
shlq $0x4, %rsi
movl -0x10(%rax,%rsi), %ecx
incl %ecx
movq %rbx, %rdi
leaq 0x9575(%rip), %r15      # 0x29fb4
movq %r15, %rsi
xorl %eax, %eax
callq 0x1fd66
movq 0x28(%r14), %rax
movslq (%rbp), %rcx
movslq 0x4(%rbp), %rsi
addq %rcx, %rsi
shlq $0x4, %rcx
movl 0x8(%rax,%rcx), %edx
subl %r12d, %edx
incl %edx
shlq $0x4, %rsi
movl -0x8(%rax,%rsi), %ecx
incl %ecx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1fd66
btl $0x18, 0x20(%rsp)
jae 0x20ba8
movq 0x18(%rsp), %r15
movq 0x28(%r15), %rax
movslq (%rbp), %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %r14
movq %rbx, %rdi
leaq 0x941c(%rip), %rsi      # 0x29ec3
movl %r12d, %edx
xorl %eax, %eax
callq 0x1fd66
cmpl $0x2, 0x4(%rbp)
jl 0x20b1b
subl %r12d, %r14d
incl %r14d
movl $0x1, %r13d
movq 0x28(%r15), %rax
movslq (%rbp), %rcx
addq %r13, %rcx
shlq $0x4, %rcx
movl (%rax,%rcx), %r15d
cmpl $0x2, %r13d
jb 0x20aed
movq %rbx, %rdi
leaq 0x93e4(%rip), %rsi      # 0x29eca
xorl %eax, %eax
callq 0x1fd66
subl %r12d, %r15d
incl %r15d
movl %r15d, %edx
subl %r14d, %edx
movq %rbx, %rdi
leaq 0x94b5(%rip), %rsi      # 0x29fb8
xorl %eax, %eax
callq 0x1fd66
incq %r13
movl %r15d, %r14d
cmpl 0x4(%rbp), %r13d
movq 0x18(%rsp), %r15
jl 0x20ac3
movq 0x28(%r15), %rax
movslq (%rbp), %rcx
shlq $0x4, %rcx
movq 0x8(%rax,%rcx), %r14
movq %rbx, %rdi
leaq 0x93ba(%rip), %rsi      # 0x29ef0
xorl %eax, %eax
callq 0x1fd66
cmpl $0x2, 0x4(%rbp)
jl 0x20ba8
subl %r12d, %r14d
incl %r14d
movl $0x1, %r13d
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rax
movslq (%rbp), %rcx
addq %r13, %rcx
shlq $0x4, %rcx
movl 0x8(%rax,%rcx), %r15d
cmpl $0x2, %r13d
jb 0x20b7f
movq %rbx, %rdi
leaq 0x9352(%rip), %rsi      # 0x29eca
xorl %eax, %eax
callq 0x1fd66
subl %r12d, %r15d
incl %r15d
movl %r15d, %edx
subl %r14d, %edx
movq %rbx, %rdi
leaq 0x9423(%rip), %rsi      # 0x29fb8
xorl %eax, %eax
callq 0x1fd66
incq %r13
movl %r15d, %r14d
cmpl 0x4(%rbp), %r13d
jl 0x20b4f
movq %rbx, %rdi
leaq 0x9218(%rip), %rsi      # 0x29dca
xorl %eax, %eax
callq 0x1fd66
movl 0x38(%rsp), %ecx
incl %ecx
movq 0x8(%rsp), %rax
cmpl 0xc(%rax), %ecx
movq 0x18(%rsp), %r15
leaq 0x7ad7(%rip), %r13      # 0x286aa
jl 0x2091c
jmp 0x20bf6
movl $0x10, %esi
movq %r15, %rdi
leaq 0x93fc(%rip), %rdx      # 0x29fe6
movb $0x1, %al
callq 0x2140
jmp 0x209fc
movl 0x40(%rsp), %ebp
movq 0x58(%rsp), %r12
incq %r12
movslq 0x8(%r15), %rax
cmpq %rax, %r12
jl 0x201ee
jmp 0x20cff
cmpl $0x0, 0x8(%rcx)
jne 0x204e0
testl %r12d, %r12d
je 0x204e0
movq 0x20(%r15), %rax
movslq 0x8(%r11), %rcx
leaq (%rcx,%rcx,4), %rdx
movl 0x8(%rax,%rdx,4), %ebp
andl $0x1, %ebp
movl %ebp, %edx
negl %edx
movq 0x28(%rsp), %r8
movq 0x10(%r8), %r8
decl %edi
andl %edx, %edi
addl %ecx, %edi
movslq %edi, %rcx
leaq (%rcx,%rcx,4), %rcx
movl 0x8(%rax,%rcx,4), %eax
shrl %eax
shlq $0x6, %rax
leaq (%r8,%rax), %r14
movslq 0x8(%r8,%rax), %rax
leaq (%rax,%rax,2), %rax
movq (%rsi,%rax,8), %rdx
movl 0xc(%rsi,%rax,8), %ecx
movq %rbx, %rdi
leaq 0x932d(%rip), %rsi      # 0x29faa
xorl %eax, %eax
movq %r11, %r12
callq 0x1fd66
testl %ebp, %ebp
movq 0x48(%rsp), %r15
jne 0x20cb3
movl 0xc(%r14), %ecx
movl 0x24(%r12), %edx
addl %ecx, %edx
addl 0x28(%r12), %ecx
movq %rbx, %rdi
leaq 0x930b(%rip), %rsi      # 0x29fb5
xorl %eax, %eax
callq 0x1fd66
jmp 0x20cee
movq 0x8(%rbx), %rax
movslq 0x38(%rsp), %rcx
movb $0x2d, (%rax,%rcx)
movl 0x20(%r12), %ecx
addl 0xc(%r14), %ecx
movl %ecx, %edx
subl 0x28(%r12), %edx
subl 0x24(%r12), %ecx
movq %rbx, %rdi
leaq 0x92d6(%rip), %rsi      # 0x29fb5
xorl %eax, %eax
callq 0x1fd66
movl $0x1, 0x34(%rsp)
movl 0x14(%rsp), %ebp
jmp 0x2052c
btl $0x14, 0x20(%rsp)
jb 0x20d0e
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9317(%rip), %rsi      # 0x2a02c
movq %rbx, %rdi
movq 0x50(%rsp), %rdx
xorl %eax, %eax
callq 0x1fd66
cmpb $0x0, 0x20(%rsp)
setns %al
cmpl $0x2, 0x14(%rsp)
setne %cl
orb %al, %cl
jne 0x20d57
movl (%rbx), %eax
cmpl $0x3, %eax
jb 0x20d57
movq 0x8(%rbx), %rcx
leal -0x1(%rax), %edx
cmpb $0x31, (%rcx,%rdx)
jne 0x20d57
addl $-0x2, %eax
cmpb $0x2f, (%rcx,%rax)
jne 0x20d57
movl %eax, (%rbx)
leaq 0x916e(%rip), %rsi      # 0x29ecc
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1fd66
leaq 0x920a(%rip), %rdi      # 0x29f89
leaq 0x9177(%rip), %rsi      # 0x29efd
leaq 0x9179(%rip), %rcx      # 0x29f06
movl $0x9b, %edx
callq 0x2160
leaq 0x9154(%rip), %rdi      # 0x29ef2
leaq 0x9158(%rip), %rsi      # 0x29efd
leaq 0x915a(%rip), %rcx      # 0x29f06
movl $0x8d, %edx
callq 0x2160
nop