LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cdiimage.c
// Function: do_cdi_imag_PLTE
static void do_cdi_imag_PLTE(deark *c, struct cdi_imag_ctx *d, struct de_iffctx *ictx)
{
	i64 offset;
	i64 count;

	offset = dbuf_getu16be(ictx->f, ictx->chunkctx->dpos);
	count = dbuf_getu16be(ictx->f, ictx->chunkctx->dpos+2);
	de_dbg(c, "entries: %u", (UI)count);
	if(offset>255 || count<1) return;
	de_read_palette_rgb(ictx->f, ictx->chunkctx->dpos+4, count, 3,
		&d->pal[offset], 256-offset, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x40(%rax), %rsi
callq 0x1651d0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x40(%rax), %rsi
addq $0x2, %rsi
callq 0x1651d0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x14ece3(%rip), %rsi    # 0x1d724c
movb $0x0, %al
callq 0x15b0d0
cmpq $0xff, -0x20(%rbp)
jg 0x88581
cmpq $0x1, -0x28(%rbp)
jge 0x88583
jmp 0x885d2
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x40(%rax), %rsi
addq $0x4, %rsi
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %r8
addq $0x30, %r8
movq -0x20(%rbp), %rax
shlq $0x2, %rax
addq %rax, %r8
movl $0x100, %r9d            # imm = 0x100
subq -0x20(%rbp), %r9
movl $0x3, %ecx
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0x16c0c0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cdiimage.c
// Function: do_cdi_imag_model8
static int do_cdi_imag_model8(deark *c, struct cdi_imag_ctx *d, struct de_iffctx *ictx,
	de_bitmap *img)
{
	int retval = 0;
	dbuf *unc_pixels = NULL;

	if(d->depth!=8) return 0;

	unc_pixels = dbuf_create_membuf(c, d->npwidth*d->h, 0x1);
	dbuf_enable_wbuffer(unc_pixels);
	if(!cdi_imag_decompress_rl7(c, d, ictx, unc_pixels)) goto done;
	// Note: There are ways to change the palette partway through the image,
	// so if we were to fully support this model, we could not use
	// de_convert_image_paletted().
	de_convert_image_paletted(unc_pixels, 0, (i64)d->depth,
		d->npwidth, d->pal, img, 0);
	retval = 1;

done:
	dbuf_close(unc_pixels);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x8, 0x24(%rax)
je 0x8882d
movl $0x0, -0x4(%rbp)
jmp 0x888bc
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
imulq 0x10(%rax), %rsi
movl $0x1, %edx
callq 0x168020
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x167b90
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x88a30
cmpl $0x0, %eax
jne 0x88874
jmp 0x888ad
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, %edx
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %r8
addq $0x30, %r8
movq -0x28(%rbp), %r9
xorl %eax, %eax
movl %eax, %esi
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0x16c520
movl $0x1, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
callq 0x1676a0
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/cdiimage.c
// Function: yuv_to_rgb
static void yuv_to_rgb(UI y, UI u, UI v, de_color *rgbclr)
{
	double r1, g1, b1;

	b1 = (double)y + ((double)u - 128.0) * 1.733;
	r1 = (double)y + ((double)v - 128.0) * 1.371;
	g1 = ((double)y - 0.299*r1 - 0.114*b1)/0.587;
	*rgbclr = DE_MAKE_RGB(dbl_to_u8(r1), dbl_to_u8(g1), dbl_to_u8(b1));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movq %rcx, -0x18(%rbp)
movl -0x4(%rbp), %eax
cvtsi2sd %rax, %xmm1
movl -0x8(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x12626b(%rip), %xmm2   # 0x1aeb68
subsd %xmm2, %xmm0
movsd 0x126267(%rip), %xmm3   # 0x1aeb70
mulsd %xmm3, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movl -0x4(%rbp), %eax
cvtsi2sd %rax, %xmm1
movl -0xc(%rbp), %eax
cvtsi2sd %rax, %xmm0
subsd %xmm2, %xmm0
movsd 0x126246(%rip), %xmm2   # 0x1aeb78
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movl -0x4(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd -0x20(%rbp), %xmm1
movsd 0x12620c(%rip), %xmm2   # 0x1aeb60
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
movsd 0x1261ef(%rip), %xmm2   # 0x1aeb58
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd 0x1261d7(%rip), %xmm1   # 0x1aeb50
divsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x889e0
movzbl %al, %eax
shll $0x10, %eax
orl $0xff000000, %eax       # imm = 0xFF000000
movl %eax, -0x38(%rbp)
movsd -0x28(%rbp), %xmm0
callq 0x889e0
movb %al, %cl
movl -0x38(%rbp), %eax
movzbl %cl, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl %eax, -0x34(%rbp)
movsd -0x30(%rbp), %xmm0
callq 0x889e0
movl -0x34(%rbp), %ecx
movzbl %al, %eax
orl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/clp.c
// Function: de_module_clp
void de_module_clp(deark *c, struct deark_module_info *mi)
{
	mi->id = "clp";
	mi->desc = "Windows Clipboard";
	mi->run_fn = de_run_clp;
	mi->identify_fn = de_identify_clp;
	mi->help_fn = de_help_clp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x126089(%rip), %rcx    # 0x1aecd0
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0x12607f(%rip), %rcx    # 0x1aecd4
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x2c(%rip), %rcx        # 0x88c90
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x22d(%rip), %rcx       # 0x88ea0
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
leaq 0x28e(%rip), %rcx       # 0x88f10
movq %rcx, 0x28(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/clp.c
// Function: de_identify_clp
static int de_identify_clp(deark *c)
{
	int has_ext;
	UI sig;

	// TODO: Improve this
	sig = (UI)de_getu16le(0);
	if(sig<0xc350 || sig>0xc352) return 0;
	has_ext = de_input_file_has_ext(c, "clp");
	if(has_ext) return 80;
	return 15;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x165280
movl %eax, -0x18(%rbp)
cmpl $0xc350, -0x18(%rbp)    # imm = 0xC350
jb 0x88ed2
cmpl $0xc352, -0x18(%rbp)    # imm = 0xC352
jbe 0x88edb
movl $0x0, -0x4(%rbp)
jmp 0x88f04
movq -0x10(%rbp), %rdi
leaq 0x125dea(%rip), %rsi    # 0x1aecd0
callq 0x15d180
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x88efd
movl $0x50, -0x4(%rbp)
jmp 0x88f04
movl $0xf, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/clp.c
// Function: do_process_items
static void do_process_items(deark *c, lctx *d)
{
	UI i;

	// Items to read first (PALETTE, LOCALE)
	for(i=0; i<(UI)d->num_items; i++) {
		if(d->index_array[i].clpfmt==CFMT_PALETTE || d->index_array[i].clpfmt==CFMT_LOCALE) {
			do_item(c, d, i);
			d->index_array[i].handled = 1;
		}
	}

	// Everything else
	for(i=0; i<(UI)d->num_items; i++) {
		if(d->index_array[i].handled==0) {
			do_item(c, d, i);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl %ecx, %eax
jae 0x89198
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x9, 0x4(%rax)
je 0x89166
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x10, 0x4(%rax)
jne 0x8918b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x891f0
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movb $0x1, (%rax)
jmp 0x8918d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x89127
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl %ecx, %eax
jae 0x891e5
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x891d8
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x891f0
jmp 0x891da
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8919f
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/clp.c
// Function: get_cf_name
static int get_cf_name(deark *c, lctx *d, UI clpfmt, char *buf, size_t buflen)
{
	static const char *names[18] = { NULL, "TEXT", "BITMAP", "METAFILEPICT",
		"SYLK", "DIF", "TIFF", "OEMTEXT", "DIB", "PALETTE", "PENDATA", "RIFF",
		"WAVE", "UNICODETEXT", "ENHMETAFILE", "HDROP", "LOCALE", "DIBV5" };

	if((size_t)clpfmt<DE_ARRAYCOUNT(names) && names[clpfmt]) {
		de_snprintf(buf, buflen, "CF_%s", names[clpfmt]);
		return 1;
	}
	// TODO: CF_OWNERDISPLAY, etc.
	de_strlcpy(buf, "?", buflen);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl -0x1c(%rbp), %eax
cmpq $0x12, %rax
jae 0x89646
movl -0x1c(%rbp), %eax
movl %eax, %ecx
leaq 0x19c0c0(%rip), %rax    # 0x2256d0
cmpq $0x0, (%rax,%rcx,8)
je 0x89646
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x1c(%rbp), %eax
movl %eax, %ecx
leaq 0x19c0a5(%rip), %rax    # 0x2256d0
movq (%rax,%rcx,8), %rcx
leaq 0x12576d(%rip), %rdx    # 0x1aeda3
movb $0x0, %al
callq 0x15a980
movl $0x1, -0x4(%rbp)
jmp 0x89661
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x12e5d8(%rip), %rsi    # 0x1b7c2d
callq 0x15aa30
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/clp.c
// Function: set_output_filename
static void set_output_filename(deark *c, lctx *d, struct member_data *md, struct index_item *ii)
{
	i64 i;
	int escape_flag = 0;
	de_ucstring *s = NULL;

	s = ucstring_create(c);

	if(c->filenames_from_file) {
		for(i=0; i<md->name->len; i++) {
			if(md->name->str[i]=='&' && !escape_flag) {
				escape_flag = 1;
			}
			else {
				ucstring_append_char(s, md->name->str[i]);
				escape_flag = 0;
			}
		}
	}

	if(ii->clpfmt==CFMT_BITMAP || ii->clpfmt==CFMT_DSPBITMAP) {
		// Add an indication that this was a device-dependent bitmap
		if(ucstring_isnonempty(s)) {
			ucstring_append_char(s, '.');
		}
		ucstring_append_sz(s, "ddb", DE_ENCODING_LATIN1);
	}

	if(ucstring_isempty(s) && md->clpfmtname_known) {
		ucstring_append_sz(s, md->clpfmtname_sz, DE_ENCODING_UTF8);
	}

	if(ucstring_isnonempty(s)) {
		de_finfo_set_name_from_ucstring(c, md->fi, s, 0);
	}

	ucstring_destroy(s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0xd0(%rax)
je 0x89725
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x10(%rcx), %rax
jge 0x89723
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
cmpl $0x26, (%rax,%rcx,4)
jne 0x896f0
cmpl $0x0, -0x2c(%rbp)
jne 0x896f0
movl $0x1, -0x2c(%rbp)
jmp 0x89713
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x1714c0
movl $0x0, -0x2c(%rbp)
jmp 0x89715
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x896b9
jmp 0x89725
movq -0x20(%rbp), %rax
cmpl $0x2, 0x4(%rax)
je 0x8973c
movq -0x20(%rbp), %rax
cmpl $0x82, 0x4(%rax)
jne 0x8976d
movq -0x38(%rbp), %rdi
callq 0x1717f0
cmpl $0x0, %eax
je 0x89758
movq -0x38(%rbp), %rdi
movl $0x2e, %esi
callq 0x1714c0
movq -0x38(%rbp), %rdi
leaq 0x12564e(%rip), %rsi    # 0x1aedb1
movl $0x5, %edx
callq 0x1715e0
movq -0x38(%rbp), %rdi
callq 0x1717b0
cmpl $0x0, %eax
je 0x8979e
movq -0x18(%rbp), %rax
movzbl 0x20(%rax), %eax
cmpl $0x0, %eax
je 0x8979e
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
addq $0x21, %rsi
movl $0x2, %edx
callq 0x1715e0
movq -0x38(%rbp), %rdi
callq 0x1717f0
cmpl $0x0, %eax
je 0x897c3
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x38(%rbp), %rdx
xorl %ecx, %ecx
callq 0x15d2c0
movq -0x38(%rbp), %rdi
callq 0x171750
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/clp.c
// Function: extract_ddb
static void extract_ddb(deark *c, lctx *d, struct member_data *md, struct index_item *ii)
{
	int old_extract_count;
	de_module_params *mparams = NULL;

	mparams = de_malloc(c, sizeof(de_module_params));
	de_dbg(c, "reading ddb");
	de_dbg_indent(c, 1);
	mparams->in_params.codes = "N";
	mparams->in_params.fi = md->fi;
	if(d->have_pal) {
		mparams->in_params.obj1 = (void*)d->pal;
	}
	old_extract_count = c->num_files_extracted;
	de_run_module_by_id_on_slice(c, "ddb", mparams, c->infile, ii->dpos, ii->dlen);
	de_dbg_indent(c, -1);

	if(c->num_files_extracted>old_extract_count && !d->ddb_warned) {
		de_warn(c, "Nonportable DDB images might not be decoded correctly");
		d->ddb_warned = 1;
	}

	de_free(c, mparams);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl $0x70, %esi
callq 0x15b780
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x12558c(%rip), %rsi    # 0x1aeda9
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x30(%rbp), %rax
leaq 0x1165bf(%rip), %rcx    # 0x19fdfc
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x38(%rax)
je 0x8986a
movq -0x10(%rbp), %rcx
addq $0x3c, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rax
movl 0x3c(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %r8
movq -0x20(%rbp), %rax
movq 0x10(%rax), %r9
leaq 0x125516(%rip), %rsi    # 0x1aedb1
callq 0x15c9f0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x8(%rbp), %rax
movl 0x3c(%rax), %eax
cmpl -0x24(%rbp), %eax
jle 0x898de
movq -0x10(%rbp), %rax
cmpb $0x0, 0x5(%rax)
jne 0x898de
movq -0x8(%rbp), %rdi
leaq 0x1254e6(%rip), %rsi    # 0x1aedb5
movb $0x0, %al
callq 0x15bc10
movq -0x10(%rbp), %rax
movb $0x1, 0x5(%rax)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x15b820
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/clp.c
// Function: extract_dib
static void extract_dib(deark *c, lctx *d, struct member_data *md, struct index_item *ii)
{
	de_module_params *mparams = NULL;

	mparams = de_malloc(c, sizeof(de_module_params));
	de_dbg(c, "reading dib");
	de_dbg_indent(c, 1);
	mparams->in_params.fi = md->fi;
	de_run_module_by_id_on_slice(c, "dib", mparams, c->infile, ii->dpos, ii->dlen);
	de_dbg_indent(c, -1);
	de_free(c, mparams);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl $0x70, %esi
callq 0x15b780
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x1254ae(%rip), %rsi    # 0x1aedeb
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %r8
movq -0x20(%rbp), %rax
movq 0x10(%rax), %r9
leaq 0x12546a(%rip), %rsi    # 0x1aedf3
callq 0x15c9f0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x15b820
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/clp.c
// Function: extract_text
static void extract_text(deark *c, lctx *d, struct member_data *md, struct index_item *ii)
{
	de_ext_encoding ee;
	const char *ext;
	i64 dlen = ii->dlen;

	ext = "txt";
	if(ii->clpfmt==CFMT_TEXT || ii->clpfmt==CFMT_DSPTEXT) {
		ee = DE_EXTENC_MAKE(d->input_encoding_ansi, DE_ENCSUBTYPE_HYBRID);
	}
	else if(ii->clpfmt==CFMT_OEMTEXT) {
		ee = DE_EXTENC_MAKE(d->input_encoding_oem, DE_ENCSUBTYPE_HYBRID);
	}
	else if(ii->clpfmt==CFMT_UNICODETEXT) {
		ee = DE_ENCODING_UTF16LE;
	}
	else {
		goto done;
	}

	// Search for the NUL terminator, to refine the data len.
	if(ii->clpfmt==CFMT_UNICODETEXT) {
		i64 bytes_consumed = 0;

		if(dbuf_get_utf16_NULterm_len(c->infile, ii->dpos, ii->dlen, &bytes_consumed)) {
			dlen = bytes_consumed - 2;
		}
	}
	else {
		i64 foundpos = 0;

		if(dbuf_search_byte(c->infile, 0x00, ii->dpos, ii->dlen, &foundpos)) {
			dlen = foundpos - ii->dpos;
		}
	}

	create_text_file_from_slice(c->infile, ii->dpos, dlen, ee, ext, md->fi);
done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
leaq 0x12c216(%rip), %rax    # 0x1b5bf1
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x1, 0x4(%rax)
je 0x899f6
movq -0x20(%rbp), %rax
cmpl $0x81, 0x4(%rax)
jne 0x89a0c
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
andl $0xff, %eax
orl $0x300, %eax            # imm = 0x300
movl %eax, -0x24(%rbp)
jmp 0x89a48
movq -0x20(%rbp), %rax
cmpl $0x7, 0x4(%rax)
jne 0x89a2c
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
orl $0x300, %eax            # imm = 0x300
movl %eax, -0x24(%rbp)
jmp 0x89a46
movq -0x20(%rbp), %rax
cmpl $0xd, 0x4(%rax)
jne 0x89a3f
movl $0x3, -0x24(%rbp)
jmp 0x89a44
jmp 0x89af8
jmp 0x89a46
jmp 0x89a48
movq -0x20(%rbp), %rax
cmpl $0xd, 0x4(%rax)
jne 0x89a8e
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
leaq -0x40(%rbp), %rcx
callq 0x1695b0
cmpl $0x0, %eax
je 0x89a8c
movq -0x40(%rbp), %rax
subq $0x2, %rax
movq %rax, -0x38(%rbp)
jmp 0x89ad0
movq $0x0, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
xorl %esi, %esi
leaq -0x48(%rbp), %r8
callq 0x1667a0
cmpl $0x0, %eax
je 0x89ace
movq -0x48(%rbp), %rax
movq -0x20(%rbp), %rcx
subq 0x8(%rcx), %rax
movq %rax, -0x38(%rbp)
jmp 0x89ad0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x38(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movq -0x18(%rbp), %rax
movq 0x10(%rax), %r9
callq 0x89cf0
addq $0x50, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/clp.c
// Function: read_palette
static void read_palette(deark *c, lctx *d, struct member_data *md, struct index_item *ii)
{
	i64 dpos, dlen;

	if(d->have_pal) goto done;
	dpos = ii->dpos + 4;
	dlen = ii->dlen - 4;

	de_dbg(c, "reading palette");
	d->have_pal = 1;
	de_dbg_indent(c, 1);
	de_read_palette_rgb(c->infile, dpos, dlen/4, 4,
		d->pal, 256, 0);
	de_dbg_indent(c, -1);

done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x38(%rax)
je 0x89b27
jmp 0x89bbb
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x4, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
subq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x1252a5(%rip), %rsi    # 0x1aedf7
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movb $0x1, 0x38(%rax)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rax
movl $0x4, %ecx
cqto
idivq %rcx
movq %rax, %rdx
movq -0x10(%rbp), %r8
addq $0x3c, %r8
movl $0x4, %ecx
movl $0x100, %r9d            # imm = 0x100
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0x16c0c0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/clp.c
// Function: destroy_md
static void destroy_md(deark *c, struct member_data *md)
{
	if(!md) return;
	de_finfo_destroy(c, md->fi);
	ucstring_destroy(md->name);
	de_free(c, md);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x89cb9
jmp 0x89ce4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x15d260
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x171750
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15b820
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/clp.c
// Function: create_text_file_from_slice
static void create_text_file_from_slice(dbuf *inf, i64 pos1, i64 len,
	de_ext_encoding ee, const char *ext, de_finfo *fi)
{
	dbuf *outf = NULL;

	outf = dbuf_create_output_file(inf->c, ext, fi, 0);
	if(inf->c->write_bom) {
		dbuf_write_uchar_as_utf8(outf, 0xfeff);
	}
	dbuf_copy_slice_convert_to_utf8(inf, pos1, len, ee, outf, 0);
	dbuf_close(outf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0x166c60
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpb $0x0, 0xcc(%rax)
je 0x89d51
movq -0x38(%rbp), %rdi
movl $0xfeff, %esi           # imm = 0xFEFF
callq 0x160cc0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
movq -0x38(%rbp), %r8
xorl %r9d, %r9d
callq 0x169da0
movq -0x38(%rbp), %rdi
callq 0x1676a0
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: de_module_comicchat
void de_module_comicchat(deark *c, struct deark_module_info *mi)
{
	mi->id = "comicchat";
	mi->desc = "Microsoft Comic Chat AVB or BGB";
	mi->run_fn = de_run_comicchat;
	mi->identify_fn = de_identify_comicchat;
	mi->help_fn = de_help_comicchat;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x1250ca(%rip), %rcx    # 0x1aee61
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0x1250c6(%rip), %rcx    # 0x1aee6b
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x2c(%rip), %rcx        # 0x89de0
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x27d(%rip), %rcx       # 0x8a040
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
leaq 0x3de(%rip), %rcx       # 0x8a1b0
movq %rcx, 0x28(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: de_identify_comicchat
static int de_identify_comicchat(deark *c)
{
	u8 has_ext, has_hdr, has_endtag;
	UI n0, n2, n4;

	n0 = (UI)de_getu16be(0);
	if(n0!=0x8100 && n0!=0x8181) return 0;
	n2 = (UI)de_getu16le(2);
	n4 = (UI)de_getu16le(4);

	has_hdr = 0;
	if(n0==0x8100) {
		if(n4==1 && (n2==1 || n2==2)) has_hdr = 1;
	}
	else { // 0x8181
		if(n4==2 && (n2>=1 && n2<=3)) has_hdr = 1;
	}
	if(!has_hdr) return 0;

	has_endtag = (de_getu16le(c->infile->len - 2) == 0x0007);
	has_ext = (de_input_file_has_ext(c, "avb") ||
		de_input_file_has_ext(c, "bgb"));
	if(has_endtag && has_ext) return 100;
	if(has_endtag || has_ext) return 55;
	return 35;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1651d0
movl %eax, -0x18(%rbp)
cmpl $0x8100, -0x18(%rbp)    # imm = 0x8100
je 0x8a07e
cmpl $0x8181, -0x18(%rbp)    # imm = 0x8181
je 0x8a07e
movl $0x0, -0x4(%rbp)
jmp 0x8a1a0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x2, %esi
callq 0x165280
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x4, %esi
callq 0x165280
movl %eax, -0x20(%rbp)
movb $0x0, -0x12(%rbp)
cmpl $0x8100, -0x18(%rbp)    # imm = 0x8100
jne 0x8a0cd
cmpl $0x1, -0x20(%rbp)
jne 0x8a0cb
cmpl $0x1, -0x1c(%rbp)
je 0x8a0c7
cmpl $0x2, -0x1c(%rbp)
jne 0x8a0cb
movb $0x1, -0x12(%rbp)
jmp 0x8a0e5
cmpl $0x2, -0x20(%rbp)
jne 0x8a0e3
cmpl $0x1, -0x1c(%rbp)
jb 0x8a0e3
cmpl $0x3, -0x1c(%rbp)
ja 0x8a0e3
movb $0x1, -0x12(%rbp)
jmp 0x8a0e5
cmpb $0x0, -0x12(%rbp)
jne 0x8a0f7
movl $0x0, -0x4(%rbp)
jmp 0x8a1a0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rsi
subq $0x2, %rsi
callq 0x165280
cmpq $0x7, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
movb %al, -0x13(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x124fc2(%rip), %rsi    # 0x1af0f0
callq 0x15d180
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x21(%rbp)
jne 0x8a158
movq -0x10(%rbp), %rdi
leaq 0x124faa(%rip), %rsi    # 0x1af0f4
callq 0x15d180
cmpl $0x0, %eax
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movb %al, -0x11(%rbp)
movzbl -0x13(%rbp), %eax
cmpl $0x0, %eax
je 0x8a17e
movzbl -0x11(%rbp), %eax
cmpl $0x0, %eax
je 0x8a17e
movl $0x64, -0x4(%rbp)
jmp 0x8a1a0
movzbl -0x13(%rbp), %eax
cmpl $0x0, %eax
jne 0x8a190
movzbl -0x11(%rbp), %eax
cmpl $0x0, %eax
je 0x8a199
movl $0x37, -0x4(%rbp)
jmp 0x8a1a0
movl $0x23, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: get_chunk_type_name
static const char *get_chunk_type_name(UI t)
{
	const char *name = NULL;

	switch(t) {
	case 0x1: name = "char name"; break;
		// 0x2 = ?
	case 0x3: case 0x100: name = "icon ref"; break;
	case 0x4: case 0x5: case 0x9: case 0xa: case 0xb: case 0xc:
		name = "image refs";
		break;
	case 0x6: name = "start of img data"; break;
		// 0x7 = end of img data (but we won't find it)
		// 0x8 = ?
	case 0x102: name = "bkgd img ref"; break;
	case 0x103: name = "copyright/author"; break;
	case 0x104: name = "url1"; break; // URL for what?
	case 0x105: name = "url2"; break; // URL for what?
	case 0x106: name = "dl prot data"; break;
	case 0x107: name = "img ptr bias"; break;
	}
	return name?name:"?";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movq $0x0, -0x10(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x14(%rbp)
subl $0x1, %eax
je 0x8a8a1
jmp 0x8a810
movl -0x14(%rbp), %eax
subl $0x3, %eax
je 0x8a8ae
jmp 0x8a81e
movl -0x14(%rbp), %eax
addl $-0x4, %eax
subl $0x2, %eax
jb 0x8a8bb
jmp 0x8a82f
movl -0x14(%rbp), %eax
subl $0x6, %eax
je 0x8a8c8
jmp 0x8a83d
movl -0x14(%rbp), %eax
addl $-0x9, %eax
subl $0x4, %eax
jb 0x8a8bb
jmp 0x8a84a
movl -0x14(%rbp), %eax
subl $0x100, %eax            # imm = 0x100
je 0x8a8ae
jmp 0x8a856
movl -0x14(%rbp), %eax
subl $0x102, %eax            # imm = 0x102
je 0x8a8d5
jmp 0x8a862
movl -0x14(%rbp), %eax
subl $0x103, %eax            # imm = 0x103
je 0x8a8e2
jmp 0x8a86e
movl -0x14(%rbp), %eax
subl $0x104, %eax            # imm = 0x104
je 0x8a8ef
jmp 0x8a87a
movl -0x14(%rbp), %eax
subl $0x105, %eax            # imm = 0x105
je 0x8a8fc
jmp 0x8a886
movl -0x14(%rbp), %eax
subl $0x106, %eax            # imm = 0x106
je 0x8a909
jmp 0x8a892
movl -0x14(%rbp), %eax
subl $0x107, %eax            # imm = 0x107
je 0x8a916
jmp 0x8a921
leaq 0x12465a(%rip), %rax    # 0x1aef02
movq %rax, -0x10(%rbp)
jmp 0x8a921
leaq 0x1246c5(%rip), %rax    # 0x1aef7a
movq %rax, -0x10(%rbp)
jmp 0x8a921
leaq 0x1246c1(%rip), %rax    # 0x1aef83
movq %rax, -0x10(%rbp)
jmp 0x8a921
leaq 0x1246bf(%rip), %rax    # 0x1aef8e
movq %rax, -0x10(%rbp)
jmp 0x8a921
leaq 0x1246c4(%rip), %rax    # 0x1aefa0
movq %rax, -0x10(%rbp)
jmp 0x8a921
leaq 0x124623(%rip), %rax    # 0x1aef0c
movq %rax, -0x10(%rbp)
jmp 0x8a921
leaq 0x124627(%rip), %rax    # 0x1aef1d
movq %rax, -0x10(%rbp)
jmp 0x8a921
leaq 0x12461f(%rip), %rax    # 0x1aef22
movq %rax, -0x10(%rbp)
jmp 0x8a921
leaq 0x12469d(%rip), %rax    # 0x1aefad
movq %rax, -0x10(%rbp)
jmp 0x8a921
leaq 0x12469d(%rip), %rax    # 0x1aefba
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x8a932
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x8a93f
leaq 0x12d2f4(%rip), %rax    # 0x1b7c2d
movq %rax, -0x20(%rbp)
jmp 0x8a93f
movq -0x20(%rbp), %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: handle_chunk_string
static void handle_chunk_string(deark *c, lctx *d, i64 pos, i64 len,
	de_ucstring *s, const char *name)
{
	ucstring_empty(s);
	dbuf_read_to_ucstring_n(c->infile, pos, len, 512, s,
		DE_CONVFLAG_STOP_AT_NUL, d->input_encoding);
	de_dbg(c, "%s: \"%s\"", name, ucstring_getpsz_d(s));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x171210
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %r8
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl $0x200, %ecx            # imm = 0x200
movl $0x1, %r9d
movl %eax, (%rsp)
callq 0x166a40
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
callq 0x172650
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq %rax, %rcx
leaq 0x12d235(%rip), %rsi    # 0x1b7c06
movb $0x0, %al
callq 0x15b0d0
addq $0x50, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: handle_chunk_multiimageptr
static void handle_chunk_multiimageptr(deark *c, lctx *d, struct chunk_ctx *cctx,
	i64 offset, i64 item_size, i64 item_count)
{
	i64 pos;
	i64 i;

	de_dbg(c, "item count: %"I64_FMT, item_count);
	pos = cctx->ck_pos + offset;

	for(i=0; i<item_count; i++) {
		i64 n, m1, m2;

		n = de_getu32le(pos);
		m1 = de_getu32le(pos+4);
		m2 = de_getu32le(pos+8);
		if(!found_image(c, d, cctx, n, m1, m2)) goto done;
		pos += item_size;
	}

done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x124671(%rip), %rsi    # 0x1af0e0
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x8ab24
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x165540
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0x4, %rsi
callq 0x165540
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0x8, %rsi
callq 0x165540
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x50(%rbp), %r8
movq -0x58(%rbp), %r9
callq 0x8ab30
cmpl $0x0, %eax
jne 0x8ab07
jmp 0x8ab26
movq -0x28(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x8aa8e
jmp 0x8ab26
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: found_image
static int found_image(deark *c, lctx *d, struct chunk_ctx *cctx,
	i64 imgpos, i64 m1pos, i64 m2pos)
{
	int retval = 0;
	int ret;
	u8 is_icon;
	u8 is_bkgd;

	if(imgpos) imgpos += d->img_ptr_bias;
	if(m1pos) m1pos += d->img_ptr_bias;
	if(m2pos) m2pos += d->img_ptr_bias;
	de_dbg(c, "pointer: image at %"I64_FMT", mask1 at %"I64_FMT", mask2 at %"I64_FMT,
		imgpos, m1pos, m2pos);
	if(m1pos==m2pos) m1pos = 0;
	if(imgpos==0 || imgpos>=c->infile->len || m1pos>=c->infile->len ||
		m2pos>=c->infile->len)
	{
		goto done;
	}
	retval = 1;

	ret = de_inthashtable_add_item(c, d->images_seen, imgpos, NULL);
	if(!ret) {
		de_dbg(c, "[already handled this image]");
		goto done;
	}

	is_icon = (cctx->ck_type==0x0003 || cctx->ck_type==0x0100);
	is_bkgd = (cctx->ck_type==0x0102);
	extract_image_highlevel(c, d, imgpos, m1pos, m2pos, is_icon, is_bkgd);

done:
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x8ab6e
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x8ab85
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x8ab9c
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
leaq 0x124414(%rip), %rsi    # 0x1aefc7
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x8abcc
movq $0x0, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x8ac09
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jge 0x8ac09
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jge 0x8ac09
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jl 0x8ac0e
jmp 0x8acb0
movl $0x1, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x20(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x15e810
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jne 0x8ac4b
movq -0x8(%rbp), %rdi
leaq 0x1243b7(%rip), %rsi    # 0x1aeff9
movb $0x0, %al
callq 0x15b0d0
jmp 0x8acb0
movq -0x18(%rbp), %rcx
movb $0x1, %al
cmpl $0x3, (%rcx)
movb %al, -0x3b(%rbp)
je 0x8ac69
movq -0x18(%rbp), %rax
cmpl $0x100, (%rax)          # imm = 0x100
sete %al
movb %al, -0x3b(%rbp)
movb -0x3b(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movb %al, -0x39(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x102, (%rax)          # imm = 0x102
sete %al
andb $0x1, %al
movzbl %al, %eax
movb %al, -0x3a(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movb -0x39(%rbp), %al
movzbl %al, %r9d
movzbl -0x3a(%rbp), %eax
movl %eax, (%rsp)
callq 0x8acc0
movl -0x34(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: read_image_lowlevel
static void read_image_lowlevel(deark *c, lctx *d, i64 pos1,
	struct image_highlevel_ctx *ih, int itype, u8 direct_to_bmp)
{
	UI magic;
	int saved_indent_level;
	de_dbg_indent_save(c, &saved_indent_level);

	if(pos1==0) goto done;

	de_dbg(c, "[image component at %"I64_FMT"]", pos1);
	de_dbg_indent(c, 1);

	magic = (UI)de_getu16be(pos1);
	de_dbg(c, "sig: 0x%04x", magic);
	if(magic!=0x0101 && magic!=0x2800 && magic!=0x424d) {
		de_err(c, "Image not found at %"I64_FMT, pos1);
		goto done;
	}

	if(magic==0x424d) {
		if(direct_to_bmp) {
			extract_whole_bmp(c, d, c->infile, pos1, ih);
		}
		else {
			read_bmp_to_img(c, d, c->infile, pos1, ih, itype);
		}
	}
	else {
		read_dib_to_img(c, d, pos1, magic, ih, itype, direct_to_bmp);
	}

done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %r9b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movb %al, -0x25(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x15b580
cmpq $0x0, -0x18(%rbp)
jne 0x8af4b
jmp 0x8b041
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x1240e2(%rip), %rsi    # 0x1af03c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x1651d0
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
leaq 0x1240c4(%rip), %rsi    # 0x1af055
movb $0x0, %al
callq 0x15b0d0
cmpl $0x101, -0x2c(%rbp)     # imm = 0x101
je 0x8afcb
cmpl $0x2800, -0x2c(%rbp)    # imm = 0x2800
je 0x8afcb
cmpl $0x424d, -0x2c(%rbp)    # imm = 0x424D
je 0x8afcb
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x12409f(%rip), %rsi    # 0x1af061
movb $0x0, %al
callq 0x15bfb0
jmp 0x8b041
cmpl $0x424d, -0x2c(%rbp)    # imm = 0x424D
jne 0x8b01c
cmpb $0x0, -0x25(%rbp)
je 0x8aff9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x8b420
jmp 0x8b01a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movl -0x24(%rbp), %r9d
callq 0x8b4e0
jmp 0x8b03f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x2c(%rbp), %ecx
movq -0x20(%rbp), %r8
movl -0x24(%rbp), %r9d
movzbl -0x25(%rbp), %eax
movl %eax, (%rsp)
callq 0x8b6e0
jmp 0x8b041
movq -0x8(%rbp), %rdi
movl -0x30(%rbp), %esi
callq 0x15b5a0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: should_apply_masks
static int should_apply_masks(deark *c, lctx *d, struct image_highlevel_ctx *ih)
{
	size_t k;

	if(!d->opt_applymasks) return 0;
	if(ih->special_2bpp_transparency) return 0;
	if(!ih->llimg[0].img) return 0;
	if(!ih->llimg[1].img && !ih->llimg[2].img) return 0;

	for(k=1; k<=2; k++) {
		if(ih->llimg[k].img) {
			if(ih->llimg[k].img->width != ih->llimg[0].img->width) return 0;
			if(ih->llimg[k].img->height != ih->llimg[0].img->height) return 0;
		}
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpb $0x0, 0x5(%rax)
jne 0x8b086
movl $0x0, -0x4(%rbp)
jmp 0x8b175
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
je 0x8b09b
movl $0x0, -0x4(%rbp)
jmp 0x8b175
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x8b0b2
movl $0x0, -0x4(%rbp)
jmp 0x8b175
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x8b0d4
movq -0x20(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x8b0d4
movl $0x0, -0x4(%rbp)
jmp 0x8b175
movq $0x1, -0x28(%rbp)
cmpq $0x2, -0x28(%rbp)
ja 0x8b16e
movq -0x20(%rbp), %rax
addq $0x8, %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x8b15b
movq -0x20(%rbp), %rax
addq $0x8, %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x8(%rcx), %rax
je 0x8b12b
movl $0x0, -0x4(%rbp)
jmp 0x8b175
movq -0x20(%rbp), %rax
addq $0x8, %rax
imulq $0x18, -0x28(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x10(%rcx), %rax
je 0x8b159
movl $0x0, -0x4(%rbp)
jmp 0x8b175
jmp 0x8b15b
jmp 0x8b15d
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x8b0dc
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: emit_images_highlevel_applymasks
static void emit_images_highlevel_applymasks(deark *c, lctx *d,
	struct image_highlevel_ctx *ih)
{
	de_bitmap *tmpimg = NULL;
	i64 w, h;
	size_t k;

	if(!ih->llimg[0].img) goto done; // should be impossible
	w = ih->llimg[0].img->width;
	h = ih->llimg[0].img->height;

	if(!ih->llimg[1].img && !ih->llimg[2].img) { // should be impossible
		emit_images_highlevel_separate(c, d, ih);
		goto done;
	}

	for(k=1; k<=2; k++) {
		if(!ih->llimg[k].img) continue;
		if(tmpimg) {
			de_bitmap_destroy(tmpimg);
		}
		tmpimg = de_bitmap_create(c, w, h, 4);
		de_bitmap_copy_rect(ih->llimg[0].img, tmpimg, 0, 0, w, h, 0, 0, 0);
		de_bitmap_apply_mask(tmpimg, ih->llimg[k].img, DE_BITMAPFLAG_WHITEISTRNS);
		de_bitmap_write_to_file_finfo(tmpimg, ih->llimg[0].fi,
			ih->llimg[0].createflags);
	}

done:
	de_bitmap_destroy(tmpimg);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x8b1ac
jmp 0x8b2d7
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x8b1f8
movq -0x18(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x8b1f8
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x8b2f0
jmp 0x8b2d7
movq $0x1, -0x38(%rbp)
cmpq $0x2, -0x38(%rbp)
ja 0x8b2d5
movq -0x18(%rbp), %rax
addq $0x8, %rax
imulq $0x18, -0x38(%rbp), %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
jne 0x8b226
jmp 0x8b2c4
cmpq $0x0, -0x20(%rbp)
je 0x8b236
movq -0x20(%rbp), %rdi
callq 0x16af60
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl $0x4, %ecx
callq 0x16b750
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
xorl %eax, %eax
movl %eax, %ecx
xorl %eax, %eax
movq %rcx, %rdx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
callq 0x16ce50
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
addq $0x8, %rax
imulq $0x18, -0x38(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rsi
movl $0x1, %edx
callq 0x16cf60
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rax
movl 0x18(%rax), %edx
callq 0x16afa0
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x8b200
jmp 0x8b2d7
movq -0x20(%rbp), %rdi
callq 0x16af60
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: emit_images_highlevel_separate
static void emit_images_highlevel_separate(deark *c, lctx *d,
	struct image_highlevel_ctx *ih)
{
	size_t k;

	if(ih->llimg[0].img) {
		if(ih->is_icon) {
			de_finfo_set_name_from_sz(c, ih->llimg[0].fi,
				"icon", 0, DE_ENCODING_LATIN1);
		}
		de_bitmap_write_to_file_finfo(ih->llimg[0].img, ih->llimg[0].fi,
			ih->llimg[0].createflags);
	}
	for(k=1; k<=2; k++) {
		if(ih->llimg[k].img) {
			de_finfo_set_name_from_sz(c, ih->llimg[k].fi,
				(k==1?"sm_mask":"lg_mask"), 0, DE_ENCODING_LATIN1);
			de_bitmap_write_to_file_finfo(ih->llimg[k].img, ih->llimg[k].fi,
				(ih->llimg[k].createflags | DE_CREATEFLAG_IS_AUX));
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x8b355
movq -0x18(%rbp), %rax
cmpb $0x0, 0x1(%rax)
je 0x8b339
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
leaq 0x12511e(%rip), %rdx    # 0x1b044a
xorl %ecx, %ecx
movl $0x5, %r8d
callq 0x15d4c0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rax
movl 0x18(%rax), %edx
callq 0x16afa0
movq $0x1, -0x20(%rbp)
cmpq $0x2, -0x20(%rbp)
ja 0x8b416
movq -0x18(%rbp), %rax
addq $0x8, %rax
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x8b403
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
addq $0x8, %rax
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rcx
leaq 0x123d33(%rip), %rdx    # 0x1af0d8
leaq 0x123d24(%rip), %rax    # 0x1af0d0
cmpq $0x1, %rcx
cmoveq %rax, %rdx
xorl %ecx, %ecx
movl $0x5, %r8d
callq 0x15d4c0
movq -0x18(%rbp), %rax
addq $0x8, %rax
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
addq $0x8, %rax
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rax
addq $0x8, %rax
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %edx
orl $0x1, %edx
callq 0x16afa0
jmp 0x8b405
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8b35d
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: extract_whole_bmp
static void extract_whole_bmp(deark *c, lctx *d, dbuf *inf, i64 pos1,
	struct image_highlevel_ctx *ih)
{
	i64 bmplen;
	dbuf *outf = NULL;
	const char *ext;

	bmplen = dbuf_getu32le(inf, pos1+2);
	if(pos1+bmplen > inf->len) goto done;
	if(bmplen < 54) goto done;

	if(ih->is_icon) {
		ext = "icon.bmp";
	}
	else {
		ext = "bmp";
	}
	outf = dbuf_create_output_file(c, ext, NULL, 0);
	dbuf_copy(inf, pos1, bmplen, outf);

done:
	dbuf_close(outf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x2, %rsi
callq 0x165540
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
addq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jle 0x8b46d
jmp 0x8b4c4
cmpq $0x36, -0x30(%rbp)
jge 0x8b476
jmp 0x8b4c4
movq -0x28(%rbp), %rax
cmpb $0x0, 0x1(%rax)
je 0x8b48d
leaq 0x123bf1(%rip), %rax    # 0x1af078
movq %rax, -0x40(%rbp)
jmp 0x8b498
leaq 0x121873(%rip), %rax    # 0x1acd07
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x166c60
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x166070
movq -0x38(%rbp), %rdi
callq 0x1676a0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/comicchat.c
// Function: fixup_2bpp_transparency
static void fixup_2bpp_transparency(deark *c, lctx *d, struct image_highlevel_ctx *ih)
{
	de_bitmap *oldimg;
	de_bitmap *newimg;
	i64 i, j;

	oldimg = ih->llimg[0].img;
	if(!oldimg) return;
	newimg = de_bitmap_create(c, oldimg->width, oldimg->height, 2);
	for(j=0; j<oldimg->height; j++) {
		for(i=0; i<oldimg->width; i++) {
			de_color clr;

			clr = de_bitmap_getpixel(oldimg, i, j);
			if(clr==DE_MAKE_GRAY(128)) clr = DE_MAKE_RGBA(128,128,128,0);
			de_bitmap_setpixel_rgba(newimg, i, j, clr);
		}
	}

	de_bitmap_destroy(ih->llimg[0].img);
	ih->llimg[0].img = newimg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x8bcac
jmp 0x8bd69
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
movl $0x2, %ecx
callq 0x16b750
movq %rax, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jge 0x8bd50
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x8bd40
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x16b540
movl %eax, -0x3c(%rbp)
cmpl $0xff808080, -0x3c(%rbp) # imm = 0xFF808080
jne 0x8bd1e
movl $0x808080, -0x3c(%rbp)  # imm = 0x808080
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x3c(%rbp), %ecx
callq 0x16b350
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x8bcec
jmp 0x8bd42
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x8bcd6
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x16af60
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
addq $0x40, %rsp
popq %rbp
retq
nop