// File: /workspace/github_cpp_makefile_star2_O1/Alcaro[P]bridges/arlib/deflate-decomp.cpp
// Function: inflator::inflate()
inflator::ret_t inflator::inflate()
{
	enum {
		st_blockinit,
		st_litblock_head,
		st_litblock,
		st_huff1,
		st_huff2,
		st_huff3,
		st_mainloop,
		st_litbyte,
		st_copy
	};
	
	switch (m_state)
	{
		while (true)
		{
		[[fallthrough]];
		case st_blockinit:
			bits_refill_fast();
			if (UNLIKELY(m_in_nbits < 3+7)) // empty block with default huffman tables is 3+7 bits; literal can also use 3+7
			{
				assert_reached();
				m_state = st_blockinit;
				goto do_ret_more_input;
			}
			m_block_type = bits_extract(3);
			if (m_block_type < 1*2) // literal block
			{
				m_in_bits_buf >>= m_in_nbits&7;
				m_in_nbits &= ~7;
				
			[[fallthrough]];
			case st_litblock_head:
				bits_refill_fast();
				
				if (UNLIKELY(m_in_nbits < 32))
				{
					assert_reached();
					m_state = st_litblock_head;
					goto do_ret_more_input;
				}
				
				uint32_t len;
				{
					len = m_in_bits_buf; // this truncates to 32 bits
					len = len ^ ((~len)<<16);
					if (UNLIKELY(len >= 0x10000)) RET_FAIL();
					m_in_nbits -= 32;
					m_in_bits_buf >>= 32;
				}
				
				if(0) {
			case st_litblock:
					len = m_stlitblk_len;
				}
				while (m_in_nbits && len)
				{
					if (UNLIKELY(m_out_end == m_out_at))
					{
						assert_reached();
						m_state = st_litblock;
						m_stlitblk_len = len;
						return ret_more_output;
					}
					assert_reached();
					*m_out_at++ = bits_extract(8);
					len--;
				}
				
				uint32_t len_actual = min(len, m_in_end-m_in_at, m_out_end-m_out_at);
				memcpy(m_out_at, m_in_at, len_actual);
				len -= len_actual;
				m_in_at += len_actual;
				m_out_at += len_actual;
				
				if (UNLIKELY(len))
				{
					assert_reached();
					m_state = st_litblock;
					m_stlitblk_len = len;
					if (m_in_at == m_in_end) goto do_ret_more_input;
					else return ret_more_output;
				}
				
				if (m_in_nbits) assert_reached();
			}
			else if (LIKELY(m_block_type < 3*2))
			{
				if (m_block_type & 4)
				{
				[[fallthrough]];
				case st_huff1:
					bits_refill_fast();
					if (UNLIKELY(m_in_nbits < 5+5+4))
					{
						assert_reached();
						m_state = st_huff1;
						goto do_ret_more_input;
					}
					// if we run out of bits, we'll read infinite zeroes, which will either error out or emit nonsense tables
					// in both cases, it will terminate, so it's safe to defer the underflow check to later
					
					// dynamic huffman
					uint32_t huff_sizes;
					huff_sizes = bits_extract(5+5+4);
					if(0) {
				case st_huff2:
						huff_sizes = m_sthuff2_sizes;
					}
					
					uint32_t hlit;
					uint32_t hdist;
					{
						hlit = (huff_sizes&31) + 257;
						hdist = ((huff_sizes>>5)&31) + 1;
						uint32_t hclen = (huff_sizes>>10) + 4;
						
						// DEFLATE can represent 288 symbols and 32 distance codes, but only 286 resp. 30 are valid. why
						// RFC 1951 seems to explicitly allow HDIST > 30 (though using them is forbidden), but zlib rejects it
						if (UNLIKELY(hlit > 286 || hdist > 30)) RET_FAIL();
						
						bits_refill_all();
						if (UNLIKELY(m_in_nbits < hclen*3))
						{
							assert_reached();
							m_state = st_huff2;
							m_sthuff2_sizes = huff_sizes;
							goto do_ret_more_input;
						}
						
						static const uint8_t huff_al_order[19] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
						uint8_t huff_al_len[19];
						memset(huff_al_len, 0, 16); // last 3 are guaranteed overwritten by below loop, no point clearing them
						// first is guaranteed overwritten too, but 16 optimizes better than 15
						
						for (uint32_t i=0;i<hclen;i++) huff_al_len[huff_al_order[i]] = bits_extract(3);
						
						bool ok = unpack_huffman_dfl(m_huff_symbol, huff_al_len, 19, 19);
						if (UNLIKELY(!ok)) RET_FAIL();
					}
					
					uint32_t i;
					i = 0;
					if(0) {
				case st_huff3:
						huff_sizes = m_sthuff2_sizes;
						hlit = (m_sthuff2_sizes&31) + 257;
						hdist = ((m_sthuff2_sizes>>5)&31) + 1;
						i = m_sthuff3_iter;
					}
					while (i < hlit+hdist)
					{
						bits_refill_fast();
						if (UNLIKELY(m_in_nbits < 15+7 && !m_in_last))
						{
							assert_reached();
							m_state = st_huff3;
							m_sthuff2_sizes = huff_sizes;
							m_sthuff3_iter = i;
							goto do_ret_more_input;
						}
						
						int sym = bits_read_huffman(m_huff_symbol); // takes 15 bits
						if (UNLIKELY((int32_t)m_in_nbits < 0)) RET_FAIL();
						
						if (sym <= 15)
						{
							m_symbol_lengths[i++] = sym;
						}
						else if (sym == 16) // repeat last length
						{
							uint32_t n_rep = bits_extract(2) + 3;
							if (UNLIKELY(i == 0)) RET_FAIL();
							if (UNLIKELY(i+n_rep > hlit+hdist)) RET_FAIL();
							int last = m_symbol_lengths[i-1];
							for (uint32_t j=0;j<n_rep;j++)
								m_symbol_lengths[i++] = last;
						}
						else // sym 17 or 18 (invalid symbols are impossible)
						{
							uint32_t n_rep = bits_extract((sym-17)*4+3) + (sym-17)*8+3; // takes 7 bits
							if (UNLIKELY(i+n_rep > hlit+hdist)) RET_FAIL();
							for (uint32_t j=0;j<n_rep;j++)
								m_symbol_lengths[i++] = 0;
						}
					}
					
					if (UNLIKELY(!unpack_huffman_dfl(m_huff_symbol, m_symbol_lengths, hlit, 287))) RET_FAIL();
					uint8_t tmp[32];
					memcpy(tmp, m_symbol_lengths+hlit, 32); // copy it - m_symbol_lengths is a union with m_huff_distance
					if (UNLIKELY(!unpack_huffman_dfl(m_huff_distance, tmp, hdist, 31))) RET_FAIL();
				}
				else
				{
					// static huffman
					uint8_t len[288];
					for (int i=0 ; i<=32; i++) len[i] = 5;
					unpack_huffman_dfl(m_huff_distance, len, 32, 0);
					for (int i=0 ; i<=143;i++) len[i] = 8;
					for (int i=144;i<=255;i++) len[i] = 9;
					for (int i=256;i<=279;i++) len[i] = 7;
					for (int i=280;i<=287;i++) len[i] = 8;
					unpack_huffman_dfl(m_huff_symbol, len, 288, 0);
				}
				
				m_state = st_mainloop;
			[[fallthrough]];
			case st_mainloop:
			case st_copy:
			case st_litbyte:
				// moving these to locals drops runtime to ~75% of using members directly
				const uint8_t * out_prev = m_out_prev;
				uint8_t * out_start = m_out_start;
				uint8_t * out_at = m_out_at;
				uint8_t * out_end = m_out_end;
				const uint8_t * in_at = m_in_at;
				const uint8_t * in_end = m_in_end;
				uint64_t bits_buf = m_in_bits_buf;
				uint32_t nbits = m_in_nbits;
				
				ret_t ret_state = ret_done;
				
				if (m_state != st_mainloop)
				{
					if (m_state == st_copy) goto st_copy_inner;
					else if (m_state == st_litbyte) goto st_litbyte_inner;
					else __builtin_unreachable();
				}
				
				while (true)
				{
					// max bits needed per symbol: 15 (huff_symbol) + 5 (length bits) + 15 (huff_distance) + 13 (distance bits) = 48
					
					if (LIKELY(in_end-in_at >= 8))
					{
						if (nbits <= 32)
						{
							bits_buf |= (uint64_t)readu_le32(in_at) << nbits;
							nbits += 32;
							in_at += 4;
						}
					}
					else
					{
						while (nbits <= 56 && in_at != in_end)
						{
							assert_reached();
							bits_buf |= (uint64_t)*in_at++ << nbits;
							nbits += 8;
						}
						
						if (nbits < 48 && !m_in_last)
						{
							assert_reached();
							ret_state = ret_more_input;
							goto inner_return;
						}
					}
					
					// at this point, we know that either
					// - there are at least 32 bits in the bit buffer, and at least 32 bits in the byte buffer
					//    -> a 32bit refill without bounds check is safe
					// - there are at least 48 bits in the bit buffer
					//    -> there's no need to refill
					// - we're at EOF
					//    -> comp_at == in_end
					// -> either comp_at == in_end, a 32bit refill is safe, or there's no need to refill
					// -> can do a 32bit refill if comp_at != in_end
					// TODO: investigate performance of adding a 16bit refill up there and not refilling further down
					
					int symbol;
					HUFF_READ_FAST(m_huff_symbol, symbol); // takes 15 bits
					if (UNLIKELY((int32_t)nbits < 0)) RET_FAIL();
					
					if (symbol < 256)
					{
						if (0)
						{
					st_litbyte_inner:
							symbol = m_stlitby_val;
						}
						if (UNLIKELY(out_at == out_end))
						{
							assert_reached();
							ret_state = ret_more_output;
							m_state = st_litbyte;
							m_stlitby_val = symbol;
							goto inner_return;
						}
						*out_at++ = symbol;
					}
					else if (LIKELY(symbol <= 285))
					{
						size_t len;
						size_t dist;
						
						{
							static const uint16_t sym_detail[] = {
								  3+(0<<12),  4+(0<<12),  5+(0<<12),  6+(0<<12),   7+(0<<12), 8+(0<<12), 9+(0<<12), 10+(0<<12),
								 11+(1<<12), 13+(1<<12), 15+(1<<12), 17+(1<<12),  19+(2<<12),23+(2<<12),27+(2<<12), 31+(2<<12),
								 35+(3<<12), 43+(3<<12), 51+(3<<12), 59+(3<<12),  67+(4<<12),83+(4<<12),99+(4<<12),115+(4<<12),
								131+(5<<12),163+(5<<12),195+(5<<12),227+(5<<12), 258+(0<<12)
							};
							uint16_t detail = sym_detail[symbol-257];
							
							BITS_FAST(detail>>12, len); // takes 5 bits
							len += (detail&511);
							
							// do not refill after underflow, shift by huge is UB
							if (LIKELY((uint32_t)nbits >= 15+13)) assert_reached();
							else if (LIKELY(in_at != in_end))
							{
								assert_reached();
								bits_buf |= (uint64_t)readu_le32(in_at) << nbits;
								nbits += 32;
								in_at += 4;
							}
							else assert_reached();
							
							int dist_key;
							HUFF_READ_FAST(m_huff_distance, dist_key); // takes 15 bits
							
							int dist_base = ((2+(dist_key&1)) << (dist_key>>1) >> 1) + (dist_key!=0);
							int dist_bits = (dist_key>>1) - (dist_key >= 2);
							
							BITS_FAST(dist_bits, dist); // takes 13 bits
							dist += dist_base;
							
							if (dist == 32768) assert_reached();
							if (UNLIKELY(dist > 32768)) RET_FAIL(); // dist_key >= 30 ends up here
							// no need to check earlier, underflow just yields endless zeroes
							if (UNLIKELY((int32_t)nbits < 0)) RET_FAIL();
						}
						
						if(0) {
					st_copy_inner:
							len = m_stcopy_len;
							dist = m_stcopy_dist;
						}
						
						if (dist > (size_t)(out_at-out_start))
						{
							if (!out_prev) RET_FAIL();
							assert_reached();
							
							size_t dist_prev = dist-(out_at-out_start);
							
							const uint8_t * src = out_prev-dist_prev;
							size_t len_actual = min(len, dist_prev);
							rep_movsb(out_at, src, len_actual);
							len -= len_actual;
						}
						
						const uint8_t * src = out_at-dist;
						size_t len_actual = min(len, out_end-out_at);
						rep_movsb(out_at, src, len_actual);
						
						len -= len_actual;
						if (UNLIKELY(len))
						{
							assert_reached();
							m_stcopy_len = len;
							m_stcopy_dist = dist;
							m_state = st_copy;
							ret_state = ret_more_output;
							goto inner_return;
						}
					}
					else if (LIKELY(symbol == 384))
						break;
					else
						RET_FAIL();
				}
				
			inner_return:
				// most of the variables don't change, no need to write them back
				m_in_at = in_at;
				m_in_bits_buf = bits_buf;
				m_in_nbits = nbits;
				m_out_at = out_at;
				
				if (ret_state != ret_done)
					return ret_state;
			}
			else RET_FAIL();
			
			if (m_block_type&1) return ret_done;
		}
	default: __builtin_unreachable();
	}
do_ret_more_input:
	if (m_in_last) RET_FAIL();
	else return ret_more_input;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movzbl (%rdi), %eax
leaq 0x27235(%rip), %rcx     # 0x2f450
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzwl 0x40(%rbx), %eax
jmp 0x82e1
movzwl 0x40(%rbx), %edx
jmp 0x83d2
movzwl 0x40(%rbx), %eax
movl %eax, %r14d
andl $0x1f, %r14d
movl %eax, 0x8(%rsp)
movl %eax, %r13d
shrl $0x5, %r13d
andl $0x1f, %r13d
movzwl 0x42(%rbx), %r12d
jmp 0x84b1
movq %rbx, %rdi
callq 0x811c
movl 0x4(%rbx), %eax
cmpl $0x9, %eax
jbe 0x872a
movq 0x8(%rbx), %rcx
movl %ecx, %esi
andl $0x7, %esi
addl $-0x3, %eax
movl %eax, 0x4(%rbx)
movq %rcx, %rdx
shrq $0x3, %rdx
movq %rdx, 0x8(%rbx)
movb %sil, 0x1(%rbx)
cmpl $0x1, %esi
ja 0x838e
movl %eax, %ecx
andb $0x7, %cl
shrq %cl, %rdx
movq %rdx, 0x8(%rbx)
andl $-0x8, %eax
movl %eax, 0x4(%rbx)
movq %rbx, %rdi
callq 0x811c
movl 0x4(%rbx), %ecx
cmpl $0x1f, %ecx
jbe 0x872f
movq 0x8(%rbx), %rdx
movl %edx, %eax
notl %eax
shll $0x10, %eax
xorl %edx, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
ja 0x871f
addl $-0x20, %ecx
movl %ecx, 0x4(%rbx)
shrq $0x20, %rdx
movq %rdx, 0x8(%rbx)
movl 0x4(%rbx), %ecx
testl %ecx, %ecx
je 0x832d
testl %eax, %eax
je 0x832d
movq 0x30(%rbx), %rdx
cmpq %rdx, 0x38(%rbx)
je 0x86eb
movq 0x8(%rbx), %rsi
addl $-0x8, %ecx
movl %ecx, 0x4(%rbx)
movq %rsi, %rcx
shrq $0x8, %rcx
movq %rcx, 0x8(%rbx)
leaq 0x1(%rdx), %rcx
movq %rcx, 0x30(%rbx)
movb %sil, (%rdx)
leal -0x1(%rax), %ebp
movl 0x4(%rbx), %ecx
testl %ecx, %ecx
je 0x832f
cmpl $0x1, %eax
movl %ebp, %eax
jne 0x82ec
jmp 0x832f
movl %eax, %ebp
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rax
subq %rsi, %rax
movq 0x38(%rbx), %r12
movq 0x30(%rbx), %rdi
subq %rdi, %r12
cmpq %rax, %r12
cmovgeq %rax, %r12
cmpl %ebp, %r12d
movl %ebp, %r14d
cmovbl %r12d, %r14d
movq %r14, %rdx
callq 0x3280
movq 0x10(%rbx), %rcx
addq %r14, %rcx
movq %rcx, 0x10(%rbx)
addq %r14, 0x30(%rbx)
xorl %eax, %eax
cmpl %r12d, %ebp
ja 0x8750
testl %eax, %eax
je 0x89bd
cmpl $0x1, %eax
jne 0x870d
jmp 0x89ca
cmpl $0x5, %esi
ja 0x871f
testb $0x4, %cl
je 0x86e1
movl %r15d, (%rsp)
movq %rbx, %rdi
callq 0x811c
movl 0x4(%rbx), %eax
cmpl $0xd, %eax
jbe 0x8734
movq 0x8(%rbx), %rcx
movl %ecx, %edx
andl $0x3fff, %edx           # imm = 0x3FFF
addl $-0xe, %eax
movl %eax, 0x4(%rbx)
shrq $0xe, %rcx
movq %rcx, 0x8(%rbx)
movl %edx, %r14d
andl $0x1f, %r14d
movl %edx, %r13d
shrl $0x5, %r13d
andl $0x1f, %r13d
movl $0x1, %ecx
movl $0x1, %r15d
cmpl $0x1d, %r14d
ja 0x84a2
cmpl $0x1d, %r13d
ja 0x84a2
movl %edx, %ebp
movl %edx, %r12d
shrl $0xa, %r12d
leal 0x4(%r12), %r15d
movq %rbx, %rdi
callq 0x8152
leal (%r15,%r15,2), %eax
cmpl %eax, 0x4(%rbx)
jb 0x8739
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rbx), %rax
movl 0x4(%rbx), %ecx
leal (%r12,%r12,2), %edx
negl %edx
movl %r15d, %esi
xorl %edi, %edi
leaq 0x27039(%rip), %r8      # 0x2f480
movl %eax, %r9d
andb $0x7, %r9b
shrq $0x3, %rax
movzbl (%rdi,%r8), %r10d
movb %r9b, 0x20(%rsp,%r10)
incq %rdi
cmpq %rdi, %rsi
jne 0x8447
addl %edx, %ecx
addl $-0xc, %ecx
movq %rax, 0x8(%rbx)
movl %ecx, 0x4(%rbx)
leaq 0x504(%rbx), %rdi
leaq 0x20(%rsp), %rsi
movl $0x13, %edx
movl $0x13, %ecx
callq 0x8a93
movl %eax, %ecx
xorb $0x1, %cl
movzbl %cl, %ecx
testb %al, %al
movl $0x1, %r15d
cmovnel (%rsp), %r15d
movl %ebp, %edx
testl %ecx, %ecx
jne 0x86d7
movl %edx, 0x8(%rsp)
xorl %r12d, %r12d
movl %r13d, %eax
incl %eax
movl %eax, 0x10(%rsp)
movl %r14d, %eax
addl $0x101, %eax            # imm = 0x101
movl %eax, (%rsp)
addl %r14d, %r13d
addl $0x102, %r13d           # imm = 0x102
leaq 0x504(%rbx), %r14
movl %r15d, %ebp
cmpl %r13d, %r12d
jae 0x8614
movq %rbx, %rdi
callq 0x811c
cmpl $0x15, 0x4(%rbx)
ja 0x84fa
testb $0x1, 0x2(%rbx)
je 0x86fd
movq %rbx, %rdi
movq %r14, %rsi
callq 0x81b2
movl 0x4(%rbx), %edx
testl %edx, %edx
js 0x85fa
cmpl $0xf, %eax
ja 0x8524
movl %r12d, %ecx
incl %r12d
movb %al, 0x44(%rbx,%rcx)
jmp 0x85e5
cmpl $0x10, %eax
jne 0x8582
movq 0x8(%rbx), %rax
addl $-0x2, %edx
movl %edx, 0x4(%rbx)
movq %rax, %rcx
shrq $0x2, %rcx
movq %rcx, 0x8(%rbx)
movl $0x1, %r15d
testl %r12d, %r12d
je 0x8602
andl $0x3, %eax
addl $0x3, %eax
leal (%rax,%r12), %ecx
cmpl %r13d, %ecx
ja 0x8605
leal -0x1(%r12), %ecx
movb 0x44(%rbx,%rcx), %cl
movl %r12d, %edx
incl %r12d
movb %cl, 0x44(%rbx,%rdx)
decl %eax
jne 0x8569
movb $0x1, %al
movl %ebp, %r15d
testb %al, %al
je 0x85de
jmp 0x85e2
leal -0x41(,%rax,4), %ecx
movq 0x8(%rbx), %rdi
movq $-0x1, %rsi
shlq %cl, %rsi
notl %esi
andl %edi, %esi
subl %ecx, %edx
movl %edx, 0x4(%rbx)
shrq %cl, %rdi
movq %rdi, 0x8(%rbx)
leal (%rsi,%rax,8), %ecx
addl $0xffffff78, %ecx       # imm = 0xFFFFFF78
addl %r12d, %ecx
addl $0x3, %ecx
cmpl %r13d, %ecx
ja 0x860c
leal (%rsi,%rax,8), %eax
addl $0xffffff7b, %eax       # imm = 0xFFFFFF7B
testl %eax, %eax
je 0x85d6
movl %r12d, %edx
incl %r12d
movb $0x0, 0x44(%rbx,%rdx)
decl %eax
jne 0x85c7
movl %ebp, %r15d
cmpl %r13d, %ecx
jbe 0x85e2
xorl %eax, %eax
jmp 0x85ea
movl %r15d, %ebp
movb $0x1, %al
movl %ebp, %r15d
movl %r15d, %ebp
testb %al, %al
jne 0x84d9
jmp 0x89ca
movl $0x1, %r15d
jmp 0x85de
xorl %r12d, %r12d
xorl %eax, %eax
jmp 0x857c
movl $0x1, %r15d
jmp 0x85d9
leaq 0x44(%rbx), %r15
movl (%rsp), %r12d
movl $0x11f, %ecx            # imm = 0x11F
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x8a93
testb %al, %al
je 0x871f
movups (%r15,%r12), %xmm0
movups 0x10(%r15,%r12), %xmm1
leaq 0x20(%rsp), %rsi
movaps %xmm1, 0x10(%rsi)
movaps %xmm0, (%rsi)
movl 0x10(%rsp), %edx
movl $0x1f, %ecx
movq %r15, %rdi
callq 0x8a93
movl $0x1, %r15d
testb %al, %al
cmovnel %ebp, %r15d
je 0x89ca
movb $0x6, (%rbx)
movl %r15d, %r13d
movq 0x20(%rbx), %r12
movq 0x28(%rbx), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rbx), %rdi
movq 0x38(%rbx), %rax
movq %rax, (%rsp)
movq 0x10(%rbx), %r8
movq 0x18(%rbx), %r15
movq 0x8(%rbx), %r9
movl 0x4(%rbx), %eax
movzbl (%rbx), %ecx
cmpl $0x6, %ecx
movq %r15, 0x18(%rsp)
je 0x86c5
cmpl $0x8, %ecx
jne 0x86cc
movzwl 0x40(%rbx), %r11d
movzwl 0x42(%rbx), %r10d
xorl %ebp, %ebp
movl %r13d, %r15d
jmp 0x891e
xorl %ebp, %ebp
jmp 0x8778
movzbl 0x40(%rbx), %edx
xorl %ebp, %ebp
jmp 0x8801
cmpl $0x1, %ecx
jne 0x870d
jmp 0x89ca
movq %rbx, %rdi
callq 0x379a
jmp 0x8671
movb $0x2, (%rbx)
movw %ax, 0x40(%rbx)
movl $0x3, %r15d
jmp 0x89ca
movb $0x5, (%rbx)
movl 0x8(%rsp), %eax
movw %ax, 0x40(%rbx)
movw %r12w, 0x42(%rbx)
movzbl 0x2(%rbx), %eax
movl $0x2, %r15d
subl %eax, %r15d
jmp 0x89ca
movl $0x1, %r15d
jmp 0x89ca
movb $0x0, (%rbx)
jmp 0x870d
movb $0x1, (%rbx)
jmp 0x870d
movb $0x3, (%rbx)
jmp 0x870d
movb $0x4, (%rbx)
movl %ebp, %edx
movw %dx, 0x40(%rbx)
movl $0x5, %ecx
movl (%rsp), %r15d
jmp 0x84a2
subl %r14d, %ebp
movb $0x2, (%rbx)
movw %bp, 0x40(%rbx)
xorl %eax, %eax
cmpq 0x18(%rbx), %rcx
sete %al
leal 0x1(,%rax,4), %eax
movl $0x3, %ecx
cmovnel %ecx, %r15d
jmp 0x8378
movq %r15, %rcx
subq %r8, %rcx
cmpq $0x7, %rcx
jle 0x89dc
cmpl $0x20, %eax
ja 0x879f
movl (%r8), %edx
movl %eax, %ecx
shlq %cl, %rdx
orq %rdx, %r9
addl $0x20, %eax
addq $0x4, %r8
movl %r9d, %ecx
andl $0x1ff, %ecx            # imm = 0x1FF
movzwl 0x504(%rbx,%rcx,2), %edx
testw %dx, %dx
jns 0x87dd
movl %edx, %esi
andl $0x7ff, %esi            # imm = 0x7FF
shrl $0xb, %edx
andb $0xf, %dl
movq %r9, %r10
movl %edx, %ecx
shrq %cl, %r10
andl $0x7, %r10d
orl %esi, %r10d
movzwl 0x504(%rbx,%r10,2), %edx
jmp 0x87b0
movl %edx, %ecx
shrl $0xb, %ecx
shrq %cl, %r9
subl %ecx, %eax
movl $0x1, %r14d
js 0x89b2
andl $0x1ff, %edx            # imm = 0x1FF
cmpl $0xff, %edx
ja 0x8815
cmpq (%rsp), %rdi
je 0x8a27
movb %dl, (%rdi)
incq %rdi
jmp 0x8778
cmpl $0x11d, %edx            # imm = 0x11D
ja 0x8a37
movl %edx, %ecx
leaq 0x26c76(%rip), %rdx     # 0x2f4a0
movzwl -0x202(%rdx,%rcx,2), %r11d
movl %r11d, %ecx
shrl $0xc, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
shll %cl, %edx
notl %edx
andl %r9d, %edx
shrq %cl, %r9
subl %ecx, %eax
andl $0x1ff, %r11d           # imm = 0x1FF
addq %rdx, %r11
cmpl $0x1b, %eax
movq %r8, 0x8(%rsp)
jbe 0x8a4e
movq %r12, %r8
movl %r9d, %ecx
andl $0x1ff, %ecx            # imm = 0x1FF
movzwl 0x44(%rbx,%rcx,2), %edx
movl %ebp, %r12d
movl %edx, %esi
testw %dx, %dx
jns 0x88a0
andl $0x7ff, %esi            # imm = 0x7FF
shrl $0xb, %edx
andb $0xf, %dl
movq %r9, %r10
movl %edx, %ecx
shrq %cl, %r10
andl $0x7, %r10d
orl %esi, %r10d
movzwl 0x44(%rbx,%r10,2), %edx
jmp 0x8876
shrl $0xb, %esi
movl %esi, %ecx
shrq %cl, %r9
movl %edx, %r10d
andl $0x1ff, %r10d           # imm = 0x1FF
movl $0x1, %r14d
andl %r14d, %edx
orl $0x2, %edx
movl %r10d, %ecx
shrl %ecx
shll %cl, %edx
sarl %edx
cmpl %r14d, %r10d
sbbl $-0x1, %edx
cmpl $0x2, %r10d
adcl $-0x1, %ecx
movq $-0x1, %r15
shlq %cl, %r15
notq %r15
andq %r9, %r15
movl %ecx, %ebp
addl %esi, %ebp
shrq %cl, %r9
movslq %edx, %r10
addq %r15, %r10
subl %ebp, %eax
cmovsl %r14d, %r13d
movl %r13d, %r15d
cmpq $0x8001, %r10           # imm = 0x8001
cmovael %r14d, %r15d
jae 0x89b8
testl %eax, %eax
movl %r12d, %ebp
movq %r8, %r12
movq 0x8(%rsp), %r8
js 0x89b8
movq %rdi, %rcx
subq 0x10(%rsp), %rcx
movq %r10, %rdx
subq %rcx, %rdx
jbe 0x8948
testq %r12, %r12
je 0x89ac
movq %r12, %rsi
subq %rdx, %rsi
cmpq %r11, %rdx
cmovaeq %r11, %rdx
movq %rdx, %rcx
rep  movsb (%rsi), %es:(%rdi)
subq %rdx, %r11
movq (%rsp), %r13
subq %rdi, %r13
movq %rdi, %rsi
subq %r10, %rsi
cmpq %r11, %r13
movq %r11, %rdx
cmovbq %r13, %rdx
movq %rdx, %rcx
rep  movsb (%rsi), %es:(%rdi)
xorl %r14d, %r14d
cmpq %r13, %r11
ja 0x8a73
testl %r14d, %r14d
je 0x899f
movl %r15d, %r13d
cmpl $0x3a, %r14d
jne 0x89b8
movq %r8, 0x10(%rbx)
movq %r9, 0x8(%rbx)
movl %eax, 0x4(%rbx)
movq %rdi, 0x30(%rbx)
xorl %r14d, %r14d
testl %ebp, %ebp
setne %r14b
cmovnel %ebp, %r13d
movl %r13d, %r15d
jmp 0x89b8
movl %r15d, %r13d
movq 0x18(%rsp), %r15
jmp 0x8778
movl $0x1, %r14d
movl $0x1, %r15d
testl %r14d, %r14d
jne 0x89ca
testb $0x1, 0x1(%rbx)
je 0x825a
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x38, %eax
ja 0x8a0a
cmpq %r15, %r8
je 0x8a0a
movl %eax, %eax
movq %r9, %rdx
movq %rax, %rcx
movzbl (%r8), %r9d
shlq %cl, %r9
incq %r8
orq %rdx, %r9
addq $0x8, %rax
cmpq $0x30, %rcx
ja 0x8a0a
cmpq %r15, %r8
jne 0x89e8
cmpl $0x2f, %eax
ja 0x879f
cmpb $0x1, 0x2(%rbx)
je 0x879f
movl $0x2, %ebp
jmp 0x897e
movb $0x7, (%rbx)
movb %dl, 0x40(%rbx)
movl $0x3, %ebp
jmp 0x897e
movl $0x1, %r15d
cmpl $0x180, %edx            # imm = 0x180
je 0x897e
jmp 0x89b8
cmpq %r15, %r8
je 0x8862
movl (%r8), %edx
movl %eax, %ecx
shlq %cl, %rdx
orq %rdx, %r9
orl $0x20, %eax
addq $0x4, %r8
movq %r8, 0x8(%rsp)
jmp 0x8862
subl %edx, %r11d
movw %r11w, 0x40(%rbx)
movw %r10w, 0x42(%rbx)
movb $0x8, (%rbx)
movl $0x3a, %r14d
movl $0x3, %ebp
jmp 0x8970