// File: /workspace/github_c_makefile_star2_O3/ksherlock[P]nroff_man/tbl.c
// Function: tbl
void tbl(void) {


	int cols = 0;
	unsigned st = 0;
	unsigned e_flag = 0;
	unsigned e_width = 0;
	unsigned z_flag = 0;

	memset(column_width, 0, sizeof(column_width));
	memset(column_align, 0, sizeof(column_align));
	memset(column_n_left, 0, sizeof(column_n_left));
	memset(column_n_right, 0, sizeof(column_n_right));

	lines = NULL;
	lines_capacity = 0;
	lines_length = 0;


	lines = malloc(sizeof(char *) * 64);
	if (!lines) man_err(1,"malloc");
	lines_capacity = 64;

	for(;;) {
		const unsigned char *cp = read_text();
		if (type == tkEOF) {
			man_warnx("TS without TE");
			break;
		}

		if (type == tkTE) break;
		if (type == tkPP) continue;
		if (type == tkPD) continue;
		if (type != tkTEXT) {
			man_warnx1s("unsupported %s within tbl", token_names[type]);
			break;
		}

		// text!
		unsigned x = strlen(cp);
		if (!x) continue;

		if (st == 0) {
			// (optional) option string (;-terminated)
			++st;
			if (cp[x-1] == ';') continue;
		}

		if (st == 1) {

			// 1+ format strings, final one is '.' terminated.
			// currently, only one line is (partially) supported

			// format string...
			cols = -1;
			unsigned w_flag = 0;

			for (unsigned i = 0; ;++i) {
				unsigned c = cp[i];
				if (c == 0) break;
				c = tolower(c);

				if (c == ',') {
					// multiple formats on one line.
					cols = -1;
					continue;
				}

				if (c == '.') {
					++st;
					++cols;
					if (cols < 1) {
						cols = 1;
						column_align[0] = align_left;
					}
					if (cols >= MAX_COLS) cols = MAX_COLS - 1;
					break;
				}
				if (c == 'l' || c == 'r' || c == 'c' || c == 'n' || c == 'a') {
					++cols;
				}
				if (cols < 0 || cols >= MAX_COLS) continue;

				switch(c) {
				case 'l':
				case 'a': // alphabetic subcolumn
					column_align[cols] = align_left;
					break;
				case 'r':
					column_align[cols] = align_right;
					break;
				case 'n':
					column_align[cols] = align_number;
					break;
				case 'c': 
					column_align[cols] = align_center;
					break;

				case 'e':
					e_flag |= (1 << cols);
					break;
				case 'z':
					z_flag |= (1 << cols);
					break;


				case 'w':
					// followed by unit-less integer -or- (width expression)
					c = cp[++i];
					x = 0;
					if (c == '(') {
						++i;
						x = get_unit(cp + i, 0, 0);
						for(;;) {
							c = cp[++i];
							if (c == ')' || c == 0) break;
						}
					}
					if (isdigit(c)) {
						x = c - '0';
						while (isdigit(c = cp[++i])) {
							x *= 10;
							x += c - '0';
						}
					}
					column_width[cols] = x;
					if (x) w_flag |= (1 << cols);
					--i;
					break;
				}
				// silently ignore everything else....
			}

			// e/z/w interaction...
			// z_flag w/o w_flag is an error...
			if ((z_flag & w_flag) != z_flag) {
				z_flag &= w_flag;
			}
			if (w_flag & e_flag) {
				w_flag &= e_flag;
				for (unsigned i = 0, mask = 1; i < cols; ++i, mask <<= 1) {
					if (w_flag & mask) {
						x = column_width[i];
						if (i > e_width) e_width = x;
					}
				}
			}

			continue;
		}


		if (lines_length == lines_capacity) {
			lines_capacity <<= 1;
			char **tmp = realloc(lines, lines_capacity * sizeof(char *));
			if (!tmp) man_err(1, "realloc");
			lines = tmp;
		}

		// a line of data...
		// count the columns...
		unsigned nc = 1;
		unsigned l = 0;
		for (l = 0; ; ++l) {
			unsigned c = cp[l];
			if (!c) break;
			if (c == '\t') ++nc;
		}

		if (!l) {
			lines[lines_length++] = SPECIAL_BLANK;
			continue;
		}

		// todo: '-', '=' just draw a line.
		if (l == 1) {
			if (cp[0] == '_' || cp[0] == '=') {
				lines[lines_length++] = SPECIAL_DASH;
				continue;
			}
		}

		if (nc > cols) nc = cols;

		// each chunk has 1 byte length, 1 byte length w/o formatting.
		char *line = malloc(l + cols * 2 + 2);
		if (!line) man_err(1, "malloc");
		memset(line, 0, l + cols * 2 + 2);
		lines[lines_length++] = line;

		for (unsigned i = 0, j = 0, col = 0, mask = 1; col < nc; ++col, mask <<= 1) {

			unsigned st = i;
			unsigned c;

			for (;;) { c = cp[i++]; if (c == '\t' || c == 0) break; }
			unsigned end = i - 1;

			line[j++] = end - st; // total length

			unsigned x = 0;

			if (column_align[col] == align_number) {
				int left;
				x = num_width(cp + st, end - st, &left);

				if (left > 0) {
					int right = x - left;
					if (left > column_n_left[col]) column_n_left[col] = left;
					if (right > column_n_right[col]) column_n_right[col] = right;
				}
			} else {
				x = xstrnlen(cp + st, end - st);
			}

			if (!(z_flag & mask)) {
				if (x > column_width[col]) column_width[col] = x;
			}

			if (e_flag & mask) {
				if (x > e_width) e_width = x;
			}

			line[j++] = x;
			while (st < end) line[j++] = cp[st++];
		}

		// todo -- only first N lines to calc width?

	}

	// re-calc n columns:
	for (unsigned col = 0, mask = 1; col < cols; ++col, mask <<= 1) {
		if (z_flag & mask) continue;
		if (column_align[col] == align_number) {
			unsigned x = column_n_left[col] + column_n_right[col];
			unsigned w = column_width[col];
			if (x > w)
				column_width[col] = x;
			else if (x < w) {
				// adjust left so content will be centered.
				unsigned sp = (w - x) >> 1;
				column_n_left[col] += sp;
				x = w;
			}

			if ((e_flag & mask) && x > e_width)
				e_width = x;

		}
	}

	// resize e columns?
	if (e_flag) {
		for (unsigned col = 0, mask = 1; col < cols; ++col, mask <<= 1) {
			if (e_flag & mask) column_width[col] = e_width;
		}
	}


	// calculate the total width (for _)
	unsigned twidth = -3; // account for extra padding
	for (unsigned i = 0, mask = 1; i < cols; ++i, mask <<= 1) {

		if (e_flag & mask) {
			column_width[i] = e_width;
			twidth += e_width;
		} else {
			twidth += column_width[i];
		}
		twidth += 3;
	}

	// now print the buffered table...

	for (unsigned i = 0; i < lines_length; ++i) {
		unsigned char *line = lines[i];


		if (line == SPECIAL_BLANK) {
			fputc('\n', stdout);
			continue;
		}
		if (line == SPECIAL_DASH) {
			for (unsigned j = 0; j < in; ++j) fputc(' ', stdout);
			for (unsigned j = 0; j < twidth; ++j)
				fputc('_', stdout);
			fputc('\n', stdout);
			continue;
		}

		unsigned padding = 0;
		unsigned k = 0;
		for (unsigned col = 0, offset = 0; col < cols; ++col) {
			unsigned w = column_width[col];
			unsigned align = column_align[col];

			unsigned ll = line[offset++]; // width w/ formatting
			unsigned l = line[offset++]; // printable width

			unsigned sp = w > l ? w - l : 0;


			switch(align) {
			default:
			case align_left:
				break;
			case align_right:
				padding += sp;
				sp = 0;
				break;
			case align_center:
				padding += sp >> 1;
				sp = (sp+1) >> 1;
				break;
			case align_number: {
					int left;
					int x;
					num_width(line + offset, l, &left);
					if (left < 0) {
						// just center it..
						padding += sp >> 1;
						sp = (sp+1) >> 1;
					} else {
						x = column_n_left[col] - left;
						if (x > 0) padding += x;
						sp = sp - x;
					}
				}
				break;

			}

			for (unsigned i = 0; i < padding; ++i) {
				buffer[k++] = ' ';
			}

			for(unsigned i = 0; i < ll; ++i) {
				buffer[k++] = line[offset++];
			}

			padding = sp + 3; // 3 spaces of padding between columns + alignment.
		}


		buffer[k++] = '\n';
		buffer[k++] = 0;
		print(buffer, 0);

		free(line);
	}

	
	free(lines);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x8b37(%rip)     # 0x10bd0
movaps %xmm0, 0x8b20(%rip)     # 0x10bc0
movaps %xmm0, 0x8b39(%rip)     # 0x10be0
movaps %xmm0, 0x8b42(%rip)     # 0x10bf0
movaps %xmm0, 0x8b4b(%rip)     # 0x10c00
movaps %xmm0, 0x8b54(%rip)     # 0x10c10
movaps %xmm0, 0x8b5d(%rip)     # 0x10c20
movaps %xmm0, 0x8b66(%rip)     # 0x10c30
xorl %eax, %eax
movl %eax, 0x8b76(%rip)      # 0x10c48
movq $0x0, (%rsp)
movl %eax, 0x8b6c(%rip)      # 0x10c4c
movl $0x200, %edi            # imm = 0x200
callq 0x4130
movq %rax, 0x8b4f(%rip)      # 0x10c40
testq %rax, %rax
jne 0x810e
callq 0x4060
movl (%rax), %esi
leaq 0x1d41(%rip), %rdx      # 0x9e45
movl $0x1, %edi
callq 0x49f1
movl $0x40, 0x8b30(%rip)     # 0x10c48
movl $0x0, 0x10(%rsp)
xorl %r14d, %r14d
movl $0x0, 0xc(%rsp)
xorl %r12d, %r12d
callq 0x5f2a
movq %rax, %r13
leaq 0x61d3(%rip), %rax      # 0xe310
movslq (%rax), %rax
cmpq $0x14, %rax
jle 0x8153
leal -0x15(%rax), %ecx
cmpl $0x2, %ecx
jb 0x812e
jmp 0x86cb
cmpl $0x1, %eax
jne 0x86d2
movq %r13, %rdi
callq 0x4090
testl %eax, %eax
je 0x812e
cmpl $0x1, 0xc(%rsp)
je 0x818c
cmpl $0x0, 0xc(%rsp)
jne 0x8396
decl %eax
movl $0x1, 0xc(%rsp)
cmpb $0x3b, (%r13,%rax)
je 0x812e
movb (%r13), %al
movl $0x1, 0xc(%rsp)
testb %al, %al
je 0x8437
xorl %r15d, %r15d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %ebx, %ebx
movl $0x45, %ebp
movzbl %al, %edi
callq 0x4110
cmpl $0x62, %eax
jg 0x81d5
cmpl $0x2c, %eax
je 0x824b
cmpl $0x61, %eax
je 0x81e7
cmpl $0x2e, %eax
jne 0x81ea
jmp 0x8693
leal -0x6c(%rax), %ecx
cmpl $0x6, %ecx
ja 0x81e2
btl %ecx, %ebp
jb 0x81e7
cmpl $0x63, %eax
jne 0x81ea
incl %r12d
cmpl $0x7, %r12d
ja 0x8382
cmpl $0x6d, %eax
jg 0x8222
cmpl $0x64, %eax
jg 0x8256
cmpl $0x61, %eax
je 0x8264
cmpl $0x63, %eax
jne 0x8382
movl %r12d, %eax
leaq 0x89ca(%rip), %rcx      # 0x10be0
movl $0x2, (%rcx,%rax,4)
jmp 0x8382
cmpl $0x76, %eax
jg 0x827a
cmpl $0x6e, %eax
je 0x8299
cmpl $0x72, %eax
jne 0x8382
movl %r12d, %eax
leaq 0x89a1(%rip), %rcx      # 0x10be0
movl $0x1, (%rcx,%rax,4)
jmp 0x8382
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x8382
cmpl $0x65, %eax
je 0x82af
cmpl $0x6c, %eax
jne 0x8382
movl %r12d, %eax
leaq 0x8972(%rip), %rcx      # 0x10be0
movl $0x0, (%rcx,%rax,4)
jmp 0x8382
cmpl $0x77, %eax
je 0x82b8
cmpl $0x7a, %eax
jne 0x8382
movq (%rsp), %rax
btsl %r12d, %eax
movq %rax, (%rsp)
jmp 0x8382
movl %r12d, %eax
leaq 0x893d(%rip), %rcx      # 0x10be0
movl $0x3, (%rcx,%rax,4)
jmp 0x8382
btsl %r12d, %r14d
jmp 0x8382
movl %r14d, 0x18(%rsp)
movq %r12, 0x20(%rsp)
leal 0x1(%rbx), %r14d
movb (%r13,%r14), %r12b
xorl %ebp, %ebp
cmpb $0x28, %r12b
jne 0x82fc
addl $0x2, %ebx
leaq (%rbx,%r13), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x66a2
movl %eax, %ebp
movl %ebx, %r14d
incl %r14d
movzbl (%r13,%r14), %r12d
cmpl $0x29, %r12d
je 0x82fc
testl %r12d, %r12d
jne 0x82e8
callq 0x41c0
movq (%rax), %rcx
movzbl %r12b, %eax
testb $0x8, 0x1(%rcx,%rax,2)
jne 0x8318
movl %ebp, %eax
movq 0x20(%rsp), %r12
jmp 0x8330
addl $-0x30, %eax
incl %r14d
movzbl (%r13,%r14), %edx
testb $0x8, 0x1(%rcx,%rdx,2)
movq 0x20(%rsp), %r12
jne 0x8337
movl $0x45, %ebp
jmp 0x8358
movl $0x45, %ebp
movzbl %dl, %edx
leal (%rax,%rax,4), %eax
leal (%rdx,%rax,2), %eax
addl $-0x30, %eax
incl %r14d
movzbl (%r13,%r14), %edx
testb $0x8, 0x1(%rcx,%rdx,2)
jne 0x833c
movl $0x1, %edx
movl %r12d, %ecx
shll %cl, %edx
movl %r12d, %ecx
testl %eax, %eax
cmovel %eax, %edx
leaq 0x884f(%rip), %rsi      # 0x10bc0
movl %eax, (%rsi,%rcx,4)
orl %edx, %r15d
decl %r14d
movl %r14d, %ebx
movl 0x18(%rsp), %r14d
incl %ebx
movb (%r13,%rbx), %al
testb %al, %al
jne 0x81b0
jmp 0x8440
movl 0x88b0(%rip), %esi      # 0x10c4c
cmpl 0x88a6(%rip), %esi      # 0x10c48
jne 0x83e3
addl %esi, %esi
movl %esi, 0x889c(%rip)      # 0x10c48
movq 0x888d(%rip), %rdi      # 0x10c40
shlq $0x3, %rsi
callq 0x4150
movq %rax, %r15
testq %rax, %rax
jne 0x83dc
callq 0x4060
movl (%rax), %esi
movl $0x1, %edi
leaq 0x1a9d(%rip), %rdx      # 0x9e74
callq 0x49f1
movq %r15, 0x885d(%rip)      # 0x10c40
xorl %eax, %eax
movl $0x1, %ebx
movl %eax, %ecx
movzbl (%r13,%rcx), %ecx
cmpl $0x9, %ecx
je 0x83fd
testl %ecx, %ecx
jne 0x83ff
jmp 0x8403
incl %ebx
incl %eax
jmp 0x83ea
cmpl $0x1, %eax
je 0x849b
testl %eax, %eax
jne 0x84cd
movq 0x8825(%rip), %rax      # 0x10c40
movl 0x882b(%rip), %ecx      # 0x10c4c
leal 0x1(%rcx), %edx
movl %edx, 0x8822(%rip)      # 0x10c4c
movq $0x2, (%rax,%rcx,8)
jmp 0x812e
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movq (%rsp), %rax
andl %r15d, %eax
movq %rax, (%rsp)
andl %r14d, %r15d
je 0x812e
testl %r12d, %r12d
je 0x812e
movl %r12d, %eax
movl $0x1, %ecx
leaq 0x8754(%rip), %rdx      # 0x10bc0
xorl %esi, %esi
movl 0x10(%rsp), %r8d
testl %r15d, %ecx
je 0x8483
movl %r8d, %edi
cmpq %rdi, %rsi
jbe 0x8483
movl (%rdx), %r8d
incq %rsi
addl %ecx, %ecx
addq $0x4, %rdx
cmpq %rsi, %rax
jne 0x8473
movl %r8d, 0x10(%rsp)
jmp 0x812e
movzbl (%r13), %ecx
cmpl $0x5f, %ecx
je 0x84aa
cmpl $0x3d, %ecx
jne 0x84cd
movq 0x878f(%rip), %rax      # 0x10c40
movl 0x8795(%rip), %ecx      # 0x10c4c
leal 0x1(%rcx), %edx
movl %edx, 0x878c(%rip)      # 0x10c4c
movq $0x1, (%rax,%rcx,8)
jmp 0x812e
cmpl %r12d, %ebx
cmovael %r12d, %ebx
leal (%rax,%r12,2), %r15d
addl $0x2, %r15d
movq %r15, %rdi
callq 0x4130
movq %rax, %rbp
testq %rax, %rax
jne 0x8504
callq 0x4060
movl (%rax), %esi
movl $0x1, %edi
leaq 0x1946(%rip), %rdx      # 0x9e45
callq 0x49f1
movq %rbp, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x40c0
movq 0x8728(%rip), %rax      # 0x10c40
movl 0x872e(%rip), %ecx      # 0x10c4c
leal 0x1(%rcx), %edx
movl %edx, 0x8725(%rip)      # 0x10c4c
movq %rbp, (%rax,%rcx,8)
testl %ebx, %ebx
je 0x812e
movl %r14d, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movl %ebx, %eax
movq %rax, 0x40(%rsp)
xorl %r15d, %r15d
movl $0x1, %r14d
xorl %r9d, %r9d
xorl %r12d, %r12d
movl 0x10(%rsp), %r8d
movl %r12d, %ecx
movl %r8d, 0x28(%rsp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %r12d, %ebx
incl %r12d
movzbl (%r13,%rbx), %eax
incl %esi
cmpl $0x9, %eax
je 0x857c
testl %eax, %eax
jne 0x8565
movq %r9, 0x10(%rsp)
movl %r9d, %eax
movb %sil, (%rbp,%rax)
leaq 0x8650(%rip), %rax      # 0x10be0
cmpl $0x3, (%rax,%r15,4)
movl %ecx, 0x1c(%rsp)
movl %ecx, %eax
movq %rax, 0x30(%rsp)
leaq (%r13,%rax), %rdi
jne 0x85ef
leaq 0x3c(%rsp), %rdx
callq 0x7fc0
movl 0x3c(%rsp), %ecx
testl %ecx, %ecx
jle 0x85f4
leaq 0x8640(%rip), %rdx      # 0x10c00
cmpl (%rdx,%r15,4), %ecx
jle 0x85d1
leaq 0x8633(%rip), %rdx      # 0x10c00
movl %ecx, (%rdx,%r15,4)
movl %eax, %edx
subl %ecx, %edx
leaq 0x8644(%rip), %rcx      # 0x10c20
cmpl (%rcx,%r15,4), %edx
jle 0x85f4
leaq 0x8637(%rip), %rcx      # 0x10c20
movl %edx, (%rcx,%r15,4)
jmp 0x85f4
callq 0x78c0
testl %r14d, (%rsp)
movq 0x10(%rsp), %r9
jne 0x8617
leaq 0x85ba(%rip), %rcx      # 0x10bc0
cmpl (%rcx,%r15,4), %eax
jbe 0x8617
leaq 0x85ad(%rip), %rcx      # 0x10bc0
movl %eax, (%rcx,%r15,4)
leal 0x1(%r9), %ecx
movl 0x28(%rsp), %esi
cmpl %esi, %eax
movl %esi, %r8d
cmoval %eax, %r8d
leal -0x1(%r12), %edx
testl %r14d, 0x18(%rsp)
cmovel %esi, %r8d
addl $0x2, %r9d
movl %ecx, %ecx
movb %al, (%rbp,%rcx)
cmpl %edx, 0x1c(%rsp)
jae 0x866e
movq 0x30(%rsp), %rcx
leaq (%rcx,%r13), %rax
subq %rcx, %rbx
movl %r9d, %ecx
xorl %edx, %edx
leal (%rcx,%rdx), %esi
movb (%rax,%rdx), %dil
movb %dil, (%rbp,%rsi)
incq %rdx
cmpq %rdx, %rbx
jne 0x8657
addl %edx, %r9d
incq %r15
addl %r14d, %r14d
cmpq 0x40(%rsp), %r15
jne 0x8558
movl %r8d, 0x10(%rsp)
movq 0x20(%rsp), %r12
movl 0x18(%rsp), %r14d
jmp 0x812e
testl %r12d, %r12d
js 0x869d
incl %r12d
jmp 0x86ad
movl $0x0, 0x8539(%rip)      # 0x10be0
movl $0x1, %r12d
movq (%rsp), %rax
cmpl $0x7, %r12d
movl $0x7, %ecx
cmovael %ecx, %r12d
movl $0x2, 0xc(%rsp)
jmp 0x8444
cmpl $0x29, %eax
je 0x86ff
jmp 0x86e6
testl %eax, %eax
jne 0x86e6
leaq 0x176f(%rip), %rsi      # 0x9e4c
xorl %edi, %edi
callq 0x41e0
jmp 0x86ff
leaq 0x5a13(%rip), %rcx      # 0xe100
movq (%rcx,%rax,8), %rdx
leaq 0x1762(%rip), %rsi      # 0x9e5a
xorl %edi, %edi
callq 0x426b
movl $0xfffffffd, %r15d      # imm = 0xFFFFFFFD
movl %r12d, %eax
testl %r12d, %r12d
movq %rax, 0x28(%rsp)
je 0x8812
leaq (,%rax,4), %rcx
movl $0x1, %edx
xorl %esi, %esi
leaq 0x8494(%rip), %rax      # 0x10bc0
movq (%rsp), %r11
movl 0x10(%rsp), %r8d
testl %r11d, %edx
jne 0x8798
leaq 0x849f(%rip), %rdi      # 0x10be0
cmpl $0x3, (%rsi,%rdi)
jne 0x8798
movl %r8d, %ebx
leaq 0x84af(%rip), %rdi      # 0x10c00
movl (%rsi,%rdi), %r8d
leaq 0x84c4(%rip), %rdi      # 0x10c20
movl (%rsi,%rdi), %edi
addl %r8d, %edi
movl (%rsi,%rax), %r9d
movl %r9d, %r10d
subl %edi, %r10d
jae 0x8773
movl %edi, (%rsi,%rax)
jmp 0x8789
jbe 0x8789
shrl %r10d
addl %r8d, %r10d
leaq 0x847e(%rip), %rdi      # 0x10c00
movl %r10d, (%rsi,%rdi)
movl %r9d, %edi
movl %ebx, %r8d
cmpl %ebx, %edi
cmovbel %ebx, %edi
testl %r14d, %edx
cmovnel %edi, %r8d
addl %edx, %edx
addq $0x4, %rsi
cmpq %rsi, %rcx
jne 0x8735
testl %r14d, %r14d
je 0x87d0
movq 0x28(%rsp), %rcx
leaq (,%rcx,4), %rcx
movl $0x1, %edx
xorl %esi, %esi
testl %r14d, %edx
je 0x87c5
movl %r8d, (%rsi,%rax)
addl %edx, %edx
addq $0x4, %rsi
cmpq %rsi, %rcx
jne 0x87bc
testl %r12d, %r12d
je 0x8812
movq 0x28(%rsp), %rcx
leaq (,%rcx,4), %rcx
movl $0xfffffffd, %r15d      # imm = 0xFFFFFFFD
movl $0x1, %edx
xorl %esi, %esi
testl %r14d, %edx
je 0x87fd
movl %r8d, (%rsi,%rax)
movl %r8d, %edi
jmp 0x8800
movl (%rsi,%rax), %edi
addl %edi, %r15d
addl $0x3, %r15d
addl %edx, %edx
addq $0x4, %rsi
cmpq %rsi, %rcx
jne 0x87ef
movq %r12, 0x20(%rsp)
cmpl $0x0, 0x842e(%rip)      # 0x10c4c
je 0x8a4a
xorl %r8d, %r8d
movq 0x5792(%rip), %r13      # 0xdfc0
leaq 0x5b37(%rip), %rbp      # 0xe36c
leaq 0x8414(%rip), %r14      # 0x10c50
leaq 0x837d(%rip), %r9       # 0x10bc0
xorl %ebx, %ebx
movq %r15, 0x30(%rsp)
movq 0x83ef(%rip), %rax      # 0x10c40
movq (%rax,%rbx,8), %r12
cmpq $0x2, %r12
je 0x88b1
cmpq $0x1, %r12
jne 0x88c4
movq %rbx, %r12
cmpl $0x0, (%rbp)
je 0x8881
xorl %ebx, %ebx
movq (%r13), %rsi
movl $0x20, %edi
callq 0x40d0
incl %ebx
cmpl (%rbp), %ebx
jb 0x886c
movl %r15d, %ebx
testl %r15d, %r15d
je 0x889b
movq (%r13), %rsi
movl $0x5f, %edi
callq 0x40d0
decl %ebx
jne 0x8889
movq (%r13), %rsi
movl $0xa, %edi
callq 0x40d0
movq %r12, %rbx
jmp 0x8a2b
movq (%r13), %rsi
movl $0xa, %edi
callq 0x40d0
jmp 0x8a2b
movq %rbx, (%rsp)
cmpl $0x0, 0x20(%rsp)
je 0x89f1
xorl %r10d, %r10d
xorl %ebx, %ebx
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x28(%rsp), %rdi
movl (%r9,%r10,4), %r11d
leaq 0x82f3(%rip), %rax      # 0x10be0
movl (%rax,%r10,4), %eax
leal 0x1(%rbx), %ecx
movl %ebx, %edx
movzbl (%r12,%rdx), %r13d
addl $0x2, %ebx
movzbl (%r12,%rcx), %esi
subl %esi, %r11d
cmovbl %r8d, %r11d
cmpl $0x3, %eax
je 0x8935
cmpl $0x2, %eax
je 0x8925
cmpl $0x1, %eax
jne 0x89a3
addl %r11d, %r15d
xorl %r11d, %r11d
jmp 0x89a3
movl %r11d, %eax
shrl %eax
addl %eax, %r15d
incl %r11d
shrl %r11d
jmp 0x89a3
movl %r11d, 0x1c(%rsp)
movq %r10, 0x10(%rsp)
movl %ebx, %edi
addq %r12, %rdi
leaq 0x38(%rsp), %rdx
callq 0x7fc0
movl 0x38(%rsp), %eax
testl %eax, %eax
js 0x897c
leaq 0x82a3(%rip), %rcx      # 0x10c00
movq 0x10(%rsp), %r10
movl (%rcx,%r10,4), %ecx
subl %eax, %ecx
testl %ecx, %ecx
movl $0x0, %eax
cmovgl %ecx, %eax
movl 0x1c(%rsp), %r11d
subl %ecx, %r11d
jmp 0x8991
movl 0x1c(%rsp), %r11d
movl %r11d, %eax
shrl %eax
incl %r11d
shrl %r11d
movq 0x10(%rsp), %r10
addl %eax, %r15d
movq 0x28(%rsp), %rdi
xorl %r8d, %r8d
leaq 0x821d(%rip), %r9       # 0x10bc0
testl %r15d, %r15d
je 0x89bc
leal (%r15,%rbp), %eax
movl %ebp, %ecx
incl %ebp
movb $0x20, (%rcx,%r14)
decl %r15d
jne 0x89ac
movl %eax, %ebp
testl %r13d, %r13d
je 0x89dc
leal (%rbx,%r13), %eax
movl %ebx, %ecx
incl %ebx
movb (%r12,%rcx), %cl
movl %ebp, %edx
incl %ebp
movb %cl, (%rdx,%r14)
decl %r13d
jne 0x89c5
movl %eax, %ebx
addl $0x3, %r11d
incq %r10
movl %r11d, %r15d
cmpq %rdi, %r10
jne 0x88e2
jmp 0x89f3
xorl %ebp, %ebp
movl %ebp, %eax
incl %ebp
movb $0xa, (%rax,%r14)
movb $0x0, (%rbp,%r14)
movq %r14, %rdi
xorl %esi, %esi
callq 0x766e
movq %r12, %rdi
callq 0x4040
movq 0x30(%rsp), %r15
movq 0x55a0(%rip), %r13      # 0xdfc0
leaq 0x5945(%rip), %rbp      # 0xe36c
movq (%rsp), %rbx
incq %rbx
movl 0x8218(%rip), %eax      # 0x10c4c
cmpq %rax, %rbx
movl $0x0, %r8d
leaq 0x817c(%rip), %r9       # 0x10bc0
jb 0x884a
movq 0x81ef(%rip), %rdi      # 0x10c40
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4040