// File: /workspace/github_c_makefile_star2_O3/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, %ebp
movq %rdx, %r14
movq %rsi, %r13
movl %edi, %ebx
movl $0x0, 0x8(%rsp)
movl $0x1, %edi
movl $0x548, %esi            # imm = 0x548
callq 0x8cc0
testq %rax, %rax
je 0x2fc1e
movq %rax, %r15
movl %ebx, 0xc(%rsp)
testb %bl, %bl
je 0x2f184
leaq 0x8(%rsp), %rdi
movl $0x3, %esi
movq %r13, %rdx
callq 0x313f0
testb %al, %al
jns 0x2f1a8
jmp 0x2fd13
cmpq $0x2, %r14
jbe 0x2fcf3
movb 0x2(%r13), %al
movb %al, 0xa(%rsp)
movzwl (%r13), %eax
movw %ax, 0x8(%rsp)
addq $0x3, %r13
addq $-0x3, %r14
cmpb $0x53, 0x8(%rsp)
jne 0x2fc2c
cmpb $0x4d, 0x9(%rsp)
jne 0x2fc2c
cmpb $0x4b, 0xa(%rsp)
jne 0x2fc2c
cmpb $0x0, 0xc(%rsp)
je 0x2f1f0
leaq 0x69(%r15), %rbx
movl $0x1, %esi
movq %rbx, %rdi
movq %r13, %rdx
callq 0x313f0
testb %al, %al
js 0x2fd22
movb (%rbx), %al
jmp 0x2f207
testq %r14, %r14
je 0x2fd1d
movb (%r13), %al
movb %al, 0x69(%r15)
incq %r13
decq %r14
cmpb $0x32, %al
je 0x2f217
movzbl %al, %esi
cmpl $0x34, %esi
jne 0x2fc9c
cmpb $0x0, 0xc(%rsp)
je 0x2f2ab
leaq 0x8(%rsp), %rdi
movl $0x4, %esi
movq %r13, %rdx
callq 0x313f0
testb %al, %al
js 0x2fd4c
leaq 0x8(%rsp), %rdi
movl (%rdi), %eax
movq %rax, 0x58(%r15)
movl $0x4, %esi
movq %r13, %rdx
callq 0x313f0
testb %al, %al
js 0x2fd7d
leaq 0x8(%rsp), %rdi
movl (%rdi), %eax
movq %rax, 0x60(%r15)
movl $0x4, %esi
movq %r13, %rdx
callq 0x313f0
testb %al, %al
js 0x2fda4
leaq 0x8(%rsp), %rdi
movl (%rdi), %eax
movq %rax, 0x10(%r15)
movl $0x4, %esi
movq %r13, %rdx
callq 0x313f0
testb %al, %al
js 0x2fdcb
movb 0xb(%rsp), %cl
movb 0xa(%rsp), %dl
movzwl 0x8(%rsp), %eax
jmp 0x2f31d
cmpq $0x3, %r14
jbe 0x2fd2c
movl (%r13), %eax
movl %eax, 0x8(%rsp)
leaq -0x4(%r14), %rcx
movq %rax, 0x58(%r15)
cmpq $0x3, %rcx
jbe 0x2fd60
movl 0x4(%r13), %eax
movl %eax, 0x8(%rsp)
leaq -0x8(%r14), %rcx
movq %rax, 0x60(%r15)
cmpq $0x3, %rcx
jbe 0x2fd87
movl 0x8(%r13), %eax
movl %eax, 0x8(%rsp)
leaq -0xc(%r14), %rcx
movq %rax, 0x10(%r15)
cmpq $0x3, %rcx
jbe 0x2fdae
movl 0xc(%r13), %eax
movl %eax, 0x8(%rsp)
addq $0x10, %r13
addq $-0x10, %r14
movl %eax, %ecx
shrl $0x18, %ecx
movl %eax, %edx
shrl $0x10, %edx
movzbl %cl, %ecx
shll $0x18, %ecx
movzbl %dl, %edx
shll $0x10, %edx
movzwl %ax, %eax
orl %edx, %eax
orl %ecx, %eax
cltq
testl %eax, %eax
jle 0x2f344
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
cvtsi2sd %rax, %xmm0
jmp 0x2f354
testl %ecx, %ecx
js 0x2fc0f
movsd 0x73dc4(%rip), %xmm0    # 0xa3118
movsd %xmm0, 0x8(%r15)
cmpb $0x0, 0xc(%rsp)
je 0x2f381
leaq 0x8(%rsp), %rdi
movl $0x4, %esi
movq %r13, %rdx
callq 0x313f0
testb %al, %al
js 0x2fdf5
movb 0x8(%rsp), %al
jmp 0x2f39b
cmpq $0x3, %r14
jbe 0x2fdd5
movl (%r13), %eax
movl %eax, 0x8(%rsp)
addq $0x4, %r13
addq $-0x4, %r14
movzbl %al, %eax
testb $0x1, %al
je 0x2f3a7
movb $0x1, 0x18(%r15)
testb $0x2, %al
je 0x2f3b0
movb $0x2, 0x68(%r15)
testb $0x4, %al
je 0x2f3c4
cmpb $0x2, 0x68(%r15)
je 0x2fd56
movb $0x1, 0x68(%r15)
movq %r14, %rdx
movl %ebp, 0x3c(%rsp)
leaq 0x408(%r15), %rax
xorl %ebp, %ebp
leaq 0x8(%rsp), %r14
movq %rax, 0x18(%rsp)
movq %r13, %r12
movq %rdx, 0x10(%rsp)
leaq (,%rbp,2), %rbx
addq %rbp, %rbx
incq %rbp
shlq $0x4, %rbx
addq %rax, %rbx
movl 0xc(%rsp), %r13d
testb %r13b, %r13b
je 0x2f433
movl $0x4, %esi
movq %r14, %rdi
movq %r12, %rdx
callq 0x313f0
testb %al, %al
js 0x2ff67
movl 0x8(%rsp), %eax
movq %rax, (%rbx)
incq %rbp
addq $0x30, %rbx
cmpq $0x8, %rbp
jne 0x2f400
jmp 0x2f495
movq 0x10(%rsp), %rcx
movq %rcx, %rax
subq $0x4, %rax
jb 0x2ff4a
movq %rax, %rdx
movl (%r12), %eax
movl %eax, 0x8(%rsp)
leaq 0x4(%r12), %r13
movq %rax, (%rbx)
cmpq $0x7, %rbp
movq 0x18(%rsp), %rax
jne 0x2f3de
cmpq $0x3, %rdx
jbe 0x2ff6e
movl 0x4(%r12), %eax
movl %eax, 0x8(%rsp)
addq $0x8, %r12
addq $-0x8, 0x10(%rsp)
movl %eax, %ecx
shrl $0x10, %ecx
movl %eax, %edx
shrl $0x8, %edx
movl 0xc(%rsp), %r13d
jmp 0x2f4bc
leaq 0x8(%rsp), %rdi
movl $0x4, %esi
movq %r12, %rdx
callq 0x313f0
testb %al, %al
js 0x2ff8e
movzwl 0xa(%rsp), %ecx
movb 0x8(%rsp), %al
movb 0x9(%rsp), %dl
shll $0x10, %ecx
movzbl %dl, %edx
shll $0x8, %edx
orl %ecx, %edx
movzbl %al, %eax
orq %rdx, %rax
movq %rax, 0x28(%rsp)
movl $0xe, %ebx
leaq 0x8(%rsp), %r14
testb %r13b, %r13b
je 0x2f4ff
movl $0x4, %esi
movq %r14, %rdi
movq %r12, %rdx
callq 0x313f0
testb %al, %al
js 0x2fe1c
movl 0x8(%rsp), %eax
jmp 0x2f523
movq 0x10(%rsp), %rcx
cmpq $0x3, %rcx
jbe 0x2fdff
movl (%r12), %eax
movl %eax, 0x8(%rsp)
addq $0x4, %r12
addq $-0x4, %rcx
movq %rcx, 0x10(%rsp)
movl %eax, %eax
movq %rax, (%r15,%rbx,8)
incq %rbx
cmpq $0x12, %rbx
jne 0x2f4dc
movq %r12, 0x18(%rsp)
leaq 0x418(%r15), %r12
xorl %r14d, %r14d
movq %r15, 0x20(%rsp)
testb %r13b, %r13b
je 0x2f577
movl $0x4, %esi
leaq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rdx
callq 0x313f0
testb %al, %al
js 0x2fe43
movb 0xb(%rsp), %al
movb 0xa(%rsp), %r13b
movzwl 0x8(%rsp), %ebp
jmp 0x2f5af
movq 0x10(%rsp), %rcx
cmpq $0x3, %rcx
jbe 0x2fe26
movq 0x18(%rsp), %rax
movl (%rax), %ebp
movl %ebp, 0x8(%rsp)
addq $0x4, %rax
movq %rax, 0x18(%rsp)
addq $-0x4, %rcx
movq %rcx, 0x10(%rsp)
movl %ebp, %eax
shrl $0x18, %eax
movl %ebp, %r13d
shrl $0x10, %r13d
movzbl %al, %r15d
testb $0x40, %r15b
je 0x2f632
movb $0x1, -0x20(%r12)
cmpq $0x0, (%r12)
jne 0x2ffdf
movq -0x10(%r12), %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, (%r12)
testq %rax, %rax
je 0x2ffd7
testb %r15b, %r15b
jns 0x2f5f4
movb $0x1, -0x8(%r12)
movl %r15d, %eax
andl $0x20, %eax
shrl $0x5, %eax
shlb $0x3, %al
addb $0x8, %al
movb %al, -0x1d(%r12)
movl %r15d, %eax
andl $0x10, %eax
cmpq $0x1, %rax
movb $0x2, %al
sbbb $0x0, %al
movb %al, -0x1e(%r12)
testb $0xc, %r15b
jne 0x2f64f
movzbl %r13b, %eax
shll $0x10, %eax
movzwl %bp, %ecx
orq %rax, %rcx
movq %rcx, -0x18(%r12)
incq %r14
addq $0x30, %r12
cmpq $0x7, %r14
movq 0x20(%rsp), %r15
movl 0xc(%rsp), %r13d
jne 0x2f546
jmp 0x2f672
movq 0xa193a(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x7467e(%rip), %rsi     # 0xa3cde
movq %r14, %rdx
xorl %eax, %eax
callq 0x8290
movb $0x2, -0x8(%r12)
jmp 0x2f620
testb %r13b, %r13b
je 0x2f69c
leaq 0x8(%rsp), %rdi
movl $0x4, %esi
movq 0x18(%rsp), %r12
movq %r12, %rdx
callq 0x313f0
testb %al, %al
movq 0x10(%rsp), %rcx
jns 0x2f6c7
jmp 0x2fe63
movq 0x10(%rsp), %rcx
cmpq $0x3, %rcx
movq 0x18(%rsp), %r12
movq 0xa18df(%rip), %rax     # 0xd0f90
jbe 0x2fe4d
movl (%r12), %eax
movl %eax, 0x8(%rsp)
addq $0x4, %r12
addq $-0x4, %rcx
movq %rcx, 0x10(%rsp)
cmpq $0x0, 0x40(%r15)
jne 0x3002a
movq 0x10(%r15), %r13
movzbl 0x18(%r15), %ebp
movq %r13, %rbx
addq %rbp, %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, 0x40(%r15)
testq %rax, %rax
je 0x30049
cmpq $0x0, 0x38(%r15)
jne 0x30051
leaq 0x38(%r15), %r14
leaq (,%rbx,8), %rsi
movl $0x1, %edi
movq %rsi, 0x18(%rsp)
callq 0x8cc0
movq %r14, 0x30(%rsp)
movq %rax, (%r14)
testq %rax, %rax
je 0x30070
testq %rbx, %rbx
je 0x2f7e7
movq %r12, %r14
xorl %r12d, %r12d
cmpb $0x0, 0xc(%rsp)
je 0x2f772
movl $0x4, %esi
leaq 0x8(%rsp), %rdi
movq %r14, %rdx
callq 0x313f0
testb %al, %al
movq 0x10(%rsp), %rcx
js 0x2fee1
movl 0x8(%rsp), %eax
jmp 0x2f790
movq 0x10(%rsp), %rcx
cmpq $0x3, %rcx
jbe 0x2fec4
movl (%r14), %eax
movl %eax, 0x8(%rsp)
addq $0x4, %r14
addq $-0x4, %rcx
movq %rcx, 0x10(%rsp)
movl %eax, %eax
movq 0x30(%rsp), %rdx
movq (%rdx), %rcx
movq %rax, (%rcx,%r12,8)
movq (%rdx), %rax
movq (%rax,%r12,8), %rcx
testb $0x1, %cl
je 0x2f7c0
movq 0x40(%r15), %rax
movb $0x1, (%rax,%r12)
movq 0x38(%r15), %rax
movq (%rax,%r12,8), %rcx
andl $-0x4, %ecx
movq %rcx, (%rax,%r12,8)
incq %r12
movq 0x10(%r15), %r13
movzbl 0x18(%r15), %ebp
movq %r13, %rbx
addq %rbp, %rbx
cmpq %rbx, %r12
jb 0x2f746
movq %r14, %r12
jmp 0x2f7e9
xorl %ebx, %ebx
cmpq $0x0, 0x48(%r15)
jne 0x3007a
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, 0x48(%r15)
testq %rax, %rax
je 0x30099
movzbl %bpl, %eax
addq %rax, %r13
jne 0x2f827
movl 0xc(%rsp), %ebp
movq 0x10(%rsp), %r14
movq 0x28(%rsp), %r13
jmp 0x2f884
xorl %ebx, %ebx
movl 0xc(%rsp), %ebp
movq 0x10(%rsp), %r14
movq 0x28(%rsp), %r13
testb %bpl, %bpl
je 0x2f859
movq 0x48(%r15), %rdi
addq %rbx, %rdi
movl $0x1, %esi
movq %r12, %rdx
callq 0x313f0
testb %al, %al
jns 0x2f873
jmp 0x2fef0
testq %r14, %r14
je 0x2feeb
movq 0x48(%r15), %rax
movb (%r12), %cl
movb %cl, (%rax,%rbx)
incq %r12
decq %r14
incq %rbx
movzbl 0x18(%r15), %eax
addq 0x10(%r15), %rax
cmpq %rax, %rbx
jb 0x2f837
movl $0x1, %edi
movq %r13, %rsi
callq 0x8cc0
testq %rax, %rax
je 0x300a1
movq %rax, %rcx
testb %bpl, %bpl
movq %rax, 0x40(%rsp)
je 0x2f8c1
movq %rcx, %rbp
movq %rcx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x313f0
testb %al, %al
jns 0x2f8e4
jmp 0x2fe8b
movq %r14, %rbx
subq %r13, %rbx
jb 0x2fe6d
movq %rcx, %rbp
movq %rcx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x80e0
addq %r13, %r12
movq %rbx, %r14
movq %r14, 0x10(%rsp)
movq %r12, 0x18(%rsp)
movq %r13, %rcx
leaq 0x50(%rsp), %r13
movq %rbp, (%r13)
addq %rcx, %rbp
movq %rbp, 0x8(%r13)
movl $0x0, 0x10(%r13)
leaq 0x90(%r15), %rax
movq %rax, 0x48(%rsp)
movq %r15, %rbp
addq $0xa0, %rbp
xorl %r14d, %r14d
movq 0x70(%r15,%r14,8), %r12
movq %r13, %rdi
callq 0x3143b
testl %eax, %eax
js 0x2fe95
leaq (%r14,%r14,2), %rax
movq 0x48(%rsp), %rcx
leaq (%rcx,%rax,8), %rbx
movq $0x0, 0x8(%rbx)
je 0x2fa24
movq %rbx, 0x28(%rsp)
leaq 0x470(%rsp), %rdi
movq %r13, %rsi
callq 0x3149b
testl %eax, %eax
je 0x2fefa
leaq 0x68(%rsp), %rdi
movq %r13, %rsi
callq 0x3149b
testl %eax, %eax
je 0x2ff01
xorl %ebx, %ebx
movq %r13, %rdi
callq 0x31566
testl %eax, %eax
js 0x2fba1
movw %ax, (%rbp,%rbx,2)
movq %r13, %rdi
callq 0x31566
testl %eax, %eax
js 0x2fbb5
shll $0x8, %eax
orw %ax, (%rbp,%rbx,2)
incq %rbx
cmpq $0x3, %rbx
jne 0x2f986
cmpl $0xc, %r12d
jb 0x2ff08
movl %r12d, %eax
andl $0x3, %eax
jne 0x2ff08
addl $-0xc, %r12d
movl %r12d, %edi
andl $-0x4, %edi
callq 0x8d50
movq 0x28(%rsp), %rbx
movq %rax, (%rbx)
testq %rax, %rax
je 0x2fe9f
shrl $0x2, %r12d
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x470(%rsp), %rdx
leaq 0x68(%rsp), %rcx
movq %r12, %r8
callq 0x315dd
testl %eax, %eax
je 0x2ff22
cmpq %r12, 0x8(%rbx)
je 0x2fa40
jmp 0x2ff2c
movl $0x4, %edi
callq 0x8d50
movq %rax, (%rbx)
testq %rax, %rax
je 0x2fe9f
movl $0x0, (%rax)
movq %r13, %rdi
callq 0x3143b
testl %eax, %eax
js 0x2feb0
jne 0x2feba
incq %r14
addq $0x18, %rbp
cmpq $0x4, %r14
jne 0x2f922
movq 0x40(%rsp), %rdi
callq 0x8270
cmpq $0x0, 0x3f0(%r15)
jne 0x300a9
movq 0x60(%r15), %rbx
imulq 0x58(%r15), %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, 0x3f0(%r15)
testq %rax, %rax
movl 0xc(%rsp), %ebp
movq 0x10(%rsp), %r13
je 0x300c8
movl 0x3c(%rsp), %eax
movb %al, (%r15)
cmpb $0x1, %al
jne 0x2fc4e
cmpq $0x0, 0x28(%r15)
jne 0x300d0
movq 0x10(%r15), %r14
movq %r15, %r12
movzbl 0x18(%r15), %r15d
leaq (%r14,%r15), %rbx
shlq $0x3, %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, 0x28(%r12)
testq %rax, %rax
je 0x3010e
addq %r15, %r14
movq 0x18(%rsp), %r12
je 0x2fc92
xorl %r14d, %r14d
movq 0x20(%rsp), %r15
movq 0x28(%r15), %rbx
cmpq $0x0, (%rbx,%r14,8)
jne 0x2fffe
movq 0x38(%r15), %rax
movq (%rax,%r14,8), %rsi
movl $0x1, %edi
callq 0x8cc0
movq %rax, (%rbx,%r14,8)
movq 0x28(%r15), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x3001d
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %rbx
testb %bpl, %bpl
je 0x2fb68
movq %rbx, %rsi
movq %r12, %rdx
callq 0x313f0
testb %al, %al
jns 0x2fb8a
jmp 0x2ffd0
movq %r13, %r15
subq %rbx, %r15
jb 0x2ffb2
movq %r12, %rsi
movq %rbx, %rdx
callq 0x80e0
addq %rbx, %r12
movq %r15, %r13
movq 0x20(%rsp), %r15
incq %r14
movzbl 0x18(%r15), %eax
addq 0x10(%r15), %rax
cmpq %rax, %r14
jb 0x2fb0d
jmp 0x2fbfa
movq 0xa13e8(%rip), %r13     # 0xd0f90
movq (%r13), %rdi
leaq 0x7482d(%rip), %rsi     # 0xa43e0
jmp 0x2fbc7
movq 0xa13d4(%rip), %r13     # 0xd0f90
movq (%r13), %rdi
leaq 0x74869(%rip), %rsi     # 0xa4430
movl %ebx, %edx
xorl %eax, %eax
callq 0x8290
movq (%r13), %rdi
leaq 0x743a5(%rip), %rsi     # 0xa3f80
movq %r14, %rdx
xorl %eax, %eax
callq 0x8290
movq 0x40(%rsp), %rdi
callq 0x8270
movq %r15, %rdi
callq 0x301d3
xorl %r15d, %r15d
movq %r15, %rax
addq $0x878, %rsp            # imm = 0x878
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq %rax, %rax
leaq (%rax,%rax,4), %rax
negq %rax
jmp 0x2f33d
leaq 0x73dfc(%rip), %rdi     # 0xa3a21
callq 0x83f0
jmp 0x2fbf7
movq 0xa135d(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x73e88(%rip), %rsi     # 0xa3ac5
leaq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x8290
jmp 0x2ff93
cmpq $0x0, 0x30(%r15)
jne 0x300ef
movq 0x10(%r15), %r14
movq %r15, %r12
movzbl 0x18(%r15), %r15d
leaq (%r14,%r15), %rbx
shlq $0x3, %rbx
movl $0x1, %edi
movq %rbx, %rsi
callq 0x8cc0
movq %rax, 0x30(%r12)
testq %rax, %rax
je 0x30116
addq %r15, %r14
movq 0x18(%rsp), %r14
jne 0x2fca9
movq 0x20(%rsp), %r15
jmp 0x2fbfa
movq %r15, %rdi
callq 0x9286
jmp 0x2f217
xorl %ebx, %ebx
movq 0x20(%rsp), %r15
movq %r14, %rdi
callq 0x8370
movq 0x30(%r15), %rcx
movq %rax, (%rcx,%rbx,8)
movq 0x38(%r15), %rax
movq (%rax,%rbx,8), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x9150
testl %eax, %eax
jne 0x2ff40
incq %rbx
movzbl 0x18(%r15), %eax
addq 0x10(%r15), %rax
cmpq %rax, %rbx
jb 0x2fcb0
jmp 0x2fbfa
movq 0xa1296(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x745d2(%rip), %rsi     # 0xa42d6
movl $0x3, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x8290
callq 0x995c
jmp 0x2ff93
callq 0x991b
callq 0x9938
jmp 0x2ff93
movq 0xa125d(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x74599(%rip), %rsi     # 0xa42d6
movl $0x4, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x8290
callq 0x98f7
jmp 0x2ff93
callq 0x92da
jmp 0x2f3bf
movq 0xa1229(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x74565(%rip), %rsi     # 0xa42d6
movl $0x4, %edx
xorl %eax, %eax
callq 0x8290
callq 0x98d3
jmp 0x2ff93
movq 0xa1202(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x7453e(%rip), %rsi     # 0xa42d6
movl $0x4, %edx
xorl %eax, %eax
callq 0x8290
callq 0x98af
jmp 0x2ff93
movq 0xa11db(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x74517(%rip), %rsi     # 0xa42d6
movl $0x4, %edx
xorl %eax, %eax
callq 0x8290
callq 0x988b
jmp 0x2ff93
movq 0xa11b4(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x744f0(%rip), %rsi     # 0xa42d6
movl $0x4, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x8290
callq 0x9867
jmp 0x2ff93
movq 0xa118a(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x744c6(%rip), %rsi     # 0xa42d6
movl $0x4, %edx
xorl %eax, %eax
callq 0x8290
callq 0x97fb
jmp 0x2ff93
movq 0xa1163(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x7449f(%rip), %rsi     # 0xa42d6
movl $0x4, %edx
xorl %eax, %eax
callq 0x8290
callq 0x97d7
jmp 0x2ff93
movq (%rax), %rdi
leaq 0x7447f(%rip), %rsi     # 0xa42d6
movl $0x4, %edx
xorl %eax, %eax
callq 0x8290
callq 0x97b3
jmp 0x2ff93
movq 0xa111c(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x74458(%rip), %rsi     # 0xa42d6
movq %r13, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x8290
callq 0x9643
jmp 0x2fbe5
callq 0x9627
jmp 0x2ff34
leaq 0x74624(%rip), %rdi     # 0xa44ca
callq 0x83f0
jmp 0x2ff34
movq %rbx, %rdi
callq 0x95ff
jmp 0x2ff34
movq %rbx, %rdi
callq 0x9430
jmp 0x2ff34
movq 0xa10c5(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x74401(%rip), %rsi     # 0xa42d6
movl $0x4, %edx
xorl %eax, %eax
callq 0x8290
callq 0x9343
jmp 0x2ff93
callq 0x9367
callq 0x9384
jmp 0x2ff93
callq 0x9414
jmp 0x2ff34
callq 0x93f8
jmp 0x2ff34
movq 0xa1081(%rip), %r13     # 0xd0f90
movq (%r13), %rdi
leaq 0x74567(%rip), %rsi     # 0xa4481
movl %r12d, %edx
jmp 0x2fbc9
movq %rbx, %rdi
callq 0x93d0
jmp 0x2ff34
movq %rbx, %rdi
callq 0x93a8
movq 0xa1055(%rip), %r13     # 0xd0f90
jmp 0x2fbd0
movq %rbx, %rdi
callq 0x9458
jmp 0x2ff93
movq 0xa103f(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x7437b(%rip), %rsi     # 0xa42d6
movl $0x4, %edx
xorl %eax, %eax
callq 0x8290
callq 0x9843
jmp 0x2ff93
movq %rdx, %rcx
movq 0xa1018(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x74354(%rip), %rsi     # 0xa42d6
movl $0x4, %edx
xorl %eax, %eax
callq 0x8290
callq 0x981f
leaq 0x7402e(%rip), %rdi     # 0xa3fc8
leaq 0x73472(%rip), %rsi     # 0xa3413
leaq 0x73c59(%rip), %rcx     # 0xa3c01
movl $0x35b, %edx            # imm = 0x35B
callq 0x8240
movq 0xa0fd7(%rip), %rax     # 0xd0f90
movq (%rax), %rdi
leaq 0x74313(%rip), %rsi     # 0xa42d6
movq %rbx, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x8290
callq 0x94d8
jmp 0x2ff93
movq %rbx, %rdi
callq 0x92f0
leaq 0x73bfb(%rip), %rdi     # 0xa3be1
leaq 0x73426(%rip), %rsi     # 0xa3413
leaq 0x73c0d(%rip), %rcx     # 0xa3c01
movl $0x300, %edx            # imm = 0x300
callq 0x8240
leaq 0x740f4(%rip), %rdi     # 0xa40f9
leaq 0x73407(%rip), %rsi     # 0xa3413
leaq 0x73bee(%rip), %rcx     # 0xa3c01
movl $0x346, %edx            # imm = 0x346
callq 0x8240
movq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x9502
leaq 0x73d44(%rip), %rdi     # 0xa3d75
leaq 0x733db(%rip), %rsi     # 0xa3413
leaq 0x73bc2(%rip), %rcx     # 0xa3c01
movl $0x315, %edx            # imm = 0x315
callq 0x8240
movq %rbx, %rdi
callq 0x9760
leaq 0x73da2(%rip), %rdi     # 0xa3dfa
leaq 0x733b4(%rip), %rsi     # 0xa3413
leaq 0x73b9b(%rip), %rcx     # 0xa3c01
movl $0x316, %edx            # imm = 0x316
callq 0x8240
movq 0x18(%rsp), %rdi
callq 0x970d
leaq 0x73e02(%rip), %rdi     # 0xa3e83
leaq 0x7338b(%rip), %rsi     # 0xa3413
leaq 0x73b72(%rip), %rcx     # 0xa3c01
movl $0x324, %edx            # imm = 0x324
callq 0x8240
movq %rbx, %rdi
callq 0x96ba
movq %r13, %rdi
callq 0x9667
leaq 0x73f27(%rip), %rdi     # 0xa3fd7
leaq 0x7335c(%rip), %rsi     # 0xa3413
leaq 0x73b43(%rip), %rcx     # 0xa3c01
movl $0x33c, %edx            # imm = 0x33C
callq 0x8240
movq %rbx, %rdi
callq 0x95ac
leaq 0x73f8b(%rip), %rdi     # 0xa4062
leaq 0x73335(%rip), %rsi     # 0xa3413
leaq 0x73b1c(%rip), %rcx     # 0xa3c01
movl $0x343, %edx            # imm = 0x343
callq 0x8240
leaq 0x740aa(%rip), %rdi     # 0xa41a0
leaq 0x73316(%rip), %rsi     # 0xa3413
leaq 0x73afd(%rip), %rcx     # 0xa3c01
movl $0x34c, %edx            # imm = 0x34C
callq 0x8240
movq %rbx, %rdi
callq 0x9559
movq %rbx, %rdi
callq 0x9485