// File: /workspace/github_c_makefile_star2_O3/ebiggers[P]xpack/lib/xpack_compress.c
// Function: write_block
static size_t
write_block(struct xpack_compressor *c, void *out, size_t out_nbytes_avail,
	    u32 block_size, u32 last_litrunlen, bool is_final_block)
{
	struct header_ostream os;
	size_t header_size;
	size_t items_size;
	int block_type;
	unsigned num_state_counts;
	unsigned order;

	/* Final litrunlen */
	record_litrunlen(c, &c->matches[c->num_matches], last_litrunlen);
	c->matches[c->num_matches].offset_sym = MAX_OFFSET_ALPHABET_SIZE;
	c->num_matches++;

	/* Choose the block type */
	block_type = choose_block_type(c);

	header_ostream_init(&os, out, out_nbytes_avail);

	/* Output the "final block" flag */
	header_ostream_write_bits(&os, is_final_block, 1);

	/* Output the block type */
	header_ostream_write_bits(&os, block_type, NUM_BLOCKTYPE_BITS);

	/* Output the block size */
	write_block_size(&os, block_size);

	/* Compute FSE state counts for each alphabet */

	c->codes.log2_num_literal_states =
		choose_state_counts(c->freqs.literal,
				    LITERAL_ALPHABET_SIZE,
				    MAX_LOG2_NUM_LITERAL_STATES,
				    c->codes.literal_state_counts);

	c->codes.log2_num_litrunlen_states =
		choose_state_counts(c->freqs.litrunlen,
				    LITRUNLEN_ALPHABET_SIZE,
				    MAX_LOG2_NUM_LITRUNLEN_STATES,
				    c->codes.litrunlen_state_counts);

	c->codes.log2_num_length_states =
		choose_state_counts(c->freqs.length,
				    LENGTH_ALPHABET_SIZE,
				    MAX_LOG2_NUM_LENGTH_STATES,
				    c->codes.length_state_counts);

	c->codes.log2_num_offset_states =
		choose_state_counts(c->freqs.offset,
				    MAX_OFFSET_ALPHABET_SIZE,
				    MAX_LOG2_NUM_OFFSET_STATES,
				    c->codes.offset_state_counts);

	if (block_type == BLOCKTYPE_ALIGNED) {
		c->codes.log2_num_aligned_states =
			choose_state_counts(c->freqs.aligned,
					    ALIGNED_ALPHABET_SIZE,
					    MAX_LOG2_NUM_ALIGNED_STATES,
					    c->codes.aligned_state_counts);
	}

	/* Output the FSE state counts for each alphabet */
	header_ostream_write_bits(&os, c->codes.log2_num_literal_states, 4);
	header_ostream_write_bits(&os, c->codes.log2_num_litrunlen_states, 4);
	header_ostream_write_bits(&os, c->codes.log2_num_length_states, 4);
	header_ostream_write_bits(&os, c->codes.log2_num_offset_states, 4);
	if (block_type == BLOCKTYPE_ALIGNED)
		header_ostream_write_bits(&os, c->codes.log2_num_aligned_states, 4);

#ifndef _MSC_VER
	STATIC_ASSERT(offsetof(struct codes,
			       aligned_state_counts[ALIGNED_ALPHABET_SIZE]) ==
		      offsetof(struct codes, state_counts) + sizeof(c->codes.state_counts));
#endif
	num_state_counts = ARRAY_LEN(c->codes.state_counts);
	if (block_type != BLOCKTYPE_ALIGNED)
		num_state_counts -= ALIGNED_ALPHABET_SIZE;

	write_state_counts(&os, c->codes.state_counts, num_state_counts);

	/* Output the number of extra bytes */
	order = bsr32(c->num_extra_bytes + 1);
	header_ostream_write_bits(&os, order, 5);
	header_ostream_write_bits(&os,
				  (c->num_extra_bytes + 1) - ((u32)1 << order),
				  order);

	/* Align to the next byte boundary */
	header_size = header_ostream_flush(&os);
	if (header_size == 0)
		return 0;

	/* Add the extra bytes */
	if (c->num_extra_bytes >= out_nbytes_avail - header_size)
		return 0;
	memcpy((u8 *)out + header_size, c->extra_bytes, c->num_extra_bytes);
	header_size += c->num_extra_bytes;

	/* Build the FSE encoding tables for each alphabet */

	build_fse_encoding_tables(c, c->codes.literal_sym_encinfo,
				  c->codes.literal_next_statesx,
				  c->codes.literal_state_counts,
				  LITERAL_ALPHABET_SIZE,
				  c->codes.log2_num_literal_states);

	build_fse_encoding_tables(c, c->codes.litrunlen_sym_encinfo,
				  c->codes.litrunlen_next_statesx,
				  c->codes.litrunlen_state_counts,
				  LITRUNLEN_ALPHABET_SIZE,
				  c->codes.log2_num_litrunlen_states);

	build_fse_encoding_tables(c, c->codes.length_sym_encinfo,
				  c->codes.length_next_statesx,
				  c->codes.length_state_counts,
				  LENGTH_ALPHABET_SIZE,
				  c->codes.log2_num_length_states);

	build_fse_encoding_tables(c, c->codes.offset_sym_encinfo,
				  c->codes.offset_next_statesx,
				  c->codes.offset_state_counts,
				  MAX_OFFSET_ALPHABET_SIZE,
				  c->codes.log2_num_offset_states);

	if (block_type == BLOCKTYPE_ALIGNED) {
		build_fse_encoding_tables(c, c->codes.aligned_sym_encinfo,
					  c->codes.aligned_next_statesx,
					  c->codes.aligned_state_counts,
					  ALIGNED_ALPHABET_SIZE,
					  c->codes.log2_num_aligned_states);
	}

	/* Encode the items */

	items_size = encode_items(c, (u8 *)out + header_size,
				  out_nbytes_avail - header_size,
				  block_type == BLOCKTYPE_ALIGNED);
	if (items_size == 0)
		return 0;

	return header_size + items_size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r9d, 0x18(%rsp)
movl %ecx, %r12d
movq %rdx, 0x8(%rsp)
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x4c810(%rdi), %rax
movq %rax, 0x48(%rsp)
movl 0x3228(%rdi), %eax
leaq (%rdi,%rax,8), %rsi
addq $0x4c810, %rsi          # imm = 0x4C810
movl %r8d, %edx
callq 0x3e0d
movl 0x3228(%r15), %eax
movb $0x20, 0x4c812(%r15,%rax,8)
incl %eax
movl %eax, 0x3228(%r15)
leaq 0x5e8(%r15), %rax
movq %rax, 0x38(%rsp)
pcmpeqd %xmm1, %xmm1
pxor %xmm2, %xmm2
movl $0x17a, %eax            # imm = 0x17A
movdqa 0x20cd(%rip), %xmm0     # 0x6040
movdqu (%r15,%rax,4), %xmm3
movdqa %xmm1, %xmm4
pxor %xmm0, %xmm1
movdqa %xmm3, %xmm5
pxor %xmm0, %xmm5
movdqa %xmm2, %xmm6
pxor %xmm0, %xmm2
pcmpgtd %xmm5, %xmm2
pcmpgtd %xmm1, %xmm5
pand %xmm5, %xmm4
pandn %xmm3, %xmm5
movdqa %xmm5, %xmm1
por %xmm4, %xmm1
pand %xmm2, %xmm6
pandn %xmm3, %xmm2
por %xmm6, %xmm2
addq $0x4, %rax
cmpq $0x182, %rax            # imm = 0x182
jne 0x3f73
pshufd $0xee, %xmm2, %xmm3     # xmm3 = xmm2[2,3,2,3]
movdqa %xmm2, %xmm4
pxor %xmm0, %xmm4
movdqa %xmm3, %xmm5
pxor %xmm0, %xmm5
pcmpgtd %xmm5, %xmm4
pand %xmm4, %xmm2
pandn %xmm3, %xmm4
por %xmm2, %xmm4
pshufd $0x55, %xmm4, %xmm2     # xmm2 = xmm4[1,1,1,1]
movdqa %xmm4, %xmm3
pxor %xmm0, %xmm3
movdqa %xmm2, %xmm5
pxor %xmm0, %xmm5
pcmpgtd %xmm5, %xmm3
pand %xmm3, %xmm4
pandn %xmm2, %xmm3
por %xmm4, %xmm3
movd %xmm3, %ebp
pshufd $0xee, %xmm1, %xmm2     # xmm2 = xmm1[2,3,2,3]
movdqa %xmm1, %xmm3
pxor %xmm0, %xmm3
movdqa %xmm2, %xmm4
pxor %xmm0, %xmm4
pcmpgtd %xmm3, %xmm4
pand %xmm4, %xmm1
pandn %xmm2, %xmm4
por %xmm1, %xmm4
pshufd $0x55, %xmm4, %xmm1     # xmm1 = xmm4[1,1,1,1]
movdqa %xmm4, %xmm2
pxor %xmm0, %xmm2
pxor %xmm1, %xmm0
pcmpgtd %xmm2, %xmm0
pand %xmm0, %xmm4
pandn %xmm1, %xmm0
por %xmm4, %xmm0
movd %xmm0, %eax
leal (%rax,%rax,2), %r13d
movq %rbx, 0x60(%rsp)
movq %rbx, 0x68(%rsp)
movq %rbx, 0x10(%rsp)
movq 0x8(%rsp), %rax
leaq (%rbx,%rax), %rcx
leal (%r12,%r12), %eax
cmpl $0x8000, %r12d          # imm = 0x8000
movl $0x1, %r14d
cmovnel %eax, %r14d
movl $0x5, %eax
movl $0x19, %r12d
cmovel %eax, %r12d
movq %rcx, 0x40(%rsp)
movq %rcx, 0x70(%rsp)
shlq $0x4, %r14
leaq 0x28(%r15), %rdi
leaq 0x2734(%r15), %rcx
movl $0x100, %esi            # imm = 0x100
movl $0xa, %edx
movq %rcx, %rbx
callq 0x4bc2
movl %eax, 0x2720(%r15)
leaq 0x428(%r15), %rdi
leaq 0x2934(%r15), %rcx
movl $0x10, %esi
movl $0x9, %edx
movq %rcx, 0x28(%rsp)
callq 0x4bc2
movl %eax, 0x2724(%r15)
leaq 0x468(%r15), %rdi
leaq 0x2954(%r15), %rcx
movl $0x40, %esi
movl $0x9, %edx
movq %rcx, 0x20(%rsp)
callq 0x4bc2
movl %eax, 0x2728(%r15)
leaq 0x568(%r15), %rdi
leaq 0x29d4(%r15), %rcx
movl $0x20, %esi
movl $0x9, %edx
movq %rcx, 0x30(%rsp)
callq 0x4bc2
xorl %ecx, %ecx
movl %eax, 0x272c(%r15)
movl %ebp, 0x4(%rsp)
movl %r13d, (%rsp)
cmpl %ebp, %r13d
setb %cl
movzbl 0x18(%rsp), %eax
leaq (%rax,%rcx,2), %rax
leaq 0x2(%r14,%rax), %r14
jae 0x4188
leaq 0x2a14(%r15), %rcx
movq 0x38(%rsp), %rdi
movl $0x8, %esi
movl $0x7, %edx
callq 0x4bc2
movl %eax, 0x2730(%r15)
movl 0x2720(%r15), %edx
movl 0x2724(%r15), %eax
movl %r12d, %ecx
shlq %cl, %rdx
leal 0x4(%r12), %ecx
shlq %cl, %rax
movl 0x2728(%r15), %edi
leal 0x8(%r12), %ecx
shlq %cl, %rdi
orq %rdx, %rax
movl 0x272c(%r15), %esi
leal 0xc(%r12), %ecx
shlq %cl, %rsi
orq %rax, %rdi
orq %rdi, %rsi
orq %r14, %rsi
leal 0x10(%r12), %ecx
movq %rsi, 0x50(%rsp)
movl %ecx, 0x58(%rsp)
movl $0x170, %edx            # imm = 0x170
movl (%rsp), %eax
cmpl 0x4(%rsp), %eax
jae 0x420a
movl 0x2730(%r15), %eax
shlq %cl, %rax
orq %rsi, %rax
movq %rax, 0x50(%rsp)
addl $0x14, %r12d
movl %r12d, 0x58(%rsp)
movl $0x178, %edx            # imm = 0x178
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %r13
movq %rbx, %rsi
callq 0x4d4a
movl 0x322c(%r15), %edi
incl %edi
bsrl %edi, %eax
movl 0x8(%r14), %ecx
movq %rax, %r8
shlq %cl, %r8
orq (%r14), %r8
leal 0x5(%rcx), %edx
movq 0x18(%r14), %r12
movq 0x20(%r14), %rsi
cmpl $0x40, %edx
jb 0x426e
movq %rsi, %rdx
subq %r12, %rdx
movq %rsi, %r9
cmpq $0x8, %rdx
jl 0x4260
movq %r8, (%r12)
addq $0x8, %r12
movq %r12, %r9
leal -0x3b(%rcx), %edx
negb %cl
movq %rax, %r8
shrq %cl, %r8
movq %r9, %r12
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %r9d
addl %edi, %r9d
movq %r9, %rdi
movl %edx, %ecx
shlq %cl, %rdi
orq %r8, %rdi
addl %eax, %edx
cmpl $0x40, %edx
jb 0x42b8
movq %rsi, %rcx
subq %r12, %rcx
movq %rsi, %r8
cmpq $0x8, %rcx
jl 0x42a8
movq %rdi, (%r12)
addq $0x8, %r12
movq %r12, %r8
addl $-0x40, %edx
subl %edx, %eax
movl %eax, %ecx
shrq %cl, %r9
movq %r8, %r12
movq %r9, %rdi
testl %edx, %edx
jle 0x42d8
cmpq %rsi, %r12
je 0x42c8
movb %dil, (%r12)
incq %r12
addl $-0x8, %edx
shrq $0x8, %rdi
testl %edx, %edx
jg 0x42bc
movq 0x70(%rsp), %rsi
cmpq %rsi, %r12
je 0x4ae3
subq 0x60(%rsp), %r12
je 0x4ae3
movl 0x322c(%r15), %edx
movq 0x8(%rsp), %rax
subq %r12, %rax
cmpq %rdx, %rax
jbe 0x4ae3
leaq 0x660(%r15), %r14
movq 0x10(%rsp), %rax
leaq (%rax,%r12), %rdi
leaq 0x171798(%r15), %rsi
callq 0x1050
movl 0x322c(%r15), %ebx
addq %r12, %rbx
leaq 0x1220(%r15), %rdx
movl 0x2720(%r15), %r9d
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rcx
movl $0x100, %r8d            # imm = 0x100
callq 0x4e2a
leaq 0xe60(%r15), %r12
leaq 0x1a20(%r15), %r14
movl 0x2724(%r15), %r9d
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq 0x28(%rsp), %rcx
movl $0x10, %r8d
callq 0x4e2a
leaq 0xee0(%r15), %rsi
leaq 0x1e20(%r15), %rdx
movl 0x2728(%r15), %r9d
movq %r15, %rdi
movq 0x20(%rsp), %rcx
movl $0x40, %r8d
callq 0x4e2a
leaq 0x10e0(%r15), %rsi
leaq 0x2220(%r15), %rdx
movl 0x272c(%r15), %r9d
movq %r15, %rdi
movq 0x30(%rsp), %rcx
movl $0x20, %r8d
callq 0x4e2a
movl (%rsp), %eax
cmpl 0x4(%rsp), %eax
jae 0x43fd
leaq 0x11e0(%r15), %rsi
leaq 0x2620(%r15), %rdx
leaq 0x2a14(%r15), %rcx
movl 0x2730(%r15), %r9d
movq %r15, %rdi
movl $0x8, %r8d
callq 0x4e2a
addq %rbx, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movq 0x8(%rsp), %rcx
subq %rbx, %rcx
cmpq $0x8, %rcx
movl $0x8, %eax
cmovbq %rcx, %rax
movq 0x40(%rsp), %r9
movl 0x2724(%r15), %ecx
movl 0x2728(%r15), %edx
movl $0x1, %r11d
movq %rcx, 0x38(%rsp)
shll %cl, %r11d
movl $0x1, %r13d
movq %rdx, 0x30(%rsp)
movl %edx, %ecx
shll %cl, %r13d
movl $0x1, %edx
movl 0x272c(%r15), %ecx
movl $0x1, %ebp
movq %rcx, 0x28(%rsp)
shll %cl, %ebp
movl 0x2730(%r15), %ecx
movq %rcx, 0x20(%rsp)
shll %cl, %edx
movq %rdx, 0x8(%rsp)
subq %rax, %r9
movl 0x3228(%r15), %edx
movl %edx, %eax
decl %eax
js 0x44f8
movl %eax, %eax
movq 0x48(%rsp), %rcx
cmpb $0x20, 0x2(%rcx,%rax,8)
jne 0x4503
movzbl (%rcx,%rax,8), %esi
movl (%r12,%rsi,8), %eax
addl %r11d, %eax
movl %eax, %r8d
shrl $0xa, %r8d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl %r8d, %ecx
shll %cl, %r10d
notl %r10d
andl %r11d, %r10d
shrl %cl, %r11d
addl 0x4(%r12,%rsi,8), %r11d
negb %cl
movq %r10, %rsi
shlq %cl, %rsi
movzwl (%r14,%r11,2), %r11d
movq %r9, %rcx
subq 0x10(%rsp), %rcx
shrl $0xd, %eax
cmpq %rax, %rcx
cmovgeq %rax, %rcx
movq %rsi, (%r9)
subq %rcx, %r9
andl $0x7, %r8d
addl $-0x2, %edx
js 0x4701
movl %edx, %eax
jmp 0x4509
xorl %r8d, %r8d
xorl %r10d, %r10d
jmp 0x4701
xorl %r10d, %r10d
xorl %r8d, %r8d
movq %r9, %rsi
movzbl 0x4c812(%r15,%rax,8), %r9d
cmpl $0x3, %r9d
jb 0x4598
leal -0x3(%r9), %ecx
movl 0x4c814(%r15,%rax,8), %edx
movl (%rsp), %edi
cmpl 0x4(%rsp), %edi
jae 0x459f
cmpl $0x3, %ecx
jb 0x459f
movl %edx, %r14d
leal -0x6(%r9), %ecx
shlq %cl, %r10
shrl $0x3, %r14d
orq %r14, %r10
leal (%r9,%r8), %r14d
addl $-0x6, %r14d
andl $0x7, %edx
movl 0x11e0(%r15,%rdx,8), %ecx
movq 0x8(%rsp), %rdi
addl %edi, %ecx
shrl $0xa, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
shll %cl, %r8d
shlq %cl, %r10
notl %r8d
andl %edi, %r8d
orq %r8, %r10
movl %ecx, %r8d
shrl %cl, %edi
addl %r14d, %r8d
addl 0x11e4(%r15,%rdx,8), %edi
movzwl 0x2620(%r15,%rdi,2), %edi
movq %rdi, 0x8(%rsp)
jmp 0x45a8
movq 0x10(%rsp), %rdi
jmp 0x45d5
shlq %cl, %r10
orq %rdx, %r10
addl %ecx, %r8d
movl %r8d, %ecx
negb %cl
movq %r10, %rdx
shlq %cl, %rdx
movq %rdx, (%rsi)
movq %rsi, %rcx
movq 0x10(%rsp), %rdi
subq %rdi, %rcx
movl %r8d, %edx
shrl $0x3, %edx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
subq %rcx, %rsi
andl $0x7, %r8d
movl %r9d, %r9d
movl 0x10e0(%r15,%r9,8), %ecx
addl %ebp, %ecx
shrl $0xa, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
shll %cl, %edx
shlq %cl, %r10
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %ebx, %edx
andl %ebp, %edx
orq %rdx, %r10
movl %ecx, %edx
shrl %cl, %ebp
addl %r8d, %edx
addl 0x10e4(%r15,%r9,8), %ebp
movzwl 0x2220(%r15,%rbp,2), %ebp
movl %edx, %ecx
negb %cl
movq %r10, %r8
shlq %cl, %r8
movq %r8, (%rsi)
movq %rsi, %r12
subq %rdi, %r12
movl %edx, %ecx
shrl $0x3, %ecx
cmpq %rcx, %r12
cmovgeq %rcx, %r12
movzbl 0x4c811(%r15,%rax,8), %r14d
movl 0xee0(%r15,%r14,8), %r9d
addl %r13d, %r9d
shrl $0xa, %r9d
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movl %r9d, %ecx
shll %cl, %r8d
notl %r8d
andl %r13d, %r8d
shlq %cl, %r10
shrl %cl, %r13d
addl 0xee4(%r15,%r14,8), %r13d
movzbl 0x4c810(%r15,%rax,8), %r14d
movl 0xe60(%r15,%r14,8), %ecx
addl %r11d, %ecx
shrl $0xa, %ecx
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
shll %cl, %ebx
orq %r8, %r10
notl %ebx
andl %r11d, %ebx
shlq %cl, %r10
orq %rbx, %r10
shrl %cl, %r11d
movl %ecx, %r8d
addl %r9d, %r8d
addl 0xe64(%r15,%r14,8), %r11d
movq %rsi, %r9
subq %r12, %r9
negq %r12
andl $0x7, %edx
addl %edx, %r8d
movl %r8d, %ecx
negb %cl
movq %r10, %rdx
shlq %cl, %rdx
movzwl 0x1e20(%r15,%r13,2), %r13d
movzwl 0x1a20(%r15,%r11,2), %r11d
movq %rdx, (%rsi,%r12)
movq %r9, %rcx
subq %rdi, %rcx
movl %r8d, %edx
shrl $0x3, %edx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
subq %rcx, %r9
andl $0x7, %r8d
movq %r9, %rsi
testq %rax, %rax
leaq -0x1(%rax), %rax
jg 0x450c
movl (%rsp), %eax
cmpl 0x4(%rsp), %eax
jae 0x4755
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq 0x20(%rsp), %rcx
shll %cl, %eax
movq 0x8(%rsp), %rdx
addl %eax, %edx
shlq %cl, %r10
orq %rdx, %r10
addl %ecx, %r8d
movl %r8d, %ecx
negb %cl
movq %r10, %rax
shlq %cl, %rax
movq %rax, (%r9)
movq %r9, %rax
movq 0x10(%rsp), %rdi
subq %rdi, %rax
movl %r8d, %ecx
shrl $0x3, %ecx
cmpq %rcx, %rax
cmovgeq %rcx, %rax
subq %rax, %r9
andl $0x7, %r8d
jmp 0x475a
movq 0x10(%rsp), %rdi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq 0x28(%rsp), %rcx
shll %cl, %eax
addl %eax, %ebp
shlq %cl, %r10
orq %rbp, %r10
leal (%rcx,%r8), %r12d
movl %r12d, %ecx
negb %cl
movq %r10, %rdx
shlq %cl, %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rdx, (%r9)
movq %r9, %rdx
subq %rdi, %rdx
movl %r12d, %ecx
shrl $0x3, %ecx
cmpq %rcx, %rdx
cmovgeq %rcx, %rdx
movq %r9, %rsi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq 0x30(%rsp), %rcx
shll %cl, %r8d
subq %rdx, %rsi
andl $0x7, %r12d
addl %r8d, %r13d
shlq %cl, %r10
orq %r13, %r10
addl %ecx, %r12d
movl %r12d, %ecx
negb %cl
movq %r10, %rbx
shlq %cl, %rbx
negq %rdx
movq %rsi, %r8
subq %rdi, %r8
movl %r12d, %ecx
shrl $0x3, %ecx
cmpq %rcx, %r8
cmovgeq %rcx, %r8
movq 0x38(%rsp), %rcx
shll %cl, %eax
movq %rbx, (%r9,%rdx)
andl $0x7, %r12d
addl %eax, %r11d
shlq %cl, %r10
orq %r11, %r10
addl %ecx, %r12d
movl %r12d, %ecx
negb %cl
movq %r10, %rax
shlq %cl, %rax
subq %r8, %rsi
movq %rsi, %rcx
subq %rdi, %rcx
movl %r12d, %edx
shrl $0x3, %edx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
movq %rax, (%rsi)
subq %rcx, %rsi
movl 0x2720(%r15), %eax
movl $0x1, %r8d
movl %eax, %ecx
shll %cl, %r8d
movl 0x3224(%r15), %edx
leal -0x1(%rdx), %ecx
andl $0x7, %r12d
testl %ecx, %ecx
jle 0x4910
movl %ecx, %r11d
movl %r8d, %r9d
movzbl 0x3230(%r15,%r11), %ebx
movl 0x660(%r15,%rbx,8), %ecx
addl %r9d, %ecx
shrl $0xa, %ecx
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
shll %cl, %r14d
notl %r14d
shlq %cl, %r10
andl %r9d, %r14d
orq %r14, %r10
movl %ecx, %ebp
addl %r12d, %ebp
shrl %cl, %r9d
addl 0x664(%r15,%rbx,8), %r9d
movzwl 0x1220(%r15,%r9,2), %r9d
movzbl 0x322f(%r15,%r11), %r14d
movl 0x660(%r15,%r14,8), %ecx
addl %r8d, %ecx
shrl $0xa, %ecx
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
shll %cl, %ebx
shlq %cl, %r10
notl %ebx
andl %r8d, %ebx
orq %rbx, %r10
movl %ecx, %r12d
shrl %cl, %r8d
addl %ebp, %r12d
addl 0x664(%r15,%r14,8), %r8d
movzwl 0x1220(%r15,%r8,2), %r8d
movl %r12d, %ecx
negb %cl
movq %r10, %rbx
shlq %cl, %rbx
movq %rbx, (%rsi)
movq %rsi, %rcx
subq %rdi, %rcx
movl %r12d, %ebx
shrl $0x3, %ebx
cmpq %rbx, %rcx
cmovgeq %rbx, %rcx
subq %rcx, %rsi
leaq -0x2(%r11), %rcx
andl $0x7, %r12d
cmpq $0x2, %r11
movq %rcx, %r11
ja 0x484d
jmp 0x4913
movl %r8d, %r9d
testb $0x1, %dl
jne 0x496a
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %r11d
shlq %cl, %r10
addl %r11d, %r9d
orq %r9, %r10
addl %eax, %r12d
movl %r12d, %ecx
negb %cl
movq %r10, %r9
shlq %cl, %r9
movq %r9, (%rsi)
movq %rsi, %rcx
subq %rdi, %rcx
movl %r12d, %r9d
shrl $0x3, %r9d
cmpq %r9, %rcx
cmovgeq %r9, %rcx
subq %rcx, %rsi
movl %eax, %ecx
shlq %cl, %r10
addl %r11d, %r8d
orq %r8, %r10
movl %r12d, %r11d
movq %rsi, %r12
jmp 0x4a24
movzbl 0x3230(%r15), %ebx
movl 0x660(%r15,%rbx,8), %ecx
addl %r9d, %ecx
shrl $0xa, %ecx
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
shll %cl, %r11d
shlq %cl, %r10
notl %r11d
andl %r9d, %r11d
orq %r11, %r10
movl %ecx, %r11d
shrl %cl, %r9d
addl %r12d, %r11d
addl 0x664(%r15,%rbx,8), %r9d
movzwl 0x1220(%r15,%r9,2), %r9d
movl %r11d, %ecx
negb %cl
movq %r10, %rbx
shlq %cl, %rbx
movq %rbx, (%rsi)
movq %rsi, %r15
subq %rdi, %r15
movl %r11d, %ecx
shrl $0x3, %ecx
cmpq %rcx, %r15
cmovgeq %rcx, %r15
movq %rsi, %r12
movl %eax, %ecx
shll %cl, %r14d
subq %r15, %r12
andl $0x7, %r11d
addl %r14d, %r8d
shlq %cl, %r10
orq %r8, %r10
addl %eax, %r11d
movl %r11d, %ecx
negb %cl
movq %r10, %r8
shlq %cl, %r8
negq %r15
movq %r12, %rcx
subq %rdi, %rcx
movl %r11d, %ebx
shrl $0x3, %ebx
cmpq %rbx, %rcx
cmovgeq %rbx, %rcx
movq %r8, (%rsi,%r15)
subq %rcx, %r12
addl %r9d, %r14d
movl %eax, %ecx
shlq %cl, %r10
orq %r14, %r10
movq 0x18(%rsp), %r14
andl $0x7, %r11d
addl %eax, %r11d
movl %r11d, %ecx
negb %cl
movq %r10, %rax
shlq %cl, %rax
movq %rax, (%r12)
movq %r12, %r8
subq %rdi, %r8
movl %r11d, %eax
shrl $0x3, %eax
cmpq %rax, %r8
cmovgeq %rax, %r8
movq %r12, %rsi
subq %r8, %rsi
andl $0x7, %r11d
leal 0x1(%rdx), %eax
bsrl %eax, %eax
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %r9d
shlq %cl, %r10
leal (%r9,%rdx), %ecx
incl %ecx
orq %rcx, %r10
leal (%r11,%rax), %edx
shlq $0x5, %r10
orq %rax, %r10
movb $0x3b, %cl
subb %dl, %cl
movq %r10, %rdx
shlq %cl, %rdx
negq %r8
addl %r11d, %eax
addl $0x5, %eax
movq %rdx, (%r12,%r8)
movq %rsi, %rcx
subq %rdi, %rcx
movl %eax, %edx
shrl $0x3, %edx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
subq %rcx, %rsi
cmpq %rdi, %rsi
je 0x4ae3
andb $0x7, %al
movb $0x8, %cl
subb %al, %cl
xorb $0x7, %al
shll %cl, %r10d
btsl %eax, %r10d
movb %r10b, 0x7(%rsi)
addq $0x7, %rsi
movq 0x40(%rsp), %rbx
subq %rsi, %rbx
je 0x4ae3
movq %rbx, %rdx
callq 0x1070
addq %rbx, %r14
jmp 0x4ae6
xorl %r14d, %r14d
movq %r14, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq