// File: /workspace/github_c_makefile_star2_O2/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 $0xb8, %rsp
movl %r9d, (%rsp)
movl %ecx, %r14d
movq %rdx, 0x18(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %rbx
leaq 0x4c810(%rdi), %rax
movq %rax, 0x38(%rsp)
movl 0x3228(%rdi), %eax
leaq (%rdi,%rax,8), %rsi
addq $0x4c810, %rsi          # imm = 0x4C810
movl %r8d, %edx
callq 0x28b6
movl 0x3228(%rbx), %eax
movb $0x20, 0x4c812(%rbx,%rax,8)
incl %eax
movl %eax, 0x3228(%rbx)
movq %rbx, 0x10(%rsp)
leaq 0x5e8(%rbx), %rax
movq %rax, 0x28(%rsp)
xorl %r15d, %r15d
pushq $-0x1
popq %rax
movl $0x17a, %ecx            # imm = 0x17A
cmpq $0x182, %rcx            # imm = 0x182
je 0x2a3a
movq 0x10(%rsp), %rdx
movl (%rdx,%rcx,4), %edx
cmpl %edx, %eax
cmovael %edx, %eax
cmpl %edx, %r15d
cmovbel %edx, %r15d
incq %rcx
jmp 0x2a18
leal (%rax,%rax,2), %r12d
xorl %ebp, %ebp
cmpl %r15d, %r12d
adcq $0x1, %rbp
leaq 0x90(%rsp), %r13
andq $0x0, (%r13)
andl $0x0, 0x8(%r13)
movq 0x8(%rsp), %rax
movq %rax, 0x10(%r13)
movq %rax, 0x18(%r13)
movq 0x18(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x58(%rsp)
movq %rax, 0x20(%r13)
movzbl (%rsp), %esi
pushq $0x1
popq %rbx
movq %r13, %rdi
movl %ebx, %edx
callq 0x35cd
pushq $0x3
popq %rdx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x35cd
leal (%r14,%r14), %esi
cmpl $0x8000, %r14d          # imm = 0x8000
cmovel %ebx, %esi
pushq $0x15
popq %rdx
cmovel %ebx, %edx
movq %r13, %rdi
callq 0x35cd
movq 0x10(%rsp), %rbx
leaq 0x28(%rbx), %rdi
leaq 0x2734(%rbx), %rcx
pushq $0xa
popq %rdx
movl $0x100, %esi            # imm = 0x100
movq %rcx, 0x30(%rsp)
callq 0x3619
movl %eax, 0x2720(%rbx)
leaq 0x428(%rbx), %rdi
leaq 0x2934(%rbx), %rcx
pushq $0x10
popq %rsi
pushq $0x9
popq %rbp
movl %ebp, %edx
movq %rcx, 0x50(%rsp)
callq 0x3619
movl %eax, 0x2724(%rbx)
leaq 0x468(%rbx), %rdi
leaq 0x2954(%rbx), %rcx
pushq $0x40
popq %rsi
movl %ebp, %edx
movq %rcx, 0x48(%rsp)
callq 0x3619
movl %eax, 0x2728(%rbx)
leaq 0x568(%rbx), %rdi
leaq 0x29d4(%rbx), %rcx
pushq $0x20
popq %rsi
movl %ebp, %edx
movq %rcx, 0x40(%rsp)
callq 0x3619
movl %eax, 0x272c(%rbx)
movl %r15d, 0x24(%rsp)
movl %r12d, 0x4(%rsp)
cmpl %r15d, %r12d
jae 0x2b72
leaq 0x2a14(%rbx), %rcx
pushq $0x8
popq %rsi
pushq $0x7
popq %rdx
movq 0x28(%rsp), %rdi
callq 0x3619
movl %eax, 0x2730(%rbx)
movl 0x2720(%rbx), %esi
leaq 0x90(%rsp), %r13
pushq $0x4
popq %rbp
movq %r13, %rdi
movl %ebp, %edx
callq 0x35cd
movl 0x2724(%rbx), %esi
movq %r13, %rdi
movl %ebp, %edx
callq 0x35cd
movl 0x2728(%rbx), %esi
movq %r13, %rdi
movl %ebp, %edx
callq 0x35cd
movl 0x272c(%rbx), %esi
movq %r13, %rdi
movl %ebp, %edx
callq 0x35cd
movl $0x170, %ecx            # imm = 0x170
movl 0x4(%rsp), %eax
cmpl 0x24(%rsp), %eax
jae 0x2be7
movl 0x2730(%rbx), %esi
leaq 0x90(%rsp), %rdi
pushq $0x4
popq %rdx
callq 0x35cd
movl $0x178, %ecx            # imm = 0x178
leaq 0x660(%rbx), %rax
movq %rax, 0x28(%rsp)
movl %ecx, (%rsp)
movl %ecx, %r14d
xorl %ebx, %ebx
leaq 0x90(%rsp), %rbp
pushq $0xb
popq %r13
cmpl (%rsp), %ebx
jae 0x2cc4
movl %ebx, %eax
movq 0x30(%rsp), %rcx
movzwl (%rcx,%rax,2), %r12d
testl %r12d, %r12d
je 0x2c3a
incl %ebx
bsrl %r12d, %edx
btcl %edx, %r12d
shll $0x4, %r12d
orl %edx, %r12d
xorl $-0x20, %edx
addl $0x24, %edx
jmp 0x2cb4
addq $0x139b, %rax           # imm = 0x139B
movl %ebx, %r15d
movq 0x10(%rsp), %rdx
leaq -0x139a(%rax), %rcx
cmpq %r14, %rcx
jae 0x2c64
incl %r15d
cmpw $0x0, (%rdx,%rax,2)
leaq 0x1(%rax), %rax
je 0x2c48
jmp 0x2c68
movl (%rsp), %r15d
movl %r15d, %r12d
subl %ebx, %r12d
cmpl $0x5, %r12d
jb 0x2c9a
movl $0x84, %eax
cmpl %eax, %r12d
movl $0x84, %ebx
cmovbl %r12d, %ebx
movl %ebx, %esi
shll $0x4, %esi
addl $-0x41, %esi
movq %rbp, %rdi
movl %r13d, %edx
callq 0x35cd
jmp 0x2c6b
movl %r15d, %ebx
testl %r12d, %r12d
je 0x2c07
shll $0x4, %r12d
addl $-0x2, %r12d
pushq $0x6
popq %rdx
movl %r15d, %ebx
movl %r12d, %esi
movq %rbp, %rdi
callq 0x35cd
jmp 0x2c07
movq 0x10(%rsp), %r15
movl 0x322c(%r15), %eax
incl %eax
bsrl %eax, %r13d
leaq 0x90(%rsp), %rbp
pushq $0x5
popq %rdx
movq %rbp, %rdi
movq %r13, %rsi
callq 0x35cd
movl 0x322c(%r15), %eax
pushq $-0x1
popq %rdx
movl %r13d, %ecx
shll %cl, %edx
leal (%rax,%rdx), %esi
incl %esi
movq %rbp, %rdi
movl %r13d, %edx
callq 0x35cd
movl 0x8(%rbp), %ecx
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rbx
movq (%rbp), %rdx
movq 0x8(%rsp), %r14
movl 0x24(%rsp), %ebp
testl %ecx, %ecx
jle 0x2d3a
cmpq %rax, %rbx
je 0x2d31
movb %dl, (%rbx)
incq %rbx
addl $-0x8, %ecx
shrq $0x8, %rdx
jmp 0x2d23
cmpq %rax, %rbx
je 0x353c
subq 0xa0(%rsp), %rbx
je 0x353c
movl 0x322c(%r15), %edx
movq 0x18(%rsp), %rax
subq %rbx, %rax
cmpq %rdx, %rax
jbe 0x353c
leaq (%r14,%rbx), %rdi
leaq 0x171798(%r15), %rsi
callq 0x1050
movl 0x322c(%r15), %r12d
addq %rbx, %r12
leaq 0x1220(%r15), %rdx
movl 0x2720(%r15), %r9d
movq %r15, %rdi
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rcx
movl $0x100, %r8d            # imm = 0x100
callq 0x375c
leaq 0xe60(%r15), %rsi
leaq 0x1a20(%r15), %rdx
movl 0x2724(%r15), %r9d
pushq $0x10
popq %r8
movq %r15, %rdi
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq 0x50(%rsp), %rcx
callq 0x375c
leaq 0xee0(%r15), %rsi
leaq 0x1e20(%r15), %rdx
movl 0x2728(%r15), %r9d
pushq $0x40
popq %r8
movq %r15, %rdi
movq %rsi, 0x50(%rsp)
movq %rdx, 0x88(%rsp)
movq 0x48(%rsp), %rcx
callq 0x375c
leaq 0x10e0(%r15), %rsi
leaq 0x2220(%r15), %rdx
movl 0x272c(%r15), %r9d
pushq $0x20
popq %r8
movq %r15, %rdi
movq %rsi, 0x48(%rsp)
movq %rdx, 0x80(%rsp)
movq 0x40(%rsp), %rcx
callq 0x375c
cmpl %ebp, 0x4(%rsp)
jae 0x2e6d
leaq 0x11e0(%r15), %rsi
leaq 0x2620(%r15), %rdx
leaq 0x2a14(%r15), %rcx
movl 0x2730(%r15), %r9d
pushq $0x8
popq %r8
movq %r15, %rdi
callq 0x375c
addq %r12, %r14
movq %r14, 0x8(%rsp)
movq %r12, 0x60(%rsp)
movq 0x18(%rsp), %rax
subq %r12, %rax
cmpq $0x8, %rax
pushq $0x8
popq %rsi
cmovbq %rax, %rsi
movl 0x2724(%r15), %ecx
movl 0x2728(%r15), %eax
pushq $0x1
popq %rdx
movl %edx, %r11d
movq %rcx, 0x40(%rsp)
shll %cl, %r11d
movl %edx, %r12d
movq %rax, 0x78(%rsp)
movl %eax, %ecx
shll %cl, %r12d
movl 0x272c(%r15), %ecx
movl %edx, %eax
movq %rcx, 0x70(%rsp)
shll %cl, %eax
movq 0x58(%rsp), %rdi
movl 0x2730(%r15), %ecx
movq %rcx, 0x68(%rsp)
shll %cl, %edx
movq %rdx, 0x18(%rsp)
subq %rsi, %rdi
movl 0x3228(%r15), %r9d
movl %r9d, %edx
decl %edx
js 0x2f67
movl %edx, %ecx
movq 0x38(%rsp), %r15
cmpb $0x20, 0x2(%r15,%rcx,8)
jne 0x2f77
movzbl (%r15,%rcx,8), %ebx
movq 0x30(%rsp), %rdx
movl (%rdx,%rbx,8), %esi
addl %r11d, %esi
movl %esi, %r8d
shrl $0xa, %r8d
pushq $-0x1
popq %r10
movl %r8d, %ecx
shll %cl, %r10d
notl %r10d
andl %r11d, %r10d
shrl %cl, %r11d
addl 0x4(%rdx,%rbx,8), %r11d
negb %cl
movq %r10, %rbx
shlq %cl, %rbx
movq 0x28(%rsp), %rcx
movzwl (%rcx,%r11,2), %r11d
movq %rbx, (%rdi)
movq %rdi, %rcx
subq 0x8(%rsp), %rcx
shrl $0xd, %esi
cmpq %rsi, %rcx
cmovgeq %rsi, %rcx
subq %rcx, %rdi
andl $0x7, %r8d
addl $-0x2, %r9d
movl %r9d, %edx
jmp 0x316f
xorl %r8d, %r8d
xorl %r10d, %r10d
movq 0x38(%rsp), %r15
jmp 0x316f
xorl %r8d, %r8d
xorl %r10d, %r10d
jmp 0x316f
movl %edx, %r14d
movzbl 0x2(%r15,%r14,8), %r9d
cmpl $0x3, %r9d
movl %edx, (%rsp)
jb 0x3012
leal -0x3(%r9), %ecx
movl 0x4(%r15,%r14,8), %ebx
cmpl %ebp, 0x4(%rsp)
jae 0x3019
cmpl $0x3, %ecx
jb 0x3019
movl %ebx, %r15d
leal -0x6(%r9), %ecx
shlq %cl, %r10
shrl $0x3, %r15d
orq %r15, %r10
leal (%r9,%r8), %ebp
addl $-0x6, %ebp
andl $0x7, %ebx
movq 0x10(%rsp), %r15
movl 0x11e0(%r15,%rbx,8), %ecx
movq 0x18(%rsp), %rdx
addl %edx, %ecx
shrl $0xa, %ecx
pushq $-0x1
popq %r8
shll %cl, %r8d
shlq %cl, %r10
notl %r8d
andl %edx, %r8d
orq %r8, %r10
movl %ecx, %r8d
shrl %cl, %edx
addl %ebp, %r8d
addl 0x11e4(%r15,%rbx,8), %edx
movzwl 0x2620(%r15,%rdx,2), %edx
movq %rdx, 0x18(%rsp)
movq 0x38(%rsp), %r15
jmp 0x3022
movq 0x8(%rsp), %r13
jmp 0x304f
shlq %cl, %r10
orq %rbx, %r10
addl %ecx, %r8d
movl %r8d, %ecx
negb %cl
movq %r10, %rbx
shlq %cl, %rbx
movq %rbx, (%rdi)
movq %rdi, %rcx
movq 0x8(%rsp), %r13
subq %r13, %rcx
movl %r8d, %ebx
shrl $0x3, %ebx
cmpq %rbx, %rcx
cmovgeq %rbx, %rcx
subq %rcx, %rdi
andl $0x7, %r8d
movl %r9d, %r9d
movq 0x48(%rsp), %rsi
movl (%rsi,%r9,8), %ecx
addl %eax, %ecx
shrl $0xa, %ecx
pushq $-0x1
popq %rdx
movl %edx, %ebx
shll %cl, %ebx
shlq %cl, %r10
xorl %edx, %ebx
andl %eax, %ebx
orq %rbx, %r10
movl %ecx, %ebp
shrl %cl, %eax
addl %r8d, %ebp
addl 0x4(%rsi,%r9,8), %eax
movq 0x80(%rsp), %rcx
movzwl (%rcx,%rax,2), %eax
movl %ebp, %ecx
negb %cl
movq %r10, %r8
shlq %cl, %r8
movq %r8, (%rdi)
movq %rdi, %rbx
subq %r13, %rbx
movl %ebp, %ecx
shrl $0x3, %ecx
cmpq %rcx, %rbx
cmovgeq %rcx, %rbx
movzbl 0x1(%r15,%r14,8), %r8d
movq 0x50(%rsp), %rsi
movl (%rsi,%r8,8), %r9d
addl %r12d, %r9d
shrl $0xa, %r9d
movl %edx, %r15d
movl %r9d, %ecx
shll %cl, %r15d
notl %r15d
andl %r12d, %r15d
shlq %cl, %r10
orq %r15, %r10
movq 0x38(%rsp), %r15
shrl %cl, %r12d
addl 0x4(%rsi,%r8,8), %r12d
movzbl (%r15,%r14,8), %r14d
movq 0x30(%rsp), %rsi
movl (%rsi,%r14,8), %ecx
addl %r11d, %ecx
shrl $0xa, %ecx
movl %edx, %r8d
shll %cl, %r8d
notl %r8d
shlq %cl, %r10
andl %r11d, %r8d
orq %r8, %r10
movl %ecx, %r8d
addl %r9d, %r8d
andl $0x7, %ebp
addl %ebp, %r8d
movq %rdi, %r9
subq %rbx, %r9
shrl %cl, %r11d
negq %rbx
movq 0x88(%rsp), %rcx
movzwl (%rcx,%r12,2), %r12d
addl 0x4(%rsi,%r14,8), %r11d
movq 0x28(%rsp), %rcx
movzwl (%rcx,%r11,2), %r11d
movl %r8d, %ecx
negb %cl
movq %r10, %r14
shlq %cl, %r14
movq %r14, (%rdi,%rbx)
movq %r9, %rcx
subq %r13, %rcx
movl %r8d, %edi
shrl $0x3, %edi
cmpq %rdi, %rcx
cmovgeq %rdi, %rcx
subq %rcx, %r9
andl $0x7, %r8d
movl (%rsp), %edx
decl %edx
movq %r9, %rdi
movl 0x24(%rsp), %ebp
testl %edx, %edx
jns 0x2f82
cmpl %ebp, 0x4(%rsp)
jae 0x31ca
pushq $-0x1
popq %r9
movl %r9d, %esi
movq 0x68(%rsp), %rcx
shll %cl, %esi
movq 0x18(%rsp), %rdx
addl %esi, %edx
shlq %cl, %r10
orq %rdx, %r10
addl %ecx, %r8d
movl %r8d, %ecx
negb %cl
movq %r10, %rdx
shlq %cl, %rdx
movq %rdx, (%rdi)
movq %rdi, %rcx
movq 0x8(%rsp), %rbx
subq %rbx, %rcx
movl %r8d, %edx
shrl $0x3, %edx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
subq %rcx, %rdi
andl $0x7, %r8d
jmp 0x31d3
movq 0x8(%rsp), %rbx
pushq $-0x1
popq %r9
movl %r9d, %edx
movq 0x70(%rsp), %rcx
shll %cl, %edx
shlq %cl, %r10
addl %edx, %eax
orq %rax, %r10
addl %ecx, %r8d
movl %r8d, %ecx
negb %cl
movq %r10, %rax
shlq %cl, %rax
movq %rax, (%rdi)
movq %rdi, %rax
subq %rbx, %rax
movl %r8d, %ecx
shrl $0x3, %ecx
cmpq %rcx, %rax
cmovgeq %rcx, %rax
movl %r9d, %edx
movq 0x78(%rsp), %rcx
shll %cl, %edx
movq %rdi, %rsi
andl $0x7, %r8d
addl %edx, %r12d
shlq %cl, %r10
orq %r12, %r10
addl %ecx, %r8d
movl %r8d, %ecx
negb %cl
movq %r10, %rdx
shlq %cl, %rdx
subq %rax, %rsi
negq %rax
movq %rdx, (%rdi,%rax)
movq %rsi, %rax
subq %rbx, %rax
movl %r8d, %ecx
shrl $0x3, %ecx
cmpq %rcx, %rax
cmovgeq %rcx, %rax
subq %rax, %rsi
movl %r9d, %eax
movq 0x40(%rsp), %rcx
shll %cl, %eax
shlq %cl, %r10
andl $0x7, %r8d
addl %eax, %r11d
orq %r11, %r10
addl %ecx, %r8d
movl %r8d, %ecx
negb %cl
movq %r10, %rax
shlq %cl, %rax
movq %rax, (%rsi)
movq %rsi, %rdx
subq %rbx, %rdx
movl %r8d, %eax
shrl $0x3, %eax
cmpq %rax, %rdx
cmovgeq %rax, %rdx
movq 0x10(%rsp), %rdi
movl 0x2720(%rdi), %eax
movl %eax, %ecx
pushq $0x1
popq %r9
shll %cl, %r9d
subq %rdx, %rsi
movl 0x3224(%rdi), %r12d
leal -0x2(%r12), %r11d
movq %r9, %rbp
movq %rbx, %rdi
movq 0x10(%rsp), %r13
leal 0x1(%r11), %ecx
andl $0x7, %r8d
testl %ecx, %ecx
jle 0x337d
movl %ecx, %ecx
movzbl 0x3230(%r13,%rcx), %ebx
movl 0x660(%r13,%rbx,8), %edx
addl %ebp, %edx
shrl $0xa, %edx
pushq $-0x1
popq %r15
movl %r15d, %r14d
movl %edx, %ecx
shll %cl, %r14d
notl %r14d
andl %ebp, %r14d
shlq %cl, %r10
shrl %cl, %ebp
orq %r14, %r10
movl %r11d, %ecx
movzbl 0x3230(%r13,%rcx), %r14d
movl 0x660(%r13,%r14,8), %ecx
addl %r9d, %ecx
shrl $0xa, %ecx
shll %cl, %r15d
addl 0x664(%r13,%rbx,8), %ebp
notl %r15d
andl %r9d, %r15d
shlq %cl, %r10
shrl %cl, %r9d
orq %r15, %r10
addl %ecx, %r8d
addl 0x664(%r13,%r14,8), %r9d
addl %edx, %r8d
movl %r8d, %ecx
negb %cl
movq %r10, %rdx
shlq %cl, %rdx
movzwl 0x1220(%r13,%rbp,2), %ebp
movzwl 0x1220(%r13,%r9,2), %r9d
movq %rdx, (%rsi)
movq %rsi, %rcx
subq %rdi, %rcx
movl %r8d, %edx
shrl $0x3, %edx
cmpq %rdx, %rcx
cmovgeq %rdx, %rcx
subq %rcx, %rsi
addl $-0x2, %r11d
jmp 0x32ba
testb $0x1, %r12b
jne 0x33d4
pushq $-0x1
popq %r13
movl %r13d, %edx
movl %eax, %ecx
shll %cl, %edx
shlq %cl, %r10
addl %edx, %ebp
orq %rbp, %r10
addl %eax, %r8d
movl %r8d, %ecx
negb %cl
movq %r10, %r11
shlq %cl, %r11
movq %r11, (%rsi)
movq %rsi, %rcx
subq %rdi, %rcx
movl %r8d, %r11d
shrl $0x3, %r11d
cmpq %r11, %rcx
cmovgeq %r11, %rcx
subq %rcx, %rsi
movl %eax, %ecx
shlq %cl, %r10
addl %edx, %r9d
orq %r9, %r10
movl %r8d, %edx
movq %rsi, %r8
jmp 0x3487
movq 0x10(%rsp), %rbx
movzbl 0x3230(%rbx), %r11d
movl 0x660(%rbx,%r11,8), %ecx
addl %ebp, %ecx
shrl $0xa, %ecx
pushq $-0x1
popq %r13
movl %r13d, %edx
shll %cl, %edx
notl %edx
andl %ebp, %edx
shlq %cl, %r10
shrl %cl, %ebp
orq %rdx, %r10
movl %ecx, %edx
addl 0x664(%rbx,%r11,8), %ebp
addl %r8d, %edx
movl %edx, %ecx
negb %cl
movq %r10, %r8
shlq %cl, %r8
movzwl 0x1220(%rbx,%rbp,2), %r11d
movq %r8, (%rsi)
movq %rsi, %rbx
subq %rdi, %rbx
movl %edx, %ecx
shrl $0x3, %ecx
cmpq %rcx, %rbx
cmovgeq %rcx, %rbx
movq %rsi, %r8
movl %r13d, %r14d
movl %eax, %ecx
shll %cl, %r14d
subq %rbx, %r8
andl $0x7, %edx
addl %r14d, %r9d
shlq %cl, %r10
orq %r9, %r10
addl %eax, %edx
movl %edx, %ecx
negb %cl
movq %r10, %r9
shlq %cl, %r9
negq %rbx
movq %r8, %rcx
subq %rdi, %rcx
movl %edx, %r15d
shrl $0x3, %r15d
cmpq %r15, %rcx
cmovgeq %r15, %rcx
movq %r9, (%rsi,%rbx)
subq %rcx, %r8
addl %r11d, %r14d
movl %eax, %ecx
shlq %cl, %r10
orq %r14, %r10
andl $0x7, %edx
addl %eax, %edx
movl %edx, %ecx
negb %cl
movq %r10, %rax
shlq %cl, %rax
movq %rax, (%r8)
movq %r8, %r9
subq %rdi, %r9
movl %edx, %eax
shrl $0x3, %eax
cmpq %rax, %r9
cmovgeq %rax, %r9
movq %r8, %rsi
subq %r9, %rsi
andl $0x7, %edx
leal 0x1(%r12), %eax
bsrl %eax, %eax
movl %eax, %ecx
shll %cl, %r13d
shlq %cl, %r10
leal (%r12,%r13), %ecx
incl %ecx
orq %rcx, %r10
leal (%rdx,%rax), %r11d
shlq $0x5, %r10
orq %rax, %r10
movb $0x3b, %cl
subb %r11b, %cl
movq %r10, %r11
shlq %cl, %r11
negq %r9
addl %edx, %eax
addl $0x5, %eax
movq %r11, (%r8,%r9)
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 0x353c
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 0x58(%rsp), %rbx
subq %rsi, %rbx
je 0x353c
movq %rbx, %rdx
callq 0x1070
movq 0x60(%rsp), %rax
addq %rbx, %rax
jmp 0x353e
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq