// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/rsc.c
// Function: de_run_rsc
static void de_run_rsc(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	const char *tmps;

	d = de_malloc(c, sizeof(lctx));
	d->c = c;
	d->avail_file_size = c->infile->len; // Starting value. Will be adjusted later.

	d->fmt = RSCFMT_UNKNOWN;
	tmps = de_get_ext_option(c, "rsc:fmt");
	if(tmps) {
		if(!de_strcmp(tmps, "pc")) {
			d->fmt = RSCFMT_PC;
		}
		else if(!de_strcmp(tmps, "atari")) {
			d->fmt = RSCFMT_ATARI;
		}
	}

	if(d->fmt==RSCFMT_UNKNOWN) {
		detect_rsc_format(c, d);
	}

	if(d->fmt==RSCFMT_UNKNOWN) {
		d->fmt = RSCFMT_ATARI;
	}

	if(d->fmt==RSCFMT_PC) {
		de_declare_fmt(c, "GEM RSC, PC");
		d->is_le = 1;
	}
	else {
		de_declare_fmt(c, "GEM RSC, Atari");
	}

	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_UNKNOWN);
	if(d->input_encoding==DE_ENCODING_UNKNOWN) {
		if(d->fmt==RSCFMT_ATARI) {
			d->input_encoding = DE_ENCODING_ATARIST;
		}
		else {
			// TODO?: This should probably be the "GEM character set", but we don't
			// support that.
			d->input_encoding = DE_ENCODING_ASCII;
		}
	}

	d->decode_objects = 1;
	// TODO: For Atari format, maybe we can disallow unaligned offsets.
	d->allow_unaligned_offsets = 1;

	de_dbg(c, "header at %d", 0);
	de_dbg_indent(c, 1);
	d->version = gem_getu16(d, 0);
	de_dbg(c, "version: 0x%04x", (int)d->version);

	d->object_offs = gem_getu16(d, 2);
	d->iconblk_offs = gem_getu16(d, 6);
	d->bitblk_offs = gem_getu16(d, 8);
	d->imagedata_offs = gem_getu16(d, 14);
	d->imagepointertable_offs = gem_getu16(d, 16);
	d->object_num = gem_getu16(d, 20);
	d->objecttree_num = gem_getu16(d, 22);
	d->iconblk_num = gem_getu16(d, 26);
	d->bitblk_num = gem_getu16(d, 28);
	d->rssize = gem_getu16(d, 34);

	de_dbg(c, "OBJECT: %d at %d", (int)d->object_num, (int)d->object_offs);
	de_dbg(c, "num object trees: %d", (int)d->objecttree_num);
	de_dbg(c, "ICONBLK: %d at %d", (int)d->iconblk_num, (int)d->iconblk_offs);
	de_dbg(c, "BITBLK: %d at %d", (int)d->bitblk_num, (int)d->bitblk_offs);
	de_dbg(c, "imagedata: at %d", (int)d->imagedata_offs);
	de_dbg(c, "imagepointertable: at %d", (int)d->imagepointertable_offs);
	if(d->version & 0x0004) {
		de_dbg(c, "extension array offset: %"I64_FMT, d->rssize);
	}
	else {
		de_dbg(c, "reported file size: %"I64_FMT, d->rssize);
		d->reported_file_size = d->rssize;
		d->avail_file_size = de_min_int(d->reported_file_size, c->infile->len);
	}
	de_dbg_indent(c, -1);

	if(d->version & 0x0004) {
		do_extension_array(c, d);
	}
	else if(d->version==0 || d->version==1) {
		;
	}
	else {
		de_err(c, "Unknown or unsupported version of RSC");
		goto done;
	}

	do_OBJECTs(c, d);
	do_BITBLKs(c, d);
	do_ICONBLKs(c, d);
	if(d->version & 0x0004) {
		do_cicon(c, d);
	}

done:
	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r13
