// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/mbk.c
// Function: do_pkscreen_bank
static void do_pkscreen_bank(deark *c, lctx *d, i64 pos1)
{
	struct pkpic_ctx *pp = NULL;
	dbuf *unc_pixels = NULL;
	de_bitmap *img = NULL;
	struct atari_img_decode_data *adata = NULL;
	de_finfo *fi = NULL;
	const char *tname = NULL;
	i64 pos;
	UI num_planes;
	UI bits_per_pixel;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	pp = de_malloc(c, sizeof(struct pkpic_ctx));
	de_zeromem(d->pal, sizeof(d->pal));

	pos = pos1+4;
	pp->res_code = (UI)de_getu16be_p(&pos);
	de_dbg(c, "res: %u", pp->res_code);

	switch(pp->res_code) {
	case 0:
		if(d->imgtype_of_res0==PKPIC_IMGTYPE_UNKNOWN) {
			pp->imgtype = PKPIC_IMGTYPE_LOW;
		}
		else {
			pp->imgtype = d->imgtype_of_res0;
		}
		break;
	case 1:
		if(d->imgtype_of_res1==PKPIC_IMGTYPE_UNKNOWN) {
			const char *tmps;

			if(d->is_container_fmt) {
				pp->imgtype = PKPIC_IMGTYPE_MED;
				tmps = "l|h";
			}
			else {
				// Unfortunately, a file with res=1 (that couldn't be identified by
				// its extension) seems to be more likely to be the oddball PP1
				// format than the nice standard STOS medium-resolution format.
				pp->imgtype = PKPIC_IMGTYPE_PP1;
				tmps = "m|h";
			}
			de_warn(c, "Ambiguous image. If it looks wrong, try \"-opt stos:res1=<%s>\".", tmps);
		}
		else {
			pp->imgtype = d->imgtype_of_res1;
		}
		break;
	case 2: pp->imgtype = PKPIC_IMGTYPE_HIGH; break;
	default: pp->imgtype = PKPIC_IMGTYPE_UNKNOWN; break;
	}

	switch(pp->imgtype) {
	case PKPIC_IMGTYPE_LOW:
		num_planes = 4;
		bits_per_pixel = 4;
		tname = "4-plane low res";
		break;
	case PKPIC_IMGTYPE_M4P:
		num_planes = 4;
		bits_per_pixel = 2;
		tname = "DAJ 4-plane med res";
		break;
	case PKPIC_IMGTYPE_MED:
		num_planes = 2;
		bits_per_pixel = 2;
		tname = "2-plane med res";
		break;
	case PKPIC_IMGTYPE_HIGH:
		num_planes = 1;
		bits_per_pixel = 1;
		tname = "1-plane high res";
		break;
	case PKPIC_IMGTYPE_PP1:
		num_planes = 2;
		bits_per_pixel = 4;
		tname = "PP1 2-plane low res";
		break;
	case PKPIC_IMGTYPE_PP3:
		num_planes = 2;
		bits_per_pixel = 1;
		tname = "PP3 2-plane high res";
		break;
	default:
		de_err(c, "Unsupported picture resolution: %u", pp->res_code);
		goto done;
	}
	if(tname) {
		de_dbg(c, "interpreted image type: %s", tname);
	}

	pos += 4;
	pp->width_in_words = de_getu16be_p(&pos);
	pp->pseudowidth = pp->width_in_words * 16;
	if(pp->imgtype==PKPIC_IMGTYPE_PP1) {
		pp->w = pp->width_in_words * 8;
	}
	else if(pp->imgtype==PKPIC_IMGTYPE_M4P) {
		pp->w = pp->width_in_words * 32;
	}
	else {
		pp->w = pp->pseudowidth;
	}
	de_dbg(c, "width in words: %"I64_FMT, pp->width_in_words);
	pp->height_in_lumps = de_getu16be_p(&pos);
	de_dbg(c, "height in lumps: %"I64_FMT, pp->height_in_lumps);
	pos += 2; // unknown
	pp->lines_per_lump = de_getu16be_p(&pos);
	de_dbg(c, "lines per lump: %"I64_FMT, pp->lines_per_lump);
	pp->pseudoheight = pp->height_in_lumps * pp->lines_per_lump;
	if(pp->imgtype==PKPIC_IMGTYPE_PP3) {
		pp->h = pp->pseudoheight * 2;
	}
	else {
		pp->h = pp->pseudoheight;
	}
	de_dbg_dimensions(c, pp->w, pp->h);
	pos += 2; // flags
	pp->picdata_rel = 70;
	pp->rledata_rel = de_getu32be_p(&pos);
	pp->pointdata_rel = de_getu32be_p(&pos);
	pp->picdata_abs = pos1 + pp->picdata_rel;
	pp->rledata_abs = pos1 + pp->rledata_rel;
	pp->pointdata_abs = pos1 + pp->pointdata_rel;
	de_dbg(c, "picdata: %"I64_FMT, pp->picdata_abs);
	de_dbg(c, "rledata: %"I64_FMT, pp->rledata_abs);
	de_dbg(c, "pointdata: %"I64_FMT, pp->pointdata_abs);

	pos = pos1+38;
	de_dbg(c, "palette at %"I64_FMT, pos);
	de_dbg_indent(c, 1);
	fmtutil_read_atari_palette(c, c->infile, pos, d->pal, 16, 16, 0);
	de_dbg_indent(c, -1);

	if(bits_per_pixel==1) {
		if((d->pal[0] & 0xffffff)==0) {
			d->pal[0] = DE_STOCKCOLOR_BLACK;
			d->pal[1] = DE_STOCKCOLOR_WHITE;
		}
		else {
			d->pal[0] = DE_STOCKCOLOR_WHITE;
			d->pal[1] = DE_STOCKCOLOR_BLACK;
		}
	}

	pp->unc_image_size = pp->width_in_words*2 * (i64)num_planes * pp->h;

	unc_pixels = dbuf_create_membuf(c, 0, 0);

	fmtutil_decompress_stos_pictbank(c, c->infile, pp->picdata_abs, pp->rledata_abs,
		pp->pointdata_abs, unc_pixels, pp->unc_image_size);

	img = de_bitmap_create(c, pp->w, pp->h, ((bits_per_pixel==1)?1:3));
	render_stos_pictbank1(c, d, pp, unc_pixels, img, num_planes);

	fi = de_finfo_create(c);
	adata = de_malloc(c, sizeof(struct atari_img_decode_data));
	adata->bpp = (i64)bits_per_pixel;
	fmtutil_atari_set_standard_density(c, adata, fi);
	de_bitmap_write_to_file_finfo(img, fi, DE_CREATEFLAG_OPT_IMAGE);

done:
	de_bitmap_destroy(img);
	dbuf_close(unc_pixels);
	if(pp) {
		de_free(c, pp);
	}
	de_free(c, adata);
	de_finfo_destroy(c, fi);
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x7c(%rsp), %rsi
callq 0xdebae
pushq $0x78
popq %rsi
movq %rbx, %rdi
callq 0xdecaf
movq %rax, %r14
leaq 0x2c(%r12), %rdi
movl $0x400, %edx            # imm = 0x400
movq %rdi, 0x10(%rsp)
xorl %esi, %esi
callq 0x18140
leaq 0x4(%r13), %rax
leaq 0x80(%rsp), %rsi
movq %rax, (%rsi)
movq 0x18(%rbx), %rdi
callq 0xe3f6e
movl %eax, (%r14)
leaq 0x927c9(%rip), %rsi     # 0x123253
movq %rbx, 0x50(%rsp)
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movl (%r14), %eax
pushq $0x1
popq %rbp
pushq $0x1
popq %r15
cmpl $0x2, %eax
movq %r14, 0x18(%rsp)
je 0x90af1
pushq $0x4
popq %rdx
pushq $0x4
popq %rbx
cmpl $0x1, %eax
je 0x90b12
testl %eax, %eax
jne 0x90b60
movl 0x4(%r12), %eax
cmpl $0x63, %eax
jne 0x90b91
movq %rdx, 0x28(%rsp)
movl $0x64, 0x4(%r14)
leaq 0x927be(%rip), %rdx     # 0x1232a2
movl $0x0, 0x8(%rsp)
jmp 0x90c44
movl $0x66, 0x4(%r14)
movb $0x1, %al
movl %eax, 0x8(%rsp)
leaq 0x927d0(%rip), %rdx     # 0x1232d6
movl %ebp, %ebx
movq %r15, 0x28(%rsp)
jmp 0x90c44
movl 0x8(%r12), %eax
cmpl $0x63, %eax
jne 0x90b91
xorl %eax, %eax
cmpb $0x0, (%r12)
sete %al
leal 0x65(%rax,%rax,8), %eax
leaq 0x9272e(%rip), %rcx     # 0x12325f
leaq 0x92723(%rip), %rdx     # 0x12325b
cmoveq %rcx, %rdx
movl %eax, 0x4(%r14)
leaq 0x9271c(%rip), %rsi     # 0x123263
movq 0x50(%rsp), %rdi
xorl %eax, %eax
callq 0xdf05a
pushq $0x4
popq %rdx
movq 0x18(%rsp), %rax
movl 0x4(%rax), %eax
jmp 0x90b95
movl $0x63, 0x4(%r14)
movl (%r14), %edx
leaq 0x9279e(%rip), %rsi     # 0x123310
xorl %r12d, %r12d
movq 0x50(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0xdf2a5
xorl %r13d, %r13d
xorl %ebx, %ebx
xorl %r15d, %r15d
jmp 0x914ee
movl %eax, 0x4(%r14)
cmpl $0x64, %eax
je 0x90bd4
pushq $0x2
popq %rcx
pushq $0x2
popq %rsi
cmpl $0x65, %eax
je 0x90bea
cmpl $0x66, %eax
je 0x90c02
cmpl $0x6e, %eax
je 0x90c13
cmpl $0x70, %eax
je 0x90c2b
cmpl $0x78, %eax
movq 0x18(%rsp), %r14
jne 0x90b68
leaq 0x926ed(%rip), %rdx     # 0x1232b2
movl $0x0, 0x8(%rsp)
movq %rcx, 0x28(%rsp)
jmp 0x90c44
movq %rdx, 0x28(%rsp)
leaq 0x926c2(%rip), %rdx     # 0x1232a2
movl $0x0, 0x8(%rsp)
jmp 0x90c3f
leaq 0x926d5(%rip), %rdx     # 0x1232c6
movl $0x0, 0x8(%rsp)
movl %esi, %ebx
movq %rcx, 0x28(%rsp)
jmp 0x90c3f
movb $0x1, %al
movl %eax, 0x8(%rsp)
leaq 0x926c7(%rip), %rdx     # 0x1232d6
movl %ebp, %ebx
jmp 0x90c3a
movq %rdx, 0x28(%rsp)
leaq 0x926c8(%rip), %rdx     # 0x1232e7
movl $0x0, 0x8(%rsp)
movl %esi, %ebx
jmp 0x90c3f
movb $0x1, %al
movl %eax, 0x8(%rsp)
leaq 0x926c3(%rip), %rdx     # 0x1232fb
movl %esi, %ebx
movq %r15, 0x28(%rsp)
movq 0x18(%rsp), %r14
leaq 0x926e8(%rip), %rsi     # 0x123333
movq 0x50(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0xde896
leaq 0x80(%rsp), %rsi
addq $0x4, (%rsi)
movq 0x18(%r15), %rdi
callq 0xe3f6e
movq %rax, 0x8(%r14)
movq %rax, %rcx
shlq $0x4, %rcx
movq %rcx, 0x20(%r14)
movl 0x4(%r14), %edx
cmpl $0x78, %edx
je 0x90c95
cmpl $0x6e, %edx
jne 0x90c9c
movq %rax, %rcx
shlq $0x3, %rcx
jmp 0x90c9c
movq %rax, %rcx
shlq $0x5, %rcx
movq %rcx, 0x30(%r14)
leaq 0x926a7(%rip), %rsi     # 0x12334e
movq 0x50(%rsp), %rbp
movq %rbp, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbp), %rdi
leaq 0x80(%rsp), %r15
movq %r15, %rsi
callq 0xe3f6e
movq %rax, 0x10(%r14)
leaq 0x9268a(%rip), %rsi     # 0x123362
movq %rbp, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
addq $0x2, (%r15)
movq 0x18(%rbp), %rdi
movq %r15, %rsi
callq 0xe3f6e
movq %rax, 0x18(%r14)
leaq 0x92677(%rip), %rsi     # 0x123377
movq %rbp, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rdx
imulq 0x10(%r14), %rdx
movq %rdx, 0x28(%r14)
cmpl $0x70, 0x4(%r14)
sete %cl
shlq %cl, %rdx
movq %rdx, 0x38(%r14)
movq 0x30(%r14), %rsi
movq %rbp, %rdi
callq 0xdf038
addq $0x2, (%r15)
movq $0x46, 0x40(%r14)
movq 0x18(%rbp), %rdi
movq %r15, %rsi
callq 0xe4071
movq %rax, 0x50(%r14)
movq 0x18(%rbp), %rdi
movq %r15, %rsi
callq 0xe4071
movq %rax, 0x60(%r14)
movq 0x40(%r14), %rdx
addq %r13, %rdx
movq %rdx, 0x48(%r14)
movq 0x50(%r14), %rcx
addq %r13, %rcx
movq %rcx, 0x58(%r14)
addq %r13, %rax
movq %rax, 0x68(%r14)
leaq 0x92606(%rip), %rsi     # 0x12338b
movq %rbp, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x58(%r14), %rdx
leaq 0x925fe(%rip), %rsi     # 0x123398
movq %rbp, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x68(%r14), %rdx
leaq 0x925f6(%rip), %rsi     # 0x1233a5
movq %rbp, %rdi
xorl %eax, %eax
callq 0xde896
addq $0x26, %r13
movq %r13, (%r15)
leaq 0x98524(%rip), %rsi     # 0x1292eb
movq %rbp, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %r14
movq %rbp, %rdi
movl %r14d, %esi
callq 0xdeba7
movq 0x18(%rbp), %rsi
movq (%r15), %rdx
andl $0x0, (%rsp)
pushq $0x10
popq %r8
movq %rbp, %rdi
movq 0x10(%rsp), %rcx
movq %r8, %r9
callq 0xecea5
pushq $-0x1
popq %rsi
movq %rbp, %rdi
callq 0xdeba7
cmpb $0x0, 0x8(%rsp)
je 0x90e43
xorl %eax, %eax
xorl %ecx, %ecx
testl $0xffffff, 0x2c(%r12)   # imm = 0xFFFFFF
sete %al
setne %cl
negl %ecx
movl $0xff000000, %edx       # imm = 0xFF000000
orl %edx, %ecx
negl %eax
orl %edx, %eax
movl %ecx, 0x2c(%r12)
movl %eax, 0x30(%r12)
movl %r14d, %r15d
jmp 0x90e47
pushq $0x3
popq %r15
leal (%rbx,%rbx), %eax
movq 0x18(%rsp), %r14
imulq 0x8(%r14), %rax
imulq 0x38(%r14), %rax
movq %rax, 0x70(%r14)
movq %rbp, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xe59cd
movq %rax, %r12
movq 0x18(%rbp), %rsi
movq 0x48(%r14), %rdx
movq 0x58(%r14), %rcx
movq 0x68(%r14), %r8
movq 0x70(%r14), %rax
movq %rax, (%rsp)
movq %rbp, %rdi
movq %r12, %r9
callq 0xf0485
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rdx
movq %rbp, %rdi
movl %r15d, %ecx
callq 0xe7437
movq %rax, %r15
pushq $0x48
popq %rsi
movq %rbp, %rdi
callq 0xdecaf
movq %rax, %r13
movl %ebx, 0x4(%rax)
movl %ebx, 0x8(%rax)
movq 0x8(%r14), %rax
movq %rax, 0x20(%rsp)
leaq (%rax,%rax), %rcx
movq %rcx, 0x10(%r13)
movq 0x10(%r14), %rdx
movq %rdx, 0x18(%r13)
movq 0x18(%r14), %rax
movq %rax, 0x20(%r13)
movq 0x28(%r14), %rsi
movq %rsi, %rdi
movq %rsi, 0x28(%r13)
movq %r12, 0x90(%rsp)
movq %r12, 0x30(%r13)
movq %r15, 0x88(%rsp)
movq %r15, 0x38(%r13)
movq 0x10(%rsp), %rsi
movq %rsi, 0x40(%r13)
movl 0x4(%r14), %esi
cmpl $0x78, %esi
je 0x911e2
cmpl $0x70, %esi
pushq $0x1
popq %rbp
je 0x9108a
cmpl $0x6e, %esi
movq %rdi, %r15
jne 0x91353
imulq %rcx, %r15
xorl %esi, %esi
cmpq %rdx, %rsi
jge 0x91491
movq %rsi, %rdx
imulq %rax, %rdx
movq %rdx, 0x20(%rsp)
movq %rax, %rdx
imulq %rcx, %rdx
imulq %rsi, %rdx
movq %rdx, 0x58(%rsp)
movq %rax, %rbx
movq $0x0, 0x30(%rsp)
xorl %edx, %edx
movq %rsi, 0x40(%rsp)
cmpq %rcx, %rdx
jge 0x9107e
testb $0x2, %dl
jne 0x9105e
movq %rdx, %r12
subq 0x30(%rsp), %r12
shlq $0x3, %r12
movq %rdx, 0x48(%rsp)
imulq %rdx, %rbx
addq 0x58(%rsp), %rbx
xorl %ecx, %ecx
cmpq %rax, %rcx
jge 0x91065
movq %rcx, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
pushq $-0x2
popq %r14
testq %r14, %r14
je 0x90fe2
movq 0x30(%r13), %rdi
movq %rbx, %rsi
callq 0xe3eb4
movb %al, 0x3a(%rsp,%r14)
movq 0x20(%r13), %rax
movq 0x30(%r13), %rdi
leaq (%rbx,%rax,2), %rsi
callq 0xe3eb4
movb %al, 0x3c(%rsp,%r14)
incq %r14
addq %r15, %rbx
jmp 0x90fae
movq %r15, %r14
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax), %r15
xorl %ebx, %ebx
cmpq $0x8, %rbx
je 0x91042
movb $0x7, %cl
subb %bl, %cl
movl %ebp, %eax
shll %cl, %eax
xorl %ecx, %ecx
xorl %edx, %edx
cmpq $0x4, %rcx
je 0x91024
movzbl 0x38(%rsp,%rcx), %esi
andl %eax, %esi
movl %ebp, %edi
shll %cl, %edi
testl %esi, %esi
cmovel %esi, %edi
orl %edi, %edx
incq %rcx
jmp 0x91007
leaq (%rbx,%r12), %rsi
movq 0x38(%r13), %rdi
movq 0x40(%r13), %rax
movl %edx, %ecx
movl (%rax,%rcx,4), %ecx
movq %r15, %rdx
callq 0xe7287
incq %rbx
jmp 0x90ff5
movq 0x10(%rsp), %rcx
incq %rcx
movq 0x20(%r13), %rax
movq 0x8(%rsp), %rbx
incq %rbx
movq %r14, %r15
jmp 0x90f97
incq 0x30(%rsp)
jmp 0x91076
movq 0x10(%r13), %rcx
movq %rax, %rbx
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
incq %rdx
jmp 0x90f69
incq %rsi
movq 0x18(%r13), %rdx
jmp 0x90f31
movq %rdi, %rsi
imulq %rcx, %rsi
xorl %edi, %edi
movq %rsi, 0x30(%rsp)
cmpq %rdx, %rdi
jge 0x91491
movq %rdi, %r8
imulq %rax, %r8
movq %r8, 0x68(%rsp)
imulq %rcx, %r8
movq %r8, 0x60(%rsp)
movq %rax, %rdx
xorl %r8d, %r8d
movq %rdi, 0x70(%rsp)
cmpq %rcx, %r8
jge 0x911d6
testb $0x1, %r8b
jne 0x911ce
xorl %ecx, %ecx
cmpq 0x20(%rsp), %r8
setge %cl
movq %rcx, 0x58(%rsp)
imulq %r8, %rdx
addq 0x60(%rsp), %rdx
movq %rdx, 0x40(%rsp)
xorl %r9d, %r9d
movq %r8, 0x48(%rsp)
cmpq %rax, %r9
jge 0x911c7
movq %r8, %rbp
cmpq 0x20(%rsp), %r8
jl 0x91119
movq %r8, %rax
cqto
idivq 0x20(%rsp)
movq %rdx, %rbp
movq 0x68(%rsp), %rax
addq %r9, %rax
movq 0x58(%rsp), %rcx
leaq (%rcx,%rax,2), %r12
shlq $0x4, %rbp
movq 0x40(%rsp), %rax
movq %r9, 0x8(%rsp)
addq %r9, %rax
movq %rax, 0x10(%rsp)
xorl %r14d, %r14d
cmpl $0x4, %r14d
je 0x911ac
movq 0x30(%r13), %rdi
movl %r14d, %eax
shrl %eax
imulq %rsi, %rax
addq 0x10(%rsp), %rax
movl %r14d, %esi
andl $0x1, %esi
imulq 0x20(%r13), %rsi
addq %rax, %rsi
callq 0xe3eb4
movzbl %al, %ebx
pushq $0x7
popq %r15
cmpl $-0x1, %r15d
je 0x911a2
xorl %eax, %eax
btl %r15d, %ebx
setb %al
movq 0x38(%r13), %rdi
movq 0x40(%r13), %rcx
movl (%rcx,%rax,4), %ecx
movq %rbp, %rsi
movq %r12, %rdx
callq 0xe7287
incq %rbp
decl %r15d
jmp 0x91175
incl %r14d
movq 0x30(%rsp), %rsi
jmp 0x91143
movq 0x8(%rsp), %r9
incq %r9
movq 0x20(%r13), %rax
movq 0x70(%rsp), %rdi
movq 0x48(%rsp), %r8
jmp 0x910f9
movq 0x10(%r13), %rcx
movq %rax, %rdx
incq %r8
jmp 0x910c1
incq %rdi
movq 0x18(%r13), %rdx
jmp 0x91098
movq %rdi, %r15
imulq %rcx, %r15
xorl %esi, %esi
pushq $0x1
popq %rbp
movq %r15, 0x30(%rsp)
cmpq %rdx, %rsi
jge 0x91491
movq %rsi, %rdx
imulq %rax, %rdx
movq %rdx, 0x68(%rsp)
movq %rax, %rdx
imulq %rcx, %rdx
imulq %rsi, %rdx
movq %rdx, 0x60(%rsp)
xorl %edx, %edx
movq %rsi, 0x70(%rsp)
cmpq %rcx, %rdx
jge 0x91347
movq %rdx, %rcx
shlq $0x4, %rcx
leaq -0x8(%rcx), %rdi
testb $0x1, %dl
cmoveq %rcx, %rdi
movq %rdi, 0x58(%rsp)
movq %rax, %rbx
imulq %rdx, %rbx
addq 0x60(%rsp), %rbx
xorl %r12d, %r12d
movq %rdx, 0x40(%rsp)
cmpq %rax, %r12
jge 0x9133b
movq %rbx, 0x48(%rsp)
xorl %r14d, %r14d
cmpq $0x4, %r14
je 0x91283
movq 0x30(%r13), %rdi
movq %rbx, %rsi
callq 0xe3eb4
movb %al, 0x38(%rsp,%r14)
incq %r14
addq %r15, %rbx
jmp 0x91264
movq 0x68(%rsp), %rax
leaq (%r12,%rax), %r15
movq 0x58(%rsp), %rbx
xorl %eax, %eax
movq %r12, 0x20(%rsp)
cmpq $0x8, %rax
je 0x91318
pushq $0x7
popq %r12
movq %rax, 0x8(%rsp)
subl %eax, %r12d
movl %r12d, %ecx
shll %cl, %ebp
movq %rbx, 0x10(%rsp)
xorl %r14d, %r14d
cmpq $0x2, %r14
je 0x912fe
movzbl 0x39(%rsp,%r14,2), %eax
xorl %ecx, %ecx
testl %eax, %ebp
setne %cl
movzbl 0x38(%rsp,%r14,2), %eax
xorl %edx, %edx
btl %r12d, %eax
setb %dl
movq 0x38(%r13), %rdi
movq 0x40(%r13), %rax
shll $0x2, %edx
leal (%rdx,%rcx,8), %ecx
movl (%rax,%rcx), %ecx
movq %rbx, %rsi
movq %r15, %rdx
callq 0xe7287
incq %r14
addq $0x10, %rbx
jmp 0x912b7
movq 0x8(%rsp), %rax
incq %rax
movq 0x10(%rsp), %rbx
incq %rbx
pushq $0x1
popq %rbp
movq 0x20(%rsp), %r12
jmp 0x91298
incq %r12
movq 0x20(%r13), %rax
movq 0x48(%rsp), %rbx
incq %rbx
movq 0x30(%rsp), %r15
movq 0x70(%rsp), %rsi
movq 0x40(%rsp), %rdx
jmp 0x91253
incq %rdx
movq 0x10(%r13), %rcx
jmp 0x9121f
incq %rsi
movq 0x18(%r13), %rdx
jmp 0x911f3
andq $0x0, 0x38(%rsp)
imulq %rcx, %r15
xorl %esi, %esi
cmpq %rdx, %rsi
jge 0x9148c
movq %rsi, %rdx
imulq %rax, %rdx
movq %rdx, 0x20(%rsp)
movq %rax, %rdx
imulq %rcx, %rdx
imulq %rsi, %rdx
movq %rdx, 0x40(%rsp)
xorl %edx, %edx
movq %rsi, 0x48(%rsp)
cmpq %rcx, %rdx
jge 0x91480
leaq (,%rdx,8), %r12
movq %rax, %rbx
movq %rdx, 0x30(%rsp)
imulq %rdx, %rbx
addq 0x40(%rsp), %rbx
xorl %ecx, %ecx
cmpq %rax, %rcx
jge 0x9146a
movq %rcx, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
xorl %r14d, %r14d
movl 0x4(%r13), %eax
cmpq %rax, %r14
jae 0x913e7
movq 0x30(%r13), %rdi
movq %rbx, %rsi
callq 0xe3eb4
movb %al, 0x38(%rsp,%r14)
incq %r14
addq %r15, %rbx
jmp 0x913c5
movq %r15, %r14
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax), %r15
xorl %ebx, %ebx
cmpq $0x8, %rbx
je 0x9144e
movb $0x7, %cl
subb %bl, %cl
movl %ebp, %eax
shll %cl, %eax
movl 0x8(%r13), %esi
xorl %ecx, %ecx
xorl %edx, %edx
cmpq %rcx, %rsi
je 0x91430
movzbl 0x38(%rsp,%rcx), %edi
andl %eax, %edi
movl %ebp, %r8d
shll %cl, %r8d
testl %edi, %edi
cmovel %edi, %r8d
orl %r8d, %edx
incq %rcx
jmp 0x91410
leaq (%rbx,%r12), %rsi
movq 0x38(%r13), %rdi
movq 0x40(%r13), %rax
movl %edx, %ecx
movl (%rax,%rcx,4), %ecx
movq %r15, %rdx
callq 0xe7287
incq %rbx
jmp 0x913fa
movq 0x10(%rsp), %rcx
incq %rcx
movq 0x20(%r13), %rax
movq 0x8(%rsp), %rbx
incq %rbx
movq %r14, %r15
jmp 0x913af
movq 0x30(%rsp), %rdx
incq %rdx
movq 0x10(%r13), %rcx
movq 0x48(%rsp), %rsi
jmp 0x9138b
incq %rsi
movq 0x18(%r13), %rdx
jmp 0x9135f
movb $0x1, (%r13)
movq 0x50(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0xded32
movq %r14, %rdi
callq 0xdfd1a
movq %rax, %r15
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0xdecaf
movq %rax, %rbx
movq 0x28(%rsp), %rax
movq %rax, (%rbx)
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xed4e6
pushq $0x2
popq %rdx
movq 0x88(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0xe70ab
movq 0x90(%rsp), %r12
movq %r13, %rdi
callq 0xe7084
movq %r12, %rdi
callq 0xe5591
movq %r14, %rdi
movq 0x18(%rsp), %rsi
callq 0xded32
movq %r14, %rdi
movq %rbx, %rsi
callq 0xded32
movq %r14, %rdi
movq %r15, %rsi
callq 0xdfd24
movl 0x7c(%rsp), %esi
movq %r14, %rdi
callq 0xdebb7
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq