// File: /workspace/github_cpp_makefile_star2_O2/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 $0x148, %rsp            # imm = 0x148
movq %rdi, %rbx
movzbl (%rdi), %eax
leaq 0x21666(%rip), %rcx     # 0x283f0
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movq 0x20(%rbx), %r13
movq 0x28(%rbx), %rbp
leaq 0x30(%rbx), %rcx
movq %rcx, 0x10(%rsp)
movq 0x30(%rbx), %rdi
movq 0x38(%rbx), %r9
leaq 0x10(%rbx), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rbx), %r11
movq 0x18(%rbx), %r10
leaq 0x8(%rbx), %rcx
movq %rcx, (%rsp)
movq 0x8(%rbx), %r15
leaq 0x4(%rbx), %rcx
movq %rcx, 0x18(%rsp)
movl 0x4(%rbx), %r8d
cmpl $0x6, %eax
je 0x72e8
cmpl $0x8, %eax
jne 0x6e05
movzwl 0x40(%rbx), %r14d
movzwl 0x42(%rbx), %r12d
jmp 0x7442
movzwl 0x40(%rbx), %ebp
jmp 0x6fa7
movzwl 0x40(%rbx), %ebp
jmp 0x6eb8
movzbl 0x40(%rbx), %edx
jmp 0x7360
movzwl 0x40(%rbx), %eax
movl %eax, %r14d
andl $0x1f, %r14d
movl %eax, (%rsp)
movl %eax, %r15d
shrl $0x5, %r15d
andl $0x1f, %r15d
movzwl 0x42(%rbx), %ebp
jmp 0x7054
movq %rbx, %rdi
callq 0x6c90
movl 0x4(%rbx), %eax
cmpl $0x9, %eax
jbe 0x72a5
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 0x6f55
movl %eax, %ecx
andb $0x7, %cl
shrq %cl, %rdx
movq %rdx, 0x8(%rbx)
andl $-0x8, %eax
movl %eax, 0x4(%rbx)
movq %rbx, %rdi
callq 0x6c90
movl 0x4(%rbx), %eax
cmpl $0x1f, %eax
jbe 0x72aa
movq 0x8(%rbx), %rcx
movl %ecx, %ebp
notl %ebp
shll $0x10, %ebp
xorl %ecx, %ebp
cmpl $0xffff, %ebp           # imm = 0xFFFF
ja 0x72d3
addl $-0x20, %eax
movl %eax, 0x4(%rbx)
shrq $0x20, %rcx
movq %rcx, 0x8(%rbx)
movl %ebp, %eax
movl 0x4(%rbx), %ecx
addl $-0x1, %eax
setb %dl
testl %ecx, %ecx
je 0x6efd
testb %dl, %dl
je 0x6efd
movq 0x30(%rbx), %rdx
cmpq %rdx, 0x38(%rbx)
je 0x7281
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)
movl %eax, %ebp
jmp 0x6eba
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rax
subq %rsi, %rax
movq 0x38(%rbx), %r15
movq 0x30(%rbx), %rdi
subq %rdi, %r15
cmpq %rax, %r15
cmovgeq %rax, %r15
cmpl %ebp, %r15d
movl %ebp, %r14d
cmovbl %r15d, %r14d
movq %r14, %rdx
callq 0x3280
movq 0x10(%rbx), %rax
addq %r14, %rax
movq %rax, 0x10(%rbx)
addq %r14, 0x30(%rbx)
cmpl %r15d, %ebp
ja 0x72bd
testb $0x1, 0x1(%rbx)
je 0x6e30
xorl %eax, %eax
jmp 0x72d6
cmpl $0x5, %esi
ja 0x72d3
testb $0x4, %cl
jne 0x6f79
xorl %eax, %eax
cmpq $0x21, %rax
je 0x71b2
movb $0x5, 0x20(%rsp,%rax)
incq %rax
jmp 0x6f65
movq %rbx, %rdi
callq 0x6c90
movl 0x4(%rbx), %eax
cmpl $0xd, %eax
jbe 0x72af
movq 0x8(%rbx), %rcx
movl %ecx, %ebp
andl $0x3fff, %ebp           # imm = 0x3FFF
addl $-0xe, %eax
movl %eax, 0x4(%rbx)
shrq $0xe, %rcx
movq %rcx, 0x8(%rbx)
movl %ebp, %r14d
andl $0x1f, %r14d
cmpl $0x1d, %r14d
ja 0x72d3
movl %ebp, %r15d
shrl $0x5, %r15d
andl $0x1f, %r15d
cmpl $0x1d, %r15d
ja 0x72d3
movl %ebp, %r12d
shrl $0xa, %r12d
addl $0x4, %r12d
movq %rbx, %rdi
callq 0x6cc6
movl 0x4(%rbx), %eax
leal (%r12,%r12,2), %ecx
cmpl %ecx, %eax
jb 0x72b4
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8(%rbx), %rcx
movl %r12d, %edx
xorl %esi, %esi
leaq 0x21419(%rip), %rdi     # 0x28420
cmpq %rsi, %rdx
je 0x7029
movl %ecx, %r8d
andb $0x7, %r8b
addl $-0x3, %eax
shrq $0x3, %rcx
movzbl (%rsi,%rdi), %r9d
movb %r8b, 0x20(%rsp,%r9)
incq %rsi
jmp 0x7007
movq %rcx, 0x8(%rbx)
movl %eax, 0x4(%rbx)
leaq 0x504(%rbx), %rdi
leaq 0x20(%rsp), %rsi
pushq $0x13
popq %rcx
movq %rcx, %rdx
callq 0x754c
testb %al, %al
je 0x72d3
movl %ebp, (%rsp)
xorl %ebp, %ebp
movl %r15d, %eax
incl %eax
movl %eax, 0x8(%rsp)
movl %r14d, %eax
addl $0x101, %eax            # imm = 0x101
movl %eax, 0x10(%rsp)
leal (%r14,%r15), %r13d
addl $0x102, %r13d           # imm = 0x102
leaq 0x504(%rbx), %r15
leaq 0x44(%rbx), %r14
cmpl %r13d, %ebp
jae 0x715f
movq %rbx, %rdi
callq 0x6c90
cmpl $0x15, 0x4(%rbx)
ja 0x70a0
testb $0x1, 0x2(%rbx)
je 0x728c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6d1e
movl 0x4(%rbx), %ecx
testl %ecx, %ecx
js 0x72d3
movl %eax, %r12d
cmpl $0xf, %eax
ja 0x70c8
movl %ebp, %eax
incl %ebp
movb %r12b, (%r14,%rax)
jmp 0x707f
cmpl $0x10, %r12d
jne 0x711a
movq 0x8(%rbx), %rax
addl $-0x2, %ecx
movl %ecx, 0x4(%rbx)
movq %rax, %rcx
shrq $0x2, %rcx
movq %rcx, 0x8(%rbx)
testl %ebp, %ebp
je 0x72d3
andl $0x3, %eax
leal (%rax,%rbp), %ecx
addl $0x3, %ecx
cmpl %r13d, %ecx
ja 0x72d3
addl $0x3, %eax
leal -0x1(%rbp), %ecx
movb (%r14,%rcx), %cl
subl $0x1, %eax
jb 0x707f
movl %ebp, %edx
incl %ebp
movb %cl, (%r14,%rdx)
jmp 0x7107
leal -0x41(,%r12,4), %esi
movq %rbx, %rdi
callq 0x6d02
leal (%rax,%r12,8), %ecx
addl $0xffffff78, %ecx       # imm = 0xFFFFFF78
addl %ebp, %ecx
addl $0x3, %ecx
cmpl %r13d, %ecx
ja 0x72d3
leal (%rax,%r12,8), %eax
addl $0xffffff7b, %eax       # imm = 0xFFFFFF7B
subl $0x1, %eax
jb 0x707f
movl %ebp, %ecx
incl %ebp
movb $0x0, (%r14,%rcx)
jmp 0x714b
movl 0x10(%rsp), %r12d
movl $0x11f, %ecx            # imm = 0x11F
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x754c
testb %al, %al
je 0x72d3
movups (%r14,%r12), %xmm0
movups 0x10(%r14,%r12), %xmm1
leaq 0x20(%rsp), %rsi
movaps %xmm1, 0x10(%rsi)
movaps %xmm0, (%rsi)
movl 0x8(%rsp), %edx
pushq $0x1f
popq %rcx
movq %r14, %rdi
callq 0x754c
testb %al, %al
jne 0x7239
jmp 0x72d3
leaq 0x44(%rbx), %rdi
xorl %r14d, %r14d
leaq 0x20(%rsp), %rsi
pushq $0x20
popq %rdx
xorl %ecx, %ecx
callq 0x754c
cmpq $0x90, %r14
je 0x71dc
movb $0x8, 0x20(%rsp,%r14)
incq %r14
jmp 0x71c8
movl $0x90, %eax
cmpq $0x100, %rax            # imm = 0x100
je 0x71f3
movb $0x9, 0x20(%rsp,%rax)
incq %rax
jmp 0x71e1
movl $0x100, %eax            # imm = 0x100
cmpq $0x118, %rax            # imm = 0x118
je 0x720a
movb $0x7, 0x20(%rsp,%rax)
incq %rax
jmp 0x71f8
movl $0x118, %eax            # imm = 0x118
cmpq $0x120, %rax            # imm = 0x120
je 0x7221
movb $0x8, 0x20(%rsp,%rax)
incq %rax
jmp 0x720f
leaq 0x504(%rbx), %rdi
leaq 0x20(%rsp), %rsi
movl $0x120, %edx            # imm = 0x120
xorl %ecx, %ecx
callq 0x754c
movb $0x6, (%rbx)
movq 0x20(%rbx), %r13
movq 0x28(%rbx), %rbp
leaq 0x30(%rbx), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rbx), %rdi
movq 0x38(%rbx), %r9
leaq 0x10(%rbx), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rbx), %r11
movq 0x18(%rbx), %r10
leaq 0x8(%rbx), %rax
movq %rax, (%rsp)
movq 0x8(%rbx), %r15
leaq 0x4(%rbx), %rax
movq %rax, 0x18(%rsp)
movl 0x4(%rbx), %r8d
jmp 0x72e8
movb $0x2, (%rbx)
movw %bp, 0x40(%rbx)
pushq $0x3
jmp 0x72d5
movb $0x5, (%rbx)
movl (%rsp), %eax
movw %ax, 0x40(%rbx)
movw %bp, 0x42(%rbx)
movzbl 0x2(%rbx), %ecx
pushq $0x2
popq %rax
subl %ecx, %eax
jmp 0x72d6
movb $0x0, (%rbx)
jmp 0x729a
movb $0x1, (%rbx)
jmp 0x729a
movb $0x3, (%rbx)
jmp 0x729a
movb $0x4, (%rbx)
movw %bp, 0x40(%rbx)
jmp 0x729a
movb $0x2, (%rbx)
cmovbl %ebp, %r15d
subl %r15d, %ebp
movw %bp, 0x40(%rbx)
cmpq 0x18(%rbx), %rax
jne 0x7288
jmp 0x729a
pushq $0x1
popq %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r10, %rax
subq %r11, %rax
cmpq $0x7, %rax
jle 0x74a4
cmpl $0x20, %r8d
ja 0x7312
movl (%r11), %eax
movl %r8d, %ecx
shlq %cl, %rax
orq %rax, %r15
addl $0x20, %r8d
addq $0x4, %r11
movl %r15d, %eax
andl $0x1ff, %eax            # imm = 0x1FF
movzwl 0x504(%rbx,%rax,2), %edx
testw %dx, %dx
jns 0x7345
movl %edx, %esi
shrl $0xb, %edx
andb $0xf, %dl
movq %r15, %rax
movl %edx, %ecx
shrq %cl, %rax
andl $0x7ff, %esi            # imm = 0x7FF
andl $0x7, %eax
orq %rsi, %rax
jmp 0x731a
movl %edx, %ecx
shrl $0xb, %ecx
shrq %cl, %r15
subl %ecx, %r8d
js 0x72d3
andl $0x1ff, %edx            # imm = 0x1FF
cmpl $0xff, %edx
ja 0x7373
cmpq %r9, %rdi
je 0x74e2
movb %dl, (%rdi)
incq %rdi
jmp 0x72e8
cmpl $0x11d, %edx            # imm = 0x11D
ja 0x7519
leaq 0x210ba(%rip), %rax     # 0x28440
movzwl -0x202(%rax,%rdx,2), %r14d
movl %r14d, %ecx
shrl $0xc, %ecx
pushq $-0x1
popq %rax
shll %cl, %eax
notl %eax
andl %r15d, %eax
shrq %cl, %r15
subl %ecx, %r8d
andl $0x1ff, %r14d           # imm = 0x1FF
addq %rax, %r14
cmpl $0x1b, %r8d
jbe 0x752a
movl %r15d, %edx
andl $0x1ff, %edx            # imm = 0x1FF
movzwl 0x44(%rbx,%rdx,2), %eax
testw %ax, %ax
jns 0x73e9
movl %eax, %esi
shrl $0xb, %eax
andb $0xf, %al
movq %r15, %rdx
movl %eax, %ecx
shrq %cl, %rdx
andl $0x7ff, %esi            # imm = 0x7FF
andl $0x7, %edx
orq %rsi, %rdx
jmp 0x73c2
movl %eax, %edx
shrl $0xb, %edx
movl %edx, %ecx
shrq %cl, %r15
movl %eax, %esi
andl $0x1ff, %esi            # imm = 0x1FF
andl $0x1, %eax
orl $0x2, %eax
movl %esi, %ecx
shrl %ecx
shll %cl, %eax
sarl %eax
cmpl $0x1, %esi
sbbl $-0x1, %eax
cmpl $0x2, %esi
adcl $-0x1, %ecx
pushq $-0x1
popq %rsi
shlq %cl, %rsi
notq %rsi
andq %r15, %rsi
movslq %eax, %r12
addq %rsi, %r12
cmpq $0x8000, %r12           # imm = 0x8000
ja 0x72d3
shrq %cl, %r15
addl %ecx, %edx
subl %edx, %r8d
js 0x72d3
movq %rdi, %rcx
subq %rbp, %rcx
movq %r12, %rax
subq %rcx, %rax
jbe 0x746e
testq %r13, %r13
je 0x72d3
movq %r13, %rsi
subq %rax, %rsi
cmpq %r14, %rax
cmovaeq %r14, %rax
movq %rax, %rcx
rep  movsb (%rsi), %es:(%rdi)
subq %rax, %r14
movq %r9, %rdx
subq %rdi, %rdx
movq %rdi, %rsi
subq %r12, %rsi
cmpq %r14, %rdx
movq %r14, %rax
cmovbq %rdx, %rax
movq %rax, %rcx
rep  movsb (%rsi), %es:(%rdi)
cmpq %rdx, %r14
jbe 0x72e8
subl %eax, %r14d
movw %r14w, 0x40(%rbx)
movw %r12w, 0x42(%rbx)
movb $0x8, (%rbx)
jmp 0x74e8
movl %r8d, %r8d
cmpq $0x38, %r8
ja 0x74c8
cmpq %r10, %r11
je 0x74c8
movzbl (%r11), %eax
movl %r8d, %ecx
shlq %cl, %rax
incq %r11
orq %rax, %r15
addq $0x8, %r8
jmp 0x74a7
cmpq $0x30, %r8
jae 0x7312
cmpb $0x1, 0x2(%rbx)
je 0x7312
xorl %ecx, %ecx
pushq $0x2
jmp 0x74ec
movb $0x7, (%rbx)
movb %dl, 0x40(%rbx)
xorl %ecx, %ecx
pushq $0x3
popq %rax
movq 0x8(%rsp), %rdx
movq %r11, (%rdx)
movq (%rsp), %rdx
movq %r15, (%rdx)
movq 0x18(%rsp), %rdx
movl %r8d, (%rdx)
movq 0x10(%rsp), %rdx
movq %rdi, (%rdx)
testb %cl, %cl
jne 0x6f44
jmp 0x72d6
xorl %eax, %eax
movb $0x1, %cl
cmpl $0x180, %edx            # imm = 0x180
je 0x74ed
jmp 0x72d3
cmpq %r10, %r11
je 0x73b9
movl (%r11), %eax
movl %r8d, %ecx
shlq %cl, %rax
orq %rax, %r15
orl $0x20, %r8d
addq $0x4, %r11
jmp 0x73b9