// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/insetpix.c
// Function: de_run_insetpix
static void de_run_insetpix(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	UI pix_version;
	i64 item;
	i64 pos;
	i64 num_skipped_items = 0;
	int saved_indent_level;

	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_CP437);

	pix_version = (UI)de_getu16le(0);
	d->item_count = de_getu16le(2);
	de_dbg(c, "version: %u", pix_version);
	de_dbg(c, "index at 4, %d items", (int)d->item_count);

	// Scan the index, and record the location of items we care about.
	// (The index will be read again when converting the image bitmap.)
	de_dbg_indent(c, 1);
	for(item=0; item<d->item_count; item++) {
		struct insetpix_item_data itd;
		u8 skip_flag = 0;

		pos = 4 + 8*item;
		if(pos+8 > c->infile->len) goto done;

		insetpix_read_item(c, pos, &itd);
		if(itd.is_tile) {
			if(d->num_tiles_found==0) {
				d->idx_of_1st_tile = item;
			}
			d->num_tiles_found++;
		}
		skip_flag = itd.is_special;
		if(skip_flag) {
			num_skipped_items++;
		}
		if(skip_flag && c->debug_level<2) { // Skip "tile" items for now
			continue;
		}

		insetpix_dbg_item(c, &itd, item);

		if(skip_flag) {
			continue;
		}

		if(itd.loc + itd.len > c->infile->len) {
			de_err(c, "Item #%d (ID %u) goes beyond end of file",
				(int)item, itd.id);
			goto done;
		}

		switch(itd.id) {
		case 0:
			d->imginfo_pos = itd.loc;
			d->imginfo_len = itd.len;
			break;
		case 1:
			if(!d->pal_pos) {
				d->pal_pos = itd.loc;
				d->pal_len = itd.len;
			}
			break;
		case 2:
			d->tileinfo_pos = itd.loc;
			d->tileinfo_len = itd.len;
			break;
		}
	}
	if(c->debug_level<2) {
		de_dbg(c, "other items not listed: %"I64_FMT, num_skipped_items);
	}
	de_dbg(c, "number of tiles: %"I64_FMT, d->num_tiles_found);
	de_dbg_indent(c, -1);

	do_image_info(c, d);
	if(!d->have_image_info) {
		de_err(c, "Bad or missing Image Info");
		goto done;
	}

	if(d->pal_sample_descriptor[0]!=0 && d->pal_sample_descriptor[1]==0 &&
		d->pal_sample_descriptor[2]==0 && d->pal_sample_descriptor[3]==0)
	{
		d->is_grayscale = 1;
	}

	do_palette(c, d);
	if(!d->have_pal_data) {
		de_err(c, "Bad or missing palette");
		goto done;
	}

	do_tileinfo(c, d);
	if(!d->have_tile_info) {
		de_err(c, "Bad or missing Tile Info");
		goto done;
	}

	if(d->graphics_type==0) {
		do_char_graphics(c, d);
	}
	else {
		if(d->gfore<1 || d->gfore>8) {
			de_err(c, "Inset PIX with %d bits/pixel are not supported", (int)d->gfore);
			goto done;
		}

		switch(d->descriptor_combined) {
		case 0x00040404U:
		case 0x00404040U:
		case 0x02000000U:
		case 0x02020202U:
			break;
		default:
			de_warn(c, "Not a known image type. This image might not be handled correctly.");
		}

		do_bitmap(c, d);
	}

