// File: /workspace/github_c_makefile_star2_O2/j-hoppe[P]tu58fs/tu58drive.c
// Function: tu58_server
void* tu58_server(void* none) {
	uint8_t flag = TUF_NULL;
	uint8_t last = TUF_NULL;
	UNUSED(none);

	// some init
	reinit(); // empty serial line buffers
	tu58_doinit = !opt_nosync; // start sending init flags?

	tu58_offline_request = 0;
	tu58_offline = 0;

	// say hello
	info("emulator %sstarted", tu58_runonce++ ? "re" : "");

	// loop forever ... almost
	for (;;) {

		if (tu58_offline_request && !tu58_offline) {
			// if requested, go offline after inactivity timeout

			if (tu58_serial.rx_lasttime_ms + opt_offlinetimeout_sec * 1000 < now_ms()
					&& tu58_serial.tx_lasttime_ms + opt_offlinetimeout_sec * 1000 < now_ms()) {
				tu58_offline = 1;
				if (opt_verbose)
					info("TU58 now offline");
			}
		} else if (!tu58_offline_request && tu58_offline) {
			tu58_offline = 0;
			if (opt_verbose)
				info("TU58 now online");
		}
		// if offline, on read/write/seek a "no cartridge" is sent

		// loop while no characters are available
		if (serial_devrxavail(&tu58_serial) == 0) {
			// delays and printout only if not VAX
			if (!opt_vax) {
				// send INITs if still required
				if (tu58_doinit) {
					if (opt_debug)
						fprintf(ferr, ".");
					serial_devtxput(&tu58_serial, TUF_INIT);
					serial_devtxflush(&tu58_serial);
					tu58_serial.tx_lasttime_ms = 0; // does not count as traffic
					delay_ms(75);
				}
				delay_ms(25);
				continue; // loop again
			}
		} else
			tu58_doinit = 0; // quit sending init flags

#ifdef ORG
		// loop while no characters are available
		while (serial_devrxavail() == 0) {
			// delays and printout only if not VAX
			if (!opt_vax) {
				// send INITs if still required
				if (tu58_doinit) {
					if (opt_debug) fprintf(ferr, ".");
					serial_devtxput(TUF_INIT);
					serial_devtxflush();
					delay_ms(75);
				}
				delay_ms(25);
			}
		}
		tu58_doinit = 0; // quit sending init flags
#endif

		// process received characters
		last = flag;
		flag = serial_devrxget(&tu58_serial);
		if (opt_debug)
			info("flag=0x%02X last=0x%02X", flag, last);

		switch (flag) {

		case TUF_CTRL:
			// control packet - process
			command(flag);
			break;

		case TUF_INIT:
			// init flag
			if (opt_debug)
				info("<INIT> seen");
			if (last == TUF_INIT) {
				// two in a row is special
				if (!opt_vax)
					delay_ms(tudelay[opt_timing].init); // no delay for VAX
				serial_devtxput(&tu58_serial, TUF_CONT); // send 'continue'
				serial_devtxflush(&tu58_serial); // send immediate
				flag = -1; // undefined
				if (opt_debug)
					info("<INIT><INIT> seen, sending <CONT>");
			}
			break;

		case TUF_BOOT:
			// special boot sequence
			if (opt_debug)
				info("<BOOT> seen");
			bootio();
			break;

		case TUF_NULL:
			// ignore nulls (which are BREAKs)
			if (opt_debug)
				info("<NULL> seen");
			break;

		case TUF_CONT:
			// continue restarts output
			if (opt_debug)
				info("<CONT> seen, starting output");
			serial_devtxstart(&tu58_serial);
			break;

		case TUF_XOFF:
			// send disable flag stops output
			if (opt_debug)
				info("<XOFF> seen, stopping output");
			serial_devtxstop(&tu58_serial);
			break;

		case TUF_DATA:
			// data packet - should never see one here
			error("protocol error - data flag out of sequence");
			reinit();
			break;

		default:
			// whoops, protocol error
			error("unknown packet flag 0x%02X (%c)", flag,
			isprint(flag) ? flag : '.');
			break;

		} // switch (flag)

	} // for (;;)

	return (void*) 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2f8, %rsp            # imm = 0x2F8
callq 0x72e4
leaq 0x1659b(%rip), %rax     # 0x1ca70
xorl %ecx, %ecx
cmpl %ecx, (%rax)
sete 0x17991(%rip)           # 0x1de71
movl %ecx, 0x179da(%rip)     # 0x1dec0
movl %ecx, 0x179d8(%rip)     # 0x1dec4
movb 0x17980(%rip), %al      # 0x1de72
leal 0x1(%rax), %ecx
movb %cl, 0x17977(%rip)      # 0x1de72
testb %al, %al
leaq 0xe2d7(%rip), %rax      # 0x147db
leaq 0xd303(%rip), %rsi      # 0x1380e
cmoveq %rax, %rsi
leaq 0xd2e5(%rip), %rdi      # 0x137fb
xorl %eax, %eax
callq 0x99c3
leaq 0x16540(%rip), %r14     # 0x1ca64
leaq 0x1799d(%rip), %r15     # 0x1dec8
leaq 0x16546(%rip), %r12     # 0x1ca78
pushq $0x19
popq %rbp
xorl %r13d, %r13d
cmpl $0x0, 0x17981(%rip)     # 0x1dec0
je 0x654a
cmpl $0x0, 0x1797c(%rip)     # 0x1dec4
je 0x6579
cmpl $0x0, 0x1796f(%rip)     # 0x1dec0
jne 0x65df
cmpl $0x0, 0x17966(%rip)     # 0x1dec4
je 0x65df
movl $0x0, 0x1795a(%rip)     # 0x1dec4
cmpl $0x0, (%r14)
leaq 0xd2ad(%rip), %rdi      # 0x13822
jne 0x65d8
jmp 0x65df
leaq 0x15d8c(%rip), %rax     # 0x1c30c
movslq (%rax), %rax
imulq $0x3e8, %rax, %rbx      # imm = 0x3E8
addq 0x17947(%rip), %rbx     # 0x1ded8
xorl %eax, %eax
callq 0x9c9e
cmpq %rax, %rbx
jae 0x65df
leaq 0x15d68(%rip), %rax     # 0x1c30c
movslq (%rax), %rax
imulq $0x3e8, %rax, %rbx      # imm = 0x3E8
addq 0x1792b(%rip), %rbx     # 0x1dee0
xorl %eax, %eax
callq 0x9c9e
cmpq %rax, %rbx
jae 0x65df
movl $0x1, 0x178f9(%rip)     # 0x1dec4
cmpl $0x0, (%r14)
leaq 0xd23b(%rip), %rdi      # 0x13811
je 0x65df
xorl %eax, %eax
callq 0x99c3
movq %r15, %rdi
callq 0x80da
testl %eax, %eax
jne 0x6648
cmpl $0x0, (%r12)
jne 0x664f
cmpb $0x0, 0x17878(%rip)     # 0x1de71
je 0x663c
leaq 0x16472(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x6619
leaq 0x17c22(%rip), %rax     # 0x1e230
movq (%rax), %rsi
pushq $0x2e
popq %rdi
callq 0x3290
movq %r15, %rdi
pushq $0x4
popq %rsi
callq 0x81f1
movq %r15, %rdi
callq 0x816c
andq $0x0, 0x178ac(%rip)     # 0x1dee0
pushq $0x4b
popq %rdi
callq 0x9c93
movl %ebp, %edi
callq 0x9c93
jmp 0x6538
movb $0x0, 0x17822(%rip)     # 0x1de71
movq %r15, %rdi
callq 0x81ba
movl %eax, %ebx
leaq 0x16414(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
movzbl %bl, %r14d
je 0x667e
movzbl %r13b, %edx
leaq 0xd1be(%rip), %rdi      # 0x13832
movl %r14d, %esi
xorl %eax, %eax
callq 0x99c3
cmpb $0x8, %bl
ja 0x66bc
leaq 0xd096(%rip), %rcx      # 0x13720
movslq (%rcx,%r14,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r13d, %r13d
leaq 0x163d7(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
leaq 0x163bd(%rip), %r14     # 0x1ca64
je 0x6538
xorl %r13d, %r13d
leaq 0xd1cd(%rip), %rdi      # 0x13884
jmp 0x680b
cmpl $0x10, %r14d
je 0x68ad
cmpl $0x13, %r14d
jne 0x66fd
leaq 0x163a1(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x66e6
leaq 0xd1ce(%rip), %rdi      # 0x138ad
xorl %eax, %eax
callq 0x99c3
movq %r15, %rdi
callq 0x8074
movb $0x13, %r13b
leaq 0x1636c(%rip), %r14     # 0x1ca64
jmp 0x6538
callq 0x35d0
movq (%rax), %rax
movzwl (%rax,%r14,2), %eax
btl $0xe, %eax
movl %r14d, %edx
pushq $0x2e
popq %rax
cmovael %eax, %edx
leaq 0xd1d7(%rip), %rdi      # 0x138f5
movl %r14d, %esi
xorl %eax, %eax
callq 0x98f2
movl %r14d, %r13d
leaq 0x16332(%rip), %r14     # 0x1ca64
jmp 0x6538
leaq 0xd18c(%rip), %rdi      # 0x138ca
xorl %eax, %eax
callq 0x98f2
callq 0x72e4
movb $0x1, %r13b
leaq 0x16310(%rip), %r14     # 0x1ca64
jmp 0x6538
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movb $0x2, 0xa(%rsp)
movq %r15, %rdi
callq 0x81ba
movb %al, 0xb(%rsp)
cmpb $0xf, %al
jb 0x68fe
movzbl %al, %esi
leaq 0xd1bb(%rip), %rdi      # 0x13944
xorl %eax, %eax
callq 0x98f2
callq 0x72e4
leaq 0x162c8(%rip), %r14     # 0x1ca64
jmp 0x6932
leaq 0x162cc(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x67bb
leaq 0xd096(%rip), %rdi      # 0x1384a
xorl %eax, %eax
callq 0x99c3
cmpb $0x4, %r13b
movb $0x4, %r13b
leaq 0x1629b(%rip), %r14     # 0x1ca64
jne 0x6538
cmpl $0x0, (%r12)
jne 0x67de
pushq $0x1
popq %rdi
callq 0x9c93
movq %r15, %rdi
pushq $0x10
popq %rsi
callq 0x81f1
movq %r15, %rdi
callq 0x816c
movb $-0x1, %r13b
leaq 0x16279(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x6538
leaq 0xd04b(%rip), %rdi      # 0x13856
xorl %eax, %eax
callq 0x99c3
jmp 0x6538
leaq 0x16256(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x6831
leaq 0xd04e(%rip), %rdi      # 0x13878
xorl %eax, %eax
callq 0x99c3
movq %r15, %rdi
callq 0x81ba
movzbl %al, %r14d
leaq 0x1763c(%rip), %rax     # 0x1de80
movq (%rax,%r14,8), %rbx
testq %rbx, %rbx
leaq 0xf0(%rsp), %r13
je 0x68de
cmpb $0x0, 0xf4(%rbx)
je 0x68de
leaq 0x161fb(%rip), %rax     # 0x1ca64
cmpl $0x0, (%rax)
je 0x688e
leaq 0xd478(%rip), %rdi      # 0x13ced
leaq 0xc13d(%rip), %rsi      # 0x129b9
movl %r14d, %edx
xorl %ecx, %ecx
movl $0x200, %r8d            # imm = 0x200
xorl %eax, %eax
callq 0x99c3
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x7bda
testl %eax, %eax
je 0x69a8
leaq 0xd465(%rip), %rdi      # 0x13d10
jmp 0x68e5
leaq 0x161c0(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x68c7
leaq 0xcfd0(%rip), %rdi      # 0x13890
xorl %eax, %eax
callq 0x99c3
movq %r15, %rdi
callq 0x807d
movb $0x10, %r13b
leaq 0x1618b(%rip), %r14     # 0x1ca64
jmp 0x6538
leaq 0xd3f5(%rip), %rdi      # 0x13cda
movl %r14d, %esi
xorl %eax, %eax
callq 0x98f2
movb $0x8, %r13b
leaq 0x1616b(%rip), %r14     # 0x1ca64
jmp 0x6538
leaq 0xa(%rsp), %rdi
callq 0x7400
testl %eax, %eax
leaq 0x16153(%rip), %r14     # 0x1ca64
je 0x693a
leaq 0xd04a(%rip), %rdi      # 0x13964
xorl %eax, %eax
callq 0x98f2
movzbl 0xe(%rsp), %edi
movl $0xef, %esi
xorl %edx, %edx
callq 0x7489
movb $0x2, %r13b
jmp 0x6538
leaq 0x16133(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x695e
movzbl 0xc(%rsp), %esi
movzbl 0xb(%rsp), %edx
leaq 0xd020(%rip), %rdi      # 0x13977
xorl %eax, %eax
callq 0x99c3
cmpl $0x0, (%r14)
leaq 0xcfd6(%rip), %rbx      # 0x1393f
je 0x6aae
movzbl 0xc(%rsp), %eax
cmpq $0xa, %rax
ja 0x6a6c
leaq 0xcdbf(%rip), %rcx      # 0x13744
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
leaq 0xd000(%rip), %r13      # 0x13993
leaq 0xd890(%rip), %rbx      # 0x1422a
jmpq *%rax
leaq 0xd006(%rip), %r13      # 0x139a9
jmp 0x6a51
movq %rbx, %rdi
movq %r13, %rsi
movl $0x200, %edx            # imm = 0x200
callq 0x7c6f
cmpl $0x200, %eax            # imm = 0x200
jne 0x69e3
movq %r15, %rdi
movq %r13, %rsi
movl $0x200, %edx            # imm = 0x200
callq 0x8124
cmpl $0x200, %eax            # imm = 0x200
je 0x68ef
leaq 0xd37e(%rip), %rdi      # 0x13d5f
jmp 0x69ea
leaq 0xd33e(%rip), %rdi      # 0x13d28
movl %r14d, %esi
movl $0x200, %edx            # imm = 0x200
movl %eax, %ecx
xorl %eax, %eax
callq 0x98f2
jmp 0x68ef
movzbl 0xe(%rsp), %edx
movzbl 0xf(%rsp), %ecx
movzbl 0xd(%rsp), %r8d
movzwl 0x14(%rsp), %r9d
leaq 0xcfba(%rip), %rdi      # 0x139d7
leaq 0xcf99(%rip), %rbx      # 0x139bd
jmp 0x6a98
leaq 0xcf80(%rip), %r13      # 0x139ad
jmp 0x6a51
leaq 0xcf7f(%rip), %r13      # 0x139b5
jmp 0x6a51
leaq 0xcf65(%rip), %r13      # 0x139a4
jmp 0x6a51
leaq 0xd153(%rip), %rbx      # 0x13b9b
jmp 0x6a73
leaq 0xcf4b(%rip), %r13      # 0x1399c
movzbl 0xe(%rsp), %edx
leaq 0xcf6d(%rip), %rdi      # 0x139ca
movq %r13, %rsi
xorl %eax, %eax
callq 0x99c3
movq %r13, %rbx
jmp 0x6aa2
leaq 0xcf4f(%rip), %rbx      # 0x139c2
movzbl 0xe(%rsp), %edx
movzbl 0xf(%rsp), %ecx
movzbl 0xd(%rsp), %r8d
movzwl 0x14(%rsp), %r9d
movzwl 0x12(%rsp), %eax
movl %eax, (%rsp)
leaq 0xcf6c(%rip), %rdi      # 0x13a04
movq %rbx, %rsi
xorl %eax, %eax
callq 0x99c3
xorl %edi, %edi
leaq 0x50(%rsp), %rsi
callq 0x3130
leaq 0x15fb7(%rip), %rax     # 0x1ca6c
cmpl $0x0, (%rax)
je 0x6ac9
movb 0xf(%rsp), %al
shrb $0x3, %al
andb $0x1, %al
movb %al, 0x173a7(%rip)      # 0x1de70
movzbl 0xc(%rsp), %eax
cmpq $0xa, %rax
ja 0x6d16
leaq 0xcc91(%rip), %rcx      # 0x13770
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
pushq $0x1
popq %rdi
jmp 0x6bf6
movzbl 0xe(%rsp), %r13d
leaq 0x17383(%rip), %rax     # 0x1de80
movq (%rax,%r13,8), %rdi
testq %rdi, %rdi
je 0x6d2d
cmpb $0x0, 0xf4(%rdi)
je 0x6d2d
cmpl $0x0, 0x173a6(%rip)     # 0x1dec4
jne 0x6cc2
cmpb $0x0, 0xd(%rsp)
movl $0x80, %esi
movl $0x200, %eax            # imm = 0x200
cmovnsl %eax, %esi
movzwl 0x14(%rsp), %edx
movzwl 0x12(%rsp), %eax
movq %rax, 0x30(%rsp)
leal -0x1(%rax), %ecx
movq %rdi, 0x18(%rsp)
movq %rsi, 0x38(%rsp)
movl %edx, 0x28(%rsp)
callq 0x7bda
testl %eax, %eax
jne 0x6b7c
movq 0x18(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl 0x28(%rsp), %edx
xorl %ecx, %ecx
callq 0x7bda
testl %eax, %eax
je 0x6eaa
leaq 0xcf9c(%rip), %rdi      # 0x13b1f
movl %r13d, %esi
movl 0x28(%rsp), %edx
xorl %eax, %eax
callq 0x98f2
movl %r13d, %edi
movl $0xc9, %esi
jmp 0x6c02
movzbl 0xe(%rsp), %r14d
leaq 0x172d8(%rip), %rax     # 0x1de80
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x6d36
cmpb $0x0, 0xf4(%rdi)
je 0x6d36
cmpl $0x0, 0x172fb(%rip)     # 0x1dec4
je 0x6d80
movl %r14d, %edi
movl $0xf7, %esi
jmp 0x6d4f
leaq 0x15e85(%rip), %rax     # 0x1ca68
movslq (%rax), %rax
imulq $0xc, %rax, %rax
leaq 0xcbaf(%rip), %rcx      # 0x137a0
movzwl 0x4(%rax,%rcx), %edi
callq 0x9c93
movzbl 0xe(%rsp), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x7489
cmpl $0x0, (%r14)
je 0x6932
xorl %edi, %edi
leaq 0x40(%rsp), %rsi
callq 0x3130
leaq 0x15e4e(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x6932
movl 0x40(%rsp), %eax
subl 0x50(%rsp), %eax
imull $0x3e8, %eax, %ecx      # imm = 0x3E8
movq 0x48(%rsp), %rax
subq 0x58(%rsp), %rax
cqto
movl $0xf4240, %esi          # imm = 0xF4240
idivq %rsi
leal (%rax,%rcx), %edx
cmpl $0x1, %edx
adcl %eax, %ecx
leaq 0xcddc(%rip), %rdi      # 0x13a3c
movq %rbx, %rsi
movl %ecx, %edx
xorl %eax, %eax
callq 0x99c3
jmp 0x6932
pushq $0x1
popq %rdi
callq 0x9c93
movq %r15, %rdi
callq 0x8090
movq %r15, %rdi
callq 0x80b2
jmp 0x6bfb
movzbl 0xe(%rsp), %r13d
leaq 0x171e5(%rip), %rax     # 0x1de80
movq (%rax,%r13,8), %rdi
testq %rdi, %rdi
je 0x6d62
cmpb $0x0, 0xf4(%rdi)
je 0x6d62
cmpl $0x0, 0x17208(%rip)     # 0x1dec4
je 0x6dc7
movl %r13d, %edi
movl $0xf7, %esi
jmp 0x6c02
pushq $0x1
popq %rdi
callq 0x9c93
leaq 0x15d8e(%rip), %rax     # 0x1ca6c
cmpl $0x0, (%rax)
jne 0x6bfb
movw $0x1801, 0xf0(%rsp)     # imm = 0x1801
leaq 0xf2(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0xf0(%rsp), %rdi
callq 0x74c0
jmp 0x6c09
pushq $0x1
popq %rdi
callq 0x9c93
movzbl 0xe(%rsp), %edi
movl $0xd0, %esi
jmp 0x6c02
leaq 0xcdd7(%rip), %rdi      # 0x13b0b
jmp 0x6d69
leaq 0xcf47(%rip), %rdi      # 0x13c84
movl %r14d, %esi
xorl %eax, %eax
callq 0x98f2
movl %r14d, %edi
movl $0xf8, %esi
xorl %edx, %edx
callq 0x7489
leaq 0x15d07(%rip), %r14     # 0x1ca64
jmp 0x6c09
leaq 0xcd3b(%rip), %rdi      # 0x13aa4
movl %r13d, %esi
xorl %eax, %eax
callq 0x98f2
movl %r13d, %edi
movl $0xf8, %esi
jmp 0x6c02
movq %rbx, %r13
cmpb $0x0, 0xd(%rsp)
movl $0x80, %esi
movl $0x200, %eax            # imm = 0x200
cmovnsl %eax, %esi
movzwl 0x14(%rsp), %ebx
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x7bda
testl %eax, %eax
je 0x6e25
leaq 0xcee9(%rip), %rdi      # 0x13c97
movl %r14d, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x98f2
movl %r14d, %edi
movl $0xc9, %esi
jmp 0x6e49
movq %r13, 0x18(%rsp)
movq %rbx, 0x38(%rsp)
cmpb $0x0, 0xd(%rsp)
movl $0x80, %ebx
movl $0x200, %eax            # imm = 0x200
cmovnsl %eax, %ebx
movzwl 0x14(%rsp), %r13d
movzwl 0x12(%rsp), %eax
movq %rax, 0x28(%rsp)
leal -0x1(%rax), %ecx
movl %ebx, %esi
movq %rdi, 0x30(%rsp)
movl %r13d, %edx
callq 0x7bda
testl %eax, %eax
je 0x6e5f
leaq 0xcca7(%rip), %rdi      # 0x13ab7
movq 0x18(%rsp), %rbx
movl %ebx, %esi
movl %r13d, %edx
xorl %eax, %eax
callq 0x98f2
movl %ebx, %edi
jmp 0x6e94
leaq 0x15c3c(%rip), %rax     # 0x1ca68
movslq (%rax), %rax
imulq $0xc, %rax, %rax
leaq 0xc966(%rip), %rcx      # 0x137a0
movzwl 0x6(%rax,%rcx), %edi
callq 0x9c93
movl %r14d, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x7489
leaq 0x15c0d(%rip), %r14     # 0x1ca64
movq %r13, %rbx
jmp 0x6c09
movq 0x30(%rsp), %rdi
movl %ebx, %esi
movl %r13d, %edx
xorl %ecx, %ecx
callq 0x7bda
testl %eax, %eax
movl %r13d, %edx
je 0x7039
leaq 0xcc35(%rip), %rdi      # 0x13ab7
movq 0x18(%rsp), %r13
movl %r13d, %esi
xorl %eax, %eax
callq 0x98f2
movl %r13d, %edi
movl $0xc9, %esi
xorl %edx, %edx
callq 0x7489
movq 0x38(%rsp), %rbx
jmp 0x6c09
movq %r13, 0x20(%rsp)
movq %rbx, %r13
leaq 0x15baf(%rip), %rax     # 0x1ca68
movslq (%rax), %rax
imulq $0xc, %rax, %rax
leaq 0xc8d9(%rip), %rcx      # 0x137a0
movzwl 0x6(%rax,%rcx), %edi
callq 0x9c93
movq 0x30(%rsp), %rdx
movl %edx, %ebx
testl %ebx, %ebx
jle 0x718c
movq %r15, %rdi
pushq $0x10
popq %rsi
callq 0x81f1
movq %r15, %rdi
callq 0x816c
leaq 0x15b7a(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x6f0d
leaq 0xc963(%rip), %rdi      # 0x13869
xorl %eax, %eax
callq 0x99c3
movb $-0x1, 0x6c(%rsp)
movb $-0x1, %r14b
movq %r15, %rdi
callq 0x81ba
movb %al, 0x6c(%rsp)
leaq 0x15b4c(%rip), %rcx     # 0x1ca74
cmpl $0x0, (%rcx)
je 0x6f46
movzbl %al, %esi
movzbl %r14b, %edx
leaq 0xc8f7(%rip), %rdi      # 0x13832
xorl %eax, %eax
callq 0x99c3
movb 0x6c(%rsp), %al
xorb $0x4, %r14b
movl %eax, %ecx
xorb $0x4, %cl
orb %r14b, %cl
je 0x70ee
cmpb $0x10, %al
je 0x6f92
movzbl %al, %eax
cmpl $0x13, %eax
je 0x6f6e
cmpl $0x2, %eax
jne 0x6fb4
jmp 0x716f
leaq 0x15aff(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x6f88
leaq 0xc92c(%rip), %rdi      # 0x138ad
xorl %eax, %eax
callq 0x99c3
movq %r15, %rdi
callq 0x8074
jmp 0x6fb4
leaq 0x15adb(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x6fac
leaq 0xc8eb(%rip), %rdi      # 0x13890
xorl %eax, %eax
callq 0x99c3
movq %r15, %rdi
callq 0x807d
movb 0x6c(%rsp), %r14b
cmpb $0x1, %r14b
jne 0x6f15
movq %r15, %rdi
callq 0x81ba
movb %al, 0x6d(%rsp)
leaq 0x6c(%rsp), %rdi
callq 0x7400
testl %eax, %eax
leaq 0x15a82(%rip), %r14     # 0x1ca64
jne 0x722f
movzbl 0x6d(%rsp), %edx
movq 0x18(%rsp), %rdi
leaq 0x6e(%rsp), %rsi
callq 0x7cf2
movzbl 0x6d(%rsp), %ecx
cmpl %ecx, %eax
jne 0x724e
leaq 0x15a58(%rip), %rax     # 0x1ca68
movslq (%rax), %rax
imulq $0xc, %rax, %rax
leaq 0xc782(%rip), %rcx      # 0x137a0
movzwl 0xa(%rax,%rcx), %edi
callq 0x9c93
movzbl 0x6d(%rsp), %eax
subl %eax, %ebx
movq 0x30(%rsp), %rdx
jmp 0x6ed8
movl %edx, 0x20(%rsp)
movq 0x30(%rsp), %r13
leaq 0x15a1f(%rip), %rax     # 0x1ca68
movslq (%rax), %rax
imulq $0xc, %rax, %rax
leaq 0xc749(%rip), %rcx      # 0x137a0
movzwl 0x6(%rax,%rcx), %edi
callq 0x9c93
movq 0x28(%rsp), %rdx
movl %edx, %ebx
testl %ebx, %ebx
jle 0x712e
movb $0x1, 0xf0(%rsp)
movl $0x80, %eax
cmpl %eax, %ebx
movl $0x80, %edx
cmovbl %ebx, %edx
movb %dl, 0xf1(%rsp)
movq %r13, %rdi
leaq 0xf2(%rsp), %rsi
callq 0x7c6f
movzbl 0xf1(%rsp), %ecx
cmpl %ecx, %eax
jne 0x713a
leaq 0xf0(%rsp), %rdi
callq 0x74c0
leaq 0x159a6(%rip), %rax     # 0x1ca68
movslq (%rax), %rax
imulq $0xc, %rax, %rax
leaq 0xc6d0(%rip), %rcx      # 0x137a0
movzwl 0x8(%rax,%rcx), %edi
callq 0x9c93
movzbl 0xf1(%rsp), %eax
subl %eax, %ebx
movq 0x28(%rsp), %rdx
jmp 0x7068
movq %r15, %rdi
pushq $0x10
popq %rsi
callq 0x81f1
movq %r15, %rdi
callq 0x816c
leaq 0x1596c(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
leaq 0x15952(%rip), %r14     # 0x1ca64
movq %r13, %rbx
je 0x6c09
leaq 0xca1e(%rip), %rdi      # 0x13b40
xorl %eax, %eax
callq 0x99c3
jmp 0x6c09
movq 0x18(%rsp), %rdi
xorl %esi, %esi
jmp 0x6e9b
leaq 0xc996(%rip), %rdi      # 0x13ad7
movq 0x18(%rsp), %rsi
movl 0x20(%rsp), %edx
movq 0x28(%rsp), %r13
movl %r13d, %ecx
xorl %eax, %eax
callq 0x98f2
subl %ebx, %r13d
movzwl %r13w, %edx
movq 0x18(%rsp), %rdi
movl $0xfe, %esi
jmp 0x6e9b
leaq 0xc9f9(%rip), %rdi      # 0x13b6f
xorl %eax, %eax
callq 0x98f2
movq 0x20(%rsp), %rdi
movl $0xef, %esi
jmp 0x6e49
movq 0x38(%rsp), %rcx
leal -0x1(%rcx), %eax
andw %dx, %ax
movq %r13, %rbx
movq 0x20(%rsp), %rdi
je 0x7228
movzwl %ax, %eax
subl %eax, %ecx
movslq %ecx, %rdx
leaq 0xf0(%rsp), %rdi
movq %rcx, %r13
xorl %esi, %esi
callq 0x3220
leaq 0x158ae(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x71e1
leaq 0xca5b(%rip), %rdi      # 0x13c2d
movq 0x20(%rsp), %rsi
movl %r13d, %edx
xorl %eax, %eax
callq 0x99c3
movq 0x18(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
movl %r13d, %edx
callq 0x7cf2
cmpl %r13d, %eax
jne 0x7285
leaq 0x15862(%rip), %rax     # 0x1ca68
movslq (%rax), %rax
imulq $0xc, %rax, %rax
leaq 0xc58c(%rip), %rcx      # 0x137a0
movzwl 0xa(%rax,%rcx), %edi
callq 0x9c93
movq 0x30(%rsp), %rdx
movq 0x20(%rsp), %rdi
xorl %esi, %esi
jmp 0x72b1
leaq 0xc96b(%rip), %rdi      # 0x13ba1
xorl %eax, %eax
callq 0x98f2
movq 0x20(%rsp), %rdi
movl $0xef, %esi
xorl %edx, %edx
jmp 0x72da
movq 0x30(%rsp), %rcx
movl %ecx, %edx
subl %ebx, %edx
movzwl %dx, %edx
movl %edx, 0x18(%rsp)
cmpl $-0x2, %eax
jne 0x72b6
leaq 0xc94b(%rip), %rdi      # 0x13bb5
movq 0x20(%rsp), %rbx
movl %ebx, %esi
movl 0x28(%rsp), %edx
xorl %eax, %eax
callq 0x98f2
movl %ebx, %edi
movl $0xf5, %esi
jmp 0x72d6
leaq 0xc9c3(%rip), %rdi      # 0x13c4f
movq 0x20(%rsp), %r13
movl %r13d, %esi
movl 0x28(%rsp), %edx
movq 0x30(%rsp), %rcx
xorl %eax, %eax
callq 0x98f2
movl %r13d, %edi
movl $0xfe, %esi
movq 0x30(%rsp), %rdx
jmp 0x6c04
leaq 0xc935(%rip), %rdi      # 0x13bf2
movq 0x20(%rsp), %rbx
movl %ebx, %esi
movl 0x28(%rsp), %edx
xorl %eax, %eax
callq 0x98f2
movl %ebx, %edi
movl $0xfe, %esi
movl 0x18(%rsp), %edx
callq 0x7489
jmp 0x6e57