// File: /workspace/github_c_makefile_star2_O2/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 $0xc8, %rsp
movq %rdi, %r14
leaq 0x30(%rsp), %rsi
callq 0xdebae
movl $0x4f0, %esi            # imm = 0x4F0
movq %r14, %rdi
callq 0xdecaf
movq %rax, %r13
movq %rax, %rbx
pushq $0xd
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, (%r13)
movq 0x18(%r14), %rdi
xorl %esi, %esi
callq 0xe3fa3
movq %rax, %r12
movq 0x18(%r14), %rdi
pushq $0x2
popq %rsi
callq 0xe3fa3
movq %rax, 0x40(%r13)
leaq 0xb08bd(%rip), %rsi     # 0x129a84
movq %r14, %rdi
movl %r12d, %edx
xorl %r12d, %r12d
xorl %eax, %eax
callq 0xde896
movq %r13, 0x38(%rsp)
movl 0x40(%r13), %edx
leaq 0xa3512(%rip), %rsi     # 0x11c6f9
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
pushq $0xc
popq %rbp
xorl %r13d, %r13d
movq %rbx, 0x10(%rsp)
cmpq 0x40(%rbx), %r12
jge 0x79323
movq 0x18(%r14), %rax
cmpq 0x18(%rax), %rbp
jg 0x79b25
leaq -0x8(%rbp), %rsi
movq %r14, %rdi
leaq 0x40(%rsp), %rdx
callq 0x7a143
cmpb $0x0, 0x49(%rsp)
je 0x7924b
movq 0x48(%rbx), %rax
testq %rax, %rax
jne 0x79244
movq %r12, 0x50(%rbx)
incq %rax
movq %rax, 0x48(%rbx)
movq %r14, %r15
movb 0x48(%rsp), %al
xorl %r14d, %r14d
testb %al, %al
setne %bl
je 0x7927b
cmpl $0x2, (%r15)
jl 0x79309
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
movq %r12, %rdx
callq 0x7a1b3
jmp 0x79309
movb %bl, 0x20(%rsp)
movq %r12, %rdx
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
movq %r12, %rbx
callq 0x7a1b3
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
leaq (%rax,%rcx), %rdx
movq 0x18(%r15), %rsi
cmpq 0x18(%rsi), %rdx
jg 0x7942e
movl 0x40(%rsp), %edx
cmpl $0x2, %edx
je 0x792f5
cmpl $0x1, %edx
movq %rbx, %r12
je 0x792d6
testl %edx, %edx
movb 0x20(%rsp), %bl
jne 0x79309
movq 0x10(%rsp), %rdx
movq %rcx, 0x10(%rdx)
movq %rax, 0x18(%rdx)
jmp 0x79309
movq 0x10(%rsp), %rdx
cmpq $0x0, 0x20(%rdx)
movb 0x20(%rsp), %bl
jne 0x79309
movq 0x10(%rsp), %rdx
movq %rcx, 0x20(%rdx)
movq %rax, 0x28(%rdx)
jmp 0x79309
movq 0x10(%rsp), %rdx
movq %rcx, 0x30(%rdx)
movq %rax, 0x38(%rdx)
movq %rbx, %r12
movb 0x20(%rsp), %bl
movb %bl, %r14b
addq %r14, %r13
incq %r12
addq $0x8, %rbp
movq %r15, %r14
movq 0x10(%rsp), %rbx
jmp 0x79207
cmpl $0x1, (%r14)
jg 0x7933d
leaq 0xa3407(%rip), %rsi     # 0x11c737
movq %r14, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x48(%rbx), %rdx
leaq 0xa340b(%rip), %rsi     # 0x11c753
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
pushq $-0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
leaq 0x80(%rsp), %rsi
movq %r14, %rdi
callq 0xdebae
movq 0x10(%rbx), %r12
testq %r12, %r12
je 0x79625
cmpq $0x20, 0x18(%rbx)
jl 0x79625
leaq 0xa34ee(%rip), %rsi     # 0x11c87a
movq %r14, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0xdeba7
leaq 0x40(%rsp), %r15
movq %r12, (%r15)
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xe3f2a
movb %al, 0x4(%rbx)
movzbl %al, %edx
leaq 0xa34cc(%rip), %rsi     # 0x11c893
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xe3f2a
movb %al, 0x5(%rbx)
movl %eax, %ecx
andb $0x1, %cl
movb %cl, 0x6(%rbx)
movzbl %al, %edx
andb $-0x2, %al
movb %al, 0x7(%rbx)
leaq 0xa34ae(%rip), %rsi     # 0x11c8a5
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
movq %r14, %rdi
movl %ebp, %esi
callq 0xdeba7
movzbl 0x7(%rbx), %edx
movl %edx, %eax
andl $0x7e, %eax
roll $0x1d, %eax
cmpl $0x3, %eax
ja 0x79452
movl %eax, %eax
leaq 0xa3687(%rip), %rsi     # 0x11caac
movslq (%rsi,%rax,4), %rcx
addq %rsi, %rcx
jmp 0x79459
movl 0x40(%rsp), %ecx
leaq 0xa32d5(%rip), %rsi     # 0x11c70e
movq %r15, %r14
movq %r15, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0xdf2a5
movq 0x10(%rsp), %rbx
jmp 0x79b25
leaq 0xa5a88(%rip), %rcx     # 0x11eee1
leaq 0xa3453(%rip), %rsi     # 0x11c8b3
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
movzbl 0x6(%rbx), %edx
testl %edx, %edx
leaq 0xa3467(%rip), %rax     # 0x11c8de
leaq 0x91446(%rip), %rcx     # 0x10a8c4
cmoveq %rax, %rcx
leaq 0xa343e(%rip), %rsi     # 0x11c8c7
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
pushq $-0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
movb 0x6(%rbx), %al
testb %al, %al
jne 0x794ef
leaq 0x5(%r12), %rax
leaq 0x40(%rsp), %r15
movq %rax, (%r15)
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xe3f2a
movzbl %al, %eax
movq %rax, 0x70(%rbx)
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xe3f2a
movzbl %al, %ecx
movq %rcx, 0x78(%rbx)
movl 0x70(%rbx), %edx
leaq 0xa3406(%rip), %rsi     # 0x11c8e8
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
movb 0x6(%rbx), %al
cmpb $0x1, %al
jne 0x7956c
leaq 0x12(%r12), %rax
leaq 0x40(%rsp), %r15
movq %rax, (%r15)
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xe3fc4
movq %rax, 0x58(%rbx)
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xe3fc4
movq %rax, 0x68(%rbx)
movq 0x58(%rbx), %rsi
movq %r14, %rdi
movq %rax, %rdx
callq 0xdf038
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xe3f2a
movzbl %al, %edx
movq %rdx, 0x80(%rbx)
leaq 0xa33ba(%rip), %rsi     # 0x11c906
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x80(%rbx), %rdi
callq 0xdfba1
decq %rax
movq %rax, 0x88(%rbx)
addq $0x19, %r12
leaq 0x40(%rsp), %r15
movq %r12, (%r15)
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xe4071
movl %eax, 0x94(%rbx)
movq %rax, %rdx
shrq $0x18, %rdx
movb %dl, 0x90(%rbx)
movq %rax, %rcx
shrq $0x10, %rcx
movb %cl, 0x91(%rbx)
movq %rax, %r8
shrq $0x8, %r8
movb %r8b, 0x92(%rbx)
movb %al, 0x93(%rbx)
movl $0xff, %r9d
andl %r9d, %edx
andl %r9d, %ecx
andl %r9d, %r8d
andl %eax, %r9d
leaq 0xa334f(%rip), %rsi     # 0x11c920
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
incq (%r15)
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xe3f2a
movzbl %al, %eax
movq %rax, 0x98(%rbx)
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xe3f2a
movzbl %al, %ecx
movq %rcx, 0xa0(%rbx)
movl 0x98(%rbx), %edx
leaq 0xa3330(%rip), %rsi     # 0x11c947
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
movb $0x1, 0x8(%rbx)
movl 0x80(%rsp), %esi
movq %r14, %rdi
callq 0xdebb7
cmpb $0x0, 0x8(%rbx)
je 0x7971e
cmpb $0x0, 0x90(%rbx)
je 0x7966c
cmpb $0x0, 0x91(%rbx)
jne 0x7966c
cmpb $0x0, 0x92(%rbx)
jne 0x7966c
cmpb $0x0, 0x93(%rbx)
jne 0x7966c
movl $0x1, 0xd8(%rbx)
leaq 0x34(%rsp), %rsi
movq %r14, %rdi
callq 0xdebae
movq 0x20(%rbx), %rdx
testq %rdx, %rdx
je 0x799ae
cmpq $0x4, 0x28(%rbx)
jl 0x799ae
movq %rdx, 0xc0(%rsp)
leaq 0xafc4b(%rip), %rsi     # 0x1292eb
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
movq 0x28(%rbx), %rax
pushq $0x4
popq %rcx
cqto
idivq %rcx
movq %rax, %r15
leaq 0x8acd5(%rip), %rsi     # 0x1043a0
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xde896
movq %r15, %rdx
movq %r15, 0xe8(%rbx)
cmpb $0x1, 0x6(%rbx)
jne 0x79700
movq 0x88(%rbx), %rax
incq %rax
cmpq %rdx, %rax
cmovgeq %rdx, %rax
movq %rax, 0xe8(%rbx)
movsd 0x91040(%rip), %xmm0    # 0x10a748
cmpb $0x0, 0x90(%rbx)
je 0x7971a
cmpl $0x0, 0xd8(%rbx)
je 0x7972a
xorl %ebp, %ebp
jmp 0x79735
leaq 0xa3043(%rip), %rsi     # 0x11c768
jmp 0x79b1b
movsd 0xa2f76(%rip), %xmm0    # 0x11c6a8
movb $0x1, %bpl
xorl %eax, %eax
cmpq $0x4, %rax
je 0x7976c
movzbl 0x90(%rbx,%rax), %ecx
cmpl $0x2, %ecx
jae 0x79750
xorpd %xmm1, %xmm1
jmp 0x7975e
decl %ecx
cvtsi2sd %ecx, %xmm2
movapd %xmm0, %xmm1
divsd %xmm2, %xmm1
movsd %xmm1, 0x80(%rsp,%rax,8)
incq %rax
jmp 0x79737
movsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movups 0x88(%rsp), %xmm0
movaps %xmm0, 0xa0(%rsp)
movsd 0x98(%rsp), %xmm0
movsd %xmm0, 0xb8(%rsp)
xorl %eax, %eax
testq %rdx, %rdx
cmovleq %rax, %rdx
movq %rdx, 0x20(%rsp)
leaq 0xc0(%rsp), %r13
xorl %r15d, %r15d
cmpq 0x20(%rsp), %r15
je 0x799aa
cmpq $0x100, %r15            # imm = 0x100
je 0x799aa
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x797ef
movq 0x18(%r14), %rdi
movq %r13, %rsi
callq 0xe3f2a
movb %al, 0x1c(%rsp,%rbx)
movb %al, 0xc(%rsp,%rbx)
incq %rbx
jmp 0x797d0
xorl %eax, %eax
movq 0x10(%rsp), %rbx
leaq 0x40(%rsp), %r12
cmpq $0x3, %rax
je 0x79829
cmpb $0x4, 0x91(%rbx,%rax)
jne 0x79824
movzbl 0xd(%rsp,%rax), %ecx
cmpl $0x1, %ecx
je 0x7981e
cmpl $0x2, %ecx
jne 0x79824
movb $0x1, %cl
jmp 0x79820
movb $0x2, %cl
movb %cl, 0xd(%rsp,%rax)
incq %rax
jmp 0x797fb
cmpl $0x0, 0xd8(%rbx)
je 0x7985b
movzbl 0xc(%rsp), %eax
cvtsi2sd %eax, %xmm0
mulsd 0x28(%rsp), %xmm0
addsd 0x90ef7(%rip), %xmm0    # 0x10a740
cvttsd2si %xmm0, %eax
movzbl %al, %eax
imull $0x10101, %eax, %eax    # imm = 0x10101
jmp 0x79915
movzbl 0xf(%rsp), %eax
cvtsi2sd %eax, %xmm0
mulsd 0xb8(%rsp), %xmm0
addsd 0x90ecb(%rip), %xmm0    # 0x10a740
cvttsd2si %xmm0, %ecx
cmpb $0x0, 0xc(%rsp)
setne %dl
andb %bpl, %dl
leal 0x55(%rcx), %eax
movzbl %al, %eax
testb %dl, %dl
cmovel %ecx, %eax
movzwl 0xd(%rsp), %ecx
movd %ecx, %xmm0
pxor %xmm3, %xmm3
punpcklbw %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3],xmm0[4],xmm3[4],xmm0[5],xmm3[5],xmm0[6],xmm3[6],xmm0[7],xmm3[7]
punpcklwd %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
cvtdq2pd %xmm0, %xmm0
mulpd 0xa0(%rsp), %xmm0
addpd 0xa2df7(%rip), %xmm0    # 0x11c6b0
cvttpd2dq %xmm0, %xmm0
packuswb %xmm0, %xmm0
packuswb %xmm0, %xmm0
movzbl %dl, %ecx
movd %ecx, %xmm1
punpcklbw %xmm1, %xmm1    # xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
psllw $0x7, %xmm1
pand 0xa2de3(%rip), %xmm1    # 0x11c6c0
pxor %xmm2, %xmm2
pcmpgtb %xmm1, %xmm2
pand 0xa2de3(%rip), %xmm2    # 0x11c6d0
paddb %xmm0, %xmm2
punpcklbw %xmm3, %xmm2    # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1],xmm2[2],xmm3[2],xmm2[3],xmm3[3],xmm2[4],xmm3[4],xmm2[5],xmm3[5],xmm2[6],xmm3[6],xmm2[7],xmm3[7]
movdqa %xmm2, %xmm0
pslld $0x10, %xmm0
psrld $0x10, %xmm2
pslld $0x8, %xmm2
por %xmm0, %xmm2
movd %xmm2, %ecx
movzbl %al, %eax
orl %ecx, %eax
orl $0xff000000, %eax       # imm = 0xFF000000
movl %eax, 0xf0(%rbx,%r15,4)
movzbl 0x1d(%rsp), %ecx
movzbl 0x1e(%rsp), %r8d
movzbl 0x1f(%rsp), %r9d
testb %bpl, %bpl
je 0x7995c
movzbl 0x1c(%rsp), %r10d
subq $0x8, %rsp
movq %r12, %rdi
pushq $0x40
popq %rsi
leaq 0xa300d(%rip), %rdx     # 0x11c95c
xorl %eax, %eax
pushq %r10
callq 0xde40c
popq %rax
popq %rcx
jmp 0x79970
movq %r12, %rdi
pushq $0x40
popq %rsi
leaq 0xa3010(%rip), %rdx     # 0x11c979
xorl %eax, %eax
callq 0xde40c
cmpq 0xe8(%rbx), %r15
movl 0xf0(%rbx,%r15,4), %edx
leaq 0x8a602(%rip), %r9      # 0x103f88
leaq 0xbe2d3(%rip), %rax     # 0x137c60
cmovlq %rax, %r9
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rcx
xorl %r8d, %r8d
callq 0xdf153
incq %r15
jmp 0x797b6
movb $0x1, 0x9(%rbx)
movl 0x34(%rsp), %esi
movq %r14, %rdi
callq 0xdebb7
cmpb $0x0, 0x9(%rbx)
je 0x79abd
leaq 0x80(%rsp), %rsi
movq %r14, %rdi
callq 0xdebae
movq 0x30(%rbx), %r15
testq %r15, %r15
je 0x79ad1
cmpq $0x8, 0x38(%rbx)
jl 0x79ad1
leaq 0xa2f99(%rip), %rsi     # 0x11c98c
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
leaq 0x40(%rsp), %r12
movq %r15, (%r12)
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe3fc4
movq %rax, 0xa8(%rbx)
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe3fc4
movq %rax, 0xb0(%rbx)
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe3fc4
movq %rax, 0xb8(%rbx)
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe3fc4
movq %rax, 0xc0(%rbx)
movq 0xa8(%rbx), %rcx
movq 0xb0(%rbx), %rdx
leaq 0xa2f2f(%rip), %rsi     # 0x11c9a4
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
movq 0xb8(%rbx), %rcx
movq 0xc0(%rbx), %rdx
leaq 0xa2f2f(%rip), %rsi     # 0x11c9c3
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
movq 0xb0(%rbx), %rdx
testb $0x7, %dl
je 0x79ac6
leaq 0xa2f30(%rip), %rsi     # 0x11c9e1
movq %r14, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0x79ad1
leaq 0xa2cbe(%rip), %rsi     # 0x11c782
jmp 0x79b1b
cmpq $0x0, 0x48(%rbx)
je 0x79ad1
movb $0x1, 0xa(%rbx)
movl 0x80(%rsp), %esi
movq %r14, %rdi
callq 0xdebb7
cmpb $0x0, 0xa(%rbx)
je 0x79b14
cmpb $0x0, 0x6(%rbx)
je 0x79b5a
movq 0x80(%rbx), %rdx
leaq -0x9(%rdx), %rax
cmpq $-0x9, %rax
ja 0x79cd8
leaq 0xa2caa(%rip), %rsi     # 0x11c7b2
movq %r14, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0x79b25
leaq 0xa2c7e(%rip), %rsi     # 0x11c799
movq %r14, %rdi
xorl %eax, %eax
callq 0xdf2a5
movq 0xe0(%rbx), %rdi
callq 0xe7084
movq %r14, %rdi
movq %rbx, %rsi
callq 0xded32
movl 0x30(%rsp), %esi
movq %r14, %rdi
callq 0xdebb7
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x80(%rsp), %rsi
movq %r14, %rdi
callq 0xdebae
leaq 0xa2e9a(%rip), %rsi     # 0x11ca0b
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
cmpq $0x1, 0x48(%rbx)
jne 0x79d83
movq 0x50(%rbx), %rax
leaq 0x4(,%rax,8), %rsi
leaq 0x40(%rsp), %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x7a143
movq 0x50(%rbx), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x7a1b3
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
xorl %edx, %edx
callq 0xe59cd
movq %rax, %r15
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0xdecaf
movq %rax, %r12
movq %r14, %rdi
xorl %esi, %esi
callq 0xe88f4
movq %rax, %r13
movb $0x1, 0x2(%rax)
movq 0xb0(%rbx), %rax
movq %rax, 0x20(%r12)
movq 0xa8(%rbx), %r8
movq %r8, 0x28(%r12)
cmpq $0x51, %rax
setge %cl
cmpq $0x1a, %r8
setge %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x79c1f
movb $0x1, 0x3(%r13)
pushq $0x1
popq %rbx
movq 0x10(%rsp), %rbp
movq %rbx, 0x80(%rbp)
leaq (%rax,%rax), %rcx
movq %rcx, 0xc8(%rbp)
leaq 0x7(%rax,%rax), %rax
pushq $0x8
popq %rcx
cqto
idivq %rcx
movq %rax, 0xd0(%rbp)
leaq 0x40(%rsp), %rdx
movq %r14, %rdi
movq %rbp, %rsi
movq %r15, %rcx
callq 0x7a276
movl (%rbp), %eax
movl %eax, 0x18(%r12)
movq %r15, (%r12)
andq $0x0, 0x8(%r12)
movq 0x28(%r12), %rax
imulq 0x20(%r12), %rax
leaq (%rax,%rax), %rcx
movq %rcx, 0x10(%r12)
movq %rbx, 0x30(%r12)
movq %rbp, %rbx
movq %rax, 0x38(%r12)
movupd 0xf0(%rbp), %xmm0
movups 0x100(%rbp), %xmm1
movups 0x110(%rbp), %xmm2
movups 0x120(%rbp), %xmm3
movupd %xmm0, 0x20(%r13)
movups %xmm1, 0x30(%r13)
movups %xmm2, 0x40(%r13)
movups %xmm3, 0x50(%r13)
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xee2e5
jmp 0x79d9d
movl 0x94(%rbx), %eax
cmpl $0x40404, %eax          # imm = 0x40404
je 0x79d0b
cmpl $0x404040, %eax         # imm = 0x404040
je 0x79d0b
cmpl $0x2000000, %eax        # imm = 0x2000000
je 0x79d0b
cmpl $0x2020202, %eax        # imm = 0x2020202
je 0x79d0b
leaq 0xa2ae0(%rip), %rsi     # 0x11c7e1
movq %r14, %rdi
xorl %eax, %eax
callq 0xdf05a
leaq 0xa2d52(%rip), %rsi     # 0x11ca64
xorl %r13d, %r13d
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
movq 0x58(%rbx), %rsi
movq 0x68(%rbx), %rdx
movq %r14, %rdi
callq 0xe6be1
testl %eax, %eax
je 0x79dcf
movq 0xb0(%rbx), %r9
pushq $0x8
popq %rcx
movq %r9, %rax
cqto
idivq %rcx
movq %rax, 0xc8(%rbx)
addq $0x7, %rax
cqto
idivq %rcx
movq %rax, 0xd0(%rbx)
cmpb $0x0, 0xd6(%r14)
je 0x79dd7
imulq 0xc0(%rbx), %r9
movq 0x58(%rbx), %rsi
jmp 0x79dde
leaq 0xa2c97(%rip), %rsi     # 0x11ca21
xorl %r15d, %r15d
movq %r14, %rdi
xorl %eax, %eax
callq 0xdf2a5
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %r14, %rdi
movq %r13, %rsi
callq 0xe89d2
movq %r14, %rdi
movq %r12, %rsi
callq 0xded32
movq %r15, %rdi
callq 0xe5591
movl 0x80(%rsp), %esi
movq %r14, %rdi
callq 0xdebb7
jmp 0x79b25
xorl %r15d, %r15d
jmp 0x7a027
movq 0x58(%rbx), %rsi
movq %rsi, %r9
movq %r9, 0x60(%rbx)
movq 0x68(%rbx), %rcx
xorl %eax, %eax
cmpl $0x0, 0xd8(%rbx)
sete %al
leal 0x1(,%rax,2), %r8d
movq %r14, %rdi
movq %r9, %rdx
callq 0xe746f
movq %rax, %r13
addq $0xf0, 0x38(%rsp)
pushq $0xc
popq %r15
xorl %r12d, %r12d
movq %rax, 0xa0(%rsp)
cmpq 0x40(%rbx), %r12
jge 0x79fe5
movq 0x18(%r14), %rax
cmpq 0x18(%rax), %r15
jg 0x79fe5
leaq -0x8(%r15), %rsi
movq %r14, %rdi
leaq 0x40(%rsp), %rdx
callq 0x7a143
cmpb $0x0, 0x49(%rsp)
je 0x79fd9
movq %r15, 0x10(%rsp)
movq %r14, %rdi
leaq 0x40(%rsp), %rsi
movq %r12, 0x20(%rsp)
movq %r12, %rdx
callq 0x7a1b3
movq %r14, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
movl 0x44(%rsp), %eax
xorl %edx, %edx
idivq 0xc0(%rbx)
movq 0xb0(%rbx), %r10
movq %r10, %r8
imulq %rdx, %r8
movq 0x68(%rbx), %r15
movq 0xa8(%rbx), %rcx
movq %rcx, %r12
imulq %rax, %r12
subq %r12, %r15
cmpq %rcx, %r15
cmovgeq %rcx, %r15
movq 0xc8(%rbx), %r13
movq %r14, %rdi
leaq 0xa2bb6(%rip), %rsi     # 0x11ca77
movl %eax, %ecx
movq %r8, 0x28(%rsp)
movl %r12d, %r9d
xorl %eax, %eax
pushq %r15
pushq %r10
callq 0xde896
popq %rax
popq %rcx
movl $0x1000, %esi           # imm = 0x1000
movq %r14, %rdi
xorl %edx, %edx
callq 0xe59cd
movq %rax, %rbp
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x40(%rsp), %rdx
movq %rax, %rcx
movq %r15, %r8
callq 0x7a276
movq 0xe0(%rbx), %rdi
movq 0xa8(%rbx), %r8
movq 0xb0(%rbx), %rcx
testq %rdi, %rdi
je 0x79f37
subq $0x8, %rsp
xorl %esi, %esi
xorl %edx, %edx
xorl %r9d, %r9d
pushq $0x0
callq 0xe8292
popq %rax
popq %rcx
movq 0xe0(%rbx), %rax
jmp 0x79f5e
xorl %eax, %eax
cmpl $0x0, 0xd8(%rbx)
sete %al
leal 0x1(%rax,%rax), %eax
movq %r14, %rdi
movq %rcx, %rsi
movq %r8, %rdx
movl %eax, %ecx
callq 0xe7437
movq %rax, 0xe0(%rbx)
imulq %r15, %r13
movq 0x80(%rbx), %rdx
movq 0xc8(%rbx), %rcx
movq %rbp, %rdi
xorl %esi, %esi
movq %r13, %r8
movq 0x38(%rsp), %r9
pushq $0x2
pushq %rax
callq 0xe7de1
popq %rax
popq %rcx
movq 0xb0(%rbx), %r8
movq 0xe0(%rbx), %rdi
subq $0x8, %rsp
movq 0xa8(%rsp), %r13
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r15, %r9
pushq $0x0
pushq %r12
pushq 0x40(%rsp)
callq 0xe8314
addq $0x20, %rsp
movq %rbp, %rdi
callq 0xe5591
movq %r14, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
movq 0x10(%rsp), %r15
movq 0x20(%rsp), %r12
incq %r12
addq $0x8, %r15
jmp 0x79e20
movq %r14, %rdi
callq 0xdfd1a
movq %rax, %r15
movl $0x1, 0x78(%rax)
cvtsi2sdq 0x98(%rbx), %xmm0
movsd %xmm0, 0x80(%rax)
cvtsi2sdq 0xa0(%rbx), %xmm0
movsd %xmm0, 0x88(%rax)
pushq $0x2
popq %rdx
movq %r13, %rdi
movq %rax, %rsi
callq 0xe70ab
movq %r13, %rdi
callq 0xe7084
movq %r14, %rdi
movq %r15, %rsi
callq 0xdfd24
pushq $-0x1
popq %rsi
movq %r14, %rdi
callq 0xdeba7
jmp 0x79b25