done:
	if(d) {
		de_bitmap_destroy(d->tile_img);
		de_free(c, d);
	}
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
leaq 0x38(%rsp), %rsi
callq 0xe958c
movl $0x4f0, %esi            # imm = 0x4F0
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r14
movq $0x0, 0x8(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0xeb7d1
movl %eax, (%r14)
movq 0x18(%rbx), %rdi
xorl %esi, %esi
callq 0xef1ca
movq %rax, %r12
movq 0x18(%rbx), %rdi
movl $0x2, %esi
callq 0xef1ca
movq %rax, 0x40(%r14)
leaq 0xb882e(%rip), %rsi     # 0x1369ba
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
movl 0x40(%r14), %edx
leaq 0xab535(%rip), %rsi     # 0x1296d9
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
cmpq $0x0, 0x40(%r14)
jle 0x7e2de
movl $0xc, %r13d
movq $0x0, 0x8(%rsp)
xorl %ebp, %ebp
movq 0x18(%rbx), %rax
movb $0x1, %r12b
cmpq 0x18(%rax), %r13
jg 0x7e2c4
leaq -0x8(%r13), %rsi
movq %rbx, %rdi
leaq 0x60(%rsp), %rdx
callq 0x7f126
cmpb $0x0, 0x69(%rsp)
je 0x7e214
movq 0x48(%r14), %rax
testq %rax, %rax
jne 0x7e20d
movq %rbp, 0x50(%r14)
incq %rax
movq %rax, 0x48(%r14)
movb 0x68(%rsp), %r15b
xorl %eax, %eax
testb %r15b, %r15b
setne %al
addq %rax, 0x8(%rsp)
testb %r15b, %r15b
je 0x7e24b
cmpl $0x2, (%rbx)
jl 0x7e2c1
movq %rbx, %rdi
leaq 0x60(%rsp), %rsi
movq %rbp, %rdx
callq 0x7f196
testb %r15b, %r15b
jne 0x7e2c1
jmp 0x7e25b
movq %rbx, %rdi
leaq 0x60(%rsp), %rsi
movq %rbp, %rdx
callq 0x7f196
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
leaq (%rax,%rcx), %rdx
movq 0x18(%rbx), %rsi
cmpq 0x18(%rsi), %rdx
jle 0x7e28c
movl 0x60(%rsp), %ecx
movq %rbx, %rdi
leaq 0xab46d(%rip), %rsi     # 0x1296ee
movl %ebp, %edx
xorl %eax, %eax
callq 0xe9df7
jmp 0x7e2c4
movl 0x60(%rsp), %edx
cmpl $0x2, %edx
je 0x7e2b9
cmpl $0x1, %edx
je 0x7e2a8
testl %edx, %edx
jne 0x7e2c1
movq %rcx, 0x10(%r14)
movq %rax, 0x18(%r14)
jmp 0x7e2c1
cmpq $0x0, 0x20(%r14)
jne 0x7e2c1
movq %rcx, 0x20(%r14)
movq %rax, 0x28(%r14)
jmp 0x7e2c1
movq %rcx, 0x30(%r14)
movq %rax, 0x38(%r14)
xorl %r12d, %r12d
testb %r12b, %r12b
jne 0x7ead1
incq %rbp
addq $0x8, %r13
cmpq 0x40(%r14), %rbp
jl 0x7e1d7
cmpl $0x1, (%rbx)
jg 0x7e2f9
leaq 0xab42d(%rip), %rsi     # 0x129717
movq %rbx, %rdi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x48(%r14), %rdx
leaq 0xab42f(%rip), %rsi     # 0x129733
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0xe958c
movq 0x10(%r14), %r15
testq %r15, %r15
je 0x7e5d1
cmpq $0x20, 0x18(%r14)
jl 0x7e5d1
leaq 0xab513(%rip), %rsi     # 0x12985a
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0x60(%rsp), %r12
movq %r15, (%r12)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
movb %al, 0x4(%r14)
movzbl %al, %edx
leaq 0xab4ef(%rip), %rsi     # 0x129873
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
movb %al, 0x5(%r14)
movl %eax, %ecx
andb $0x1, %cl
movb %cl, 0x6(%r14)
movzbl %al, %edx
andb $-0x2, %al
movb %al, 0x7(%r14)
leaq 0xab4ce(%rip), %rsi     # 0x129885
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movzbl 0x7(%r14), %edx
movl %edx, %eax
andl $0x7e, %eax
roll $0x1d, %eax
cmpl $0x3, %eax
ja 0x7e3f2
movl %eax, %eax
leaq 0xab6a3(%rip), %rsi     # 0x129a8c
movslq (%rsi,%rax,4), %rcx
addq %rsi, %rcx
jmp 0x7e3f9
leaq 0xada70(%rip), %rcx     # 0x12be69
leaq 0xab493(%rip), %rsi     # 0x129893
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movzbl 0x6(%r14), %edx
testl %edx, %edx
leaq 0xab4a6(%rip), %rax     # 0x1298be
leaq 0x9945d(%rip), %rcx     # 0x11787c
cmoveq %rax, %rcx
leaq 0xab47d(%rip), %rsi     # 0x1298a7
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
cmpb $0x0, 0x6(%r14)
jne 0x7e490
leaq 0x5(%r15), %rax
leaq 0x60(%rsp), %r12
movq %rax, (%r12)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
movzbl %al, %eax
movq %rax, 0x70(%r14)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
movzbl %al, %ecx
movq %rcx, 0x78(%r14)
movl 0x70(%r14), %edx
leaq 0xab442(%rip), %rsi     # 0x1298c8
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
cmpb $0x1, 0x6(%r14)
jne 0x7e510
leaq 0x12(%r15), %rax
leaq 0x60(%rsp), %r12
movq %rax, (%r12)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0x58(%r14)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0x68(%r14)
movq 0x58(%r14), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe9b05
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
movzbl %al, %edx
movq %rdx, 0x80(%r14)
leaq 0xab3f6(%rip), %rsi     # 0x1298e6
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x80(%r14), %rdi
callq 0xea7f2
decq %rax
movq %rax, 0x88(%r14)
addq $0x19, %r15
leaq 0x60(%rsp), %r12
movq %r15, (%r12)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef34e
movl %eax, 0x94(%r14)
movq %rax, %rdx
shrq $0x18, %rdx
movb %dl, 0x90(%r14)
movq %rax, %rcx
shrq $0x10, %rcx
movb %cl, 0x91(%r14)
movq %rax, %r8
shrq $0x8, %r8
movb %r8b, 0x92(%r14)
movb %al, 0x93(%r14)
movl $0xff, %r9d
andl %r9d, %edx
andl %r9d, %ecx
andl %r9d, %r8d
andl %eax, %r9d
leaq 0xab386(%rip), %rsi     # 0x129900
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
incq (%r12)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
movzbl %al, %eax
movq %rax, 0x98(%r14)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
movzbl %al, %ecx
movq %rcx, 0xa0(%r14)
movl 0x98(%r14), %edx
leaq 0xab365(%rip), %rsi     # 0x129927
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movb $0x1, 0x8(%r14)
movl 0x40(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
cmpb $0x0, 0x8(%r14)
je 0x7e6e4
cmpb $0x0, 0x90(%r14)
je 0x7e61b
cmpb $0x0, 0x91(%r14)
jne 0x7e61b
cmpb $0x0, 0x92(%r14)
jne 0x7e61b
cmpb $0x0, 0x93(%r14)
jne 0x7e61b
movl $0x1, 0xd8(%r14)
leaq 0x3c(%rsp), %rsi
movq %rbx, %rdi
callq 0xe958c
movq 0x20(%r14), %rdx
testq %rdx, %rdx
je 0x7e95a
cmpq $0x4, 0x28(%r14)
jl 0x7e95a
movq %rdx, 0xa0(%rsp)
leaq 0xb7b59(%rip), %rsi     # 0x1361a8
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x28(%r14), %r12
leaq 0x3(%r12), %r15
testq %r12, %r12
cmovnsq %r12, %r15
sarq $0x2, %r15
leaq 0x92d33(%rip), %rsi     # 0x1113b4
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe9226
movq %r15, 0x8(%rsp)
movq %r15, 0xe8(%r14)
cmpb $0x1, 0x6(%r14)
jne 0x7e6b2
movq 0x88(%r14), %rax
incq %rax
movq %rax, 0xe8(%r14)
movq 0x8(%rsp), %rax
cmpq %rax, 0xe8(%r14)
jle 0x7e6cc
movq 0x8(%rsp), %rax
movq %rax, 0xe8(%r14)
cmpb $0x0, 0x90(%r14)
je 0x7e6f0
cmpl $0x0, 0xd8(%r14)
sete %bpl
jmp 0x7e6f2
leaq 0xab05d(%rip), %rsi     # 0x129748
jmp 0x7eac7
xorl %ebp, %ebp
testb %bpl, %bpl
jne 0x7e701
movsd 0x98fd9(%rip), %xmm0    # 0x1176d8
jmp 0x7e709
movsd 0xaafaf(%rip), %xmm0    # 0x1296b8
xorl %eax, %eax
movzbl 0x90(%r14,%rax), %ecx
cmpl $0x2, %ecx
jae 0x7e71f
xorpd %xmm1, %xmm1
jmp 0x7e730
decl %ecx
xorps %xmm2, %xmm2
cvtsi2sd %ecx, %xmm2
movapd %xmm0, %xmm1
divsd %xmm2, %xmm1
movsd %xmm1, 0x40(%rsp,%rax,8)
incq %rax
cmpq $0x4, %rax
jne 0x7e70b
cmpq $0x4, %r12
jl 0x7e955
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0xa0(%rsp), %r12
xorl %r13d, %r13d
cmpq $0x100, %r13            # imm = 0x100
je 0x7e955
movl %ebp, %r15d
xorl %ebp, %ebp
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
movb %al, 0x14(%rsp,%rbp)
movb %al, 0x4(%rsp,%rbp)
incq %rbp
cmpq $0x4, %rbp
jne 0x7e796
xorl %eax, %eax
movl %r15d, %ebp
leaq 0x60(%rsp), %r15
cmpb $0x4, 0x91(%r14,%rax)
jne 0x7e7e1
movzbl 0x5(%rsp,%rax), %ecx
cmpl $0x1, %ecx
je 0x7e7db
cmpl $0x2, %ecx
jne 0x7e7e1
movb $0x1, %cl
jmp 0x7e7dd
movb $0x2, %cl
movb %cl, 0x5(%rsp,%rax)
incq %rax
cmpq $0x3, %rax
jne 0x7e7bd
cmpl $0x0, 0xd8(%r14)
je 0x7e820
movzbl 0x4(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x30(%rsp), %xmm0
addsd 0x98ec2(%rip), %xmm0    # 0x1176d0
cvttsd2si %xmm0, %eax
movzbl %al, %eax
imull $0x10101, %eax, %ecx    # imm = 0x10101
jmp 0x7e8b3
movzbl 0x5(%rsp), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x28(%rsp), %xmm0
movsd 0x98e96(%rip), %xmm1    # 0x1176d0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movzbl 0x6(%rsp), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd 0x18(%rsp), %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %edx
movzbl 0x7(%rsp), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
mulsd 0x20(%rsp), %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %esi
cmpb $0x0, 0x4(%rsp)
setne %dil
leal 0x55(%rsi), %ecx
movzbl %cl, %ecx
testb %dil, %bpl
cmovel %esi, %ecx
leal 0x55(%rdx), %esi
movzbl %sil, %esi
cmovel %edx, %esi
leal 0x55(%rax), %edx
movzbl %dl, %edx
cmovel %eax, %edx
movl $0xff, %eax
andl %eax, %edx
shll $0x10, %edx
andl %eax, %esi
shll $0x8, %esi
orl %edx, %esi
andl %eax, %ecx
orl %esi, %ecx
orl $0xff000000, %ecx       # imm = 0xFF000000
movl %ecx, 0xf0(%r14,%r13,4)
movzbl 0x15(%rsp), %ecx
movzbl 0x16(%rsp), %r8d
movzbl 0x17(%rsp), %r9d
testb %bpl, %bpl
je 0x7e8ff
movzbl 0x14(%rsp), %r10d
subq $0x8, %rsp
movl $0x40, %esi
movq %r15, %rdi
leaq 0xab04c(%rip), %rdx     # 0x12993c
xorl %eax, %eax
pushq %r10
callq 0xe8d67
addq $0x10, %rsp
jmp 0x7e915
movl $0x40, %esi
movq %r15, %rdi
leaq 0xab04b(%rip), %rdx     # 0x129959
xorl %eax, %eax
callq 0xe8d67
cmpq 0xe8(%r14), %r13
movl 0xf0(%r14,%r13,4), %edx
leaq 0x92671(%rip), %r9      # 0x110f9c
leaq 0xc629e(%rip), %rax     # 0x144bd0
cmovlq %rax, %r9
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xe9c1e
incq %r13
cmpq 0x8(%rsp), %r13
jne 0x7e784
movb $0x1, 0x9(%r14)
movl 0x3c(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
cmpb $0x0, 0x9(%r14)
je 0x7ea69
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0xe958c
movq 0x30(%r14), %r15
testq %r15, %r15
je 0x7ea7e
cmpq $0x8, 0x38(%r14)
jl 0x7ea7e
leaq 0xaafcf(%rip), %rsi     # 0x12996c
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0x60(%rsp), %r12
movq %r15, (%r12)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0xa8(%r14)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0xb0(%r14)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0xb8(%r14)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0xc0(%r14)
movq 0xa8(%r14), %rcx
movq 0xb0(%r14), %rdx
leaq 0xaaf63(%rip), %rsi     # 0x129984
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0xb8(%r14), %rcx
movq 0xc0(%r14), %rdx
leaq 0xaaf63(%rip), %rsi     # 0x1299a3
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0xb0(%r14), %rdx
testb $0x7, %dl
je 0x7ea72
leaq 0xaaf64(%rip), %rsi     # 0x1299c1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0x7ea7e
leaq 0xaacf2(%rip), %rsi     # 0x129762
jmp 0x7eac7
cmpq $0x0, 0x48(%r14)
je 0x7ea7e
movb $0x1, 0xa(%r14)
movl 0x40(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
cmpb $0x0, 0xa(%r14)
je 0x7eac0
cmpb $0x0, 0x6(%r14)
je 0x7eb06
movq 0x80(%r14), %rdx
leaq -0x9(%rdx), %rax
cmpq $-0x9, %rax
ja 0x7ec95
leaq 0xaacde(%rip), %rsi     # 0x129792
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0x7ead1
leaq 0xaacb2(%rip), %rsi     # 0x129779
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq 0xe0(%r14), %rdi
callq 0xf28d4
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
movl 0x38(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0xe958c
leaq 0xaaed1(%rip), %rsi     # 0x1299eb
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
cmpq $0x1, 0x48(%r14)
jne 0x7ecb3
movq 0x50(%r14), %rax
leaq 0x4(,%rax,8), %rsi
leaq 0x60(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rdx
callq 0x7f126
movq 0x50(%r14), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7f196
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %rax, %r15
movl $0x40, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r12
movq %rbx, %rdi
xorl %esi, %esi
callq 0xf43cc
movq %rax, %r13
movb $0x1, 0x2(%rax)
movq 0xb0(%r14), %rax
movq %rax, 0x20(%r12)
movq 0xa8(%r14), %r8
movq %r8, 0x28(%r12)
cmpq $0x51, %rax
setge %cl
cmpq $0x1a, %r8
setge %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x7ebcc
movb $0x1, 0x3(%r13)
movl $0x1, %ebp
movq %rbp, 0x80(%r14)
leaq (%rax,%rax), %rcx
movq %rcx, 0xc8(%r14)
leaq 0x7(,%rax,2), %rcx
leaq 0xe(,%rax,2), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
sarq $0x3, %rax
movq %rax, 0xd0(%r14)
leaq 0x60(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rcx
callq 0x7f262
movl (%r14), %eax
movl %eax, 0x18(%r12)
movq %r15, (%r12)
movq $0x0, 0x8(%r12)
movq 0x28(%r12), %rax
imulq 0x20(%r12), %rax
leaq (%rax,%rax), %rcx
movq %rcx, 0x10(%r12)
movq %rbp, 0x30(%r12)
movq %rax, 0x38(%r12)
movupd 0xf0(%r14), %xmm0
movupd 0x100(%r14), %xmm1
movupd 0x110(%r14), %xmm2
movups 0x120(%r14), %xmm3
movupd %xmm0, 0x20(%r13)
movupd %xmm1, 0x30(%r13)
movupd %xmm2, 0x40(%r13)
movups %xmm3, 0x50(%r13)
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xfa176
jmp 0x7eccd
movl 0x94(%r14), %eax
cmpl $0x1ffffff, %eax        # imm = 0x1FFFFFF
jg 0x7ecfc
cmpl $0x40404, %eax          # imm = 0x40404
je 0x7ed1b
cmpl $0x404040, %eax         # imm = 0x404040
je 0x7ed1b
jmp 0x7ed0a
leaq 0xaad47(%rip), %rsi     # 0x129a01
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r13, %rsi
callq 0xf44c8
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe9752
movq %r15, %rdi
callq 0xf0b13
movl 0x40(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
jmp 0x7ead1
cmpl $0x2000000, %eax        # imm = 0x2000000
je 0x7ed1b
cmpl $0x2020202, %eax        # imm = 0x2020202
je 0x7ed1b
leaq 0xaaab0(%rip), %rsi     # 0x1297c1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9b27
leaq 0xaad22(%rip), %rsi     # 0x129a44
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x58(%r14), %rsi
movq 0x68(%r14), %rdx
movq %rbx, %rdi
callq 0xf241d
testl %eax, %eax
je 0x7ed9a
movq 0xb0(%r14), %rdx
leaq 0x7(%rdx), %rax
testq %rdx, %rdx
cmovnsq %rdx, %rax
sarq $0x3, %rax
movq %rax, 0xc8(%r14)
leaq 0x7(%rax), %rcx
addq $0xe, %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
sarq $0x3, %rax
movq %rax, 0xd0(%r14)
cmpb $0x0, 0xd6(%rbx)
je 0x7eda2
imulq 0xc0(%r14), %rdx
jmp 0x7eda6
xorl %r15d, %r15d
jmp 0x7effe
movq 0x58(%r14), %rdx
movq %rdx, 0x60(%r14)
movq 0x58(%r14), %rsi
movq 0x68(%r14), %rcx
xorl %eax, %eax
cmpl $0x0, 0xd8(%r14)
sete %al
leal 0x1(,%rax,2), %r8d
movq %rbx, %rdi
callq 0xf2ce6
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x40(%r14)
jle 0x7efb2
movq %r14, %rax
addq $0xf0, %rax
movq %rax, 0x20(%rsp)
movl $0xc, %r12d
xorl %ebp, %ebp
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %r12
jg 0x7efb2
leaq -0x8(%r12), %rsi
movq %rbx, %rdi
leaq 0x60(%rsp), %rdx
callq 0x7f126
cmpb $0x0, 0x69(%rsp)
je 0x7efa1
movq %rbx, %rdi
leaq 0x60(%rsp), %r15
movq %r15, %rsi
movq %rbp, %rdx
callq 0x7f196
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movl 0x64(%rsp), %eax
xorl %edx, %edx
idivq 0xc0(%r14)
movq 0xb0(%r14), %r10
movq %r10, %r8
imulq %rdx, %r8
movq 0x68(%r14), %r13
movq 0xa8(%r14), %rcx
movq %rcx, %r9
imulq %rax, %r9
subq %r9, %r13
cmpq %rcx, %r13
cmovgeq %rcx, %r13
movq 0xc8(%r14), %rcx
movq %rcx, 0x30(%rsp)
movq %rbx, %rdi
leaq 0xaabca(%rip), %rsi     # 0x129a57
movl %eax, %ecx
movq %r8, 0x8(%rsp)
movq %r9, 0x28(%rsp)
xorl %eax, %eax
pushq %r13
pushq %r10
callq 0xe9226
addq $0x10, %rsp
movl $0x1000, %esi           # imm = 0x1000
movq %rbx, %rdi
xorl %edx, %edx
callq 0xf0faf
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rax, %r15
movq %rax, %rcx
movq %r13, %r8
callq 0x7f262
movq 0xe0(%r14), %rdi
movq 0xa8(%r14), %r8
movq 0xb0(%r14), %rcx
testq %rdi, %rdi
je 0x7ef00
subq $0x8, %rsp
xorl %esi, %esi
xorl %edx, %edx
xorl %r9d, %r9d
pushq $0x0
callq 0xf3cb3
addq $0x10, %rsp
jmp 0x7ef28
xorl %eax, %eax
cmpl $0x0, 0xd8(%r14)
sete %al
leal 0x1(%rax,%rax), %eax
movq %rbx, %rdi
movq %rcx, %rsi
movq %r8, %rdx
movl %eax, %ecx
callq 0xf2cab
movq %rax, 0xe0(%r14)
movq 0x30(%rsp), %r8
imulq %r13, %r8
movq 0x80(%r14), %rdx
movq 0xc8(%r14), %rcx
movq %r15, %rdi
xorl %esi, %esi
movq 0x20(%rsp), %r9
pushq $0x2
pushq 0xe0(%r14)
callq 0xf36f9
addq $0x10, %rsp
movq 0xb0(%r14), %r8
movq 0xe0(%r14), %rdi
subq $0x8, %rsp
movq 0x20(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r13, %r9
pushq $0x0
pushq 0x38(%rsp)
pushq 0x20(%rsp)
callq 0xf3d2f
addq $0x20, %rsp
movq %r15, %rdi
callq 0xf0b13
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
incq %rbp
addq $0x8, %r12
cmpq 0x40(%r14), %rbp
jl 0x7edf5
movq %rbx, %rdi
callq 0xea9a9
movq %rax, %r15
movl $0x1, 0x78(%rax)
cvtsi2sdq 0x98(%r14), %xmm0
movsd %xmm0, 0x80(%rax)
xorps %xmm0, %xmm0
cvtsi2sdq 0xa0(%r14), %xmm0
movsd %xmm0, 0x88(%rax)
movq 0x18(%rsp), %r12
movq %r12, %rdi
movq %rax, %rsi
movl $0x2, %edx
callq 0xf2917
movq %r12, %rdi
callq 0xf28d4
movq %rbx, %rdi
movq %r15, %rsi
callq 0xea9b3
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
jmp 0x7ead1