// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/libsmacker/smacker.c
// Function: smk_open_generic
static smk smk_open_generic(const unsigned char m, union smk_read_t fp, unsigned long size, const unsigned char process_mode)
{
	/* Smacker structure we intend to work on / return */
	smk s;
	/* Temporary variables */
	long temp_l;
	unsigned long temp_u;
	/* r is used by macros above for return code */
	char r;
	unsigned char buf[4] = {'\0'};
	/* video hufftrees are stored as a large chunk (bitstream)
		these vars are used to load, then decode them */
	unsigned char * hufftree_chunk = NULL;
	unsigned long tree_size;
	/* a bitstream struct */
	struct smk_bit_t bs;

	/** **/
	/* safe malloc the structure */
	if ((s = calloc(1, sizeof(struct smk_t))) == NULL) {
		perror("libsmacker::smk_open_generic() - ERROR: failed to malloc() smk structure");
		return NULL;
	}

	/* Check for a valid signature */
	smk_read(buf, 3);

	if (buf[0] != 'S' || buf[1] != 'M' || buf[2] != 'K') {
		fprintf(stderr, "libsmacker::smk_open_generic - ERROR: invalid SMKn signature (got: %s)\n", buf);
		goto error;
	}

	/* Read .smk file version */
	smk_read(&s->video.v, 1);

	if (s->video.v != '2' && s->video.v != '4') {
		fprintf(stderr, "libsmacker::smk_open_generic - Warning: invalid SMK version %c (expected: 2 or 4)\n", s->video.v);

		/* take a guess */
		if (s->video.v < '4')
			s->video.v = '2';
		else
			s->video.v = '4';

		fprintf(stderr, "\tProcessing will continue as type %c\n", s->video.v);
	}

	/* width, height, total num frames */
	smk_read_ul(s->video.w);
	smk_read_ul(s->video.h);
	smk_read_ul(s->f);
	/* frames per second calculation */
	smk_read_ul(temp_u);
	temp_l = (int)temp_u;

	if (temp_l > 0) {
		/* millisec per frame */
		s->usf = temp_l * 1000;
	} else if (temp_l < 0) {
		/* 10 microsec per frame */
		s->usf = temp_l * -10;
	} else {
		/* defaults to 10 usf (= 100000 microseconds) */
		s->usf = 100000;
	}

	/* Video flags follow.
		Ring frame is important to libsmacker.
		Y scale / Y interlace go in the Video flags.
		The user should scale appropriately. */
	smk_read_ul(temp_u);

	if (temp_u & 0x01)
		s->ring_frame = 1;

	if (temp_u & 0x02)
		s->video.y_scale_mode = SMK_FLAG_Y_DOUBLE;

	if (temp_u & 0x04) {
		if (s->video.y_scale_mode == SMK_FLAG_Y_DOUBLE)
			fputs("libsmacker::smk_open_generic - Warning: SMK file specifies both Y-Double AND Y-Interlace.\n", stderr);

		s->video.y_scale_mode = SMK_FLAG_Y_INTERLACE;
	}

	/* Max buffer size for each audio track - used to pre-allocate buffers */
	for (temp_l = 0; temp_l < 7; temp_l ++)
		smk_read_ul(s->audio[temp_l].max_buffer);

	/* Read size of "hufftree chunk" - save for later. */
	smk_read_ul(tree_size);

	/* "unpacked" sizes of each huff tree */
	for (temp_l = 0; temp_l < 4; temp_l ++)
		smk_read_ul(s->video.tree_size[temp_l]);

	/* read audio rate data */
	for (temp_l = 0; temp_l < 7; temp_l ++) {
		smk_read_ul(temp_u);

		if (temp_u & 0x40000000) {
			/* Audio track specifies "exists" flag, malloc structure and copy components. */
			s->audio[temp_l].exists = 1;
			/* and for all audio tracks */
			smk_malloc(s->audio[temp_l].buffer, s->audio[temp_l].max_buffer);

			if (temp_u & 0x80000000)
				s->audio[temp_l].compress = 1;

			s->audio[temp_l].bitdepth = ((temp_u & 0x20000000) ? 16 : 8);
			s->audio[temp_l].channels = ((temp_u & 0x10000000) ? 2 : 1);

			if (temp_u & 0x0c000000) {
				fprintf(stderr, "libsmacker::smk_open_generic - Warning: audio track %ld is compressed with Bink (perceptual) Audio Codec: this is currently unsupported by libsmacker\n", temp_l);
				s->audio[temp_l].compress = 2;
			}

			/* Bits 25 & 24 are unused. */
			s->audio[temp_l].rate = (temp_u & 0x00FFFFFF);
		}
	}

	/* Skip over Dummy field */
	smk_read_ul(temp_u);
	/* FrameSizes and Keyframe marker are stored together. */
	smk_malloc(s->keyframe, (s->f + s->ring_frame));
	smk_malloc(s->chunk_size, (s->f + s->ring_frame) * sizeof(unsigned long));

	for (temp_u = 0; temp_u < (s->f + s->ring_frame); temp_u ++) {
		smk_read_ul(s->chunk_size[temp_u]);

		/* Set Keyframe */
		if (s->chunk_size[temp_u] & 0x01)
			s->keyframe[temp_u] = 1;

		/* Bits 1 is used, but the purpose is unknown. */
		s->chunk_size[temp_u] &= 0xFFFFFFFC;
	}

	/* That was easy... Now read FrameTypes! */
	smk_malloc(s->frame_type, (s->f + s->ring_frame));

	for (temp_u = 0; temp_u < (s->f + s->ring_frame); temp_u ++)
		smk_read(&s->frame_type[temp_u], 1);

	/* HuffmanTrees
		We know the sizes already: read and assemble into
		something actually parse-able at run-time */
	smk_malloc(hufftree_chunk, tree_size);
	smk_read(hufftree_chunk, tree_size);
	/* set up a Bitstream */
	smk_bs_init(&bs, hufftree_chunk, tree_size);

	/* create some tables */
	for (temp_u = 0; temp_u < 4; temp_u ++) {
		if (! smk_huff16_build(&s->video.tree[temp_u], &bs, s->video.tree_size[temp_u])) {
			fprintf(stderr, "libsmacker::smk_open_generic - ERROR: failed to create huff16 tree %lu\n", temp_u);
			goto error;
		}
	}

	/* clean up */
	smk_free(hufftree_chunk);
	/* Go ahead and malloc storage for the video frame */
	smk_malloc(s->video.frame, s->video.w * s->video.h);
	/* final processing: depending on ProcessMode, handle what to do with rest of file data */
	s->mode = process_mode;

	/* Handle the rest of the data.
		For MODE_MEMORY, read the chunks and store */
	if (s->mode == SMK_MODE_MEMORY) {
		smk_malloc(s->source.chunk_data, (s->f + s->ring_frame) * sizeof(unsigned char *));

		for (temp_u = 0; temp_u < (s->f + s->ring_frame); temp_u ++) {
			smk_malloc(s->source.chunk_data[temp_u], s->chunk_size[temp_u]);
			smk_read(s->source.chunk_data[temp_u], s->chunk_size[temp_u]);
		}
	} else {
		/* MODE_STREAM: don't read anything now, just precompute offsets.
			use fseek to verify that the file is "complete" */
		smk_malloc(s->source.file.chunk_offset, (s->f + s->ring_frame) * sizeof(unsigned long));

		for (temp_u = 0; temp_u < (s->f + s->ring_frame); temp_u ++) {
			s->source.file.chunk_offset[temp_u] = ftell(fp.file);

			if (fseek(fp.file, s->chunk_size[temp_u], SEEK_CUR)) {
				fprintf(stderr, "libsmacker::smk_open - ERROR: fseek to frame %lu not OK.\n", temp_u);
				perror("\tError reported was");
				goto error;
			}
		}
	}

	return s;
error:
	smk_free(hufftree_chunk);
	smk_close(s);
	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x878, %rsp            # imm = 0x878
movl %ecx, %r15d
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r13d
movl $0x0, 0xc(%rsp)
movl $0x1, %edi
movl $0x548, %esi            # imm = 0x548
callq 0x8cc0
testq %rax, %rax
je 0x2e945
movq %rax, %rbp
testb %r13b, %r13b
je 0x2de5b
leaq 0xc(%rsp), %rdi
movl $0x3, %esi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2de80
cmpq $0x2, %rbx
jbe 0x2ea8e
movb 0x2(%r14), %al
movb %al, 0xe(%rsp)
movzwl (%r14), %eax
movw %ax, 0xc(%rsp)
addq $0x3, %r14
addq $-0x3, %rbx
xorl %eax, %eax
testb %al, %al
jne 0x2e956
cmpb $0x53, 0xc(%rsp)
jne 0x2e960
cmpb $0x4d, 0xd(%rsp)
jne 0x2e960
cmpb $0x4b, 0xe(%rsp)
jne 0x2e960
testb %r13b, %r13b
je 0x2dec4
leaq 0x69(%rbp), %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2dedb
testq %rbx, %rbx
je 0x2eab5
movb (%r14), %al
movb %al, 0x69(%rbp)
incq %r14
decq %rbx
xorl %eax, %eax
testb %al, %al
jne 0x2e982
movzbl 0x69(%rbp), %eax
cmpl $0x32, %eax
je 0x2def5
cmpl $0x34, %eax
jne 0x2ea73
testb %r13b, %r13b
je 0x2df11
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2df2c
cmpq $0x3, %rbx
jbe 0x2eadc
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addq $0x4, %r14
addq $-0x4, %rbx
xorl %eax, %eax
testb %al, %al
jne 0x2ea0f
movl 0xc(%rsp), %eax
movq %rax, 0x58(%rbp)
testb %r13b, %r13b
je 0x2df58
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2df73
cmpq $0x3, %rbx
jbe 0x2eb0d
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addq $0x4, %r14
addq $-0x4, %rbx
xorl %eax, %eax
testb %al, %al
jne 0x2ea19
movl 0xc(%rsp), %eax
movq %rax, 0x60(%rbp)
testb %r13b, %r13b
je 0x2df9f
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2dfba
cmpq $0x3, %rbx
jbe 0x2eb3b
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addq $0x4, %r14
addq $-0x4, %rbx
xorl %eax, %eax
testb %al, %al
jne 0x2ea23
movl 0xc(%rsp), %eax
movq %rax, 0x10(%rbp)
testb %r13b, %r13b
je 0x2dfe6
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2e001
cmpq $0x3, %rbx
jbe 0x2eb62
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addq $0x4, %r14
addq $-0x4, %rbx
xorl %eax, %eax
testb %al, %al
jne 0x2ea2d
movzbl 0xf(%rsp), %eax
shll $0x18, %eax
movzbl 0xe(%rsp), %ecx
shll $0x10, %ecx
movzbl 0xd(%rsp), %edx
shll $0x8, %edx
movzbl 0xc(%rsp), %esi
orl %ecx, %esi
orl %edx, %esi
orl %eax, %esi
movslq %esi, %rcx
testl %ecx, %ecx
jle 0x2e041
imulq $0x3e8, %rcx, %rax      # imm = 0x3E8
cvtsi2sd %rax, %xmm0
jmp 0x2e051
testl %eax, %eax
js 0x2e936
movsd 0x71f17(%rip), %xmm0    # 0x9ff68
movsd %xmm0, 0x8(%rbp)
testb %r13b, %r13b
je 0x2e072
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2e08d
cmpq $0x3, %rbx
jbe 0x2eb89
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addq $0x4, %r14
addq $-0x4, %rbx
xorl %eax, %eax
testb %al, %al
jne 0x2ea37
movzbl 0xc(%rsp), %eax
testb $0x1, %al
je 0x2e0a2
movb $0x1, 0x18(%rbp)
movl %r15d, 0x4c(%rsp)
testb $0x2, %al
je 0x2e0af
movb $0x2, 0x68(%rbp)
movq %rbx, %r15
testb $0x4, %al
je 0x2e0c4
cmpb $0x2, 0x68(%rbp)
je 0x2eb03
movb $0x1, 0x68(%rbp)
movl $0x408, %ebx            # imm = 0x408
leaq 0xc(%rsp), %r12
testb %r13b, %r13b
je 0x2e0e8
movl $0x4, %esi
movq %r12, %rdi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2e105
movq %r15, %rcx
cmpq $0x3, %r15
jbe 0x2e125
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addq $0x4, %r14
addq $-0x4, %rcx
movq %rcx, %r15
xorl %eax, %eax
testb %al, %al
jne 0x2ea41
movl 0xc(%rsp), %eax
movq %rax, (%rbp,%rbx)
addq $0x30, %rbx
cmpq $0x558, %rbx            # imm = 0x558
jne 0x2e0ce
jmp 0x2e146
movq 0x9fe74(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
movl $0x4, %edx
leaq 0x72feb(%rip), %rsi     # 0xa1126
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2e105
testb %r13b, %r13b
je 0x2e162
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2e184
cmpq $0x3, %r15
movq 0x9fe33(%rip), %rax     # 0xcdfa0
jbe 0x2ebe4
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addq $0x4, %r14
addq $-0x4, %r15
xorl %eax, %eax
testb %al, %al
jne 0x2ea4b
movq %r15, %r12
leaq 0xc(%rsp), %r15
movl (%r15), %eax
movq %rax, 0x40(%rsp)
movl $0xe, %ebx
testb %r13b, %r13b
je 0x2e1bb
movl $0x4, %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2e1d8
movq %r12, %rcx
cmpq $0x3, %r12
jbe 0x2e1f4
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addq $0x4, %r14
addq $-0x4, %rcx
movq %rcx, %r12
xorl %eax, %eax
testb %al, %al
jne 0x2ea55
movl 0xc(%rsp), %eax
movq %rax, (%rbp,%rbx,8)
incq %rbx
cmpq $0x12, %rbx
jne 0x2e1a1
jmp 0x2e215
movq 0x9fda5(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
movl $0x4, %edx
leaq 0x72f1c(%rip), %rsi     # 0xa1126
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2e1d8
movl %r13d, 0x1c(%rsp)
movq %r14, 0x20(%rsp)
leaq 0x418(%rbp), %r15
xorl %r13d, %r13d
movq %rbp, 0x10(%rsp)
cmpb $0x0, 0x1c(%rsp)
je 0x2e24e
movl $0x4, %esi
leaq 0xc(%rsp), %rdi
movq 0x20(%rsp), %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2e272
cmpq $0x3, %r12
jbe 0x2e359
movq 0x20(%rsp), %rcx
movl (%rcx), %eax
movl %eax, 0xc(%rsp)
addq $0x4, %rcx
movq %rcx, 0x20(%rsp)
addq $-0x4, %r12
xorl %eax, %eax
testb %al, %al
jne 0x2ea5f
movzbl 0xf(%rsp), %r14d
testb $0x40, %r14b
je 0x2e324
movq %r12, 0x38(%rsp)
movzbl 0xe(%rsp), %r12d
movzbl 0xd(%rsp), %eax
movq %rax, 0x28(%rsp)
movzbl 0xc(%rsp), %ebp
movb $0x1, -0x20(%r15)
cmpq $0x0, (%r15)
jne 0x2ecdb
movq -0x10(%r15), %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, (%r15)
testq %rax, %rax
je 0x2ecd3
testb %r14b, %r14b
jns 0x2e2da
movb $0x1, -0x8(%r15)
movl %r14d, %eax
andl $0x20, %eax
shrl $0x5, %eax
shlb $0x3, %al
addb $0x8, %al
movb %al, -0x1d(%r15)
movl %r14d, %eax
andl $0x10, %eax
cmpq $0x1, %rax
movb $0x2, %al
sbbb $0x0, %al
movb %al, -0x1e(%r15)
testb $0xc, %r14b
jne 0x2e337
shll $0x10, %r12d
movq 0x28(%rsp), %rax
shll $0x8, %eax
orq %r12, %rbp
orq %rax, %rbp
movq %rbp, -0x18(%r15)
movq 0x10(%rsp), %rbp
movq 0x38(%rsp), %r12
incq %r13
addq $0x30, %r15
cmpq $0x7, %r13
jne 0x2e22e
jmp 0x2e380
movq 0x9fc62(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
leaq 0x727e6(%rip), %rsi     # 0xa0b2e
movq %r13, %rdx
xorl %eax, %eax
callq 0x8290
movb $0x2, -0x8(%r15)
jmp 0x2e304
movq 0x9fc40(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
movl $0x4, %edx
leaq 0x72db7(%rip), %rsi     # 0xa1126
movq %r12, %rcx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2e272
cmpb $0x0, 0x1c(%rsp)
je 0x2e3a3
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movq 0x20(%rsp), %r14
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2e3c3
cmpq $0x3, %r12
movq 0x20(%rsp), %r14
jbe 0x2ec04
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addq $0x4, %r14
addq $-0x4, %r12
xorl %eax, %eax
testb %al, %al
jne 0x2ea69
cmpq $0x0, 0x40(%rbp)
jne 0x2ed45
movzbl 0x18(%rbp), %ebx
addq 0x10(%rbp), %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, 0x40(%rbp)
testq %rax, %rax
je 0x2ed64
cmpq $0x0, 0x38(%rbp)
jne 0x2ed6c
leaq 0x38(%rbp), %r15
shlq $0x3, %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %r15, 0x28(%rsp)
movq %rax, (%r15)
testq %rax, %rax
je 0x2ed8b
movq %r12, %r15
movzbl 0x18(%rbp), %ebx
addq 0x10(%rbp), %rbx
je 0x2e4e4
movl $0xfffffffc, %r12d      # imm = 0xFFFFFFFC
xorl %r13d, %r13d
cmpb $0x0, 0x1c(%rsp)
je 0x2e461
movl $0x4, %esi
leaq 0xc(%rsp), %rdi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2e47e
movq %r15, %rcx
cmpq $0x3, %r15
jbe 0x2e4c3
movl (%r14), %eax
movl %eax, 0xc(%rsp)
addq $0x4, %r14
addq $-0x4, %rcx
movq %rcx, %r15
xorl %eax, %eax
testb %al, %al
jne 0x2eb34
movl 0xc(%rsp), %eax
movq 0x28(%rsp), %rdx
movq (%rdx), %rcx
movq %rax, (%rcx,%r13,8)
movq (%rdx), %rax
testb $0x1, (%rax,%r13,8)
je 0x2e4a9
movq 0x40(%rbp), %rax
movb $0x1, (%rax,%r13)
movq 0x38(%rbp), %rax
andq %r12, (%rax,%r13,8)
incq %r13
movzbl 0x18(%rbp), %ebx
addq 0x10(%rbp), %rbx
cmpq %rbx, %r13
jb 0x2e443
jmp 0x2e4e4
movq 0x9fad6(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
movl $0x4, %edx
leaq 0x72c4d(%rip), %rsi     # 0xa1126
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2e47e
cmpq $0x0, 0x48(%rbp)
jne 0x2ed93
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, 0x48(%rbp)
testq %rax, %rax
movl 0x1c(%rsp), %r12d
je 0x2edb2
movzbl 0x18(%rbp), %eax
addq 0x10(%rbp), %rax
jne 0x2e55a
movl $0x1, %edi
movq 0x40(%rsp), %r13
movq %r13, %rsi
callq 0x8cc0
testq %rax, %rax
je 0x2edba
movq %rax, %rcx
testb %r12b, %r12b
movq %rax, 0x30(%rsp)
je 0x2e5d8
movq %rcx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2e601
leaq 0x72bc5(%rip), %r13     # 0xa1126
xorl %ebx, %ebx
testb %r12b, %r12b
je 0x2e581
movq 0x48(%rbp), %rdi
addq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2e59e
movq %r15, %rcx
testq %r15, %r15
je 0x2e5bb
movq 0x48(%rbp), %rax
movb (%r14), %dl
movb %dl, (%rax,%rbx)
incq %r14
decq %rcx
movq %rcx, %r15
xorl %eax, %eax
testb %al, %al
jne 0x2ebb0
incq %rbx
movzbl 0x18(%rbp), %eax
addq 0x10(%rbp), %rax
cmpq %rax, %rbx
jb 0x2e563
jmp 0x2e518
movq 0x9f9de(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
movl $0x1, %edx
movq %r13, %rsi
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2e59e
movq %r15, %rbx
subq %r13, %rbx
movq 0x9f9bb(%rip), %rax     # 0xcdfa0
jb 0x2ec2b
movq %rcx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x80e0
addq %r13, %r14
xorl %eax, %eax
movq %rbx, %r15
testb %al, %al
jne 0x2ea84
movq %r15, 0x38(%rsp)
movq %r14, 0x20(%rsp)
leaq 0x50(%rsp), %r12
movq 0x30(%rsp), %rax
movq %rax, (%r12)
addq %r13, %rax
movq %rax, 0x8(%r12)
movl $0x0, 0x10(%r12)
leaq 0x90(%rbp), %rax
movq %rax, 0x40(%rsp)
movq %rbp, %r14
addq $0xa0, %r14
xorl %r13d, %r13d
leaq 0x470(%rsp), %rbx
movq 0x70(%rbp,%r13,8), %r15
movq %r12, %rdi
callq 0x300f9
testl %eax, %eax
js 0x2ec49
leaq (%r13,%r13,2), %rax
movq 0x40(%rsp), %rcx
leaq (%rcx,%rax,8), %rbp
movq $0x0, 0x8(%rbp)
je 0x2e74b
movq %rbx, %rdi
movq %r12, %rsi
callq 0x30159
testl %eax, %eax
je 0x2ec72
leaq 0x68(%rsp), %rdi
movq %r12, %rsi
callq 0x30159
testl %eax, %eax
je 0x2ec79
xorl %ebx, %ebx
movq %r12, %rdi
callq 0x30224
testl %eax, %eax
js 0x2e8e6
movw %ax, (%r14,%rbx,2)
movq %r12, %rdi
callq 0x30224
testl %eax, %eax
js 0x2e8f9
shll $0x8, %eax
orw %ax, (%r14,%rbx,2)
incq %rbx
cmpq $0x3, %rbx
jne 0x2e6ae
cmpl $0xc, %r15d
leaq 0x470(%rsp), %rbx
jb 0x2ec80
movl %r15d, %eax
andl $0x3, %eax
jne 0x2ec80
addl $-0xc, %r15d
movl %r15d, %edi
andl $-0x4, %edi
callq 0x8d50
movq %rax, (%rbp)
testq %rax, %rax
je 0x2ec50
shrl $0x2, %r15d
movq %rbp, %rdi
movq %r12, %rsi
movq %rbx, %rdx
leaq 0x68(%rsp), %rcx
movq %r15, %r8
callq 0x3029b
testl %eax, %eax
je 0x2ec99
cmpq %r15, 0x8(%rbp)
je 0x2e768
jmp 0x2eca3
movl $0x4, %edi
callq 0x8d50
movq %rax, (%rbp)
testq %rax, %rax
je 0x2ec50
movl $0x0, (%rax)
movq %r12, %rdi
callq 0x300f9
testl %eax, %eax
js 0x2ec5e
jne 0x2ec68
incq %r13
addq $0x18, %r14
cmpq $0x4, %r13
movq 0x10(%rsp), %rbp
jne 0x2e653
movq 0x30(%rsp), %rdi
callq 0x8270
cmpq $0x0, 0x3f0(%rbp)
jne 0x2edc2
movq 0x60(%rbp), %rbx
imulq 0x58(%rbp), %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, 0x3f0(%rbp)
testq %rax, %rax
movq 0x20(%rsp), %r13
movl 0x4c(%rsp), %eax
je 0x2ede1
movb %al, (%rbp)
cmpb $0x1, %al
jne 0x2e98c
cmpq $0x0, 0x28(%rbp)
jne 0x2ede9
movzbl 0x18(%rbp), %ebx
addq 0x10(%rbp), %rbx
shlq $0x3, %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, 0x28(%rbp)
testq %rax, %rax
je 0x2ee27
movzbl 0x18(%rbp), %eax
addq 0x10(%rbp), %rax
je 0x2ebcf
leaq 0x728fa(%rip), %r12     # 0xa1126
xorl %r15d, %r15d
movq 0x28(%rbp), %rbx
cmpq $0x0, (%rbx,%r15,8)
jne 0x2ed19
movq 0x38(%rbp), %rax
movq (%rax,%r15,8), %rsi
movl $0x1, %edi
callq 0x8cc0
movq %rax, (%rbx,%r15,8)
movq 0x28(%rbp), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x2ed38
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r15,8), %rbx
cmpb $0x0, 0x1c(%rsp)
je 0x2e888
movq %rbx, %rsi
movq %r13, %rdx
callq 0x300ae
shrb $0x7, %al
jmp 0x2e8aa
movq 0x38(%rsp), %rcx
movq %rcx, %r14
subq %rbx, %r14
jb 0x2e8cb
movq %r13, %rsi
movq %rbx, %rdx
callq 0x80e0
addq %rbx, %r13
xorl %eax, %eax
movq %r14, 0x38(%rsp)
testb %al, %al
jne 0x2ecc9
incq %r15
movzbl 0x18(%rbp), %eax
addq 0x10(%rbp), %rax
cmpq %rax, %r15
jb 0x2e82f
jmp 0x2ebcf
movq 0x9f6ce(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
movq %r12, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2e8aa
movq 0x9f6b3(%rip), %r14     # 0xcdfa0
movq (%r14), %rdi
leaq 0x72939(%rip), %rsi     # 0xa1230
jmp 0x2e90a
movq 0x9f6a0(%rip), %r14     # 0xcdfa0
movq (%r14), %rdi
leaq 0x72976(%rip), %rsi     # 0xa1280
movl %ebx, %edx
xorl %eax, %eax
callq 0x8290
movq 0x10(%rsp), %rbp
movq (%r14), %rdi
leaq 0x724ae(%rip), %rsi     # 0xa0dd0
movq %r13, %rdx
xorl %eax, %eax
callq 0x8290
movq 0x30(%rsp), %rdi
jmp 0x2ebb7
addq %rcx, %rcx
leaq (%rcx,%rcx,4), %rax
negq %rax
jmp 0x2e03a
leaq 0x71f25(%rip), %rdi     # 0xa0871
callq 0x83f0
jmp 0x2ebcd
callq 0x9920
jmp 0x2ebb5
movq 0x9f639(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
leaq 0x71fa4(%rip), %rsi     # 0xa0915
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x8290
jmp 0x2ebb5
callq 0x98fc
jmp 0x2ebb5
cmpq $0x0, 0x30(%rbp)
jne 0x2ee08
movzbl 0x18(%rbp), %ebx
addq 0x10(%rbp), %rbx
shlq $0x3, %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, 0x30(%rbp)
testq %rax, %rax
je 0x2ee2f
movzbl 0x18(%rbp), %eax
addq 0x10(%rbp), %rax
je 0x2ebcf
xorl %ebx, %ebx
movq %r13, %rdi
callq 0x8370
movq 0x30(%rbp), %rcx
movq %rax, (%rcx,%rbx,8)
movq 0x38(%rbp), %rax
movq (%rax,%rbx,8), %rsi
movq %r13, %rdi
movl $0x1, %edx
callq 0x9150
testl %eax, %eax
jne 0x2ecbc
incq %rbx
movzbl 0x18(%rbp), %eax
addq 0x10(%rbp), %rax
cmpq %rax, %rbx
jb 0x2e9cd
jmp 0x2ebcf
callq 0x98d8
jmp 0x2ebb5
callq 0x98b4
jmp 0x2ebb5
callq 0x9890
jmp 0x2ebb5
callq 0x986c
jmp 0x2ebb5
callq 0x9848
jmp 0x2ebb5
callq 0x9824
jmp 0x2ebb5
callq 0x9800
jmp 0x2ebb5
callq 0x97dc
jmp 0x2ebb5
callq 0x97b8
jmp 0x2ebb5
callq 0x9794
jmp 0x2ebb5
leaq 0x69(%rbp), %rsi
movzbl %al, %edi
callq 0x9286
jmp 0x2def5
callq 0x9624
jmp 0x2e92c
movq 0x9f50b(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
leaq 0x72687(%rip), %rsi     # 0xa1126
movl $0x3, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2de80
movq 0x9f4e4(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
leaq 0x72660(%rip), %rsi     # 0xa1126
movl $0x1, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2dedb
movq 0x9f4bd(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
leaq 0x72639(%rip), %rsi     # 0xa1126
movl $0x4, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2df2c
callq 0x92d8
jmp 0x2e0c0
movq 0x9f48c(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
leaq 0x72608(%rip), %rsi     # 0xa1126
movl $0x4, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2df73
callq 0x9341
jmp 0x2ebb5
movq 0x9f45e(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
leaq 0x725da(%rip), %rsi     # 0xa1126
movl $0x4, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2dfba
movq 0x9f437(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
leaq 0x725b3(%rip), %rsi     # 0xa1126
movl $0x4, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2e001
movq 0x9f410(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
leaq 0x7258c(%rip), %rsi     # 0xa1126
movl $0x4, %edx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2e08d
callq 0x9365
xorl %edi, %edi
testq %rdi, %rdi
je 0x2ecfa
callq 0x8270
movq %rbp, %rdi
callq 0x2eeeb
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x878, %rsp            # imm = 0x878
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rax), %rdi
leaq 0x72538(%rip), %rsi     # 0xa1126
movl $0x4, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2e184
movq 0x9f395(%rip), %rax     # 0xcdfa0
movq (%rax), %rdi
leaq 0x72511(%rip), %rsi     # 0xa1126
movl $0x4, %edx
movq %r12, %rcx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2e3c3
movq (%rax), %rdi
leaq 0x724f1(%rip), %rsi     # 0xa1126
movq %r13, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x8290
movb $0x1, %al
jmp 0x2e601
callq 0x9608
jmp 0x2ecb0
leaq 0x726c3(%rip), %rdi     # 0xa131a
callq 0x83f0
jmp 0x2ecab
movq %rbp, %rdi
callq 0x95e0
jmp 0x2ecab
movq %rbp, %rdi
callq 0x9411
jmp 0x2ecab
callq 0x93f5
jmp 0x2ecab
callq 0x93d9
jmp 0x2ecab
movq 0x9f319(%rip), %r14     # 0xcdfa0
movq (%r14), %rdi
leaq 0x72640(%rip), %rsi     # 0xa12d1
movl %r15d, %edx
jmp 0x2e90c
movq %rbp, %rdi
callq 0x93b1
jmp 0x2ecab
movq %rbp, %rdi
callq 0x9389
movq 0x10(%rsp), %rbp
movq 0x9f2e9(%rip), %r14     # 0xcdfa0
jmp 0x2e918
movq %rbx, %rdi
callq 0x9439
jmp 0x2ebb5
callq 0x94b9
jmp 0x2ebb5
movq %rbx, %rdi
callq 0x92ee
leaq 0x71d4f(%rip), %rdi     # 0xa0a31
leaq 0x7157a(%rip), %rsi     # 0xa0263
leaq 0x71d61(%rip), %rcx     # 0xa0a51
movl $0x300, %edx            # imm = 0x300
callq 0x8240
leaq 0x72117(%rip), %rdi     # 0xa0e18
leaq 0x7155b(%rip), %rsi     # 0xa0263
leaq 0x71d42(%rip), %rcx     # 0xa0a51
movl $0x35b, %edx            # imm = 0x35B
callq 0x8240
leaq 0x72229(%rip), %rdi     # 0xa0f49
leaq 0x7153c(%rip), %rsi     # 0xa0263
leaq 0x71d23(%rip), %rcx     # 0xa0a51
movl $0x346, %edx            # imm = 0x346
callq 0x8240
movq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x94e3
leaq 0x71e79(%rip), %rdi     # 0xa0bc5
leaq 0x71510(%rip), %rsi     # 0xa0263
leaq 0x71cf7(%rip), %rcx     # 0xa0a51
movl $0x315, %edx            # imm = 0x315
callq 0x8240
movq %rbx, %rdi
callq 0x9741
leaq 0x71ed7(%rip), %rdi     # 0xa0c4a
leaq 0x714e9(%rip), %rsi     # 0xa0263
leaq 0x71cd0(%rip), %rcx     # 0xa0a51
movl $0x316, %edx            # imm = 0x316
callq 0x8240
movq %rbx, %rdi
callq 0x96ee
leaq 0x71f39(%rip), %rdi     # 0xa0cd3
leaq 0x714c2(%rip), %rsi     # 0xa0263
leaq 0x71ca9(%rip), %rcx     # 0xa0a51
movl $0x324, %edx            # imm = 0x324
callq 0x8240
movq %rbx, %rdi
callq 0x969b
movq %r13, %rdi
callq 0x9648
leaq 0x7205e(%rip), %rdi     # 0xa0e27
leaq 0x71493(%rip), %rsi     # 0xa0263
leaq 0x71c7a(%rip), %rcx     # 0xa0a51
movl $0x33c, %edx            # imm = 0x33C
callq 0x8240
movq %rbx, %rdi
callq 0x958d
leaq 0x720c2(%rip), %rdi     # 0xa0eb2
leaq 0x7146c(%rip), %rsi     # 0xa0263
leaq 0x71c53(%rip), %rcx     # 0xa0a51
movl $0x343, %edx            # imm = 0x343
callq 0x8240
leaq 0x721e1(%rip), %rdi     # 0xa0ff0
leaq 0x7144d(%rip), %rsi     # 0xa0263
leaq 0x71c34(%rip), %rcx     # 0xa0a51
movl $0x34c, %edx            # imm = 0x34C
callq 0x8240
movq %rbx, %rdi
callq 0x953a
movq %rbx, %rdi
callq 0x9466