// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/tga.c
// Function: de_run_tga
static void de_run_tga(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos;
	dbuf *unc_pixels = NULL;
	int saved_indent_level;
	i64 rowspan_tmp;
	const char *opt_trans_str;

	de_dbg_indent_save(c, &saved_indent_level);
	d = de_malloc(c, sizeof(lctx));
	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_ASCII);
	d->trans_setting = TRANS_AUTO;

	opt_trans_str = de_get_ext_option(c, "tga:trans");
	if(opt_trans_str) {
		if(!de_strcmp(opt_trans_str, "auto")) {
			d->trans_setting = TRANS_AUTO;
		}
		else if(!de_strcmp(opt_trans_str, "0")) {
			d->trans_setting = TRANS_REMOVE;
		}
		else if(!de_strcmp(opt_trans_str, "1")) {
			d->trans_setting = TRANS_RESPECT;
		}
		else if(!de_strcmp(opt_trans_str, "2")) {
			d->trans_setting = TRANS_ASSOC;
		}
	}

	detect_file_format(c, d);

	if(d->file_format==FMT_VST) {
		de_declare_fmt(c, "TrueVista");
	}
	else {
		de_declare_fmt(c, "TGA");
	}

	d->thumbnail_image.is_thumb = 1;

	pos = 0;

	if(d->file_format==FMT_VST) {
		if(!do_read_vst_headers(c, d)) goto done;
	}
	else {
		if(!do_read_tga_headers(c, d)) goto done;
	}

	if(d->trans_setting==TRANS_ASSOC) {
		d->alpha_is_premultiplied = 1;
	}

	pos += 18;

	de_dbg(c, "image/color data at %"I64_FMT, pos);
	de_dbg_indent(c, 1);

	read_image_id(c, d, pos);
	pos += d->id_field_len;

	if(d->color_map_type!=0) {
		d->bytes_per_pal_entry = (d->cmap_depth+7)/8;
		d->pal_size_in_bytes = d->cmap_length * d->bytes_per_pal_entry;
		de_dbg(c, "color map at %"I64_FMT" (%d colors, %d bytes)", pos,
			(int)d->cmap_length, (int)d->pal_size_in_bytes);

		de_dbg_indent(c, 1);
		if(!do_read_palette(c, d, pos)) goto done;
		de_dbg_indent(c, -1);

		pos += d->pal_size_in_bytes;
	}

	de_dbg(c, "bitmap at %"I64_FMT, pos);
	de_dbg_indent(c, 1);

	d->bytes_per_pixel = ((d->pixel_depth+7)/8);
	if(d->pixel_depth==1) {
		rowspan_tmp = (d->main_image.width+7)/8;
	}
	else {
		rowspan_tmp = d->main_image.width * d->bytes_per_pixel;
	}
	d->main_image.img_size_in_bytes = d->main_image.height * rowspan_tmp;

	if(d->color_type!=TGA_CLRTYPE_PALETTE && d->color_type!=TGA_CLRTYPE_TRUECOLOR &&
		d->color_type!=TGA_CLRTYPE_GRAYSCALE)
	{
		de_err(c, "Unsupported color type (%d: %s)", (int)d->color_type, d->clrtype_name);
		goto done;
	}

	if( (d->color_type==TGA_CLRTYPE_PALETTE && d->pixel_depth==8) ||
		(d->color_type==TGA_CLRTYPE_TRUECOLOR && d->pixel_depth==15) ||
		(d->color_type==TGA_CLRTYPE_TRUECOLOR && d->pixel_depth==16) ||
		(d->color_type==TGA_CLRTYPE_TRUECOLOR && d->pixel_depth==24) ||
		(d->color_type==TGA_CLRTYPE_TRUECOLOR && d->pixel_depth==32) ||
		(d->color_type==TGA_CLRTYPE_GRAYSCALE && d->pixel_depth==1) ||
		(d->color_type==TGA_CLRTYPE_GRAYSCALE && d->pixel_depth==8) )
	{
		;
	}
	else {
		de_err(c, "Unsupported TGA image type (%s, depth=%d)", d->clrtype_name,
			(int)d->pixel_depth);
		goto done;
	}

	if(d->cmpr_type==TGA_CMPR_RLE) {
		if(d->pixel_depth<8) {
			de_err(c, "RLE compression not supported when depth (%d) is less than 8",
				(int)d->pixel_depth);
			goto done;
		}
		unc_pixels = dbuf_create_membuf(c, d->main_image.img_size_in_bytes, 1);
		dbuf_enable_wbuffer(unc_pixels);
		if(!do_decode_rle(c, d, pos, unc_pixels)) goto done;
	}
	else if(d->cmpr_type==TGA_CMPR_NONE) {
		unc_pixels = dbuf_open_input_subfile(c->infile, pos, d->main_image.img_size_in_bytes);
	}
	else {
		de_err(c, "Unsupported image or compression type");
		goto done;
	}

	do_decode_image(c, d, &d->main_image, unc_pixels, NULL, 0);

	de_dbg_indent(c, -2);

	if(d->thumbnail_offset!=0) {
		do_decode_thumbnail(c, d);
	}

