LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/mac-arch.c
// Function: tome_decompress_fork
static void tome_decompress_fork(struct tome_md *md, UI fn, dbuf *outf)
{
	deark *c = md->c;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.id = (UI)(md->member_idx * 1000 + fn);
	dcmpri.f = c->infile;
	dcmpri.pos = md->frk[fn].cmpr_pos;
	dcmpri.len = md->frk[fn].cmpr_len;
	dcmpro.f = outf;
	dcmpro.len_known = 1;
	dcmpro.expected_len = md->frk[fn].orig_len;

	fmtutil_ic1_codectype1(c, &dcmpri, &dcmpro, &dres, NULL);

	if(dres.errcode) {
		de_err(c, "Decompression failed for file %s[%s fork]: %s",
			ucstring_getpsz_d(md->fname->str),
			md->frk[fn].forkname, de_dfilter_get_errmsg(c, &dres));
		goto done;
	}

	md->frk[fn].decompress_succeeded = 1;

done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq -0xbc(%rbp), %rsi
callq 0x15b580
movq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x58(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
callq 0x1773f0
movq -0x8(%rbp), %rax
imulq $0x3e8, 0x10(%rax), %rax # imm = 0x3E8
movl -0xc(%rbp), %ecx
addq %rcx, %rax
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rax
movl -0xc(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rax
movl -0xc(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movb $0x1, -0x50(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rax
movl -0xc(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x58(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0x181150
cmpl $0x0, -0xb8(%rbp)
je 0xe4b0a
movq -0x20(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x172650
movq %rax, -0xd0(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rax
movl -0xc(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
addq $0x30, %rax
movq %rax, -0xc8(%rbp)
movq -0x20(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x177360
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rdx
movq -0xc8(%rbp), %rcx
movq %rax, %r8
leaq 0xbbee4(%rip), %rsi     # 0x1a09e5
movb $0x0, %al
callq 0x15bfb0
jmp 0xe4b22
movq -0x8(%rbp), %rax
addq $0xc0, %rax
movl -0xc(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movb $0x1, 0xd(%rax)
movq -0x20(%rbp), %rdi
movl -0xbc(%rbp), %esi
callq 0x15b5a0
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/mac-arch.c
// Function: tome_copy_fork
static void tome_copy_fork(struct tome_md *md, UI fn, dbuf *outf)
{
	i64 ipos;
	i64 nbytes_left;

	ipos = md->frk[fn].cmpr_pos;
	nbytes_left = md->frk[fn].orig_len;
	while(nbytes_left>0) {
		i64 nbytes_this_segment;

		ipos += 4; // skip over marker (?)
		nbytes_this_segment = de_min_int(nbytes_left, 65536);
		dbuf_copy(md->advf->c->infile, ipos, nbytes_this_segment, outf);
		ipos += nbytes_this_segment;
		nbytes_left -= nbytes_this_segment;
	}

	md->frk[fn].decompress_succeeded = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rax
movl -0xc(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rax
movl -0xc(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jle 0xe4bed
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x15ccf0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq (%rax), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x166070
movq -0x30(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0xe4b8b
movq -0x8(%rbp), %rax
addq $0xc0, %rax
movl -0xc(%rbp), %ecx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movb $0x1, 0xd(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/msp.c
// Function: de_module_msp
void de_module_msp(deark *c, struct deark_module_info *mi)
{
	mi->id = "msp";
	mi->desc = "Microsoft Paint image";
	mi->run_fn = de_run_msp;
	mi->identify_fn = de_identify_msp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xd8398(%rip), %rcx     # 0x1bcfbf
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xd838e(%rip), %rcx     # 0x1bcfc3
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0xe4c60
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x11d(%rip), %rcx       # 0xe4d70
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/msp.c
// Function: de_run_msp
static void de_run_msp(deark *c, de_module_params *mparams)
{
	lctx *d;

	d = de_malloc(c, sizeof(lctx));

	d->ver = de_getbyte(0) == 0x4c ? 2 : 1;
	de_dbg(c, "version: %d", d->ver);
	de_declare_fmtf(c, "MS Paint v%d", d->ver);

	d->width = de_getu16le(4);
	d->height = de_getu16le(6);
	de_dbg_dimensions(c, d->width, d->height);

	if(d->ver==1) {
		do_ver1(c, d);
	}
	else {
		do_ver2(c, d);
	}

	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl $0x20, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x165060
movzbl %al, %edx
movl $0x1, %ecx
movl $0x2, %eax
cmpl $0x4c, %edx
cmovel %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %edx
leaq 0xdb553(%rip), %rsi     # 0x1c0210
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %edx
leaq 0xd8304(%rip), %rsi     # 0x1bcfd9
movb $0x0, %al
callq 0x15e3d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x4, %esi
callq 0x165280
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x6, %esi
callq 0x165280
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0x15bba0
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
jne 0xe4d47
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xe4e00
jmp 0xe4d54
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xe4e70
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/msp.c
// Function: de_identify_msp
static int de_identify_msp(deark *c)
{
	u8 b[4];
	de_read(b, 0, 4);

	if(b[0]==0x44 && b[1]==0x61 && b[2]==0x6e && b[3]==0x4d)
		return 100;
	if(b[0]==0x4c && b[1]==0x69 && b[2]==0x6e && b[3]==0x53)
		return 100;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x14(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x4, %ecx
callq 0x164d10
movzbl -0x14(%rbp), %eax
cmpl $0x44, %eax
jne 0xe4dc3
movzbl -0x13(%rbp), %eax
cmpl $0x61, %eax
jne 0xe4dc3
movzbl -0x12(%rbp), %eax
cmpl $0x6e, %eax
jne 0xe4dc3
movzbl -0x11(%rbp), %eax
cmpl $0x4d, %eax
jne 0xe4dc3
movl $0x64, -0x4(%rbp)
jmp 0xe4df7
movzbl -0x14(%rbp), %eax
cmpl $0x4c, %eax
jne 0xe4df0
movzbl -0x13(%rbp), %eax
cmpl $0x69, %eax
jne 0xe4df0
movzbl -0x12(%rbp), %eax
cmpl $0x6e, %eax
jne 0xe4df0
movzbl -0x11(%rbp), %eax
cmpl $0x53, %eax
jne 0xe4df0
movl $0x64, -0x4(%rbp)
jmp 0xe4df7
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/msp.c
// Function: do_ver1
static void do_ver1(deark *c, lctx *d)
{
	i64 src_rowspan;

	// TODO: Are version-1 MSP files padded this way?
	// (Maybe the width is always a multiple of 8, so it doesn't matter.)
	src_rowspan = (d->width+7)/8;

	de_convert_and_write_image_bilevel(c->infile, 32,
		d->width, d->height, src_rowspan, 0, NULL, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x7, %rax
movl $0x8, %ecx
cqto
idivq %rcx
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %r8
movl $0x20, %esi
xorl %r9d, %r9d
xorl %eax, %eax
movq $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x16bf50
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: de_module_nol
void de_module_nol(deark *c, struct deark_module_info *mi)
{
	mi->id = "nol";
	mi->desc = "Nokia Operator Logo";
	mi->run_fn = de_run_nol;
	mi->identify_fn = de_identify_nol;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xd7e01(%rip), %rcx     # 0x1bd058
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xd7df7(%rip), %rcx     # 0x1bd05c
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0xe5290
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0xcd(%rip), %rcx        # 0xe5350
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: de_run_nol
static void de_run_nol(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));

	d->w = de_getu16le(10);
	d->h = de_getu16le(12);
	de_dbg_dimensions(c, d->w, d->h);
	if(!de_good_image_dimensions(c, d->w, d->h)) goto done;

	nol_ngg_read_bitmap(c, d, 20);
done:
	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x18, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0xa, %esi
callq 0x165280
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0xc, %esi
callq 0x165280
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x15bba0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x16a850
cmpl $0x0, %eax
jne 0xe532a
jmp 0xe533c
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x14, %edx
callq 0xe5a90
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: de_module_ngg
void de_module_ngg(deark *c, struct deark_module_info *mi)
{
	mi->id = "ngg";
	mi->desc = "Nokia Group Graphic";
	mi->run_fn = de_run_ngg;
	mi->identify_fn = de_identify_ngg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xd7cb9(%rip), %rcx     # 0x1bd070
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xd7caf(%rip), %rcx     # 0x1bd074
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0xe53f0
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0xcd(%rip), %rcx        # 0xe54b0
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: de_run_ngg
static void de_run_ngg(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));

	d->w = de_getu16le(6);
	d->h = de_getu16le(8);
	de_dbg_dimensions(c, d->w, d->h);
	if(!de_good_image_dimensions(c, d->w, d->h)) goto done;

	nol_ngg_read_bitmap(c, d, 16);
done:
	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x18, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x6, %esi
callq 0x165280
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x8, %esi
callq 0x165280
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x15bba0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x16a850
cmpl $0x0, %eax
jne 0xe548a
jmp 0xe549c
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x10, %edx
callq 0xe5a90
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: de_module_npm
void de_module_npm(deark *c, struct deark_module_info *mi)
{
	mi->id = "npm";
	mi->desc = "Nokia Picture Message";
	mi->run_fn = de_run_npm;
	mi->identify_fn = de_identify_npm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xd7b71(%rip), %rcx     # 0x1bd088
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xd7b67(%rip), %rcx     # 0x1bd08c
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0xe5550
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x17d(%rip), %rcx       # 0xe56c0
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: de_run_npm
static void de_run_npm(deark *c, de_module_params *mparams)
{
	i64 txt_len;
	i64 pos;
	lctx *d = NULL;
	de_ucstring *s = NULL;

	d = de_malloc(c, sizeof(lctx));

	pos = 4;
	txt_len = (i64)de_getbyte_p(&pos);
	de_dbg(c, "text length: %d", (int)txt_len);
	if(txt_len>0) {
		s = ucstring_create(c);
		dbuf_read_to_ucstring(c->infile, pos, txt_len, s, 0, DE_ENCODING_ASCII);
		de_dbg(c, "text: \"%s\"", ucstring_getpsz_d(s));
		pos += txt_len;
	}
	pos += 1;

	d->w = (i64)de_getbyte_p(&pos);
	d->h = (i64)de_getbyte_p(&pos);
	de_dbg_dimensions(c, d->w, d->h);

	pos += 3;
	npm_nlm_read_bitmap(c, d, pos);

	ucstring_destroy(s);
	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl $0x18, %esi
callq 0x15b780
movq %rax, -0x28(%rbp)
movq $0x4, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
leaq 0xbfe00(%rip), %rsi     # 0x1a53b3
movb $0x0, %al
callq 0x15b0d0
cmpq $0x0, -0x18(%rbp)
jle 0xe5622
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x30(%rbp), %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x1669f0
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x172650
movq -0x38(%rbp), %rdi
movq %rax, %rdx
leaq 0xe1443(%rip), %rsi     # 0x1c6a52
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165170
movzbl %al, %eax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x15bba0
movq -0x20(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xe5b90
movq -0x30(%rbp), %rdi
callq 0x171750
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x15b820
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: de_module_nlm
void de_module_nlm(deark *c, struct deark_module_info *mi)
{
	mi->id = "nlm";
	mi->desc = "Nokia Logo Manager bitmap";
	mi->run_fn = de_run_nlm;
	mi->identify_fn = de_identify_nlm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xd797b(%rip), %rcx     # 0x1bd0a2
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xd7971(%rip), %rcx     # 0x1bd0a6
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0xe5760
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x14d(%rip), %rcx       # 0xe58a0
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: de_run_nlm
static void de_run_nlm(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	u8 imgtype;
	const char *s;

	d = de_malloc(c, sizeof(lctx));

	imgtype = de_getbyte(5);
	switch(imgtype) {
	case 0: s="Operator logo"; break;
	case 1: s="Caller logo"; break;
	case 2: s="Startup logo"; break;
	case 3: s="Picture image logo"; break;
	default: s="unknown";
	}
	de_dbg(c, "image type: %d (%s)", (int)imgtype, s);

	d->w = (i64)de_getbyte(7);
	d->h = (i64)de_getbyte(8);
	de_dbg_dimensions(c, d->w, d->h);

	npm_nlm_read_bitmap(c, d, 10);

	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x18, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x5, %esi
callq 0x165060
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
movq %rax, -0x30(%rbp)
subq $0x3, %rax
ja 0xe57f5
movq -0x30(%rbp), %rax
leaq 0xd7890(%rip), %rcx     # 0x1bd048
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xd791b(%rip), %rax     # 0x1bd0e3
movq %rax, -0x28(%rbp)
jmp 0xe5800
leaq 0xd791c(%rip), %rax     # 0x1bd0f1
movq %rax, -0x28(%rbp)
jmp 0xe5800
leaq 0xd791b(%rip), %rax     # 0x1bd0fd
movq %rax, -0x28(%rbp)
jmp 0xe5800
leaq 0xd791b(%rip), %rax     # 0x1bd10a
movq %rax, -0x28(%rbp)
jmp 0xe5800
leaq 0xb8d60(%rip), %rax     # 0x19e55c
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x19(%rbp), %edx
movq -0x28(%rbp), %rcx
leaq 0xd790a(%rip), %rsi     # 0x1bd11d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x7, %esi
callq 0x165060
movzbl %al, %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x8, %esi
callq 0x165060
movzbl %al, %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x15bba0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0xa, %edx
callq 0xe5b90
movq -0x8(%rbp), %rdi
movq -0x18(%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/nokia.c
// Function: de_module_nsl
void de_module_nsl(deark *c, struct deark_module_info *mi)
{
	mi->id = "nsl";
	mi->desc = "Nokia Startup Logo";
	mi->run_fn = de_run_nsl;
	mi->identify_fn = de_identify_nsl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xd77b9(%rip), %rcx     # 0x1bd0c0
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xd77af(%rip), %rcx     # 0x1bd0c4
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0xe5940
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0xbd(%rip), %rcx        # 0xe59f0
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: de_run_nsl
static void de_run_nsl(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	struct de_iffctx *ictx = NULL;

	d = de_malloc(c, sizeof(lctx));
	ictx = fmtutil_create_iff_decoder(c);

	ictx->userdata = (void*)d;
	ictx->handle_chunk_fn = my_nsl_chunk_handler;
	ictx->f = c->infile;
	ictx->sizeof_len = 2;

	fmtutil_read_iff_format(ictx, 0, c->infile->len);

	fmtutil_destroy_iff_decoder(ictx);
	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl $0x18, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x18c8b0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
leaq 0x27a(%rip), %rcx       # 0xe5c10
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq $0x2, 0x50(%rax)
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x18c920
movq -0x20(%rbp), %rdi
callq 0x18c8f0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: de_identify_nsl
static int de_identify_nsl(deark *c)
{
	i64 x;

	// NSL uses a variant of IFF, which is not so easy to identify.
	// (TODO: Write an IFF format detector.)

	if(dbuf_memcmp(c->infile, 0, "FORM", 4)) return 0;

	x = de_getu16be(4);
	if(x+6 != c->infile->len) return 0;

	if(de_input_file_has_ext(c, "nsl")) {
		return 100;
	}
	return 10;
}

// 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
leaq 0xc1630(%rip), %rdx     # 0x1a703f
movl $0x4, %ecx
callq 0x166ab0
cmpl $0x0, %eax
je 0xe5a27
movl $0x0, -0x4(%rbp)
jmp 0xe5a81
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x4, %esi
callq 0x1651d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x6, %rax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
je 0xe5a5c
movl $0x0, -0x4(%rbp)
jmp 0xe5a81
movq -0x10(%rbp), %rdi
leaq 0xd7659(%rip), %rsi     # 0x1bd0c0
callq 0x15d180
cmpl $0x0, %eax
je 0xe5a7a
movl $0x64, -0x4(%rbp)
jmp 0xe5a81
movl $0xa, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: nol_ngg_read_bitmap
static void nol_ngg_read_bitmap(deark *c, lctx *d, i64 pos)
{
	de_bitmap *img = NULL;
	i64 i, j;
	u8 n;

	img = de_bitmap_create(c, d->w, d->h, 1);

	for(j=0; j<d->h; j++) {
		for(i=0; i<d->w; i++) {
			n = de_getbyte(pos);
			pos++;
			de_bitmap_setpixel_gray(img, i, j, n=='0' ? 255 : 0);
		}
	}

	de_bitmap_write_to_file(img, NULL, DE_CREATEFLAG_IS_BWIMG);
	de_bitmap_destroy(img);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1, %ecx
callq 0x16b750
movq %rax, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0xe5b60
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jge 0xe5b4d
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x165060
movb %al, -0x31(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movzbl -0x31(%rbp), %r8d
xorl %eax, %eax
movl $0xff, %ecx
cmpl $0x30, %r8d
cmovel %ecx, %eax
movzbl %al, %ecx
callq 0x16b1c0
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xe5aeb
jmp 0xe5b4f
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xe5ad5
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x8, %edx
callq 0x16afd0
movq -0x20(%rbp), %rdi
callq 0x16af60
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: my_nsl_chunk_handler
static int my_nsl_chunk_handler(struct de_iffctx *ictx)
{
	deark *c = ictx->c;
	lctx *d = (lctx*)ictx->userdata;

	if(ictx->chunkctx->chunk4cc.id == CODE_FORM) {
		ictx->is_raw_container = 1;
		return 1;
	}

	switch(ictx->chunkctx->chunk4cc.id) {
	case CODE_NSLD:
		if(ictx->level==1 && !d->done_flag) {
			nsl_read_bitmap(c, d, ictx->chunkctx->dpos, ictx->chunkctx->dlen);
		}
		ictx->handled = 1;
		break;
	}

	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
cmpl $0x464f524d, 0x4(%rax)  # imm = 0x464F524D
jne 0xe5c5e
movq -0x10(%rbp), %rax
movl $0x1, 0x138(%rax)
movl $0x1, -0x4(%rbp)
jmp 0xe5cc9
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movl 0x4(%rax), %eax
subl $0x4e534c44, %eax       # imm = 0x4E534C44
jne 0xe5cc2
jmp 0xe5c75
movq -0x10(%rbp), %rax
cmpl $0x1, 0x64(%rax)
jne 0xe5cb4
movq -0x20(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0xe5cb4
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x40(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x48(%rax), %rcx
callq 0xe5ce0
movq -0x10(%rbp), %rax
movl $0x1, 0x130(%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/nokia.c
// Function: nsl_read_bitmap
static void nsl_read_bitmap(deark *c, lctx *d, i64 pos, i64 len)
{
	de_bitmap *img = NULL;
	i64 i, j;
	u8 x;

	de_dbg(c, "bitmap at %d, len=%d", (int)pos, (int)len);
	d->done_flag = 1;

	if(len!=504) {
		de_err(c, "Unsupported NSL version (bitmap size=%d)", (int)len);
		goto done;
	}

	d->w = 84;
	d->h = 48;

	img = de_bitmap_create(c, d->w, d->h, 1);

	for(j=0; j<d->h; j++) {
		for(i=0; i<d->w; i++) {
			x = de_getbyte(pos + (j/8)*d->w + i);
			x = x & (1<<(j%8));
			if(x==0)
				de_bitmap_setpixel_gray(img, i, j, 255);
		}
	}

	de_bitmap_write_to_file(img, NULL, DE_CREATEFLAG_IS_BWIMG);

done:
	de_bitmap_destroy(img);
}

// 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 $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movl %eax, %ecx
leaq 0xd741f(%rip), %rsi     # 0x1bd136
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movl $0x1, 0x10(%rax)
cmpq $0x1f8, -0x20(%rbp)     # imm = 0x1F8
je 0xe5d50
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %edx
leaq 0xd7407(%rip), %rsi     # 0x1bd14b
movb $0x0, %al
callq 0x15bfb0
jmp 0xe5e6b
movq -0x10(%rbp), %rax
movq $0x54, (%rax)
movq -0x10(%rbp), %rax
movq $0x30, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x1, %ecx
callq 0x16b750
movq %rax, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0xe5e59
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jge 0xe5e46
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rax
movl $0x8, %ecx
cqto
idivq %rcx
movq -0x10(%rbp), %rcx
imulq (%rcx), %rax
addq %rax, %rsi
addq -0x30(%rbp), %rsi
callq 0x165060
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movl $0x8, %ecx
cqto
idivq %rcx
movl -0x40(%rbp), %eax
movl %edx, %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
cmpl $0x0, %eax
jne 0xe5e33
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl $0xff, %ecx
callq 0x16b1c0
jmp 0xe5e35
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xe5daa
jmp 0xe5e48
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xe5d90
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x8, %edx
callq 0x16afd0
movq -0x28(%rbp), %rdi
callq 0x16af60
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/os2bmp.c
// Function: de_module_os2bmp
void de_module_os2bmp(deark *c, struct deark_module_info *mi)
{
	mi->id = "os2bmp";
	mi->desc = "OS/2 icon (.ICO), cursor (.PTR), bitmap array";
	mi->run_fn = de_run_os2bmp;
	mi->identify_fn = de_identify_os2bmp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xd7375(%rip), %rcx     # 0x1bd20c
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xd736e(%rip), %rcx     # 0x1bd213
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0xe5ed0
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0xed(%rip), %rcx        # 0xe5fb0
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/os2bmp.c
// Function: de_run_os2bmp
static void de_run_os2bmp(deark *c, de_module_params *mparams)
{
	enum fmtcode fmt;
	const char *name;

	fmt = de_identify_os2bmp_internal(c);

	name = get_fmt_longname_from_code(fmt);
	if(name) {
		de_declare_fmt(c, name);
	}

	switch(fmt) {
	case DE_OS2FMT_IC:
	case DE_OS2FMT_PT:
	case DE_OS2FMT_CI:
	case DE_OS2FMT_CP:
		do_decode_icon_or_cursor(c, fmt);
		break;
	case DE_OS2FMT_BA:
	case DE_OS2FMT_BA_IC:
	case DE_OS2FMT_BA_PT:
	case DE_OS2FMT_BA_CI:
	case DE_OS2FMT_BA_CP:
	case DE_OS2FMT_BA_BM:
		do_BA_file(c);
		break;
	default:
		de_err(c, "Format not supported");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xe6060
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %edi
callq 0xe6160
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xe5f0c
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x15e380
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
subl $0x1, %eax
je 0xe5f81
jmp 0xe5f19
movl -0x24(%rbp), %eax
subl $0x3, %eax
je 0xe5f81
jmp 0xe5f23
movl -0x24(%rbp), %eax
subl $0x4, %eax
je 0xe5f73
jmp 0xe5f2d
movl -0x24(%rbp), %eax
subl $0x5, %eax
je 0xe5f81
jmp 0xe5f37
movl -0x24(%rbp), %eax
subl $0x6, %eax
je 0xe5f73
jmp 0xe5f41
movl -0x24(%rbp), %eax
subl $0x7, %eax
je 0xe5f81
jmp 0xe5f4b
movl -0x24(%rbp), %eax
subl $0x8, %eax
je 0xe5f73
jmp 0xe5f55
movl -0x24(%rbp), %eax
subl $0x9, %eax
je 0xe5f81
jmp 0xe5f5f
movl -0x24(%rbp), %eax
subl $0xa, %eax
je 0xe5f73
jmp 0xe5f69
movl -0x24(%rbp), %eax
subl $0xb, %eax
je 0xe5f81
jmp 0xe5f8c
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0xe6210
jmp 0xe5f9e
movq -0x8(%rbp), %rdi
callq 0xe62f0
jmp 0xe5f9e
movq -0x8(%rbp), %rdi
leaq 0xe5a6b(%rip), %rsi     # 0x1cba02
movb $0x0, %al
callq 0x15bfb0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/os2bmp.c
// Function: de_identify_os2bmp
static int de_identify_os2bmp(deark *c)
{
	enum fmtcode fmt;

	// TODO: We could do a better job of identifying these formats.
	fmt = de_identify_os2bmp_internal(c);
	switch(fmt) {
	case DE_OS2FMT_BA_IC:
	case DE_OS2FMT_BA_PT:
	case DE_OS2FMT_BA_CI:
	case DE_OS2FMT_BA_CP:
	case DE_OS2FMT_BA_BM:
		return 90;
	case DE_OS2FMT_CI:
	case DE_OS2FMT_CP: // Note that Corel Photo-Paint is similar
	case DE_OS2FMT_PT:
		return 20;
	case DE_OS2FMT_BA:
	case DE_OS2FMT_IC:
		return 10;
	default:
		break;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0xe6060
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
subl $0x1, %eax
je 0xe6041
jmp 0xe5fd5
movl -0x18(%rbp), %eax
subl $0x3, %eax
je 0xe602f
jmp 0xe5fdf
movl -0x18(%rbp), %eax
subl $0x4, %eax
je 0xe6041
jmp 0xe5fe9
movl -0x18(%rbp), %eax
subl $0x5, %eax
je 0xe602f
jmp 0xe5ff3
movl -0x18(%rbp), %eax
subl $0x6, %eax
je 0xe6038
jmp 0xe5ffd
movl -0x18(%rbp), %eax
subl $0x7, %eax
je 0xe602f
jmp 0xe6007
movl -0x18(%rbp), %eax
subl $0x8, %eax
je 0xe6038
jmp 0xe6011
movl -0x18(%rbp), %eax
subl $0x9, %eax
je 0xe602f
jmp 0xe601b
movl -0x18(%rbp), %eax
subl $0xa, %eax
je 0xe6038
jmp 0xe6025
movl -0x18(%rbp), %eax
subl $0xb, %eax
jne 0xe604a
jmp 0xe602f
movl $0x5a, -0x4(%rbp)
jmp 0xe6053
movl $0x14, -0x4(%rbp)
jmp 0xe6053
movl $0xa, -0x4(%rbp)
jmp 0xe6053
jmp 0xe604c
movl $0x0, -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/os2bmp.c
// Function: de_identify_os2bmp_internal
static enum fmtcode de_identify_os2bmp_internal(deark *c)
{
	enum fmtcode fmt;
	u8 b[16];

	de_read(b, 0, 16);

	fmt = bytes_to_fmtcode(b[0], b[1]);
	if(fmt==DE_OS2FMT_BA) {
		enum fmtcode ba_fmt;

		// A Bitmap Array file can contain a mixture of different image types,
		// but for the purposes of identifying the file type, we only look at
		// the first one. This is not ideal, but it really doesn't matter.
		ba_fmt = bytes_to_fmtcode(b[14], b[15]);
		if(ba_fmt==DE_OS2FMT_IC) return DE_OS2FMT_BA_IC;
		if(ba_fmt==DE_OS2FMT_PT) return DE_OS2FMT_BA_PT;
		if(ba_fmt==DE_OS2FMT_CI) return DE_OS2FMT_BA_CI;
		if(ba_fmt==DE_OS2FMT_CP) return DE_OS2FMT_BA_CP;
		if(ba_fmt==DE_OS2FMT_BM) return DE_OS2FMT_BA_BM;
		return DE_OS2FMT_BA;
	}
	if(fmt==DE_OS2FMT_IC) return DE_OS2FMT_IC;
	if(fmt==DE_OS2FMT_PT) return DE_OS2FMT_PT;
	if(fmt==DE_OS2FMT_CI) return DE_OS2FMT_CI;
	if(fmt==DE_OS2FMT_CP) return DE_OS2FMT_CP;
	return DE_OS2FMT_UNKNOWN;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x10, %ecx
callq 0x164d10
movb -0x30(%rbp), %al
movzbl %al, %edi
movzbl -0x2f(%rbp), %esi
callq 0xe6360
movl %eax, -0x14(%rbp)
cmpl $0x1, -0x14(%rbp)
jne 0xe6107
movb -0x22(%rbp), %al
movzbl %al, %edi
movzbl -0x21(%rbp), %esi
callq 0xe6360
movl %eax, -0x34(%rbp)
cmpl $0x4, -0x34(%rbp)
jne 0xe60c2
movl $0x5, -0x4(%rbp)
jmp 0xe614a
cmpl $0x6, -0x34(%rbp)
jne 0xe60d1
movl $0x7, -0x4(%rbp)
jmp 0xe614a
cmpl $0x8, -0x34(%rbp)
jne 0xe60e0
movl $0x9, -0x4(%rbp)
jmp 0xe614a
cmpl $0xa, -0x34(%rbp)
jne 0xe60ef
movl $0xb, -0x4(%rbp)
jmp 0xe614a
cmpl $0x2, -0x34(%rbp)
jne 0xe60fe
movl $0x3, -0x4(%rbp)
jmp 0xe614a
movl $0x1, -0x4(%rbp)
jmp 0xe614a
cmpl $0x4, -0x14(%rbp)
jne 0xe6116
movl $0x4, -0x4(%rbp)
jmp 0xe614a
cmpl $0x6, -0x14(%rbp)
jne 0xe6125
movl $0x6, -0x4(%rbp)
jmp 0xe614a
cmpl $0x8, -0x14(%rbp)
jne 0xe6134
movl $0x8, -0x4(%rbp)
jmp 0xe614a
cmpl $0xa, -0x14(%rbp)
jne 0xe6143
movl $0xa, -0x4(%rbp)
jmp 0xe614a
movl $0x0, -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/os2bmp.c
// Function: get_fmt_longname_from_code
static const char* get_fmt_longname_from_code(enum fmtcode fmt)
{
	switch(fmt) {
	case DE_OS2FMT_IC: return "OS/2 Icon";
	case DE_OS2FMT_PT: return "OS/2 Pointer";
	case DE_OS2FMT_CI: return "OS/2 Color Icon";
	case DE_OS2FMT_CP: return "OS/2 Color Pointer";
	case DE_OS2FMT_BA: return "OS/2 Bitmap Array";
	case DE_OS2FMT_BA_IC:
	case DE_OS2FMT_BA_CI:
		return "OS/2 Bitmap Array of Icons";
	case DE_OS2FMT_BA_PT:
	case DE_OS2FMT_BA_CP:
		return "OS/2 Bitmap Array of Pointers";
	case DE_OS2FMT_BA_BM:
		return "OS/2 Bitmap Array of Bitmaps";
	default:
		break;
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0xc(%rbp)
movl -0xc(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0xa, %eax
ja 0xe61f3
movq -0x18(%rbp), %rax
leaq 0xd6ff2(%rip), %rcx     # 0x1bd174
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xd70af(%rip), %rax     # 0x1bd241
movq %rax, -0x8(%rbp)
jmp 0xe61fd
leaq 0xd70ac(%rip), %rax     # 0x1bd24b
movq %rax, -0x8(%rbp)
jmp 0xe61fd
leaq 0xd70ac(%rip), %rax     # 0x1bd258
movq %rax, -0x8(%rbp)
jmp 0xe61fd
leaq 0xd70af(%rip), %rax     # 0x1bd268
movq %rax, -0x8(%rbp)
jmp 0xe61fd
leaq 0xd70b5(%rip), %rax     # 0x1bd27b
movq %rax, -0x8(%rbp)
jmp 0xe61fd
leaq 0xd70ba(%rip), %rax     # 0x1bd28d
movq %rax, -0x8(%rbp)
jmp 0xe61fd
leaq 0xd70c8(%rip), %rax     # 0x1bd2a8
movq %rax, -0x8(%rbp)
jmp 0xe61fd
leaq 0xd70d9(%rip), %rax     # 0x1bd2c6
movq %rax, -0x8(%rbp)
jmp 0xe61fd
jmp 0xe61f5
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/os2bmp.c
// Function: do_decode_icon_or_cursor
static void do_decode_icon_or_cursor(deark *c, enum fmtcode fmt)
{
	struct os2icoctx *d = NULL;

	d = de_malloc(c, sizeof(struct os2icoctx));
	d->fmt = fmt;
	d->fmtname = get_fmt_shortname_from_code(d->fmt);

	switch(fmt) {
	case DE_OS2FMT_IC:
	case DE_OS2FMT_PT:
		do_decode_IC_or_PT(c, d, 0);
		break;
	case DE_OS2FMT_CI:
	case DE_OS2FMT_CP:
		do_decode_CI_or_CP(c, d, 0);
		break;
	default:
		break;
	}

	if(d) {
		do_free_srcbmp(c, d->srcbmp);
		do_free_srcbmp(c, d->maskbmp);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x20, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edi
callq 0xe6430
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl -0xc(%rbp), %eax
addl $-0x4, %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x6, %eax
ja 0xe62a4
movq -0x20(%rbp), %rax
leaq 0xd6f2b(%rip), %rcx     # 0x1bd1a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xe64c0
jmp 0xe62a6
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xe65c0
jmp 0xe62a6
jmp 0xe62a6
cmpq $0x0, -0x18(%rbp)
je 0xe62dc
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0xe6740
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0xe6740
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/os2bmp.c
// Function: do_BA_file
static void do_BA_file(deark *c)
{
	i64 pos;
	i64 nextoffset = 0;

	// The file contains a linked list of BA segments. There's nothing special
	// about the first segment, but it can be used to identify the file type.

	pos = 0;
	while(1) {
		do_BA_segment(c, pos, &nextoffset);
		if(nextoffset==0) break;
		if(nextoffset<=pos) {
			de_err(c, "Invalid BA segment offset");
			break;
		}
		pos = nextoffset;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0xe6e90
cmpq $0x0, -0x18(%rbp)
jne 0xe6326
jmp 0xe634e
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
jg 0xe6344
movq -0x8(%rbp), %rdi
leaq 0xd7043(%rip), %rsi     # 0x1bd37e
movb $0x0, %al
callq 0x15bfb0
jmp 0xe634e
movq -0x18(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0xe630c
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/os2bmp.c
// Function: bytes_to_fmtcode
static enum fmtcode bytes_to_fmtcode(u8 b0, u8 b1)
{
	if(b0=='C' && b1=='I') {
		return DE_OS2FMT_CI;
	}
	else if(b0=='C' && b1=='P') {
		return DE_OS2FMT_CP;
	}
	else if(b0=='I' && b1=='C') {
		return DE_OS2FMT_IC;
	}
	else if(b0=='P' && b1=='T') {
		return DE_OS2FMT_PT;
	}
	else if(b0=='B' && b1=='M') {
		return DE_OS2FMT_BM;
	}
	else if(b0=='B' && b1=='A') {
		return DE_OS2FMT_BA;
	}
	return DE_OS2FMT_UNKNOWN;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %sil, %al
movb %dil, %cl
movb %cl, -0x5(%rbp)
movb %al, -0x6(%rbp)
movzbl -0x5(%rbp), %eax
cmpl $0x43, %eax
jne 0xe638e
movzbl -0x6(%rbp), %eax
cmpl $0x49, %eax
jne 0xe638e
movl $0x8, -0x4(%rbp)
jmp 0xe6426
movzbl -0x5(%rbp), %eax
cmpl $0x43, %eax
jne 0xe63a9
movzbl -0x6(%rbp), %eax
cmpl $0x50, %eax
jne 0xe63a9
movl $0xa, -0x4(%rbp)
jmp 0xe6426
movzbl -0x5(%rbp), %eax
cmpl $0x49, %eax
jne 0xe63c4
movzbl -0x6(%rbp), %eax
cmpl $0x43, %eax
jne 0xe63c4
movl $0x4, -0x4(%rbp)
jmp 0xe6426
movzbl -0x5(%rbp), %eax
cmpl $0x50, %eax
jne 0xe63df
movzbl -0x6(%rbp), %eax
cmpl $0x54, %eax
jne 0xe63df
movl $0x6, -0x4(%rbp)
jmp 0xe6426
movzbl -0x5(%rbp), %eax
cmpl $0x42, %eax
jne 0xe63fa
movzbl -0x6(%rbp), %eax
cmpl $0x4d, %eax
jne 0xe63fa
movl $0x2, -0x4(%rbp)
jmp 0xe6426
movzbl -0x5(%rbp), %eax
cmpl $0x42, %eax
jne 0xe6415
movzbl -0x6(%rbp), %eax
cmpl $0x41, %eax
jne 0xe6415
movl $0x1, -0x4(%rbp)
jmp 0xe6426
jmp 0xe6417
jmp 0xe6419
jmp 0xe641b
jmp 0xe641d
jmp 0xe641f
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/os2bmp.c
// Function: get_fmt_shortname_from_code
static const char *get_fmt_shortname_from_code(enum fmtcode fmt)
{
	switch(fmt) {
	case DE_OS2FMT_IC: return "IC";
	case DE_OS2FMT_PT: return "PT";
	case DE_OS2FMT_CI: return "CI";
	case DE_OS2FMT_CP: return "CP";
	case DE_OS2FMT_BM: return "BM";
	case DE_OS2FMT_BA:
	case DE_OS2FMT_BA_IC:
	case DE_OS2FMT_BA_CI:
	case DE_OS2FMT_BA_PT:
	case DE_OS2FMT_BA_CP:
	case DE_OS2FMT_BA_BM:
		return "BA";
	default:
		break;
	}
	return "??";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0xc(%rbp)
movl -0xc(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0xa, %eax
ja 0xe64a9
movq -0x18(%rbp), %rax
leaq 0xd6d6a(%rip), %rcx     # 0x1bd1bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xc11b1(%rip), %rax     # 0x1a7613
movq %rax, -0x8(%rbp)
jmp 0xe64b6
leaq 0xda3e2(%rip), %rax     # 0x1c0851
movq %rax, -0x8(%rbp)
jmp 0xe64b6
leaq 0xc2e4f(%rip), %rax     # 0x1a92cb
movq %rax, -0x8(%rbp)
jmp 0xe64b6
leaq 0xd0ff2(%rip), %rax     # 0x1b747b
movq %rax, -0x8(%rbp)
jmp 0xe64b6
leaq 0xc1854(%rip), %rax     # 0x1a7cea
movq %rax, -0x8(%rbp)
jmp 0xe64b6
leaq 0xd059a(%rip), %rax     # 0x1b6a3d
movq %rax, -0x8(%rbp)
jmp 0xe64b6
jmp 0xe64ab
leaq 0xd00bf(%rip), %rax     # 0x1b6571
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/os2bmp.c
// Function: do_decode_IC_or_PT
static void do_decode_IC_or_PT(deark *c, struct os2icoctx *d, i64 pos)
{
	de_bitmap *img_main = NULL;

	d->maskbmp = de_malloc(c, sizeof(struct srcbitmap));
	if(!do_bitmap_header(c, d, d->maskbmp, pos, "mask-like")) {
		goto done;
	}

	if(!do_read_bitmap(c, d->maskbmp, 1, "mask-like")) goto done;

	// There is no "main" image, so manufacture one.
	img_main = de_bitmap_create(c, d->maskbmp->bi.width, d->maskbmp->bi.height/2, 4);

	do_apply_os2bmp_mask(c, img_main, d->maskbmp->img, 0);
	do_write_final_image(c, d, img_main);

done:
	de_bitmap_destroy(img_main);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl $0x4b8, %esi            # imm = 0x4B8
callq 0x15b780
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x18(%rbp), %rcx
leaq 0xd6dd3(%rip), %r8      # 0x1bd2e3
callq 0xe6790
cmpl $0x0, %eax
jne 0xe651f
jmp 0xe65a5
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
movl $0x1, %edx
leaq 0xd6dac(%rip), %rcx     # 0x1bd2e3
callq 0xe68f0
cmpl $0x0, %eax
jne 0xe6543
jmp 0xe65a5
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x30(%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, %rdx
movl $0x4, %ecx
callq 0x16b750
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rdx
xorl %ecx, %ecx
callq 0xe6a70
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xe6c30
movq -0x20(%rbp), %rdi
callq 0x16af60
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/os2bmp.c
// Function: do_decode_CI_or_CP
static void do_decode_CI_or_CP(deark *c, struct os2icoctx *d, i64 pos)
{
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	de_dbg(c, "%s image at %"I64_FMT, d->fmtname, pos);
	de_dbg_indent(c, 1);

	d->maskbmp = de_malloc(c, sizeof(struct srcbitmap));
	if(!do_bitmap_header(c, d, d->maskbmp, pos, "mask")) {
		goto done;
	}
	pos += d->maskbmp->bi.size_of_headers_and_pal;

	d->srcbmp = de_malloc(c, sizeof(struct srcbitmap));
	if(!do_bitmap_header(c, d, d->srcbmp, pos, "foreground")) {
		goto done;
	}

	if(!do_read_bitmap(c, d->maskbmp, 1, "mask")) goto done;
	if(!do_read_bitmap(c, d->srcbmp, 0, "foreground")) goto done;
	do_apply_os2bmp_mask(c, d->srcbmp->img, d->maskbmp->img, 1);
	do_write_final_image(c, d, d->srcbmp->img);

done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rcx
leaq 0xd6d6c(%rip), %rsi     # 0x1bd363
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movl $0x4b8, %esi            # imm = 0x4B8
callq 0x15b780
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x18(%rbp), %rcx
leaq 0xeb503(%rip), %r8      # 0x1d1b43
callq 0xe6790
cmpl $0x0, %eax
jne 0xe664f
jmp 0xe672a
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x90(%rax), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x4b8, %esi            # imm = 0x4B8
callq 0x15b780
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x18(%rbp), %rcx
leaq 0xd6cd9(%rip), %r8      # 0x1bd373
callq 0xe6790
cmpl $0x0, %eax
jne 0xe66a9
jmp 0xe672a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
movl $0x1, %edx
leaq 0xeb482(%rip), %rcx     # 0x1d1b43
callq 0xe68f0
cmpl $0x0, %eax
jne 0xe66cd
jmp 0xe672a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
xorl %edx, %edx
leaq 0xd6c91(%rip), %rcx     # 0x1bd373
callq 0xe68f0
cmpl $0x0, %eax
jne 0xe66ee
jmp 0xe672a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rdx
movl $0x1, %ecx
callq 0xe6a70
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdx
callq 0xe6c30
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x15b5a0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/os2bmp.c
// Function: do_free_srcbmp
static void do_free_srcbmp(deark *c, struct srcbitmap *srcbmp)
{
	if(!srcbmp) return;
	if(srcbmp->img) {
		de_bitmap_destroy(srcbmp->img);
	}
	de_free(c, srcbmp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xe6759
jmp 0xe677c
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0xe676f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x16af60
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15b820
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)