// File: /workspace/github_c_makefile_star2_O1/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 $0x2e8, %rsp            # imm = 0x2E8
callq 0x7665
leaq 0x1621c(%rip), %rax     # 0x1ca80
xorl %ecx, %ecx
cmpl %ecx, (%rax)
sete 0x17612(%rip)           # 0x1de81
movl %ecx, 0x1765b(%rip)     # 0x1ded0
movl %ecx, 0x17659(%rip)     # 0x1ded4
movb 0x17601(%rip), %al      # 0x1de82
leal 0x1(%rax), %ecx
movb %cl, 0x175f8(%rip)      # 0x1de82
testb %al, %al
leaq 0xef0c(%rip), %rax      # 0x1579f
leaq 0xdf8c(%rip), %rsi      # 0x14826
cmoveq %rax, %rsi
leaq 0xdf6e(%rip), %rdi      # 0x14813
xorl %eax, %eax
callq 0xa127
leaq 0x17625(%rip), %r15     # 0x1ded8
leaq 0x161ce(%rip), %r12     # 0x1ca88
leaq 0x161c3(%rip), %rbp     # 0x1ca84
xorl %r14d, %r14d
leaq 0x15a51(%rip), %r13     # 0x1c31c
cmpl $0x0, 0x175fe(%rip)     # 0x1ded0
je 0x68dd
cmpl $0x0, 0x175f9(%rip)     # 0x1ded4
je 0x6912
cmpl $0x0, 0x175ec(%rip)     # 0x1ded0
jne 0x6972
cmpl $0x0, 0x175e3(%rip)     # 0x1ded4
je 0x6972
movl $0x0, 0x175d7(%rip)     # 0x1ded4
leaq 0x16170(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
leaq 0xdf2c(%rip), %rdi      # 0x1483a
jne 0x696b
jmp 0x6972
movslq (%r13), %rax
imulq $0x3e8, %rax, %rbx      # imm = 0x3E8
addq 0x175c4(%rip), %rbx     # 0x1dee8
xorl %eax, %eax
callq 0xa41c
cmpq %rax, %rbx
jae 0x6972
movslq (%r13), %rax
imulq $0x3e8, %rax, %rbx      # imm = 0x3E8
addq 0x175ae(%rip), %rbx     # 0x1def0
xorl %eax, %eax
callq 0xa41c
cmpq %rax, %rbx
jae 0x6972
movl $0x1, 0x1757c(%rip)     # 0x1ded4
leaq 0x16115(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
leaq 0xdec0(%rip), %rdi      # 0x14829
je 0x6972
xorl %eax, %eax
callq 0xa127
movq %r15, %rdi
callq 0x8522
testl %eax, %eax
jne 0x69e1
cmpl $0x0, (%r12)
jne 0x69e8
cmpb $0x0, 0x174f5(%rip)     # 0x1de81
je 0x69d2
cmpl $0x0, (%rbp)
je 0x69a8
leaq 0x178a5(%rip), %rax     # 0x1e240
movq (%rax), %rsi
movl $0x2e, %edi
callq 0x32a0
movq %r15, %rdi
movl $0x4, %esi
callq 0x8646
movq %r15, %rdi
callq 0x85be
movq $0x0, 0x17528(%rip) # 0x1def0
movl $0x4b, %edi
callq 0xa411
movl $0x19, %edi
callq 0xa411
jmp 0x68cb
movb $0x0, 0x17499(%rip)     # 0x1de81
movq %r15, %rdi
callq 0x860f
movl %eax, %r13d
cmpl $0x0, (%rbp)
movzbl %al, %ebx
je 0x6a10
movzbl %r14b, %edx
leaq 0xde43(%rip), %rdi      # 0x1484a
movl %ebx, %esi
xorl %eax, %eax
callq 0xa127
cmpb $0x8, %r13b
ja 0x6a46
leaq 0xdcf3(%rip), %rcx      # 0x14710
movslq (%rcx,%rbx,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, (%rbp)
movl %r13d, %r14d
je 0x68c4
leaq 0xde62(%rip), %rdi      # 0x1489c
xorl %eax, %eax
callq 0xa127
jmp 0x6fbf
cmpl $0x10, %ebx
je 0x6bf4
cmpl $0x13, %ebx
jne 0x6a75
cmpl $0x0, (%rbp)
je 0x6a68
leaq 0xde64(%rip), %rdi      # 0x148c5
xorl %eax, %eax
callq 0xa127
movq %r15, %rdi
callq 0x84b0
jmp 0x6fbf
callq 0x35e0
movq (%rax), %rax
movzwl (%rax,%rbx,2), %eax
btl $0xe, %eax
movl %ebx, %edx
movl $0x2e, %eax
cmovael %eax, %edx
leaq 0xde77(%rip), %rdi      # 0x1490d
movl %ebx, %esi
xorl %eax, %eax
callq 0xa054
jmp 0x6fbf
leaq 0xde37(%rip), %rdi      # 0x148e2
xorl %eax, %eax
callq 0xa054
jmp 0x6aeb
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movb %r13b, 0x12(%rsp)
movq %r15, %rdi
callq 0x860f
movb %al, 0x13(%rsp)
cmpb $0xf, %al
jb 0x6c2a
movzbl %al, %esi
leaq 0xde78(%rip), %rdi      # 0x1495c
xorl %eax, %eax
callq 0xa054
callq 0x7665
jmp 0x6fbf
cmpl $0x0, (%rbp)
je 0x6b09
leaq 0xdd60(%rip), %rdi      # 0x14862
xorl %eax, %eax
callq 0xa127
cmpb $0x4, %r14b
movl %r13d, %r14d
jne 0x68c4
cmpl $0x0, (%r12)
jne 0x6b3c
leaq 0x15f54(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xdc2e(%rip), %rcx      # 0x14760
movzwl 0x2(%rcx,%rax,4), %edi
callq 0xa411
movq %r15, %rdi
movl $0x10, %esi
callq 0x8646
movq %r15, %rdi
callq 0x85be
movb $-0x1, %r14b
cmpl $0x0, (%rbp)
je 0x68c4
leaq 0xdd09(%rip), %rdi      # 0x1486e
xorl %eax, %eax
callq 0xa127
jmp 0x68c4
cmpl $0x0, (%rbp)
je 0x6b85
leaq 0xdd12(%rip), %rdi      # 0x14890
xorl %eax, %eax
callq 0xa127
movq %r15, %rdi
callq 0x860f
movzbl %al, %ebx
leaq 0x172f9(%rip), %rax     # 0x1de90
movq (%rax,%rbx,8), %r14
testq %r14, %r14
je 0x6c15
cmpb $0x0, 0xf4(%r14)
je 0x6c15
leaq 0x15ec3(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x6bd5
leaq 0xe148(%rip), %rdi      # 0x14d05
leaq 0xcdf5(%rip), %rsi      # 0x139b9
movl %ebx, %edx
xorl %ecx, %ecx
movl $0x200, %r8d            # imm = 0x200
xorl %eax, %eax
callq 0xa127
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x7fae
testl %eax, %eax
je 0x6d1b
leaq 0xe136(%rip), %rdi      # 0x14d28
jmp 0x6c1c
cmpl $0x0, (%rbp)
je 0x6c08
leaq 0xdca7(%rip), %rdi      # 0x148a8
xorl %eax, %eax
callq 0xa127
movq %r15, %rdi
callq 0x84b9
jmp 0x6fbf
leaq 0xe0d6(%rip), %rdi      # 0x14cf2
movl %ebx, %esi
xorl %eax, %eax
callq 0xa054
jmp 0x6fbf
leaq 0x12(%rsp), %rdi
callq 0x7782
testl %eax, %eax
je 0x6c7a
leaq 0xdd3d(%rip), %rdi      # 0x1497c
xorl %eax, %eax
callq 0xa054
movb 0x16(%rsp), %al
movb %al, 0x157cc(%rip)      # 0x1c41c
movb $-0x11, 0x157c4(%rip)   # 0x1c41b
movl $0x0, 0x157bf(%rip)     # 0x1c420
leaq 0x157b0(%rip), %rdi     # 0x1c418
callq 0x7847
movq %r15, %rdi
callq 0x85be
jmp 0x6fbf
cmpl $0x0, (%rbp)
je 0x6c98
movzbl 0x14(%rsp), %esi
movzbl 0x13(%rsp), %edx
leaq 0xdcfe(%rip), %rdi      # 0x1498f
xorl %eax, %eax
callq 0xa127
leaq 0x15dd5(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
leaq 0xdcae(%rip), %rbx      # 0x14957
movl $0x200, %r14d           # imm = 0x200
je 0x6dcd
movzbl 0x14(%rsp), %eax
movl $0x3, %ecx
leaq 0xdd14(%rip), %rbx      # 0x149da
cmpq $0xa, %rax
ja 0x6ce7
shll $0x2, %eax
leaq 0xdaae(%rip), %rcx      # 0x14784
movslq (%rax,%rcx), %rbx
addq %rcx, %rbx
leaq 0xdacc(%rip), %rcx      # 0x147b0
movl (%rax,%rcx), %ecx
cmpl $0x3, %ecx
je 0x6d7a
cmpl $0x2, %ecx
jne 0x6dab
movzbl 0x16(%rsp), %edx
movzbl 0x17(%rsp), %ecx
movzbl 0x15(%rsp), %r8d
movzwl 0x1c(%rsp), %r9d
leaq 0xdcd9(%rip), %rdi      # 0x149ef
jmp 0x6d9f
movq %r14, %rdi
leaq 0xe0(%rsp), %r14
movq %r14, %rsi
movl $0x200, %edx            # imm = 0x200
callq 0x808a
cmpl $0x200, %eax            # imm = 0x200
jne 0x6d5e
movq %r15, %rdi
movq %r14, %rsi
movl $0x200, %edx            # imm = 0x200
callq 0x8576
cmpl $0x200, %eax            # imm = 0x200
je 0x6fbf
leaq 0xe01b(%rip), %rdi      # 0x14d77
jmp 0x6d65
leaq 0xdfdb(%rip), %rdi      # 0x14d40
movl %ebx, %esi
movl $0x200, %edx            # imm = 0x200
movl %eax, %ecx
xorl %eax, %eax
callq 0xa054
jmp 0x6fbf
movzbl 0x16(%rsp), %edx
movzbl 0x17(%rsp), %ecx
movzbl 0x15(%rsp), %r8d
movzwl 0x1c(%rsp), %r9d
movzwl 0x1a(%rsp), %eax
movl %eax, (%rsp)
leaq 0xdc7d(%rip), %rdi      # 0x14a1c
movq %rbx, %rsi
xorl %eax, %eax
callq 0xa127
jmp 0x6dc1
movzbl 0x16(%rsp), %edx
leaq 0xdc2b(%rip), %rdi      # 0x149e2
movq %rbx, %rsi
xorl %eax, %eax
callq 0xa127
xorl %edi, %edi
leaq 0x40(%rsp), %rsi
callq 0x3140
leaq 0x15ca8(%rip), %rax     # 0x1ca7c
cmpl $0x0, (%rax)
je 0x6de8
movb 0x17(%rsp), %al
shrb $0x3, %al
andb $0x1, %al
movb %al, 0x17098(%rip)      # 0x1de80
movzbl 0x14(%rsp), %eax
cmpq $0xa, %rax
ja 0x709b
leaq 0xd936(%rip), %rcx      # 0x14734
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x15c6a(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xd944(%rip), %rcx      # 0x14760
movzwl (%rcx,%rax,4), %edi
jmp 0x6f22
movb 0x16(%rsp), %al
movzbl %al, %esi
leaq 0x1705d(%rip), %rcx     # 0x1de90
movq (%rcx,%rsi,8), %r14
testq %r14, %r14
je 0x70cf
cmpb $0x0, 0xf4(%r14)
je 0x70cf
cmpl $0x0, 0x1707f(%rip)     # 0x1ded4
jne 0x6ef9
cmpb $0x0, 0x15(%rsp)
movl $0x80, %esi
movl $0x200, %eax            # imm = 0x200
cmovnsl %eax, %esi
movzwl 0x1c(%rsp), %edx
movzwl 0x1a(%rsp), %ecx
decl %ecx
movq %r14, %rdi
callq 0x7fae
testl %eax, %eax
jne 0x6eae
cmpb $0x0, 0x15(%rsp)
movl $0x80, %esi
movl $0x200, %eax            # imm = 0x200
cmovnsl %eax, %esi
movzwl 0x1c(%rsp), %edx
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x7fae
testl %eax, %eax
je 0x7219
movzbl 0x16(%rsp), %esi
movzwl 0x1c(%rsp), %edx
leaq 0xdc78(%rip), %rdi      # 0x14b37
jmp 0x7168
movb 0x16(%rsp), %al
movzbl %al, %esi
leaq 0x16fbe(%rip), %rcx     # 0x1de90
movq (%rcx,%rsi,8), %rdi
testq %rdi, %rdi
je 0x70d8
cmpb $0x0, 0xf4(%rdi)
je 0x70d8
cmpl $0x0, 0x16fe1(%rip)     # 0x1ded4
je 0x7135
movb %al, 0x1551d(%rip)      # 0x1c41c
movb $-0x9, 0x15515(%rip)    # 0x1c41b
jmp 0x6f38
leaq 0x15b69(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xd843(%rip), %rcx      # 0x14760
movzwl 0x4(%rcx,%rax,4), %edi
callq 0xa411
movb 0x16(%rsp), %al
movb %al, 0x154eb(%rip)      # 0x1c41c
movb $0x0, 0x154e3(%rip)     # 0x1c41b
movl $0x0, 0x154de(%rip)     # 0x1c420
leaq 0x154cf(%rip), %rdi     # 0x1c418
callq 0x7847
movq %r15, %rdi
callq 0x85be
leaq 0x15b17(%rip), %rax     # 0x1ca74
cmpl $0x0, (%rax)
je 0x6fbf
xorl %edi, %edi
leaq 0x30(%rsp), %rsi
callq 0x3140
cmpl $0x0, (%rbp)
je 0x6fbf
movl 0x30(%rsp), %eax
subl 0x40(%rsp), %eax
imull $0x3e8, %eax, %ecx      # imm = 0x3E8
movq 0x38(%rsp), %rax
subq 0x48(%rsp), %rax
movabsq $0x431bde82d7b634db, %rdx # imm = 0x431BDE82D7B634DB
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x12, %rdx
addl %eax, %edx
leal (%rdx,%rcx), %eax
cmpl $0x1, %eax
adcl %ecx, %edx
leaq 0xda9f(%rip), %rdi      # 0x14a54
movq %rbx, %rsi
xorl %eax, %eax
callq 0xa127
movl %r13d, %r14d
jmp 0x68c4
leaq 0x15aaa(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xd784(%rip), %rcx      # 0x14760
movzwl 0x2(%rcx,%rax,4), %edi
callq 0xa411
movq %r15, %rdi
callq 0x84ce
movq %r15, %rdi
callq 0x84f5
jmp 0x6f27
movb 0x16(%rsp), %al
movzbl %al, %esi
leaq 0x16e87(%rip), %rcx     # 0x1de90
movq (%rcx,%rsi,8), %r14
testq %r14, %r14
je 0x70fc
cmpb $0x0, 0xf4(%r14)
je 0x70fc
cmpl $0x0, 0x16ea9(%rip)     # 0x1ded4
je 0x7185
movb $-0x9, %cl
xorl %r14d, %r14d
jmp 0x7113
leaq 0x15a36(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xd710(%rip), %rcx      # 0x14760
movzwl (%rcx,%rax,4), %edi
callq 0xa411
leaq 0x15a1c(%rip), %rax     # 0x1ca7c
cmpl $0x0, (%rax)
jne 0x6f27
movw $0x1801, 0xe0(%rsp)     # imm = 0x1801
leaq 0xe2(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0xe0(%rsp), %rdi
callq 0x7847
jmp 0x6f56
leaq 0x159d6(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xd6b0(%rip), %rcx      # 0x14760
movzwl (%rcx,%rax,4), %edi
callq 0xa411
movb 0x16(%rsp), %al
movb %al, 0x15359(%rip)      # 0x1c41c
movb $-0x30, 0x15351(%rip)   # 0x1c41b
jmp 0x6f38
leaq 0xda4d(%rip), %rdi      # 0x14b23
jmp 0x70df
leaq 0xdbbd(%rip), %rdi      # 0x14c9c
xorl %eax, %eax
callq 0xa054
movb 0x16(%rsp), %al
movb %al, 0x1532c(%rip)      # 0x1c41c
movb $-0x8, 0x15324(%rip)    # 0x1c41b
jmp 0x6f38
xorl %r14d, %r14d
leaq 0xd9b6(%rip), %rdi      # 0x14abc
xorl %eax, %eax
callq 0xa054
movb $-0x8, %cl
movb 0x16(%rsp), %al
movb %al, 0x15303(%rip)      # 0x1c41c
movb %cl, 0x152fc(%rip)      # 0x1c41b
movw %r14w, 0x152f9(%rip)    # 0x1c420
movw $0x0, 0x152f2(%rip)     # 0x1c422
jmp 0x6f42
cmpb $0x0, 0x15(%rsp)
movl $0x80, %esi
cmovnsl %r14d, %esi
movzwl 0x1c(%rsp), %edx
xorl %ecx, %ecx
callq 0x7fae
testl %eax, %eax
je 0x71fa
movzbl 0x16(%rsp), %esi
movzwl 0x1c(%rsp), %edx
leaq 0xdb47(%rip), %rdi      # 0x14caf
xorl %eax, %eax
callq 0xa054
movb 0x16(%rsp), %al
movb %al, 0x152a3(%rip)      # 0x1c41c
movb $-0x37, 0x1529b(%rip)   # 0x1c41b
jmp 0x6f38
cmpb $0x0, 0x15(%rsp)
movl $0x80, %esi
movl $0x200, %eax            # imm = 0x200
cmovnsl %eax, %esi
movzwl 0x1c(%rsp), %edx
movzwl 0x1a(%rsp), %ecx
decl %ecx
movq %r14, %rdi
callq 0x7fae
testl %eax, %eax
jne 0x71d8
cmpb $0x0, 0x15(%rsp)
movl $0x80, %esi
movl $0x200, %eax            # imm = 0x200
cmovnsl %eax, %esi
movzwl 0x1c(%rsp), %edx
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x7fae
testl %eax, %eax
je 0x7427
movzbl 0x16(%rsp), %esi
movzwl 0x1c(%rsp), %edx
xorl %r14d, %r14d
leaq 0xd8e3(%rip), %rdi      # 0x14acf
xorl %eax, %eax
callq 0xa054
movb $-0x37, %cl
jmp 0x710f
leaq 0x15877(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xd551(%rip), %rcx      # 0x14760
movzwl 0x6(%rcx,%rax,4), %edi
jmp 0x6f22
movq %r14, 0x20(%rsp)
leaq 0x15853(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xd52d(%rip), %rcx      # 0x14760
movzwl 0x6(%rcx,%rax,4), %edi
callq 0xa411
movzwl 0x1a(%rsp), %eax
testl %eax, %eax
je 0x738b
movl %eax, 0x2c(%rsp)
movq %r15, %rdi
movl $0x10, %esi
callq 0x8646
movq %r15, %rdi
callq 0x85be
cmpl $0x0, (%rbp)
je 0x7277
leaq 0xd611(%rip), %rdi      # 0x14881
xorl %eax, %eax
callq 0xa127
movb $-0x1, 0x5c(%rsp)
movzbl 0x5c(%rsp), %r14d
movq %r15, %rdi
callq 0x860f
movb %al, 0x5c(%rsp)
cmpl $0x0, (%rbp)
je 0x72a8
movzbl %al, %esi
leaq 0xd5ac(%rip), %rdi      # 0x1484a
movl %r14d, %edx
xorl %eax, %eax
callq 0xa127
xorb $0x4, %r14b
movb 0x5c(%rsp), %al
movl %eax, %ecx
xorb $0x4, %cl
orb %r14b, %cl
je 0x74da
movzbl %al, %eax
cmpl $0x10, %eax
je 0x72f3
cmpl $0x13, %eax
je 0x72d5
cmpl $0x2, %eax
jne 0x730f
jmp 0x753f
cmpl $0x0, (%rbp)
je 0x72e9
leaq 0xd5e3(%rip), %rdi      # 0x148c5
xorl %eax, %eax
callq 0xa127
movq %r15, %rdi
callq 0x84b0
jmp 0x730f
cmpl $0x0, (%rbp)
je 0x7307
leaq 0xd5a8(%rip), %rdi      # 0x148a8
xorl %eax, %eax
callq 0xa127
movq %r15, %rdi
callq 0x84b9
cmpb $0x1, 0x5c(%rsp)
jne 0x727c
movq %r15, %rdi
callq 0x860f
movb %al, 0x5d(%rsp)
leaq 0x5c(%rsp), %rdi
callq 0x7782
testl %eax, %eax
jne 0x75e7
movzbl 0x5d(%rsp), %edx
movq 0x20(%rsp), %rdi
leaq 0x5e(%rsp), %rsi
callq 0x810f
movzbl 0x5d(%rsp), %ecx
cmpl %ecx, %eax
jne 0x75f3
leaq 0x15718(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xd3f2(%rip), %rcx      # 0x14760
movzwl 0xa(%rcx,%rax,4), %edi
callq 0xa411
movzbl 0x5d(%rsp), %eax
movl 0x2c(%rsp), %ecx
subl %eax, %ecx
movl %ecx, %eax
jg 0x724a
movzwl 0x1a(%rsp), %ecx
cmpb $0x0, 0x15(%rsp)
movl $0x200, %eax            # imm = 0x200
movl $0x80, %r14d
cmovnsl %eax, %r14d
leal -0x1(%r14), %eax
andl %ecx, %eax
je 0x75c5
subl %eax, %r14d
movslq %r14d, %rdx
leaq 0xe0(%rsp), %rdi
xorl %esi, %esi
callq 0x3230
cmpl $0x0, (%rbp)
je 0x73e1
movzbl 0x16(%rsp), %esi
leaq 0xd86e(%rip), %rdi      # 0x14c45
movl %r14d, %edx
xorl %eax, %eax
callq 0xa127
movq 0x20(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
movl %r14d, %edx
callq 0x810f
movl %eax, 0x20(%rsp)
cmpl %r14d, %eax
jne 0x7563
leaq 0x1566e(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xd348(%rip), %rcx      # 0x14760
movzwl 0xa(%rcx,%rax,4), %edi
callq 0xa411
jmp 0x75ba
leaq 0x1564a(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xd324(%rip), %rcx      # 0x14760
movzwl 0x6(%rcx,%rax,4), %edi
callq 0xa411
movzwl 0x1a(%rsp), %ecx
testl %ecx, %ecx
je 0x74c9
movl %ecx, 0x20(%rsp)
movb $0x1, 0xe0(%rsp)
movl $0x80, %eax
cmpl %eax, %ecx
movl $0x80, %edx
cmovll %ecx, %edx
movb %dl, 0xe1(%rsp)
movq %r14, %rdi
leaq 0xe2(%rsp), %rsi
callq 0x808a
movzbl 0xe1(%rsp), %ecx
cmpl %ecx, %eax
jne 0x750c
leaq 0xe0(%rsp), %rdi
callq 0x7847
leaq 0x155d7(%rip), %rax     # 0x1ca78
movslq (%rax), %rax
leaq (%rax,%rax,2), %rax
leaq 0xd2b1(%rip), %rcx      # 0x14760
movzwl 0x8(%rcx,%rax,4), %edi
callq 0xa411
movzbl 0xe1(%rsp), %eax
movl 0x20(%rsp), %ecx
subl %eax, %ecx
jg 0x744f
movb 0x16(%rsp), %al
movzwl 0x1a(%rsp), %r14d
xorl %ecx, %ecx
jmp 0x7113
movq %r15, %rdi
movl $0x10, %esi
callq 0x8646
movq %r15, %rdi
callq 0x85be
cmpl $0x0, (%rbp)
je 0x6f56
leaq 0xd658(%rip), %rdi      # 0x14b58
xorl %eax, %eax
callq 0xa127
jmp 0x6f56
movzbl 0x16(%rsp), %esi
movzwl 0x1c(%rsp), %edx
movzwl 0x1a(%rsp), %ecx
leaq 0xd5cd(%rip), %rdi      # 0x14aef
xorl %eax, %eax
callq 0xa054
movb 0x16(%rsp), %al
movzwl 0x1a(%rsp), %r14d
subl 0x20(%rsp), %r14d
movb $-0x2, %cl
jmp 0x7113
leaq 0xd641(%rip), %rdi      # 0x14b87
xorl %eax, %eax
callq 0xa054
movb 0x16(%rsp), %al
movb %al, 0x14ec5(%rip)      # 0x1c41c
movb $-0x11, 0x14ebd(%rip)   # 0x1c41b
jmp 0x6f38
movzbl 0x16(%rsp), %esi
movzwl 0x1c(%rsp), %edx
movzwl 0x1a(%rsp), %ecx
leaq 0xd6ee(%rip), %rdi      # 0x14c67
xorl %eax, %eax
callq 0xa054
movb 0x16(%rsp), %al
movzwl 0x1a(%rsp), %ecx
movb %al, 0x14e8d(%rip)      # 0x1c41c
movb $-0x2, 0x14e85(%rip)    # 0x1c41b
movw %cx, 0x14e83(%rip)      # 0x1c420
movw $0x0, 0x14e7c(%rip)     # 0x1c422
leaq 0x14e6b(%rip), %rdi     # 0x1c418
callq 0x7847
movq %r15, %rdi
callq 0x85be
cmpl %r14d, 0x20(%rsp)
jne 0x6f56
movb 0x16(%rsp), %al
movzwl 0x1a(%rsp), %ecx
movb %al, 0x14e48(%rip)      # 0x1c41c
movb $0x0, 0x14e40(%rip)     # 0x1c41b
movw %cx, 0x14e3e(%rip)      # 0x1c420
jmp 0x7127
leaq 0xd5cb(%rip), %rdi      # 0x14bb9
jmp 0x7546
movzbl 0x16(%rsp), %esi
movzwl 0x1c(%rsp), %edx
movzwl 0x1a(%rsp), %ecx
cmpl $-0x2, %eax
jne 0x7631
leaq 0xd5bf(%rip), %rdi      # 0x14bcd
xorl %eax, %eax
callq 0xa054
movb 0x16(%rsp), %al
movzwl 0x1a(%rsp), %ecx
subl 0x2c(%rsp), %ecx
movb %al, 0x14df4(%rip)      # 0x1c41c
movb $-0xb, 0x14dec(%rip)    # 0x1c41b
jmp 0x7659
leaq 0xd5d2(%rip), %rdi      # 0x14c0a
xorl %eax, %eax
callq 0xa054
movb 0x16(%rsp), %al
movzwl 0x1a(%rsp), %ecx
subl 0x2c(%rsp), %ecx
movb %al, 0x14dca(%rip)      # 0x1c41c
movb $-0x2, 0x14dc2(%rip)    # 0x1c41b
movw %cx, 0x14dc0(%rip)      # 0x1c420
jmp 0x7127