done:
	dbuf_close(unc_pixels);
	de_dbg_indent_restore(c, saved_indent_level);
	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdi, %rbx
leaq 0x44(%rsp), %rsi
callq 0xdebae
movl $0x4f8, %esi            # imm = 0x4F8
movq %rbx, %rdi
callq 0xdecaf
movq %rax, %r12
pushq $0x1
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, 0x8(%r12)
movb $0x64, 0x10(%r12)
leaq 0x6d8c5(%rip), %rsi     # 0x12ec2d
movq %rbx, %rdi
callq 0xdfa87
testq %rax, %rax
je 0xc13b8
movq %rax, %r15
leaq 0x421f8(%rip), %rsi     # 0x103577
movq %rax, %rdi
callq 0x181a0
testl %eax, %eax
je 0xc13b1
movzbl (%r15), %eax
cmpl $0x32, %eax
je 0xc1690
cmpl $0x31, %eax
je 0xc167e
cmpl $0x30, %eax
jne 0xc13b8
cmpb $0x0, 0x1(%r15)
jne 0xc13b8
movb $0x65, %al
jmp 0xc13b3
movb $0x64, %al
movb %al, 0x10(%r12)
leaq 0x90(%r12), %r15
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0xc2c2d
movl %eax, 0x98(%r12)
testl %eax, %eax
leaq 0x59c38(%rip), %rax     # 0x11b016
leaq 0x68a53(%rip), %rdx     # 0x129e38
cmoveq %rax, %rdx
leaq 0x6d93d(%rip), %rsi     # 0x12ed2d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
cmpl $0x0, 0x98(%r12)
jne 0xc1445
movq 0x18(%rbx), %rdi
pushq $0x2
popq %rsi
callq 0xe3eb4
testb %al, %al
jne 0xc1445
movq 0x18(%rbx), %rdi
pushq $0x14
popq %rsi
callq 0xe404f
cmpq $0x49474348, %rax       # imm = 0x49474348
jne 0xc1445
leaq 0xc(%r12), %rax
movq %rax, 0x48(%rsp)
movl $0x1, 0xc(%r12)
leaq 0x6d7f4(%rip), %rsi     # 0x12ec37
jmp 0xc145c
leaq 0xc(%r12), %rax
movq %rax, 0x48(%rsp)
andl $0x0, 0xc(%r12)
leaq 0x5c112(%rip), %rsi     # 0x11d56e
movq %rbx, %rdi
callq 0xe07f7
movl $0x1, 0x50(%r12)
movl 0xc(%r12), %r14d
leaq 0x6af75(%rip), %rsi     # 0x12c3ee
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0xdeba7
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0xe3eb4
movzbl %al, %edx
cmpl $0x1, %r14d
movq %r12, 0x10(%rsp)
jne 0xc1566
testb %dl, %dl
pushq $0x12
popq %rax
cmovnel %edx, %eax
movzbl %al, %eax
movq %rax, (%r12)
movl $0x1, 0xa0(%r12)
leaq 0x42240(%rip), %rax     # 0x103711
movq %rax, 0xa8(%r12)
movq 0x18(%rbx), %rdi
pushq $0xc
popq %rsi
callq 0xe3fa3
movq %rax, 0x18(%r12)
movq 0x18(%rbx), %rdi
pushq $0xe
popq %rsi
callq 0xe3fa3
movq %rax, 0x20(%r12)
movq 0x18(%r12), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xdf038
movq 0x18(%rbx), %rdi
pushq $0x10
popq %rsi
callq 0xe3eb4
movzbl %al, %edx
movq %rdx, 0x70(%r12)
leaq 0x6d85f(%rip), %rsi     # 0x12ed85
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
cmpq $0x8, 0x70(%r12)
movq %r12, %rbp
jne 0xc15f4
movb $0x1, 0x11(%rbp)
andq $0x0, 0x58(%rbp)
movq $0x100, 0x60(%rbp)      # imm = 0x100
movq $0x18, 0x68(%rbp)
leaq 0x67c55(%rip), %rax     # 0x1291b4
pushq $0x1
jmp 0xc15fd
movq %rdx, (%r12)
leaq 0x6d88c(%rip), %rsi     # 0x12edfd
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
pushq $0x1
popq %rsi
callq 0xe3eb4
movb %al, 0x11(%r12)
movzbl %al, %edx
leaq 0x6d879(%rip), %rsi     # 0x12ee0f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
pushq $0x2
popq %rsi
callq 0xe3eb4
movb %al, 0x12(%r12)
movzbl %al, %edx
leaq 0x6d867(%rip), %rsi     # 0x12ee22
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movzbl 0x12(%r12), %eax
leaq 0x67be2(%rip), %rcx     # 0x1291b4
cmpq $0xb, %rax
ja 0xc1626
leaq 0x6d591(%rip), %rdx     # 0x12eb70
movslq (%rdx,%rax,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
pushq $0x2
popq %rbp
leaq 0x67af9(%rip), %rcx     # 0x1290eb
jmp 0xc1643
leaq 0x67af0(%rip), %rax     # 0x1290eb
pushq $0x2
popq %rcx
movl %ecx, 0xa4(%rbp)
movq %rax, 0xb0(%rbp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xc2d62
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
jmp 0xc1ea0
leal -0x20(%rax), %edx
cmpl $0x2, %edx
jb 0xc1643
leaq 0x43e47(%rip), %rcx     # 0x10547c
xorl %ebp, %ebp
jmp 0xc1643
leaq 0x479b0(%rip), %rcx     # 0x108ff0
pushq $0x3
popq %rbp
movq 0x10(%rsp), %rdx
movl %ebp, 0xa4(%rdx)
movq %rdx, %rbp
movq %rcx, 0xb0(%rdx)
decb %al
cmpb $0xa, %al
ja 0xc16bc
leaq 0x6d54f(%rip), %rcx     # 0x12ebb4
movzbl %al, %eax
shll $0x2, %eax
movl (%rax,%rcx), %ecx
leaq 0x6d56b(%rip), %rdx     # 0x12ebe0
movslq (%rax,%rdx), %rax
addq %rdx, %rax
jmp 0xc16c5
cmpb $0x0, 0x1(%r15)
jne 0xc13b8
movb $0x66, %al
jmp 0xc13b3
cmpb $0x0, 0x1(%r15)
jne 0xc13b8
movb $0x67, %al
jmp 0xc13b3
movq 0x10(%rsp), %rbp
andl $0x0, 0xa4(%rbp)
leaq 0x6d77c(%rip), %rax     # 0x12ee31
movq %rax, 0xb0(%rbp)
leaq 0x43db9(%rip), %rax     # 0x10547c
xorl %ecx, %ecx
movl %ecx, 0xa0(%rbp)
movq %rax, 0xa8(%rbp)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0xb0(%rbp), %rdx
leaq 0x6d74f(%rip), %rsi     # 0x12ee3a
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0xa8(%rbp), %rdx
leaq 0x4e880(%rip), %rsi     # 0x10ff83
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
cmpb $0x0, 0x11(%rbp)
je 0xc17b8
movq 0x18(%rbx), %rdi
pushq $0x3
popq %rsi
callq 0xe3fa3
movq %rax, 0x58(%rbp)
movq 0x18(%rbx), %rdi
pushq $0x5
popq %rsi
callq 0xe3fa3
movq %rax, 0x60(%rbp)
movq 0x18(%rbx), %rdi
pushq $0x7
popq %rsi
callq 0xe3eb4
movzbl %al, %eax
movq %rax, 0x68(%rbp)
leaq 0x6d6ed(%rip), %rsi     # 0x12ee49
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movl 0x58(%rbp), %edx
leaq 0x6d6e3(%rip), %rsi     # 0x12ee5e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movl 0x60(%rbp), %edx
leaq 0x6d6e0(%rip), %rsi     # 0x12ee6f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movl 0x68(%rbp), %edx
leaq 0x6d6dc(%rip), %rsi     # 0x12ee7f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x18(%rbx), %rdi
pushq $0xc
popq %rsi
callq 0xe3fa3
movq %rax, 0x18(%rbp)
movq 0x18(%rbx), %rdi
pushq $0xe
popq %rsi
callq 0xe3fa3
movq %rax, 0x20(%rbp)
movq 0x18(%rbp), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xdf038
movq 0x18(%rbx), %rdi
pushq $0x10
popq %rsi
callq 0xe3eb4
movzbl %al, %edx
movq %rdx, 0x70(%rbp)
leaq 0x6d584(%rip), %rsi     # 0x12ed85
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xc2d62
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
cmpl $0x0, 0x98(%rbp)
je 0xc1ea0
movq (%r15), %rdx
leaq 0x88(%rsp), %r15
movq %rdx, (%r15)
leaq 0x6d64b(%rip), %rsi     # 0x12ee8e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe40bf
movq %rax, %r12
leaq 0x6d64b(%rip), %rsi     # 0x12eeb9
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe40bf
movq %rax, %r14
leaq 0x6d7ad(%rip), %rsi     # 0x12f03e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
testq %r12, %r12
je 0xc1d63
movq %r12, 0x18(%rsp)
leaq 0x6d5e1(%rip), %rsi     # 0x12ee9f
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
addq $-0x2, %rax
cmpq %r12, %rax
jge 0xc18f5
leaq 0x6d5d2(%rip), %rsi     # 0x12eeb5
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xdf05a
jmp 0xc1d63
movq %r14, 0x30(%rsp)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq %rbx, %rdi
callq 0xeac74
movq %rax, %r13
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %r14
movq %r14, %rsi
callq 0xe3fc4
movq %rax, %rbp
leaq 0x6d5a9(%rip), %rsi     # 0x12eed4
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
addq %rbp, %r12
movq (%r14), %rax
addq $0x29, %rax
cmpq %r12, %rax
jg 0xc1d46
movq %r13, %rdi
callq 0xeac85
movq 0x18(%rbx), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rax
movl 0x8(%rax), %r9d
pushq $0x29
popq %rdx
pushq $0x1
popq %r14
movq %r13, %rcx
movl %r14d, %r8d
callq 0xe4c9a
movq %r13, %rdi
callq 0xead03
movq %r13, %rdi
callq 0xeb877
leaq 0x543b3(%rip), %rsi     # 0x115d41
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rsp), %rax
addq $0x29, %rax
movq %rax, 0x18(%rsp)
pushq $0x51
popq %r15
xorl %ebp, %ebp
cmpq $0x4, %rbp
je 0xc1a23
addq $0x51, %rax
cmpq %r12, %rax
jg 0xc1d46
movq %r13, %rdi
callq 0xeac85
movq 0x18(%rbx), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rax
movl 0x8(%rax), %r9d
movq %r15, %rdx
movq %r13, %rcx
movl %r14d, %r8d
callq 0xe4c9a
movq %r13, %rdi
callq 0xead03
movq %r13, %rdi
callq 0xeb877
movq %rbx, %rdi
leaq 0x6d4e9(%rip), %rsi     # 0x12eeed
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rsp), %rax
addq $0x51, %rax
movq %rax, 0x18(%rsp)
incq %rbp
jmp 0xc19af
addq $0xc, %rax
cmpq %r12, %rax
jg 0xc1d46
xorl %r15d, %r15d
leaq 0x18(%rsp), %r14
xorl %ebp, %ebp
cmpq $0x6, %r15
je 0xc1a5f
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3fc4
movq %rax, 0x50(%rsp,%r15,8)
testq %rax, %rax
pushq $0x1
popq %rax
cmovnel %eax, %ebp
incq %r15
jmp 0xc1a3a
testl %ebp, %ebp
je 0xc1acd
movq 0x10(%rsp), %r15
leaq 0x4e8(%r15), %r14
movq 0x60(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq 0x58(%rsp), %rcx
movq 0x68(%rsp), %r8
movq 0x70(%rsp), %r9
movq 0x78(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
callq 0xe0174
movb $0x2, 0x4e9(%r15)
leaq 0x90(%rsp), %rbp
pushq $0x40
popq %rdx
movq %r14, %rdi
movq %rbp, %rsi
xorl %ecx, %ecx
callq 0xe0644
leaq 0x4a3f7(%rip), %rsi     # 0x10beb7
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rsp), %rax
leaq 0x2f(%rax), %rcx
movq %rcx, 0x18(%rsp)
addq $0x58, %rax
cmpq %r12, %rax
jg 0xc1d46
movq %r13, %rdi
callq 0xeac85
movq 0x18(%rbx), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rax
movl 0x8(%rax), %r9d
pushq $0x29
popq %rdx
pushq $0x1
popq %r8
movq %r13, %rcx
callq 0xe4c9a
movq %r13, %rdi
callq 0xead03
movq %r13, %rdi
callq 0xeb877
leaq 0x6d3db(%rip), %rsi     # 0x12ef03
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rsp), %rax
leaq 0x29(%rax), %rcx
movq %rcx, 0x18(%rsp)
addq $0x2c, %rax
cmpq %r12, %rax
jg 0xc1d46
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rbp
movq %rbp, %rsi
callq 0xe3fc4
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xe3f2a
movl %eax, %esi
testq %r14, %r14
setne %al
cmpb $0x20, %sil
setne %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0xc1bab
pushq $0x64
popq %rcx
movq %r14, %rax
cqto
idivq %rcx
movq %rdx, %rcx
movzbl %sil, %r8d
leaq 0x6d376(%rip), %rsi     # 0x12ef15
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rsp), %rax
addq $0x4, %rax
cmpq %r12, %rax
jg 0xc1d46
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0xe40bf
testq %rax, %rax
je 0xc1be3
leaq 0x6d359(%rip), %rsi     # 0x12ef30
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rsp), %rax
addq $0x4, %rax
cmpq %r12, %rax
jg 0xc1d46
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %r14
movq %r14, %rsi
callq 0xe3fc4
movq 0x10(%rsp), %r15
movq %rax, 0xd0(%r15)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3fc4
movq %rax, 0xd8(%r15)
testq %rax, %rax
je 0xc1c44
movl 0xd0(%r15), %edx
leaq 0x6d311(%rip), %rsi     # 0x12ef49
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x18(%rsp)
addq $0xc, %rax
cmpq %r12, %rax
jg 0xc1d46
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %r14
movq %r14, %rsi
callq 0xe40bf
movq 0x10(%rsp), %rcx
movq %rax, 0xe0(%rcx)
leaq 0x6d2da(%rip), %rsi     # 0x12ef5d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq (%r14), %rax
addq $0x4, %rax
cmpq %r12, %rax
jg 0xc1d46
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %r14
movq %r14, %rsi
callq 0xe40bf
leaq 0x6d2c1(%rip), %rsi     # 0x12ef79
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
cmpq %r12, (%r14)
jge 0xc1d46
movq 0x18(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0xe3f2a
movq 0x10(%rsp), %r14
movb %al, 0x88(%r14)
movl $0x1, 0x9c(%r14)
movzbl %al, %edx
leaq 0x6d29c(%rip), %rsi     # 0x12ef95
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movzbl 0x88(%r14), %eax
testl %eax, %eax
je 0xc1d22
cmpl $0x4, %eax
jne 0xc1d46
movq 0x10(%rsp), %rax
movb $0x1, 0x89(%rax)
jmp 0xc1d46
movq 0x10(%rsp), %rax
movq 0x80(%rax), %rdx
testq %rdx, %rdx
je 0xc1d46
leaq 0x6d26f(%rip), %rsi     # 0x12efa9
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xdf05a
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq %r13, %rdi
callq 0xeaf3c
movq 0x10(%rsp), %rbp
movq 0x30(%rsp), %r14
testq %r14, %r14
je 0xc1ea0
leaq 0x6d2b1(%rip), %rsi     # 0x12f024
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
addq $-0x2, %rax
cmpq %r14, %rax
jge 0xc1daa
leaq 0x6d2a2(%rip), %rsi     # 0x12f03a
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0xdf05a
jmp 0xc1ea0
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3fa3
leaq 0x6d291(%rip), %rsi     # 0x12f059
movq %rbx, %rdi
movq %rax, 0x38(%rsp)
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
addq $0x8, %r14
xorl %ebp, %ebp
cmpq 0x38(%rsp), %rbp
jge 0xc1e90
cmpq $0xc7, %rbp
ja 0xc1e90
movq 0x18(%rbx), %rdi
leaq -0x6(%r14), %rsi
callq 0xe3fa3
movq %rax, %r15
movq 0x18(%rbx), %rdi
leaq -0x4(%r14), %rsi
callq 0xe409f
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq %r14, 0x30(%rsp)
movq %r14, %rsi
callq 0xe409f
movq %rax, %r14
movq %rbx, %r12
movq %rbx, %rdi
leaq 0x6d234(%rip), %rsi     # 0x12f06c
movl %ebp, %edx
movl %r15d, %ecx
movq %r13, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0xde896
cmpq $0x14, %r15
jne 0xc1e7c
movq %r12, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movq 0x18(%r12), %rsi
movq %r12, %rdi
movq %r13, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0xec5fa
movq %r12, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
incq %rbp
movq 0x30(%rsp), %r14
addq $0xa, %r14
movq %r12, %rbx
jmp 0xc1ddf
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x10(%rsp), %rbp
movq 0x18(%rbp), %rsi
movq 0x20(%rbp), %rdx
movq %rbx, %rdi
callq 0xe6be1
testl %eax, %eax
je 0xc202e
cmpb $0x67, 0x10(%rbp)
jne 0xc1ec5
movb $0x1, 0x89(%rbp)
leaq 0x6cd75(%rip), %rsi     # 0x12ec41
pushq $0x12
popq %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq (%rbp), %r15
testq %r15, %r15
jle 0xc1f44
movq 0x48(%rsp), %rax
cmpl $0x0, (%rax)
jne 0xc1f44
movq %rbx, %rdi
callq 0xeac74
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq (%rbp), %rdx
movl 0x8(%rbp), %r9d
pushq $0x12
popq %rsi
movq %rax, %rcx
xorl %r8d, %r8d
callq 0xe4c9a
movq %r14, %rdi
callq 0xeb877
leaq 0x6d163(%rip), %rsi     # 0x12f08e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq %r14, %rdi
callq 0xeaf3c
movq (%rbp), %r15
addq $0x12, %r15
cmpb $0x0, 0x11(%rbp)
pushq $0x8
popq %r14
je 0xc204f
movq 0x60(%rbp), %rcx
movq 0x68(%rbp), %rax
addq $0x7, %rax
cqto
idivq %r14
movq %rax, 0xc0(%rbp)
imulq %rcx, %rax
movq %rax, 0xc8(%rbp)
leaq 0x6ccd9(%rip), %rsi     # 0x12ec59
movq %rbx, %rdi
movq %r15, %rdx
movl %eax, %r8d
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
cmpl $0x1, 0xa4(%rbp)
movq %rbp, %r14
jne 0xc2036
movq 0x68(%r14), %rdx
cmpq $0x18, %rdx
movq %r14, %rbp
jne 0xc210e
movq 0x70(%rbp), %rdx
cmpq $0x8, %rdx
jne 0xc22a0
movq %rbp, %rax
xorl %ebp, %ebp
cmpl $0x1, 0xc(%rax)
setne %bpl
xorl %r13d, %r13d
movq 0x10(%rsp), %r12
movq 0x10(%rsp), %r14
cmpq 0x60(%r14), %r13
jge 0xc2036
movq 0x58(%r14), %r14
addq %r13, %r14
cmpq $0xff, %r14
ja 0xc2029
movq 0x18(%rbx), %rdi
movq 0xc0(%r12), %rsi
imulq %r13, %rsi
addq %r15, %rsi
movl %ebp, %edx
callq 0xe45a4
movl %eax, 0xe8(%r12,%r14,4)
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0xdf23b
incq %r13
jmp 0xc1fdf
xorl %r13d, %r13d
jmp 0xc22b4
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
addq 0xc8(%r14), %r15
movq %r14, %rbp
pushq $0x8
popq %r14
leaq 0x672af(%rip), %rsi     # 0x129305
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x18(%rbp), %r8
movq 0x70(%rbp), %rcx
leaq 0x7(%rcx), %rax
cqto
idivq %r14
movq %rax, 0xb8(%rbp)
cmpq $0x1, %rcx
jne 0xc209d
addq $0x7, %r8
movq %r8, %rax
cqto
idivq %r14
movq %rax, %r8
jmp 0xc20a1
imulq %rax, %r8
imulq 0x20(%rbp), %r8
movq %r8, 0x28(%rbp)
movl 0xa4(%rbp), %edx
leal -0x1(%rdx), %eax
cmpl $0x3, %eax
jae 0xc20ee
cmpl $0x2, %edx
je 0xc211a
cmpl $0x1, %edx
je 0xc20c8
cmpq $0x1, %rcx
je 0xc2130
cmpq $0x8, %rcx
je 0xc2130
movq 0xb0(%rbp), %rdx
leaq 0x6cbc4(%rip), %rsi     # 0x12eca0
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0xc22b4
movq 0xb0(%rbp), %rcx
leaq 0x6cb84(%rip), %rsi     # 0x12ec80
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0xc22b4
leaq 0x6cf88(%rip), %rsi     # 0x12f09d
jmp 0xc22a7
cmpq $0x20, %rcx
ja 0xc20ce
movabsq $0x101018000, %rax      # imm = 0x101018000
btq %rcx, %rax
jae 0xc20ce
movl 0xa0(%rbp), %eax
cmpl $0x1, %eax
je 0xc2162
cmpl $0x2, %eax
jne 0xc228a
cmpq $0x7, %rcx
ja 0xc22e5
leaq 0x6cb75(%rip), %rsi     # 0x12ecca
xorl %r13d, %r13d
movq %rbx, %rdi
movl %ecx, %edx
jmp 0xc22ad
movq 0x18(%rbx), %rdi
movq %r15, %rsi
movq %r8, %rdx
callq 0xe6248
movq %rax, %r13
leaq 0x18(%rbp), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xc2669
pushq $-0x2
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0xe0(%rbp), %rdx
testq %rdx, %rdx
je 0xc22b4
pushq $0x2
popq %r15
leaq 0x6d0e9(%rip), %rsi     # 0x12f29b
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x18(%rbx), %rdi
movq 0xe0(%rbp), %rsi
callq 0xe3eb4
movzbl %al, %eax
movq %rax, 0x38(%rbp)
movq 0x18(%rbx), %rdi
movq 0xe0(%rbp), %rsi
incq %rsi
callq 0xe3eb4
movzbl %al, %ecx
movq %rcx, 0x40(%rbp)
movl 0x38(%rbp), %edx
leaq 0x5bcf3(%rip), %rsi     # 0x11def5
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x38(%rbp), %rsi
movq 0x40(%rbp), %rdx
testq %rsi, %rsi
je 0xc241a
testq %rdx, %rdx
jne 0xc241c
leaq 0x6d085(%rip), %rsi     # 0x12f2b2
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf05a
movq 0x18(%rbx), %rdi
movq 0xe0(%rbp), %rsi
callq 0xe3fa3
movq %rax, 0x38(%rbp)
movq 0x18(%rbx), %rdi
movq 0xe0(%rbp), %rsi
addq $0x2, %rsi
callq 0xe3fa3
movq %rax, 0x40(%rbp)
movl 0x38(%rbp), %edx
leaq 0x6d0b0(%rip), %rsi     # 0x12f31d
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0xde896
movq 0x38(%rbp), %rsi
movq 0x40(%rbp), %rdx
pushq $0x4
popq %r15
jmp 0xc241c
leaq 0x6ca76(%rip), %rsi     # 0x12ed07
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0xc22b4
leaq 0x6ce20(%rip), %rsi     # 0x12f0c7
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
movq %r13, %rdi
callq 0xe5591
movl 0x44(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xded32
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r8, %rsi
callq 0xe59cd
movq %rax, %r12
movq %rax, %rdi
callq 0xe589c
leaq 0x50(%rsp), %r14
leaq 0x18(%rsp), %r13
leaq 0x90(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0xee7ee
movq 0x18(%rbx), %rax
movq %rax, (%r14)
movq %r15, 0x8(%r14)
movq 0x18(%rax), %rax
subq %r15, %rax
movq %rax, 0x10(%r14)
movq %r12, (%r13)
movb $0x1, 0x8(%r13)
movq 0x28(%rbp), %rcx
movq %rcx, 0x10(%r13)
movq 0xb8(%rbp), %r13
leaq -0x9(%r13), %rdx
movq %r12, 0x38(%rsp)
cmpq $-0x8, %rdx
jb 0xc24b0
xorl %edx, %edx
leaq 0x88(%rsp), %rbp
movq %r15, %r12
addq %r15, %rax
cmpq %rax, %r12
jge 0xc2493
cmpq %rcx, %rdx
jge 0xc2493
movq %rdx, 0x30(%rsp)
movq 0x50(%rsp), %rdi
movq %r12, %rsi
callq 0xe3eb4
incq %r12
testb %al, %al
js 0xc23be
incb %al
movzbl %al, %r14d
movq 0x50(%rsp), %rdi
imulq %r13, %r14
movq 0x18(%rsp), %rcx
movq %r12, %rsi
movq %r14, %rdx
callq 0xe45f4
movq %r14, %r15
jmp 0xc23fb
andb $0x7f, %al
incb %al
movzbl %al, %r15d
movq 0x50(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0xe3cb7
movq %r15, %r14
subq $0x1, %r14
jb 0xc23f4
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xe46ba
jmp 0xc23dc
imulq %r13, %r15
movq %r13, %r14
movq 0x30(%rsp), %rdx
addq %r15, %rdx
addq %r14, %r12
movq 0x58(%rsp), %r15
movq 0x60(%rsp), %rax
movq 0x28(%rsp), %rcx
jmp 0xc236c
xorl %esi, %esi
movq %rbx, %rdi
callq 0xe6be1
testl %eax, %eax
je 0xc2478
movq %rbp, %r12
addq $0x38, %r12
movq 0x38(%rbp), %rdx
imulq 0x40(%rbp), %rdx
imulq 0xb8(%rbp), %rdx
movq %rdx, 0x48(%rbp)
movq 0x18(%rbx), %rdi
addq 0xe0(%rbp), %r15
movq %r15, %rsi
callq 0xe6248
movq %rax, %r14
leaq 0x5ba45(%rip), %r8      # 0x11dea6
pushq $0x1
popq %r9
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0xc2669
jmp 0xc247b
xorl %r14d, %r14d
movq %r14, %rdi
callq 0xe5591
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
jmp 0xc22b4
subq %r15, %r12
movq %r12, 0x98(%rsp)
movb $0x1, 0x94(%rsp)
movq 0x18(%rsp), %r12
movq 0x10(%rsp), %rbp
movq %r12, %rdi
callq 0xe58e8
cmpl $0x0, 0x90(%rsp)
je 0xc24f0
leaq 0x90(%rsp), %rsi
movq %rbx, %rdi
callq 0xee7bc
leaq 0x45826(%rip), %rsi     # 0x107cff
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xdf2a5
movq 0x38(%rsp), %r13
jmp 0xc22b4
movq 0x98(%rsp), %rdx
movq 0x38(%rsp), %r13
movq 0x18(%r13), %rcx
leaq 0x4b1b3(%rip), %rsi     # 0x10d6bb
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
jmp 0xc2174