// File: /workspace/github_c_makefile_star2_O3/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 $0xe8, %rsp
movq %rdi, %rbx
leaq 0x3c(%rsp), %rsi
callq 0xe8a1c
movl $0x4f8, %esi            # imm = 0x4F8
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %r13
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0xeb220
movl %eax, 0x8(%r13)
movb $0x64, 0x10(%r13)
leaq 0x729f1(%rip), %rsi     # 0x13bf1d
movq %rbx, %rdi
callq 0xe9b74
testq %rax, %rax
je 0xc957b
movq %rax, %r15
leaq 0x47034(%rip), %rsi     # 0x110577
movq %rax, %rdi
callq 0x181a0
testl %eax, %eax
je 0xc9575
movzbl (%r15), %eax
cmpl $0x32, %eax
je 0xc985c
cmpl $0x31, %eax
je 0xc984a
cmpl $0x30, %eax
jne 0xc957b
cmpb $0x0, 0x1(%r15)
jne 0xc957b
movb $0x65, %al
jmp 0xc9577
movb $0x64, %al
movb %al, 0x10(%r13)
leaq 0x90(%r13), %r15
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0xcaf0d
movl %eax, 0x98(%r13)
testl %eax, %eax
leaq 0x5ecb7(%rip), %rax     # 0x128256
leaq 0x6db92(%rip), %rdx     # 0x137138
cmoveq %rax, %rdx
leaq 0x72a6c(%rip), %rsi     # 0x13c01d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
cmpl $0x0, 0x98(%r13)
jne 0xc9607
movq 0x18(%rbx), %rdi
movl $0x2, %esi
callq 0xeead3
testb %al, %al
jne 0xc9607
movq 0x18(%rbx), %rdi
movl $0x14, %esi
callq 0xeed0d
cmpq $0x49474348, %rax       # imm = 0x49474348
jne 0xc9607
leaq 0xc(%r13), %rax
movq %rax, 0x28(%rsp)
movl $0x1, 0xc(%r13)
leaq 0x72922(%rip), %rsi     # 0x13bf27
jmp 0xc961f
leaq 0xc(%r13), %rax
movq %rax, 0x28(%rsp)
movl $0x0, 0xc(%r13)
leaq 0x6119f(%rip), %rsi     # 0x12a7be
movq %rbx, %rdi
callq 0xeb125
movl $0x1, 0x50(%r13)
movl 0xc(%r13), %r14d
leaq 0x700b4(%rip), %rsi     # 0x1396ee
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe8617
movl $0x1, %ebp
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0xeead3
cmpl $0x1, %r14d
jne 0xc972c
testb %al, %al
movzbl %al, %eax
movl $0x12, %ecx
cmovnel %eax, %ecx
movzbl %cl, %eax
movq %rax, (%r13)
movl $0x1, 0xa0(%r13)
leaq 0x4707e(%rip), %rax     # 0x110711
movq %rax, 0xa8(%r13)
movq 0x18(%rbx), %rdi
movl $0xc, %esi
callq 0xeebc8
movq %rax, 0x18(%r13)
movq 0x18(%rbx), %rdi
movl $0xe, %esi
callq 0xeebc8
movq %rax, 0x20(%r13)
movq 0x18(%r13), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe8f88
movq 0x18(%rbx), %rdi
movl $0x10, %esi
callq 0xeead3
movzbl %al, %edx
movq %rdx, 0x70(%r13)
leaq 0x7298c(%rip), %rsi     # 0x13c075
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
cmpq $0x8, 0x70(%r13)
jne 0xc97c0
movb $0x1, 0x11(%r13)
movq $0x0, 0x58(%r13)
movq $0x100, 0x60(%r13)      # imm = 0x100
movq $0x18, 0x68(%r13)
leaq 0x6cd92(%rip), %rax     # 0x1364b4
movl $0x1, %ecx
jmp 0xc97cc
movzbl %al, %edx
movq %rdx, (%r13)
leaq 0x729b3(%rip), %rsi     # 0x13c0ed
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0xeead3
movb %al, 0x11(%r13)
movzbl %al, %edx
leaq 0x7299f(%rip), %rsi     # 0x13c0ff
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movl $0x2, %esi
callq 0xeead3
movb %al, 0x12(%r13)
movzbl %al, %edx
leaq 0x7298c(%rip), %rsi     # 0x13c112
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movzbl 0x12(%r13), %eax
leaq 0x6cd18(%rip), %rcx     # 0x1364b4
cmpq $0xb, %rax
ja 0xc97f7
leaq 0x726b7(%rip), %rdx     # 0x13be60
movslq (%rdx,%rax,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
leaq 0x6cc32(%rip), %rcx     # 0x1363eb
movl $0x2, %ebp
jmp 0xc9816
leaq 0x6cc24(%rip), %rax     # 0x1363eb
movl $0x2, %ecx
movl %ecx, 0xa4(%r13)
movq %rax, 0xb0(%r13)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xcb045
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
jmp 0xc9c95
leal -0x20(%rax), %edx
cmpl $0x2, %edx
jb 0xc9816
leaq 0x48c96(%rip), %rcx     # 0x11249c
xorl %ebp, %ebp
jmp 0xc9816
leaq 0x4c86f(%rip), %rcx     # 0x116080
movl $0x3, %ebp
movl %ebp, 0xa4(%r13)
movq %rcx, 0xb0(%r13)
decb %al
cmpb $0xa, %al
ja 0xc9887
leaq 0x72673(%rip), %rcx     # 0x13bea4
movzbl %al, %eax
shll $0x2, %eax
movl (%rax,%rcx), %ecx
leaq 0x7268f(%rip), %rdx     # 0x13bed0
movslq (%rax,%rdx), %rax
addq %rdx, %rax
jmp 0xc9890
cmpb $0x0, 0x1(%r15)
jne 0xc957b
movb $0x66, %al
jmp 0xc9577
cmpb $0x0, 0x1(%r15)
jne 0xc957b
movb $0x67, %al
jmp 0xc9577
movl $0x0, 0xa4(%r13)
leaq 0x728a1(%rip), %rax     # 0x13c121
movq %rax, 0xb0(%r13)
leaq 0x48c0e(%rip), %rax     # 0x11249c
xorl %ecx, %ecx
movl %ecx, 0xa0(%r13)
movq %rax, 0xa8(%r13)
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0xb0(%r13), %rdx
leaq 0x72871(%rip), %rsi     # 0x13c12a
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0xa8(%r13), %rdx
leaq 0x537a2(%rip), %rsi     # 0x11d073
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpb $0x0, 0x11(%r13)
je 0xc9996
movq 0x18(%rbx), %rdi
movl $0x3, %esi
callq 0xeebc8
movq %rax, 0x58(%r13)
movq 0x18(%rbx), %rdi
movl $0x5, %esi
callq 0xeebc8
movq %rax, 0x60(%r13)
movq 0x18(%rbx), %rdi
movl $0x7, %esi
callq 0xeead3
movzbl %al, %eax
movq %rax, 0x68(%r13)
leaq 0x72806(%rip), %rsi     # 0x13c139
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movl 0x58(%r13), %edx
leaq 0x727f9(%rip), %rsi     # 0x13c14e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movl 0x60(%r13), %edx
leaq 0x727f5(%rip), %rsi     # 0x13c15f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movl 0x68(%r13), %edx
leaq 0x727f0(%rip), %rsi     # 0x13c16f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x18(%rbx), %rdi
movl $0xc, %esi
callq 0xeebc8
movq %rax, 0x18(%r13)
movq 0x18(%rbx), %rdi
movl $0xe, %esi
callq 0xeebc8
movq %rax, 0x20(%r13)
movq 0x18(%r13), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe8f88
movq 0x18(%rbx), %rdi
movl $0x10, %esi
callq 0xeead3
movzbl %al, %edx
movq %rdx, 0x70(%r13)
leaq 0x72690(%rip), %rsi     # 0x13c075
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movq %r13, %rsi
callq 0xcb045
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
cmpl $0x0, 0x98(%r13)
je 0xc9c95
movq (%r15), %rdx
leaq 0x78(%rsp), %r15
movq %rdx, (%r15)
leaq 0x72757(%rip), %rsi     # 0x13c17e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeed83
movq %rax, %r12
leaq 0x72755(%rip), %rsi     # 0x13c1a9
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeed83
movq %rax, %r15
leaq 0x728b7(%rip), %rsi     # 0x13c32e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
testq %r12, %r12
je 0xc9b4c
movq %r12, 0x10(%rsp)
leaq 0x726e9(%rip), %rsi     # 0x13c18f
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
addq $-0x2, %rax
cmpq %r12, %rax
jge 0xc9ada
leaq 0x726da(%rip), %rsi     # 0x13c1a5
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8faa
jmp 0xc9b4c
movq %r13, 0x8(%rsp)
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %rbx, %rdi
callq 0xf6410
movq %rax, %r13
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0xeebeb
movq %rax, %rbp
leaq 0x726b2(%rip), %rsi     # 0x13c1c4
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
addq %rbp, %r12
movq (%r14), %rax
addq $0x29, %rax
cmpq %r12, %rax
jle 0xca0ee
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq %r13, %rdi
callq 0xf6753
movq 0x8(%rsp), %r13
testq %r15, %r15
je 0xc9c95
leaq 0x727b8(%rip), %rsi     # 0x13c314
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
addq $-0x2, %rax
cmpq %r15, %rax
jge 0xc9b93
leaq 0x727a9(%rip), %rsi     # 0x13c32a
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8faa
jmp 0xc9c95
movq %r13, 0x8(%rsp)
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeebc8
movq %rax, %r14
leaq 0x7278e(%rip), %rsi     # 0x13c349
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0xe8617
testq %r14, %r14
jle 0xc9c83
movq %r14, %rcx
decq %rcx
movl $0xc7, %eax
cmpq %rax, %rcx
cmovaeq %rax, %rcx
incq %rcx
movq %rcx, 0x30(%rsp)
addq $0x8, %r15
xorl %ebp, %ebp
movq 0x18(%rbx), %rdi
leaq -0x6(%r15), %rsi
callq 0xeebc8
movq %rax, %r12
movq 0x18(%rbx), %rdi
leaq -0x4(%r15), %rsi
callq 0xeed61
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeed61
movq %rax, %r14
movq %rbx, %rdi
leaq 0x72732(%rip), %rsi     # 0x13c35c
movl %ebp, %edx
movl %r12d, %ecx
movq %r13, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0xe8617
cmpq $0x14, %r12
jne 0xc9c71
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rsi
movq %rbx, %rdi
movq %r13, %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0xf7eb8
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
incq %rbp
addq $0xa, %r15
cmpq %rbp, 0x30(%rsp)
jne 0xc9bf1
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x8(%rsp), %r13
movq 0x18(%r13), %rsi
movq 0x20(%r13), %rdx
movq %rbx, %rdi
callq 0xf1db1
testl %eax, %eax
je 0xc9e99
cmpb $0x67, 0x10(%r13)
jne 0xc9cbc
movb $0x1, 0x89(%r13)
leaq 0x7226e(%rip), %rsi     # 0x13bf31
movl $0x12, %edx
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq (%r13), %r12
testq %r12, %r12
jle 0xc9d41
movq 0x28(%rsp), %rax
cmpl $0x0, (%rax)
jne 0xc9d41
movq %rbx, %rdi
callq 0xf6410
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq (%r13), %rdx
movl 0x8(%r13), %r9d
movl $0x12, %esi
movq %rax, %rcx
xorl %r8d, %r8d
callq 0xefbd7
movq %r14, %rdi
callq 0xf70f6
leaq 0x72656(%rip), %rsi     # 0x13c37e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
callq 0xf6753
movq (%r13), %r12
addq $0x12, %r12
cmpb $0x0, 0x11(%r13)
je 0xc9e3b
movq 0x60(%r13), %rcx
movq 0x68(%r13), %r8
leaq 0x7(%r8), %rax
addq $0xe, %r8
testq %rax, %rax
cmovnsq %rax, %r8
sarq $0x3, %r8
movq %r8, 0xc0(%r13)
imulq %rcx, %r8
movq %r8, 0xc8(%r13)
leaq 0x721c5(%rip), %rsi     # 0x13bf49
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
cmpl $0x1, 0xa4(%r13)
jne 0xc9e27
movq 0x68(%r13), %rdx
cmpq $0x18, %rdx
jne 0xc9f12
movq 0x70(%r13), %rdx
cmpq $0x8, %rdx
jne 0xca0aa
xorl %ebp, %ebp
cmpl $0x1, 0xc(%r13)
setne %cl
movq 0x60(%r13), %rax
testq %rax, %rax
jle 0xc9e27
movb %cl, %bpl
xorl %r15d, %r15d
movq 0x58(%r13), %r14
addq %r15, %r14
cmpq $0xff, %r14
ja 0xc9e1f
movq 0x18(%rbx), %rdi
movq 0xc0(%r13), %rsi
imulq %r15, %rsi
addq %r12, %rsi
movl %ebp, %edx
callq 0xef42f
movl %eax, 0xe8(%r13,%r14,4)
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0xe91fc
movq 0x60(%r13), %rax
incq %r15
cmpq %rax, %r15
jl 0xc9ddd
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq 0xc8(%r13), %r12
leaq 0x6c7c3(%rip), %rsi     # 0x136605
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x70(%r13), %rcx
leaq 0x7(%rcx), %rdx
leaq 0xe(%rcx), %rax
testq %rdx, %rdx
cmovnsq %rdx, %rax
movq 0x18(%r13), %rdx
sarq $0x3, %rax
movq %rax, 0xb8(%r13)
cmpq $0x1, %rcx
jne 0xc9ea0
leaq 0x7(%rdx), %rax
addq $0xe, %rdx
testq %rax, %rax
cmovnsq %rax, %rdx
sarq $0x3, %rdx
jmp 0xc9ea4
xorl %ebp, %ebp
jmp 0xca0bd
imulq %rax, %rdx
imulq 0x20(%r13), %rdx
movq %rdx, 0x28(%r13)
movl 0xa4(%r13), %eax
leal -0x1(%rax), %esi
cmpl $0x3, %esi
jae 0xc9ef1
cmpl $0x2, %eax
je 0xc9f1e
cmpl $0x1, %eax
je 0xc9ecc
cmpq $0x1, %rcx
je 0xc9f34
cmpq $0x8, %rcx
je 0xc9f34
movq 0xb0(%r13), %rdx
leaq 0x720b0(%rip), %rsi     # 0x13bf90
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0xca0bd
movq 0xb0(%r13), %rcx
leaq 0x72071(%rip), %rsi     # 0x13bf70
xorl %ebp, %ebp
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9295
jmp 0xca0bd
leaq 0x72474(%rip), %rsi     # 0x13c38d
jmp 0xca0b1
cmpq $0x20, %rcx
ja 0xc9ed2
movabsq $0x101018000, %rax      # imm = 0x101018000
btq %rcx, %rax
jae 0xc9ed2
movl 0xa0(%r13), %eax
cmpl $0x1, %eax
je 0xc9f66
cmpl $0x2, %eax
jne 0xca095
cmpq $0x7, %rcx
ja 0xca4ee
leaq 0x72060(%rip), %rsi     # 0x13bfba
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ecx, %edx
jmp 0xca0b6
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xf1388
movq %rax, %rbp
leaq 0x18(%r13), %rdx
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xca8bf
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0xe8a15
movq 0xe0(%r13), %rdx
testq %rdx, %rdx
je 0xca0bd
leaq 0x725da(%rip), %rsi     # 0x13c58b
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rdi
movq 0xe0(%r13), %rsi
callq 0xeead3
movzbl %al, %eax
movq %rax, 0x38(%r13)
movq 0x18(%rbx), %rdi
movq 0xe0(%r13), %rsi
incq %rsi
callq 0xeead3
movzbl %al, %ecx
movq %rcx, 0x40(%r13)
movl 0x38(%r13), %edx
leaq 0x61161(%rip), %rsi     # 0x12b165
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x38(%r13), %rsi
movq 0x40(%r13), %rdx
movl $0x2, %r15d
testq %rsi, %rsi
je 0xca63e
testq %rdx, %rdx
jne 0xca640
leaq 0x7256d(%rip), %rsi     # 0x13c5a2
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8faa
movq 0x18(%rbx), %rdi
movq 0xe0(%r13), %rsi
callq 0xeebc8
movq %rax, 0x38(%r13)
movq 0x18(%rbx), %rdi
movq 0xe0(%r13), %rsi
addq $0x2, %rsi
callq 0xeebc8
movq %rax, 0x40(%r13)
movl 0x38(%r13), %edx
leaq 0x72597(%rip), %rsi     # 0x13c60d
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x38(%r13), %rsi
movq 0x40(%r13), %rdx
movl $0x4, %r15d
jmp 0xca640
leaq 0x71f5b(%rip), %rsi     # 0x13bff7
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0xca0bd
leaq 0x72306(%rip), %rsi     # 0x13c3b7
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq %rbp, %rdi
callq 0xf052b
movl 0x3c(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe8be2
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0xf6423
movq 0x18(%rbx), %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rax
movl 0x8(%rax), %r9d
movl $0x29, %edx
movq %r13, %rcx
movl $0x1, %r8d
callq 0xefbd7
movq %r13, %rdi
callq 0xf64a0
movq %r13, %rdi
callq 0xf70f6
leaq 0x58dcf(%rip), %rsi     # 0x122f01
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x10(%rsp), %rax
addq $0x29, %rax
movq %rax, 0x10(%rsp)
leaq 0x72089(%rip), %r14     # 0x13c1dd
xorl %ebp, %ebp
addq $0x51, %rax
cmpq %r12, %rax
jg 0xc9b32
movq %r13, %rdi
callq 0xf6423
movq 0x18(%rbx), %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rax
movl 0x8(%rax), %r9d
movl $0x51, %edx
movq %r13, %rcx
movl $0x1, %r8d
callq 0xefbd7
movq %r13, %rdi
callq 0xf64a0
movq %r13, %rdi
callq 0xf70f6
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
movq 0x10(%rsp), %rcx
leaq 0x51(%rcx), %rax
movq %rax, 0x10(%rsp)
incq %rbp
cmpq $0x4, %rbp
jne 0xca156
addq $0x5d, %rcx
cmpq %r12, %rcx
jg 0xc9b32
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0xeebeb
movq %rax, 0x40(%rsp,%r14,8)
testq %rax, %rax
movl $0x1, %eax
cmovnel %eax, %ebp
incq %r14
cmpq $0x6, %r14
jne 0xca1db
testl %ebp, %ebp
je 0xca271
movq 0x8(%rsp), %rbp
leaq 0x4e8(%rbp), %r14
movq 0x50(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
movq 0x58(%rsp), %r8
movq 0x60(%rsp), %r9
movq 0x68(%rsp), %rax
movq %rax, (%rsp)
movq %r14, %rdi
callq 0xea98e
movb $0x2, 0x4e9(%rbp)
leaq 0x80(%rsp), %rbp
movl $0x40, %edx
movq %r14, %rdi
movq %rbp, %rsi
xorl %ecx, %ecx
callq 0xeaf46
leaq 0x4ed43(%rip), %rsi     # 0x118fa7
movq %rbx, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x10(%rsp), %rax
leaq 0x2f(%rax), %rcx
movq %rcx, 0x10(%rsp)
addq $0x58, %rax
cmpq %r12, %rax
jg 0xc9b32
movq %r13, %rdi
callq 0xf6423
movq 0x18(%rbx), %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rax
movl 0x8(%rax), %r9d
movl $0x29, %edx
movq %r13, %rcx
movl $0x1, %r8d
callq 0xefbd7
movq %r13, %rdi
callq 0xf64a0
movq %r13, %rdi
callq 0xf70f6
leaq 0x71f23(%rip), %rsi     # 0x13c1f3
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x10(%rsp), %rax
leaq 0x29(%rax), %rcx
movq %rcx, 0x10(%rsp)
addq $0x2c, %rax
cmpq %r12, %rax
jg 0xc9b32
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0xeebeb
movq %rax, %rbp
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movl %eax, %ecx
testq %rbp, %rbp
setne %al
cmpb $0x20, %cl
setne %dl
orb %al, %dl
cmpb $0x1, %dl
jne 0xca369
movabsq $-0x5c28f5c28f5c28f5, %rdx # imm = 0xA3D70A3D70A3D70B
movq %rbp, %rax
imulq %rdx
addq %rbp, %rdx
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x6, %rdx
addl %eax, %edx
imull $0x64, %edx, %eax
subl %eax, %ebp
movzbl %cl, %r8d
leaq 0x71ea8(%rip), %rsi     # 0x13c205
movq %rbx, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x10(%rsp), %rax
addq $0x4, %rax
cmpq %r12, %rax
jg 0xc9b32
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0xeed83
testq %rax, %rax
je 0xca3a1
leaq 0x71e8b(%rip), %rsi     # 0x13c220
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x10(%rsp), %rax
addq $0x4, %rax
cmpq %r12, %rax
jg 0xc9b32
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0xeebeb
movq 0x8(%rsp), %rbp
movq %rax, 0xd0(%rbp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeebeb
movq %rax, 0xd8(%rbp)
testq %rax, %rax
je 0xca401
movl 0xd0(%rbp), %edx
leaq 0x71e44(%rip), %rsi     # 0x13c239
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x10(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x10(%rsp)
addq $0xc, %rax
cmpq %r12, %rax
jg 0xc9b32
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0xeed83
movq 0x8(%rsp), %rcx
movq %rax, 0xe0(%rcx)
leaq 0x71e0d(%rip), %rsi     # 0x13c24d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq (%r14), %rax
addq $0x4, %rax
cmpq %r12, %rax
jg 0xc9b32
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0xeed83
leaq 0x71df4(%rip), %rsi     # 0x13c269
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
cmpq %r12, (%r14)
jge 0xc9b32
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0xeeb4b
movq 0x8(%rsp), %r14
movb %al, 0x88(%r14)
movl $0x1, 0x9c(%r14)
movzbl %al, %edx
leaq 0x71dcb(%rip), %rsi     # 0x13c285
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movzbl 0x88(%r14), %eax
testl %eax, %eax
je 0xca738
cmpl $0x4, %eax
jne 0xc9b32
movq 0x8(%rsp), %rax
movb $0x1, 0x89(%rax)
jmp 0xc9b32
movq %rbx, %rdi
movq %rdx, %rsi
movl $0x1, %edx
callq 0xf09c5
movq %rax, %rbp
movq %rax, %rdi
callq 0xf0855
leaq 0x40(%rsp), %r14
leaq 0x10(%rsp), %r15
leaq 0x80(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xfa1dc
movq 0x18(%rbx), %rax
movq %rax, (%r14)
movq %r12, 0x8(%r14)
movq 0x18(%rax), %rax
subq %r12, %rax
movq %rax, 0x10(%r14)
movq %rbp, (%r15)
movb $0x1, 0x8(%r15)
movq 0x28(%r13), %rcx
movq %rcx, 0x10(%r15)
movq %r13, 0x8(%rsp)
movq 0xb8(%r13), %r13
leaq -0x9(%r13), %rdx
movq %rbp, %rdi
cmpq $-0x8, %rdx
jb 0xca6d4
testq %rax, %rax
setg %al
testq %rcx, %rcx
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xca6bb
movq %rbp, 0x28(%rsp)
xorl %r14d, %r14d
leaq 0x78(%rsp), %rbp
movq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0xeead3
movq %r12, %r15
incq %r15
testb %al, %al
js 0xca5cb
incb %al
movzbl %al, %r12d
movq 0x40(%rsp), %rdi
imulq %r13, %r12
movq 0x10(%rsp), %rcx
movq %r15, %rsi
movq %r12, %rdx
callq 0xef481
movq %r12, %rdx
jmp 0xca60c
andb $0x7f, %al
incb %al
movzbl %al, %r12d
movq 0x40(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0xee8d4
movq %r12, 0x30(%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xef547
decq %r12
jne 0xca5eb
movq 0x30(%rsp), %rdx
imulq %r13, %rdx
movq %r13, %r12
addq %r15, %r12
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
addq %rax, %rcx
cmpq %rcx, %r12
jge 0xca62f
addq %rdx, %r14
cmpq 0x20(%rsp), %r14
jl 0xca590
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rbp
jmp 0xca6c1
xorl %esi, %esi
movq %rbx, %rdi
callq 0xf1db1
testl %eax, %eax
je 0xca69e
movq %r13, %r12
addq $0x38, %r12
movq 0x38(%r13), %rdx
imulq 0x40(%r13), %rdx
imulq 0xb8(%r13), %rdx
movq %rdx, 0x48(%r13)
movq 0x18(%rbx), %rdi
addq 0xe0(%r13), %r15
movq %r15, %rsi
callq 0xf1388
movq %rax, %r14
leaq 0x60a91(%rip), %r8      # 0x12b116
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rax, %rcx
movl $0x1, %r9d
callq 0xca8bf
jmp 0xca6a1
xorl %r14d, %r14d
movq %r14, %rdi
callq 0xf052b
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
jmp 0xca0bd
movq %rbp, %rdi
movq %r12, %rax
subq %rax, %r12
movq %r12, 0x88(%rsp)
movb $0x1, 0x84(%rsp)
callq 0xf08ba
cmpl $0x0, 0x80(%rsp)
je 0xca711
leaq 0x80(%rsp), %rsi
movq %rbx, %rdi
callq 0xfa1a4
leaq 0x4a665(%rip), %rsi     # 0x114d5f
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9295
movq 0x8(%rsp), %r13
jmp 0xca0bd
movq 0x88(%rsp), %rdx
movq 0x18(%rbp), %rcx
leaq 0x50087(%rip), %rsi     # 0x11a7ab
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x8(%rsp), %r13
jmp 0xc9f75
movq 0x8(%rsp), %rax
movq 0x80(%rax), %rdx
testq %rdx, %rdx
je 0xc9b32
leaq 0x71b45(%rip), %rsi     # 0x13c299
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xe8faa
jmp 0xc9b32