movl $0x4d8, %esi            # imm = 0x4D8
callq 0xe8b2b
movq %rax, %r14
movq %r13, (%rax)
movq 0x18(%r13), %rax
movq 0x18(%rax), %rax
movq %rax, 0x80(%r14)
movl $0x0, 0xc(%r14)
leaq 0x76a2a(%rip), %rsi     # 0x13ac70
movq %r13, %rdi
callq 0xe9b74
testq %rax, %rax
je 0xc427f
cmpb $0x70, (%rax)
jne 0xc4268
cmpb $0x63, 0x1(%rax)
jne 0xc4268
cmpb $0x0, 0x2(%rax)
je 0xc536b
leaq 0x76a09(%rip), %rsi     # 0x13ac78
movq %rax, %rdi
callq 0x181a0
testl %eax, %eax
je 0xc4364
movl 0xc(%r14), %ecx
testl %ecx, %ecx
jne 0xc42a0
movq 0x18(%r13), %rdi
xorl %esi, %esi
callq 0xeeb67
testq %rax, %rax
je 0xc42c5
movl $0x1, %ecx
movl %ecx, 0xc(%r14)
cmpl $0x2, %ecx
jne 0xc436c
leaq 0x769ce(%rip), %rsi     # 0x13ac7e
movq %r13, %rdi
callq 0xeb125
movl $0x1, 0x10(%r14)
jmp 0xc437b
movq 0x18(%r13), %rdi
movl $0x22, %esi
callq 0xeebc8
movq %rax, %rbx
movq 0x18(%r13), %rdi
movl $0x22, %esi
callq 0xeeb67
cmpq %rax, %rbx
jne 0xc5378
movl $0x2, %ebx
movq 0x18(%r13), %rdi
movq %rbx, %rsi
callq 0xeebc8
testq %rax, %rax
je 0xc434b
movq %rax, %r15
cmpq $0xffff, %rax           # imm = 0xFFFF
je 0xc434b
movq 0x18(%r13), %rdi
movq %rbx, %rsi
callq 0xeeb67
movq 0x18(%r13), %rcx
movq 0x18(%rcx), %rdx
cmpq %rdx, %r15
jg 0xc4297
movl $0x2, %ecx
cmpq %rdx, %rax
jg 0xc429c
testb $0x1, %r15b
jne 0xc4297
testb $0x1, %al
jne 0xc429c
leaq 0x2(%rbx), %rax
cmpq $0x11, %rbx
movq %rax, %rbx
jb 0xc42f2
movl 0xc(%r14), %ecx
testl %ecx, %ecx
jne 0xc42a0
movl $0x1, 0xc(%r14)
leaq 0x76917(%rip), %rsi     # 0x13ac8a
movq %r13, %rdi
callq 0xeb125
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xeb220
movl %eax, 0x8(%r14)
testl %eax, %eax
jne 0xc43a5
cmpl $0x1, 0xc(%r14)
movl $0x12, %eax
movl $0x1, %ecx
cmovel %eax, %ecx
movl %ecx, 0x8(%r14)
movw $0x101, 0x14(%r14)      # imm = 0x101
leaq 0x7533b(%rip), %rsi     # 0x1396ee
movq %r13, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
xorl %esi, %esi
callq 0xeef43
movq %rax, 0x18(%r14)
leaq 0x71010(%rip), %rsi     # 0x1353f9
movq %r13, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movl $0x2, %esi
callq 0xeef43
movq %rax, 0x20(%r14)
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movl $0x6, %esi
callq 0xeef43
movq %rax, 0x38(%r14)
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movl $0x8, %esi
callq 0xeef43
movq %rax, 0x48(%r14)
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movl $0xe, %esi
callq 0xeef43
movq %rax, 0x58(%r14)
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movl $0x10, %esi
callq 0xeef43
movq %rax, 0x60(%r14)
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movl $0x14, %esi
callq 0xeef43
movq %rax, 0x28(%r14)
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movl $0x16, %esi
callq 0xeef43
movq %rax, 0x30(%r14)
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movl $0x1a, %esi
callq 0xeef43
movq %rax, 0x40(%r14)
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movl $0x1c, %esi
callq 0xeef43
movq %rax, 0x50(%r14)
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movl $0x22, %esi
callq 0xeef43
movq %rax, 0x68(%r14)
movl 0x20(%r14), %ecx
movl 0x28(%r14), %edx
leaq 0x7679b(%rip), %rsi     # 0x13ac99
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movl 0x30(%r14), %edx
leaq 0x76797(%rip), %rsi     # 0x13acaa
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movl 0x38(%r14), %ecx
movl 0x40(%r14), %edx
leaq 0x76793(%rip), %rsi     # 0x13acbf
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movl 0x48(%r14), %ecx
movl 0x50(%r14), %edx
leaq 0x7678c(%rip), %rsi     # 0x13acd1
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movl 0x58(%r14), %edx
leaq 0x76788(%rip), %rsi     # 0x13ace2
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movl 0x60(%r14), %edx
leaq 0x76784(%rip), %rsi     # 0x13acf3
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
testb $0x4, 0x18(%r14)
movq 0x68(%r14), %rdx
jne 0xc45b3
leaq 0x5726e(%rip), %rsi     # 0x11b7f9
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x68(%r14), %rdi
movq %rdi, 0x78(%r14)
movq 0x18(%r13), %rax
movq 0x18(%rax), %rsi
callq 0xe9c3b
movq %rax, 0x80(%r14)
jmp 0xc45c4
leaq 0x76752(%rip), %rsi     # 0x13ad0c
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x18(%r14), %rax
testb $0x4, %al
jne 0xc45f9
cmpq $0x2, %rax
jb 0xc46df
leaq 0x7673e(%rip), %rsi     # 0x13ad28
movq %r13, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0xc4e6a
movq 0x68(%r14), %r15
leaq 0x7674a(%rip), %rsi     # 0x13ad4e
movq %r13, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x68(%r14), %rcx
movq 0x80(%r14), %rdx
movzbl 0x15(%r14), %esi
leaq 0x76730(%rip), %r9      # 0x13ad65
movl $0x8, %r8d
movq %r13, %rdi
callq 0xc53e3
testl %eax, %eax
je 0xc46d2
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movq %r15, %rsi
callq 0xeeff3
movq %rax, 0x78(%r14)
leaq 0x57190(%rip), %rsi     # 0x11b7f9
movq %r13, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x78(%r14), %rdi
movq 0x18(%r13), %rax
movq 0x18(%rax), %rsi
callq 0xe9c3b
movq %rax, 0x80(%r14)
addq $0x4, %r15
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movq %r15, %rsi
callq 0xeeff3
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
movq $-0x1, %rdx
cmovneq %rax, %rdx
movq %rdx, 0x70(%r14)
testq %rdx, %rdx
je 0xc46d2
leaq 0x766ad(%rip), %rsi     # 0x13ad75
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpq $0x0, 0x28(%r14)
movq %r13, 0x10(%rsp)
movq %r14, 0x20(%rsp)
jle 0xc4946
movq 0x20(%r14), %rdx
leaq 0x766be(%rip), %rsi     # 0x13adbd
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x20(%r14), %rcx
movq 0x28(%r14), %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %r8
movq 0x80(%r14), %rdx
movzbl 0x15(%r14), %esi
leaq 0x766a0(%rip), %r9      # 0x13adcc
movq %r13, %rdi
callq 0xc53e3
testl %eax, %eax
je 0xc4946
cmpb $0x0, 0x14(%r14)
je 0xc4946
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
cmpq $0x0, 0x28(%r14)
jle 0xc4934
movl $0xc, %r13d
xorl %r12d, %r12d
movq 0x20(%r14), %rbp
leaq 0xc(,%rbp), %rax
addq %r13, %rax
cmpq 0x80(%r14), %rax
jg 0xc4934
leaq -0xc(,%rbp), %rbx
addq %r13, %rbx
movq 0x10(%rsp), %r15
movq %r15, %rdi
leaq 0x7663b(%rip), %rsi     # 0x13add9
movq %r12, 0x8(%rsp)
movl %r12d, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0xe8617
movq %r15, %rdi
movl $0x1, %esi
callq 0xe8a15
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movq %rbx, %rsi
callq 0xeef43
movq %rax, %rbx
leaq -0xa(,%rbp), %rsi
addq %r13, %rsi
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
callq 0xeef43
movq %rax, %r12
leaq -0x8(,%rbp), %rsi
addq %r13, %rsi
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
callq 0xeef43
movl $0xffff, %ecx           # imm = 0xFFFF
cmpq %rcx, %rbx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmovel %edx, %ebx
cmpq %rcx, %r12
cmovel %edx, %r12d
cmpq %rcx, %rax
cmovel %edx, %eax
movq %r15, %rdi
leaq 0x765b8(%rip), %rsi     # 0x13adea
movl %ebx, %edx
movl %r12d, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0xe8617
leaq -0x6(,%rbp), %rsi
addq %r13, %rsi
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
callq 0xeef43
leal -0x14(%rax), %ecx
leaq 0x678eb(%rip), %r8      # 0x12c151
cmpb $0xd, %cl
ja 0xc487c
movzbl %cl, %ecx
leaq 0x769fb(%rip), %rdx     # 0x13b270
movslq (%rdx,%rcx,4), %r8
addq %rdx, %r8
movq 0x8(%rsp), %r12
incq %r12
movzbl %al, %ecx
movq 0x10(%rsp), %r14
movq %r14, %rdi
leaq 0x76586(%rip), %rsi     # 0x13ae1c
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rsi
addq %rbp, %rsi
movq 0x20(%rsp), %r15
movq (%r15), %rax
movl 0x10(%r15), %edx
movq 0x18(%rax), %rdi
callq 0xeeff3
movq %r14, %rdi
leaq 0x7656e(%rip), %rsi     # 0x13ae32
movl %eax, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
leaq 0x8(,%rbp), %rsi
addq %r13, %rsi
movq (%r15), %rax
movl 0x10(%r15), %edx
movq 0x18(%rax), %rdi
callq 0xeef43
movq %rax, %rbx
leaq 0xa(,%rbp), %rsi
addq %r13, %rsi
movq (%r15), %rax
movl 0x10(%r15), %edx
movq 0x18(%rax), %rdi
callq 0xeef43
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0xe8f88
movq %r14, %rdi
movq %r15, %r14
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq $0x18, %r13
cmpq 0x28(%r15), %r12
jl 0xc4768
movq 0x10(%rsp), %r13
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpq $0x0, 0x50(%r14)
jle 0xc4b83
movq 0x48(%r14), %rdx
leaq 0x76598(%rip), %rsi     # 0x13aef4
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x48(%r14), %rcx
movq 0x50(%r14), %r8
leaq (%r8,%r8), %rax
shlq $0x4, %r8
subq %rax, %r8
movq 0x80(%r14), %rdx
movzbl 0x15(%r14), %esi
leaq 0x76577(%rip), %r9      # 0x13af03
movq %r13, %rdi
callq 0xc53e3
testl %eax, %eax
je 0xc4b83
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
cmpq $0x0, 0x50(%r14)
jle 0xc4b76
movl $0xc, %r15d
xorl %r12d, %r12d
movq 0x48(%r14), %rbp
leaq (%r15,%rbp), %rax
addq $0x2, %rax
cmpq 0x80(%r14), %rax
jg 0xc4b76
movq %r12, 0x8(%rsp)
leaq (%r15,%rbp), %rax
movq %rax, 0x28(%rsp)
leaq (%r15,%rbp), %rbx
addq $-0xc, %rbx
movq %r13, %rdi
leaq 0x7651a(%rip), %rsi     # 0x13af10
movq %rbx, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movq %rbx, %rsi
callq 0xeeff3
movq %rax, 0x18(%rsp)
movq %r13, %rdi
leaq 0x764ef(%rip), %rsi     # 0x13af1e
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
leaq (%r15,%rbp), %rsi
addq $-0x8, %rsi
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
callq 0xeef43
movq %rax, %r12
leaq (,%rax,8), %rbx
movq %r13, %rdi
leaq 0x764c8(%rip), %rsi     # 0x13af2e
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
leaq (%r15,%rbp), %rsi
addq $-0x6, %rsi
movq %rbx, %rbp
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
callq 0xeef43
movq %rax, %rbx
movq %r13, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xe8f88
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movq 0x28(%rsp), %rsi
callq 0xeef43
movq %r13, %rdi
leaq 0x76486(%rip), %rsi     # 0x13af41
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %r8
imulq %r12, %r8
movq 0x80(%r14), %rdx
movzbl 0x15(%r14), %esi
movq 0x18(%rsp), %r14
movq %r13, %rdi
movq %r14, %rcx
leaq 0x52ecb(%rip), %r9      # 0x1179b4
callq 0xc53e3
testl %eax, %eax
je 0xc4b41
movq %r13, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0xf1db1
testl %eax, %eax
je 0xc4b41
movq %r13, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movl $0x1, %ecx
callq 0xf266a
movq %rax, %rbx
movq 0x20(%rsp), %rbp
movq %rbp, %rdi
movq %rax, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0xc5468
movq %rbx, %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0xf22dc
jmp 0xc4b48
xorl %ebx, %ebx
movq 0x20(%rsp), %rbp
movq 0x8(%rsp), %r12
incq %r12
movq %rbx, %rdi
callq 0xf228d
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq $0xe, %r15
cmpq 0x50(%rbp), %r12
movq %rbp, %r14
jl 0xc49bd
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpq $0x0, 0x40(%r14)
jle 0xc4d3f
movq 0x38(%r14), %rdx
leaq 0x763c1(%rip), %rsi     # 0x13af5a
movq %r13, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x38(%r14), %rcx
movq 0x40(%r14), %rax
movq %rax, %rdx
shlq $0x5, %rdx
leaq (%rdx,%rax,2), %r8
movq 0x80(%r14), %rdx
movzbl 0x15(%r14), %esi
leaq 0x763a1(%rip), %r9      # 0x13af6a
movq %r13, %rdi
callq 0xc53e3
testl %eax, %eax
je 0xc4d3f
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
cmpq $0x0, 0x40(%r14)
jle 0xc4d32
xorl %r15d, %r15d
xorl %ecx, %ecx
movq 0x38(%r14), %rbp
leaq (%r15,%rbp), %rax
addq $0x22, %rax
cmpq 0x80(%r14), %rax
jg 0xc4d32
movq %rcx, 0x28(%rsp)
leaq (%r15,%rbp), %rbx
movq %r13, %rdi
leaq 0x40(%rsp), %rsi
callq 0xe8a1c
movl $0x28, %esi
movq %r13, %rdi
callq 0xe8b2b
movq %rax, %r12
movq %r13, %rdi
leaq 0x76339(%rip), %rsi     # 0x13af78
movq %rbx, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, 0x8(%rsp)
movq %r12, %rcx
callq 0xc5562
testl %eax, %eax
je 0xc4d00
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movq %rbx, %rsi
callq 0xeeff3
movq %rax, %rbx
leaq (%r15,%rbp), %rsi
addq $0x4, %rsi
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
callq 0xeeff3
movq %rax, %rbp
movq %r13, %rdi
leaq 0x762d8(%rip), %rsi     # 0x13af87
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
leaq 0x75c86(%rip), %rsi     # 0x13a949
movq %rbx, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x8(%rsp), %rdx
movq (%rdx), %rax
leaq 0xf(%rax), %rcx
addq $0x1e, %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
sarq $0x4, %rax
addq %rax, %rax
movq %rax, 0x10(%rdx)
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rcx
movq %rbx, %r8
callq 0xc55ff
movq 0x28(%rsp), %rbx
incq %rbx
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0xc5753
movl 0x40(%rsp), %esi
movq %r13, %rdi
callq 0xe8a25
addq $0x22, %r15
cmpq 0x40(%r14), %rbx
movq %rbx, %rcx
jl 0xc4bf6
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
testb $0x4, 0x18(%r14)
je 0xc4e6a
leaq 0x38(%rsp), %rsi
movq %r13, %rdi
callq 0xe8a1c
movq 0x70(%r14), %rcx
movq 0x80(%r14), %rdx
movzbl 0x15(%r14), %esi
leaq 0x76245(%rip), %r9      # 0x13afb3
movl $0x1, %r8d
movq %r13, %rdi
callq 0xc53e3
testl %eax, %eax
je 0xc4e5e
movq 0x70(%r14), %r15
leaq 0x76232(%rip), %rsi     # 0x13afc1
movq %r13, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq 0x40(%rsp), %rsi
movq %r13, %rdi
callq 0xe8a1c
leaq 0x7621e(%rip), %rsi     # 0x13afdb
movq %r13, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
cmpq %r15, 0x80(%r14)
movq %r14, %r12
jle 0xc4e4a
movl $0x4, %ebp
leaq 0x7620a(%rip), %r14     # 0x13aff9
xorl %ebx, %ebx
movq (%r12), %rax
movl 0x10(%r12), %edx
movq 0x18(%rax), %rdi
movq %r15, %rsi
callq 0xeeff3
movq %rax, %r13
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r13
movq $-0x1, %rax
cmoveq %rax, %r13
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movl %ebx, %edx
movq %r13, %rcx
xorl %eax, %eax
callq 0xe889f
testq %r13, %r13
js 0xc4e84
addq $0x4, %r15
incq %rbx
addq $0x4, %rbp
cmpq 0x80(%r12), %r15
jl 0xc4df1
movl 0x40(%rsp), %esi
movq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0xe8a25
movq %r12, %r14
movl 0x38(%rsp), %esi
movq %r13, %rdi
callq 0xe8a25
movq %r13, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, 0x88(%r12)
leaq 0x76174(%rip), %rsi     # 0x13b007
movq 0x10(%rsp), %r13
movq %r13, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0xe8617
movl 0x40(%rsp), %esi
movq %r13, %rdi
callq 0xe8a25
cmpq $0x0, 0x88(%r12)
movq %r12, %r14
jle 0xc4e5e
addq $0x4, %r15
xorl %ebx, %ebx
cmpq 0x80(%r14), %r15
jge 0xc4e5e
movq %r13, %rdi
leaq 0x3c(%rsp), %rsi
callq 0xe8a1c
movq %r13, %rdi
leaq 0x7613a(%rip), %rsi     # 0x13b01e
movq %rbx, 0x60(%rsp)
movl %ebx, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movl $0x28, %esi
movq %r13, %rdi
callq 0xe8b2b
movq %rax, %rbx
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rax, %rcx
callq 0xc5562
testl %eax, %eax
movq %rbx, 0x8(%rsp)
je 0xc5327
leaq 0x22(%r15), %rsi
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
callq 0xeeff3
movq %r13, %rdi
leaq 0x760e4(%rip), %rsi     # 0x13b032
movq %rax, 0x10(%rsp)
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq (%rbx), %rax
leaq 0xf(%rax), %rcx
addq $0x1e, %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
leaq 0x26(%r15), %rdx
sarq $0x4, %rax
addq %rax, %rax
movq %rax, 0x10(%rbx)
movq %r13, %rdi
leaq 0x760d4(%rip), %rsi     # 0x13b05b
movq %rdx, 0x18(%rsp)
xorl %eax, %eax
callq 0xe87e4
movq 0x8(%rbx), %rax
imulq 0x10(%rbx), %rax
leaq (%rax,%r15), %rcx
addq $0x26, %rcx
movq %rax, 0x28(%rsp)
movq %rcx, 0x30(%rsp)
leaq (%rcx,%rax), %r12
movq %r13, %rdi
leaq 0x760c4(%rip), %rsi     # 0x13b080
movq %r12, %rdx
xorl %eax, %eax
callq 0xe87e4
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
jne 0xc4fde
movq %r13, %rdi
callq 0xf6410
movq %rax, %rdi
movq %rax, 0x20(%rbx)
callq 0xf6423
movq 0x18(%r13), %rdi
movq 0x20(%rbx), %rcx
movl 0x8(%r14), %r9d
movl $0xc, %edx
movq %r12, %rsi
movl $0x1, %r8d
callq 0xefbd7
movq 0x20(%rbx), %rdi
callq 0xf70f6
movq %r13, %rdi
leaq 0x7608a(%rip), %rsi     # 0x13b09f
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r13, %rdi
callq 0xf1db1
testl %eax, %eax
je 0xc5327
movq %r13, %rdi
leaq 0x7606f(%rip), %rsi     # 0x13b0af
movq 0x18(%rsp), %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r13, %rdi
leaq 0x75f24(%rip), %rsi     # 0x13af87
movq 0x18(%rsp), %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
leaq 0x758d0(%rip), %rsi     # 0x13a949
movq 0x30(%rsp), %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq 0x18(%rsp), %rcx
movq 0x30(%rsp), %r8
callq 0xc55ff
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpq $0x0, 0x10(%rsp)
jle 0xc5367
addq $0xc, %r12
movq 0x18(%r13), %rax
cmpq 0x18(%rax), %r12
movb $0x1, %bl
jge 0xc5329
movq %r15, 0x58(%rsp)
xorl %edx, %edx
incq %rdx
movq %r13, %rdi
leaq 0x75feb(%rip), %rsi     # 0x13b0c9
movq %rdx, 0x18(%rsp)
movq 0x10(%rsp), %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
movq %r12, %rsi
callq 0xeef43
movq 0x8(%rsp), %r15
movq %rax, 0x18(%r15)
movq %r13, %rdi
leaq 0x7638a(%rip), %rsi     # 0x13b4af
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0xa(%r12), %rsi
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
callq 0xeeff3
movq %rax, 0x30(%rsp)
movq %r13, %rdi
leaq 0x75f94(%rip), %rsi     # 0x13b0e6
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0x12(%r12), %rsi
movq (%r14), %rax
movl 0x10(%r14), %edx
movq 0x18(%rax), %rdi
callq 0xeeff3
movq %r13, %rdi
leaq 0x75f7e(%rip), %rsi     # 0x13b0f8
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0x16(%r12), %rbx
movq 0x18(%r15), %rbp
imulq 0x28(%rsp), %rbp
movq %r13, %rdi
leaq 0x75f6e(%rip), %rsi     # 0x13b10a
movq %rbx, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r13, %rdi
leaq 0x75dca(%rip), %rsi     # 0x13af87
movq %rbx, %rdx
xorl %eax, %eax
callq 0xe8617
addq %rbp, %r12
addq $0x16, %r12
movq %r13, %rdi
leaq 0x75771(%rip), %rsi     # 0x13a949
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movl 0x18(%r15), %ecx
movl $0x10, %esi
leaq 0x40(%rsp), %r14
movq %r14, %rdi
leaq 0x71122(%rip), %rdx     # 0x13631c
xorl %eax, %eax
callq 0xe8193
movl $0x0, (%rsp)
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq %r15, %rdx
movq %rbx, %rcx
movq %r14, %rbx
movq 0x28(%rsp), %r14
movq %r12, %r8
movq %rbx, %r9
callq 0xc5808
addq %r14, %r12
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpq $0x0, 0x30(%rsp)
je 0xc52eb
movq %r13, %rdi
leaq 0x75ebd(%rip), %rsi     # 0x13b10c
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r13, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %r13, %rdi
leaq 0x75d17(%rip), %rsi     # 0x13af87
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
addq %r12, %rbp
movq %r13, %rdi
leaq 0x756c2(%rip), %rsi     # 0x13a949
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x8(%rsp), %r15
movl 0x18(%r15), %ecx
movl $0x10, %esi
movq %rbx, %rdi
leaq 0x75e79(%rip), %rdx     # 0x13b122
xorl %eax, %eax
callq 0xe8193
movl $0x1, (%rsp)
movq %r13, %rdi
movq %r12, %rcx
movq 0x20(%rsp), %r12
movq %r12, %rsi
movq %r15, %rdx
movq %rbp, %r8
movq %rbx, %r9
callq 0xc5808
addq %r14, %rbp
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %r12, %r14
movq %rbp, %r12
jmp 0xc52f0
movq 0x20(%rsp), %r14
movq %r13, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x18(%rsp), %rdx
cmpq %rdx, 0x10(%rsp)
setne %bl
je 0xc531a
movq 0x18(%r13), %rax
cmpq 0x18(%rax), %r12
jl 0xc50d1
movq 0x58(%rsp), %r15
subq %r15, %r12
movq %r12, %rbp
jmp 0xc5329
movb $0x1, %bl
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0xc5753
movl 0x3c(%rsp), %esi
movq %r13, %rdi
callq 0xe8a25
testb %bl, %bl
movq 0x60(%rsp), %rbx
jne 0xc4e5e
addq %rbp, %r15
incq %rbx
cmpq 0x88(%r14), %rbx
jl 0xc4ec4
jmp 0xc4e5e
xorl %ebx, %ebx
jmp 0xc5329
movl $0x2, 0xc(%r14)
jmp 0xc42a9
movq 0x18(%r13), %rcx
movq 0x18(%rcx), %rdx
cmpq %rdx, %rax
je 0xc4297
movl $0x2, %ecx
cmpq %rdx, %rbx
je 0xc429c
jmp 0xc42ed