LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: colorref_to_color
static u32 colorref_to_color(u32 colorref)
{
	u32 r,g,b;
	r = DE_COLOR_B(colorref);
	g = DE_COLOR_G(colorref);
	b = DE_COLOR_R(colorref);
	return DE_MAKE_RGB(r,g,b);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %eax
andl $0xff, %eax
movzbl %al, %eax
movl %eax, -0x8(%rbp)
movl -0x4(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movzbl %al, %eax
movl %eax, -0xc(%rbp)
movl -0x4(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movzbl %al, %eax
movl %eax, -0x10(%rbp)
movl -0x8(%rbp), %eax
shll $0x10, %eax
orl $0xff000000, %eax       # imm = 0xFF000000
movl -0xc(%rbp), %ecx
shll $0x8, %ecx
orl %ecx, %eax
orl -0x10(%rbp), %eax
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: read_object_index_p
static void read_object_index_p(deark *c, lctx *d, i64 *ppos)
{
	UI n;
	n = (UI)de_getu32le_p(ppos);
	if(n & 0x80000000U) {
		// A stock object
		de_dbg(c, "object index: 0x%08x (%s)", n, get_stock_obj_name(n));
	}
	else {
		de_dbg(c, "object index: %u", n);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x165580
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x5b605
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %edi
callq 0x5b620
movq -0x28(%rbp), %rdi
movl -0x20(%rbp), %edx
movq %rax, %rcx
leaq 0x14bebe(%rip), %rsi    # 0x1a74ba
movb $0x0, %al
callq 0x15b0d0
jmp 0x5b61a
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq 0x1717fa(%rip), %rsi    # 0x1cce0d
movb $0x0, %al
callq 0x15b0d0
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: get_stock_obj_name
static const char *get_stock_obj_name(UI n)
{
	const char *names[20] = { "WHITE_BRUSH", "LTGRAY_BRUSH", "GRAY_BRUSH",
		"DKGRAY_BRUSH", "BLACK_BRUSH", "NULL_BRUSH", "WHITE_PEN", "BLACK_PEN",
		"NULL_PEN", NULL, "OEM_FIXED_FONT", "ANSI_FIXED_FONT", "ANSI_VAR_FONT",
		"SYSTEM_FONT", "DEVICE_DEFAULT_FONT", "DEFAULT_PALETTE",
		"SYSTEM_FIXED_FONT", "DEFAULT_GUI_FONT", "DC_BRUSH", "DC_PEN" };
	const char *name = NULL;

	if(n & 0x80000000U) {
		UI idx;
		idx = n & 0x7fffffff;
		if(idx<20) name = names[idx];
	}
	return name ? name : "?";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl %edi, -0x4(%rbp)
leaq -0xb0(%rbp), %rdi
leaq 0x1bbe14(%rip), %rsi    # 0x217450
movl $0xa0, %edx
callq 0x191e0
movq $0x0, -0xb8(%rbp)
movl -0x4(%rbp), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x5b68c
movl -0x4(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0xbc(%rbp)
cmpl $0x14, -0xbc(%rbp)
jae 0x5b68a
movl -0xbc(%rbp), %eax
movq -0xb0(%rbp,%rax,8), %rax
movq %rax, -0xb8(%rbp)
jmp 0x5b68c
cmpq $0x0, -0xb8(%rbp)
je 0x5b6a6
movq -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
jmp 0x5b6b6
leaq 0x15c580(%rip), %rax    # 0x1b7c2d
movq %rax, -0xc8(%rbp)
jmp 0x5b6b6
movq -0xc8(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: read_LogPen
static void read_LogPen(deark *c, lctx *d, i64 pos)
{
	UI style;
	i64 n;
	u32 colorref;

	style = (UI)de_getu32le_p(&pos);
	de_dbg(c, "style: 0x%08x", style);

	n = de_geti32le_p(&pos); // <PointL>.x = pen width
	de_dbg(c, "width: %d", (int)n);

	pos += 4; // <PointL>.y = unused

	colorref = (u32)de_getu32le_p(&pos);
	do_dbg_colorref(c, d, colorref);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x165580
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq 0x14beb8(%rip), %rsi    # 0x1a75be
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x165670
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x14f520(%rip), %rsi    # 0x1aac53
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x165580
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0x5b4f0
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: read_LogBrushEx
static void read_LogBrushEx(deark *c, lctx *d, i64 pos)
{
	UI style;
	u32 colorref;

	style = (UI)de_getu32le_p(&pos);
	de_dbg(c, "style: 0x%08x", style);

	colorref = (u32)de_getu32le_p(&pos);
	do_dbg_colorref(c, d, colorref);

	// TODO: BrushHatch
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x165580
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq 0x14be18(%rip), %rsi    # 0x1a75be
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x165580
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x20(%rbp), %edx
callq 0x5b4f0
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: do_comment_emfplus
static void do_comment_emfplus(deark *c, lctx *d, i64 pos1, i64 len)
{
	i64 pos = pos1;
	i64 bytes_consumed;
	int continuation_flag = 0;

	de_dbg(c, "EMF+ data at %"I64_FMT", len=%"I64_FMT, pos1, len);
	de_dbg_indent(c, 1);

	while(1) {
		if(pos >= pos1+len) break;
		do_one_emfplus_record(c, d, pos, pos1+len-pos, &bytes_consumed, &continuation_flag);
		pos += bytes_consumed;
	}
	// EMFPlusRecords (one or more EMF+ records)
	de_dbg_indent(c, -1);
}

// 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 -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x14be4d(%rip), %rsi    # 0x1a7667
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
addq -0x20(%rbp), %rcx
cmpq %rcx, %rax
jl 0x5b842
jmp 0x5b875
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rcx
addq -0x20(%rbp), %rcx
subq -0x28(%rbp), %rcx
leaq -0x30(%rbp), %r8
leaq -0x34(%rbp), %r9
callq 0x5b980
movq -0x30(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x5b82f
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: do_comment_public
static void do_comment_public(deark *c, lctx *d, i64 pos1, i64 len)
{
	u32 ty;
	const char *name;
	ty = (u32)de_getu32le(pos1);
	switch(ty) {
	case 0x80000001U: name = "WINDOWS_METAFILE"; break;
	case 0x00000002U: name = "BEGINGROUP"; break;
	case 0x00000003U: name = "ENDGROUP"; break;
	case 0x40000004U: name = "MULTIFORMATS"; break;
	case 0x00000040U: name = "UNICODE_STRING"; break;
	case 0x00000080U: name = "UNICODE_END"; break;
	default: name = "?";
	}
	de_dbg(c, "public comment record type: 0x%08x (%s)", (UI)ty, name);
}

// 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 -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x165540
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x34(%rbp)
subl $0x80000001, %eax       # imm = 0x80000001
je 0x5b901
jmp 0x5b8cb
movl -0x34(%rbp), %eax
subl $0x2, %eax
je 0x5b90e
jmp 0x5b8d5
movl -0x34(%rbp), %eax
subl $0x3, %eax
je 0x5b91b
jmp 0x5b8df
movl -0x34(%rbp), %eax
subl $0x40, %eax
je 0x5b935
jmp 0x5b8e9
movl -0x34(%rbp), %eax
subl $0x80, %eax
je 0x5b942
jmp 0x5b8f5
movl -0x34(%rbp), %eax
subl $0x40000004, %eax       # imm = 0x40000004
je 0x5b928
jmp 0x5b94f
leaq 0x14c135(%rip), %rax    # 0x1a7a3d
movq %rax, -0x30(%rbp)
jmp 0x5b95a
leaq 0x14c139(%rip), %rax    # 0x1a7a4e
movq %rax, -0x30(%rbp)
jmp 0x5b95a
leaq 0x14c137(%rip), %rax    # 0x1a7a59
movq %rax, -0x30(%rbp)
jmp 0x5b95a
leaq 0x14c133(%rip), %rax    # 0x1a7a62
movq %rax, -0x30(%rbp)
jmp 0x5b95a
leaq 0x14c133(%rip), %rax    # 0x1a7a6f
movq %rax, -0x30(%rbp)
jmp 0x5b95a
leaq 0x14c135(%rip), %rax    # 0x1a7a7e
movq %rax, -0x30(%rbp)
jmp 0x5b95a
leaq 0x15c2d7(%rip), %rax    # 0x1b7c2d
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %edx
movq -0x30(%rbp), %rcx
leaq 0x14c11e(%rip), %rsi    # 0x1a7a8a
movb $0x0, %al
callq 0x15b0d0
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: emfplus_handler_4003
static int emfplus_handler_4003(deark *c, lctx *d, i64 rectype, i64 pos, i64 len)
{
	if(c->debug_level>=2) {
		de_dbg_hexdump(c, c->infile, pos, len, 256, "comment", 0x1);
	}
	else {
		de_dbg(c, "[%"I64_FMT" comment bytes at %"I64_FMT"]", len, pos);
	}
	return 1;
}

// 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 %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x2, (%rax)
jl 0x5bc44
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movl $0x100, %r8d            # imm = 0x100
leaq 0x17470f(%rip), %r9     # 0x1d0345
movl $0x1, (%rsp)
callq 0x15b840
jmp 0x5bc5e
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x14bcbd(%rip), %rsi    # 0x1a7914
movb $0x0, %al
callq 0x15b0d0
movl $0x1, %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: do_emfplus_object
static void do_emfplus_object(deark *c, lctx *d, i64 pos, i64 len,
	u32 flags)
{
	u32 object_id;
	u32 object_type;
	const char *name;
	static const char *names[10] = { "Invalid", "Brush", "Pen", "Path",
		"Region", "Image", "Font", "StringFormat", "ImageAttributes",
		"CustomLineCap" };

	object_type = (flags&0x7f00)>>8;
	object_id = (flags&0x00ff);

	if(object_type<=9)
		name = names[object_type];
	else
		name = "?";

	de_dbg(c, "EmfPlusObject type=%d (%s), id=%d", (int)object_type, name,
		(int)object_id);

	de_dbg_indent(c, 1);
	if(object_type==5) {
		do_emfplus_object_image(c, d, pos, len);
	}
	de_dbg_indent(c, -1);
}

// 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 %r8d, -0x24(%rbp)
movl -0x24(%rbp), %eax
andl $0x7f00, %eax           # imm = 0x7F00
shrl $0x8, %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
andl $0xff, %eax
movl %eax, -0x28(%rbp)
cmpl $0x9, -0x2c(%rbp)
ja 0x5bcc1
movl -0x2c(%rbp), %eax
movl %eax, %ecx
leaq 0x1c9949(%rip), %rax    # 0x225600
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
jmp 0x5bccc
leaq 0x15bf65(%rip), %rax    # 0x1b7c2d
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
movq -0x38(%rbp), %rcx
movl -0x28(%rbp), %r8d
leaq 0x14bc84(%rip), %rsi    # 0x1a7966
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
cmpl $0x5, -0x2c(%rbp)
jne 0x5bd12
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x5be30
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/emf.c
// Function: emfplus_handler_401c
static int emfplus_handler_401c(deark *c, lctx *d, i64 rectype, i64 pos1, i64 len)
{
	i64 pos = pos1;
	i64 nchars;
	de_ucstring *s = NULL;

	pos += 8; // brushid, formatid
	nchars = de_getu32le(pos);
	pos += 4;
	pos += 16; // layoutrect
	if(pos+nchars*2 > pos1+len) goto done;
	s = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, pos, nchars*2, DE_DBG_MAX_STRLEN*2,
		s, 0, DE_ENCODING_UTF16LE);
	de_dbg(c, "text: \"%s\"", ucstring_getpsz(s));

done:
	ucstring_destroy(s);
	return 1;
}

// 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 -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x165540
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
shlq %rcx
addq %rcx, %rax
movq -0x20(%rbp), %rcx
addq -0x28(%rbp), %rcx
cmpq %rcx, %rax
jle 0x5bdb2
jmp 0x5be10
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
shlq %rdx
movq -0x40(%rbp), %r8
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %r9d, %r9d
movl $0x3, (%rsp)
callq 0x166a40
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x172500
movq -0x48(%rbp), %rdi
movq %rax, %rdx
leaq 0x16ac49(%rip), %rsi    # 0x1c6a52
movb $0x0, %al
callq 0x15b0d0
movq -0x40(%rbp), %rdi
callq 0x171750
movl $0x1, %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: do_emfplus_object_image
static void do_emfplus_object_image(deark *c, lctx *d, i64 pos1, i64 len)
{
	i64 ver;
	i64 datatype;
	i64 pos = pos1;
	const char *name;

	ver = de_getu32le(pos);
	datatype = de_getu32le(pos+4);

	switch(datatype) { // ImageDataType
	case 0: name="Unknown"; break;
	case 1: name="Bitmap"; break; // EmfPlusBitmap
	case 2: name="Metafile"; break; // EmfPlusMetafile
	default: name="?"; break;
	}

	de_dbg(c, "Image osver=0x%08x, type=%d (%s)", (UI)ver,
		(int)datatype, name);

	if(datatype==1) {
		do_emfplus_object_image_bitmap(c, d, pos1+8, len-8);
	}
	else if(datatype==2) {
		do_emfplus_object_image_metafile(c, d, pos1+8, len-8);
	}
}

// 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 -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x165540
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0x4, %rsi
callq 0x165540
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
testq %rax, %rax
je 0x5bea5
jmp 0x5be8d
movq -0x48(%rbp), %rax
subq $0x1, %rax
je 0x5beb2
jmp 0x5be99
movq -0x48(%rbp), %rax
subq $0x2, %rax
je 0x5bebf
jmp 0x5becc
leaq 0x14badc(%rip), %rax    # 0x1a7988
movq %rax, -0x40(%rbp)
jmp 0x5bed7
leaq 0x14bad7(%rip), %rax    # 0x1a7990
movq %rax, -0x40(%rbp)
jmp 0x5bed7
leaq 0x14ef0b(%rip), %rax    # 0x1aadd1
movq %rax, -0x40(%rbp)
jmp 0x5bed7
leaq 0x15bd5a(%rip), %rax    # 0x1b7c2d
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
movq -0x30(%rbp), %rax
movl %eax, %ecx
movq -0x40(%rbp), %r8
leaq 0x14baa5(%rip), %rsi    # 0x1a7997
movb $0x0, %al
callq 0x15b0d0
cmpq $0x1, -0x30(%rbp)
jne 0x5bf1f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x8, %rdx
movq -0x20(%rbp), %rcx
subq $0x8, %rcx
callq 0x5bf50
jmp 0x5bf45
cmpq $0x2, -0x30(%rbp)
jne 0x5bf43
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x8, %rdx
movq -0x20(%rbp), %rcx
subq $0x8, %rcx
callq 0x5c070
jmp 0x5bf45
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: do_emfplus_object_image_bitmap
static void do_emfplus_object_image_bitmap(deark *c, lctx *d, i64 pos, i64 len)
{
	i64 w, h;
	i64 ty;
	i64 endpos;
	const char *name;

	if(len<=0) return;
	endpos = pos + len;

	w = de_getu32le(pos);
	h = de_getu32le(pos+4);
	de_dbg_dimensions(c, w, h);

	// 8 stride
	// 12 pixelformat
	ty = de_getu32le(pos+16); // BitmapDataType
	switch(ty) {
	case 0: name="Pixel"; break;
	case 1: name="Compressed"; break;
	default: name="?"; break;
	}
	de_dbg(c, "type: %d (%s)", (int)ty, name);

	if(ty==1) {
		do_identify_and_extract_compressed_bitmap(c, d, pos+20, endpos - (pos+20));
	}
}

// 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)
cmpq $0x0, -0x20(%rbp)
jg 0x5bf74
jmp 0x5c062
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x165540
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
callq 0x165540
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x15bba0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
callq 0x165540
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x50(%rbp)
testq %rax, %rax
je 0x5bff6
jmp 0x5bfea
movq -0x50(%rbp), %rax
subq $0x1, %rax
je 0x5c003
jmp 0x5c010
leaq 0x16cfb7(%rip), %rax    # 0x1c8fb4
movq %rax, -0x48(%rbp)
jmp 0x5c01b
leaq 0x16aeaf(%rip), %rax    # 0x1c6eb9
movq %rax, -0x48(%rbp)
jmp 0x5c01b
leaq 0x15bc16(%rip), %rax    # 0x1b7c2d
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %edx
movq -0x48(%rbp), %rcx
leaq 0x172912(%rip), %rsi    # 0x1ce942
movb $0x0, %al
callq 0x15b0d0
cmpq $0x1, -0x38(%rbp)
jne 0x5c062
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x14, %rdx
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
addq $0x14, %rax
subq %rax, %rcx
callq 0x5c200
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: do_emfplus_object_image_metafile
static void do_emfplus_object_image_metafile(deark *c, lctx *d, i64 pos, i64 len)
{
	i64 ty;
	i64 dlen;
	const char *name;
	const char *ext = NULL;

	if(len<8) return;

	ty = de_getu32le(pos);
	switch(ty) {
	case 1: name="Wmf"; break;
	case 2: name="WmfPlaceable"; break;
	case 3: name="Emf"; break;
	case 4: name="EmfPlusOnly"; break;
	case 5: name="EmfPlusDual"; break;
	default: name = "?";
	}
	de_dbg(c, "type: %d (%s)", (int)ty, name);

	dlen = de_getu32le(pos+4);
	de_dbg(c, "metafile data size: %"I64_FMT, dlen);

	if(dlen<1 || dlen>len-8) return;

	if(ty==1 || ty==2) ext="wmf";
	else if(ty==3 || ty==4 || ty==5) ext="emf";
	else return;

	dbuf_create_file_from_slice(c->infile, pos+8, dlen, ext, NULL, 0);
}

// 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 $0x0, -0x40(%rbp)
cmpq $0x8, -0x20(%rbp)
jge 0x5c09c
jmp 0x5c1ed
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x165540
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
decq %rax
movq %rax, -0x48(%rbp)
subq $0x4, %rax
ja 0x5c117
movq -0x48(%rbp), %rax
leaq 0x14acdb(%rip), %rcx    # 0x1a6da8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x14b91b(%rip), %rax    # 0x1a79f8
movq %rax, -0x38(%rbp)
jmp 0x5c122
leaq 0x14b912(%rip), %rax    # 0x1a79fc
movq %rax, -0x38(%rbp)
jmp 0x5c122
leaq 0x14b912(%rip), %rax    # 0x1a7a09
movq %rax, -0x38(%rbp)
jmp 0x5c122
leaq 0x14b909(%rip), %rax    # 0x1a7a0d
movq %rax, -0x38(%rbp)
jmp 0x5c122
leaq 0x14b908(%rip), %rax    # 0x1a7a19
movq %rax, -0x38(%rbp)
jmp 0x5c122
leaq 0x15bb0f(%rip), %rax    # 0x1b7c2d
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
movq -0x38(%rbp), %rcx
leaq 0x17280b(%rip), %rsi    # 0x1ce942
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
callq 0x165540
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x14b8bf(%rip), %rsi    # 0x1a7a25
movb $0x0, %al
callq 0x15b0d0
cmpq $0x1, -0x30(%rbp)
jl 0x5c185
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
subq $0x8, %rcx
cmpq %rcx, %rax
jle 0x5c187
jmp 0x5c1ed
cmpq $0x1, -0x28(%rbp)
je 0x5c195
cmpq $0x2, -0x28(%rbp)
jne 0x5c1a2
leaq 0x14bfb7(%rip), %rax    # 0x1a8153
movq %rax, -0x40(%rbp)
jmp 0x5c1c8
cmpq $0x3, -0x28(%rbp)
je 0x5c1b7
cmpq $0x4, -0x28(%rbp)
je 0x5c1b7
cmpq $0x5, -0x28(%rbp)
jne 0x5c1c4
leaq 0x14ac03(%rip), %rax    # 0x1a6dc1
movq %rax, -0x40(%rbp)
jmp 0x5c1c6
jmp 0x5c1ed
jmp 0x5c1c8
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
movq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
xorl %r9d, %r9d
callq 0x166be0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: do_LogFont
static void do_LogFont(deark *c, lctx *d, struct decoder_params *dp, i64 pos1, i64 len)
{
	de_ucstring *facename = NULL;
	i64 pos = pos1;
	i64 n, n2;
	u8 b;

	if(len<92) goto done;

	n = de_geti32le_p(&pos);
	n2 = de_geti32le_p(&pos);
	de_dbg(c, "height,width: %d,%d", (int)n, (int)n2);
	pos += 15;
	b = de_getbyte_p(&pos);
	de_dbg(c, "charset: 0x%02x (%s)", (UI)b,
		fmtutil_get_windows_charset_name(b));

	pos += 4;
	facename = ucstring_create(c);
	dbuf_read_to_ucstring(c->infile, pos, 32*2, facename, 0, DE_ENCODING_UTF16LE);
	ucstring_truncate_at_NUL(facename);
	de_dbg(c, "facename: \"%s\"", ucstring_getpsz_d(facename));

done:
	ucstring_destroy(facename);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x5c, -0x28(%rbp)
jge 0x5c5d8
jmp 0x5c6db
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165670
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165670
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movl %eax, %edx
movq -0x48(%rbp), %rax
movl %eax, %ecx
leaq 0x14b50a(%rip), %rsi    # 0x1a7b23
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rax
addq $0xf, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165170
movb %al, -0x49(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movzbl -0x49(%rbp), %eax
movl %eax, -0x5c(%rbp)
movzbl -0x49(%rbp), %edi
callq 0x174f50
movq -0x68(%rbp), %rdi
movl -0x5c(%rbp), %edx
movq %rax, %rcx
leaq 0x14b4ce(%rip), %rsi    # 0x1a7b37
movb $0x0, %al
callq 0x15b0d0
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rcx
movl $0x40, %edx
xorl %r8d, %r8d
movl $0x3, %r9d
callq 0x1669f0
movq -0x30(%rbp), %rdi
callq 0x1712b0
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rdi
callq 0x172650
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq 0x14b478(%rip), %rsi    # 0x1a7b4c
movb $0x0, %al
callq 0x15b0d0
movq -0x30(%rbp), %rdi
callq 0x171750
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/emf.c
// Function: do_emf_xEmrText
static void do_emf_xEmrText(deark *c, lctx *d, i64 recpos, i64 pos1, i64 len,
	i64 bytesperchar, de_encoding encoding)
{
	i64 pos = pos1;
	i64 nchars;
	i64 offstring;
	de_ucstring *s = NULL;

	pos += 8; // Reference
	nchars = de_getu32le(pos);
	pos += 4;
	offstring = de_getu32le(pos);
	if(recpos+offstring+nchars*bytesperchar > pos1+len) goto done;
	s = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, recpos+offstring, nchars*bytesperchar,
		DE_DBG_MAX_STRLEN*bytesperchar, s, 0, encoding);
	ucstring_strip_trailing_NUL(s);
	de_dbg(c, "text: \"%s\"", ucstring_getpsz(s));

done:
	ucstring_destroy(s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl 0x10(%rbp), %eax
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 -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x165540
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x165540
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
addq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
imulq -0x30(%rbp), %rcx
addq %rcx, %rax
movq -0x20(%rbp), %rcx
addq -0x28(%rbp), %rcx
cmpq %rcx, %rax
jle 0x5c858
jmp 0x5c8c7
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
imulq -0x30(%rbp), %rdx
imulq $0x1f4, -0x30(%rbp), %rcx # imm = 0x1F4
movq -0x50(%rbp), %r8
movl 0x10(%rbp), %eax
xorl %r9d, %r9d
movl %eax, (%rsp)
callq 0x166a40
movq -0x50(%rbp), %rdi
callq 0x171310
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
callq 0x172500
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq 0x16a192(%rip), %rsi    # 0x1c6a52
movb $0x0, %al
callq 0x15b0d0
movq -0x50(%rbp), %rdi
callq 0x171750
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: de_module_epocimage
void de_module_epocimage(deark *c, struct deark_module_info *mi)
{
	mi->id = "epocimage";
	mi->desc = "EPOC/Symbian MBM, Sketch, AIF";
	mi->run_fn = de_run_epocimage;
	mi->identify_fn = de_identify_epocimage;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x14b369(%rip), %rcx    # 0x1a7cb0
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0x14b365(%rip), %rcx    # 0x1a7cba
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0x5c980
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x11d(%rip), %rcx       # 0x5ca90
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: de_run_epocimage
static void de_run_epocimage(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));
	d->fmt = de_identify_epocimage_internal(c);

	switch(d->fmt) {
	case DE_PFMT_SKETCH:
		de_declare_fmt(c, "EPOC Sketch");
		de_run_epocsketch(c, d);
		break;
	case DE_PFMT_MBM:
		de_declare_fmt(c, "EPOC MBM");
		de_run_epocmbm(c, d);
		break;
	case DE_PFMT_EXPORTED_MBM:
		de_declare_fmt(c, "EPOC Exported MBM");
		de_run_epocmbm(c, d);
		break;
	case DE_PFMT_AIF:
		de_declare_fmt(c, "EPOC AIF");
		de_run_epocaif(c, d);
		break;
	default:
		de_internal_err_nonfatal(c, "Unidentified format");
	}

	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 $0x430, %esi            # imm = 0x430
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5cac0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl (%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x3, %eax
ja 0x5ca62
movq -0x20(%rbp), %rax
leaq 0x14b183(%rip), %rcx    # 0x1a7b60
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
leaq 0x14b2e7(%rip), %rsi    # 0x1a7cd8
callq 0x15e380
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5cbc0
jmp 0x5ca74
movq -0x8(%rbp), %rdi
leaq 0x14b2d4(%rip), %rsi    # 0x1a7ce4
callq 0x15e380
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5cc00
jmp 0x5ca74
movq -0x8(%rbp), %rdi
leaq 0x14b2be(%rip), %rsi    # 0x1a7ced
callq 0x15e380
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5cc00
jmp 0x5ca74
movq -0x8(%rbp), %rdi
leaq 0x14b2b1(%rip), %rsi    # 0x1a7cff
callq 0x15e380
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5cc40
jmp 0x5ca74
movq -0x8(%rbp), %rdi
leaq 0x14b29b(%rip), %rsi    # 0x1a7d08
movb $0x0, %al
callq 0x15c380
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/epocimage.c
// Function: de_identify_epocimage_internal
static int de_identify_epocimage_internal(deark *c)
{
	u8 b[12];
	de_read(b, 0, 12);

	if(!de_memcmp(b, "\x37\x00\x00\x10\x42\x00\x00\x10", 8)) {
		return DE_PFMT_MBM; // EPOC MBM
	}
	if(!de_memcmp(b, "\x37\x00\x00\x10\x8a\x00\x00\x10", 8)) {
		return DE_PFMT_EXPORTED_MBM; // EPOC exported MBM
	}
	if(!de_memcmp(b, "\x37\x00\x00\x10\x6D\x00\x00\x10\x7D\x00\x00\x10", 12)) {
		return DE_PFMT_SKETCH; // EPOC Sketch
	}
	if(!de_memcmp(b, "\x37\x00\x00\x10\x6a\x00\x00\x10", 8)) {
		return DE_PFMT_AIF; // EPOC AIF
	}
	if(!de_memcmp(b, "\x37\x00\x00\x10\x38\x3a\x00\x10", 8)) {
		return DE_PFMT_AIF;
	}
	//if(!de_memcmp(b, "\x32\xb0\x1f\x10\x00\x00\x00\x00", 8)) {
	//	return DE_PFMT_?;
	//}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x1c(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0xc, %ecx
callq 0x164d10
leaq -0x1c(%rbp), %rax
movq (%rax), %rax
movabsq $0x1000004210000037, %rcx # imm = 0x1000004210000037
subq %rcx, %rax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5cb11
movl $0x1, -0x4(%rbp)
jmp 0x5cbb3
leaq -0x1c(%rbp), %rax
movq (%rax), %rax
movabsq $0x1000008a10000037, %rcx # imm = 0x1000008A10000037
subq %rcx, %rax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5cb39
movl $0x2, -0x4(%rbp)
jmp 0x5cbb3
leaq -0x1c(%rbp), %rdi
leaq 0x14b066(%rip), %rsi    # 0x1a7baa
movl $0xc, %edx
callq 0x19170
cmpl $0x0, %eax
jne 0x5cb5c
movl $0x3, -0x4(%rbp)
jmp 0x5cbb3
leaq -0x1c(%rbp), %rax
movq (%rax), %rax
movabsq $0x1000006a10000037, %rcx # imm = 0x1000006A10000037
subq %rcx, %rax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5cb84
movl $0x4, -0x4(%rbp)
jmp 0x5cbb3
leaq -0x1c(%rbp), %rax
movq (%rax), %rax
movabsq $0x10003a3810000037, %rcx # imm = 0x10003A3810000037
subq %rcx, %rax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5cbac
movl $0x4, -0x4(%rbp)
jmp 0x5cbb3
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/epocimage.c
// Function: do_epocsketch_header
static void do_epocsketch_header(deark *c, lctx *d, i64 pos)
{
	de_dbg(c, "header section at %"I64_FMT, pos);
	de_dbg_indent(c, 1);
	d->section_table_offset = de_getu32le(pos+16);
	de_dbg(c, "section table offset: %"I64_FMT, d->section_table_offset);
	de_dbg_indent(c, -1);
}

// 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
movq -0x18(%rbp), %rdx
leaq 0x14ad59(%rip), %rsi    # 0x1a7d1c
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
addq $0x10, %rsi
callq 0x165540
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x14ad27(%rip), %rsi    # 0x1a7d32
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: do_epocsketch_section_table
static void do_epocsketch_section_table(deark *c, lctx *d, i64 pos)
{
	u8 section_table_size_code;
	int num_sections;
	i64 i;

	// Section table section
	de_dbg(c, "section table at %"I64_FMT, pos);
	de_dbg_indent(c, 1);

	section_table_size_code = de_getbyte(pos);
	// The Section Table is a single "BListL" object. A BlistL starts with a byte
	// indicating the remaining size in 4-byte Longs. Each entry in the table is 8
	// bytes, so divide by 2 to get the number of entries.
	num_sections = ((int)section_table_size_code)/2;

	de_dbg(c, "section table size: %u (%d entries)", (UI)section_table_size_code,
		(int)num_sections);
	pos++;

	for(i=0; i<num_sections; i++) {
		do_epocsketch_section_table_entry(c, d, i, pos+8*i);
	}
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x14acf9(%rip), %rsi    # 0x1a7d4c
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 0x165060
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x19(%rbp), %edx
movl -0x20(%rbp), %ecx
leaq 0x14acc4(%rip), %rsi    # 0x1a7d61
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movslq -0x20(%rbp), %rcx
cmpq %rcx, %rax
jge 0x5d0f3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
callq 0x5d110
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x5d0b8
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: do_epocsketch_section_table_entry
static void do_epocsketch_section_table_entry(deark *c, lctx *d,
	i64 entry_index, i64 pos)
{
	i64 section_id;
	i64 section_loc;

	section_id = de_getu32le(pos);
	section_loc = de_getu32le(pos+4);
	de_dbg(c, "section #%d: id=0x%08x, pos=%"I64_FMT, (int)entry_index,
		(UI)section_id, section_loc);
	de_dbg_indent(c, 1);
	if(section_id==0x1000007d) {
		do_sketch_section(c, d, section_loc);
	}
	de_dbg_indent(c, -1);
}

// 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 -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x165540
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x4, %rsi
callq 0x165540
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movq -0x28(%rbp), %rax
movl %eax, %ecx
movq -0x30(%rbp), %r8
leaq 0x14ac14(%rip), %rsi    # 0x1a7d85
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
cmpq $0x1000007d, -0x28(%rbp) # imm = 0x1000007D
jne 0x5d1a1
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x5d1c0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: do_read_and_write_paint_data_section
static void do_read_and_write_paint_data_section(deark *c, lctx *d, i64 pos1)
{
	struct phys_image_ctx *pi = NULL;

	pi = de_malloc(c, sizeof(struct phys_image_ctx));
	pi->is_mask = 0;
	do_read_paint_data_section(c, d, pi, pos1);
	if(pi->img) {
		de_bitmap_write_to_file(pi->img, NULL, 0);
	}
	d->last_paint_data_section_size = pi->paint_data_section_size;
	destroy_phys_image(c, pi);
}

// 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 $0x440, %esi            # imm = 0x440
callq 0x15b780
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x5d420
movq -0x20(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x5d3fc
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x16afd0
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x5d8b0
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: destroy_phys_image
static void destroy_phys_image(deark *c, struct phys_image_ctx *pi)
{
	if(!pi) return;
	if(pi->img) {
		de_bitmap_destroy(pi->img);
	}
	de_free(c, pi);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x5d8c9
jmp 0x5d8ee
movq -0x10(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x5d8e1
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x16af60
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15b820
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: get_cmpr_type_name
static const char *get_cmpr_type_name(i64 t)
{
	const char *s = NULL;
	switch(t) {
	case 0: s="none"; break;
	case 1: s="RLE8"; break;
	case 2: s="RLE12"; break;
	case 3: s="RLE16"; break;
	case 4: s="RLE24"; break;
	}
	return s?s:"?";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
subq $0x4, %rax
ja 0x5d971
movq -0x18(%rbp), %rax
leaq 0x14a25b(%rip), %rcx    # 0x1a7b84
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x13edd4(%rip), %rax    # 0x19c70d
movq %rax, -0x10(%rbp)
jmp 0x5d971
leaq 0x178502(%rip), %rax    # 0x1d5e48
movq %rax, -0x10(%rbp)
jmp 0x5d971
leaq 0x14a675(%rip), %rax    # 0x1a7fc8
movq %rax, -0x10(%rbp)
jmp 0x5d971
leaq 0x14a66e(%rip), %rax    # 0x1a7fce
movq %rax, -0x10(%rbp)
jmp 0x5d971
leaq 0x14a667(%rip), %rax    # 0x1a7fd4
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x5d982
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x5d98f
leaq 0x15a2a4(%rip), %rax    # 0x1b7c2d
movq %rax, -0x20(%rbp)
jmp 0x5d98f
movq -0x20(%rbp), %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: do_rle8
static void do_rle8(deark *c, lctx *d, dbuf *unc_pixels,
	i64 pos1, i64 len)
{
	u8 b0, b1;
	i64 pos;
	i64 count;

	pos = pos1;
	while(pos<pos1+len) {
		b0 = de_getbyte(pos);
		pos++;

		if(b0<=0x7f) {
			// Next byte should be repeated b0+1 times.
			count = 1+(i64)b0;
			b1 = de_getbyte(pos);
			pos++;
			dbuf_write_run(unc_pixels, b1, count);
		}
		else {
			// 256-b0 bytes of uncompressed data.
			count = 256-(i64)b0;
			dbuf_copy(c->infile, pos, count, unc_pixels);
			pos += count;
		}
	}
}

// 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 -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
addq -0x28(%rbp), %rcx
cmpq %rcx, %rax
jge 0x5da7f
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x165060
movb %al, -0x29(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movzbl -0x29(%rbp), %eax
cmpl $0x7f, %eax
jg 0x5da43
movzbl -0x29(%rbp), %eax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x165060
movb %al, -0x2a(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movb -0x2a(%rbp), %al
movq -0x40(%rbp), %rdx
movzbl %al, %esi
callq 0x168800
jmp 0x5da7a
movzbl -0x29(%rbp), %eax
movl %eax, %ecx
movl $0x100, %eax            # imm = 0x100
subq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x166070
movq -0x40(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x5d9c4
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: do_rle12
static void do_rle12(deark *c, lctx *d, dbuf *unc_pixels,
	i64 pos1, i64 len)
{
	i64 pos = pos1;
	i64 count;
	i64 k;
	unsigned int n;
	u8 v[3];

	while(pos<pos1+len) {
		n = (unsigned int)de_getu16le_p(&pos);
		count = 1+(i64)((n&0xf000)>>12);
		v[0] = (u8)((n&0x0f00)>>8);
		v[1] = (u8)((n&0x00f0)>>4);
		v[2] = (u8)(n&0x000f);
		v[0] *= 17;
		v[1] *= 17;
		v[2] *= 17;
		for(k=0; k<count; k++) {
			dbuf_write(unc_pixels, v, 3);
		}
	}
}

// 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 -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
addq -0x28(%rbp), %rcx
cmpq %rcx, %rax
jge 0x5db6c
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1652c0
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
shrl $0xc, %eax
movl %eax, %eax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movl -0x44(%rbp), %eax
andl $0xf00, %eax            # imm = 0xF00
shrl $0x8, %eax
movb %al, -0x47(%rbp)
movl -0x44(%rbp), %eax
andl $0xf0, %eax
shrl $0x4, %eax
movb %al, -0x46(%rbp)
movl -0x44(%rbp), %eax
andl $0xf, %eax
movb %al, -0x45(%rbp)
movzbl -0x47(%rbp), %eax
imull $0x11, %eax, %eax
movb %al, -0x47(%rbp)
movzbl -0x46(%rbp), %eax
imull $0x11, %eax, %eax
movb %al, -0x46(%rbp)
movzbl -0x45(%rbp), %eax
imull $0x11, %eax, %eax
movb %al, -0x45(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
jge 0x5db67
movq -0x18(%rbp), %rdi
leaq -0x47(%rbp), %rsi
movl $0x3, %edx
callq 0x166170
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x5db3d
jmp 0x5dab4
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: do_rle16_24
static void do_rle16_24(deark *c, lctx *d, dbuf *unc_pixels,
	i64 pos1, i64 len, i64 bytes_per_pixel)
{
	i64 i;
	i64 k;
	u8 b0;
	i64 pos;
	i64 count;
	u8 v[3];

	pos = pos1;
	while(pos<pos1+len) {
		b0 = de_getbyte(pos);
		pos++;

		if(b0<=0x7f) {
			// Next pixel should be repeated b0+1 times.
			count = 1+(i64)b0;
			for(k=0; k<bytes_per_pixel; k++) {
				v[k] = de_getbyte(pos++);
			}
			for(i=0; i<count; i++) {
				dbuf_write(unc_pixels, v, bytes_per_pixel);
			}
		}
		else {
			// 256-b0 pixels of uncompressed data.
			count = 256-(i64)b0;
			dbuf_copy(c->infile, pos, count*bytes_per_pixel, unc_pixels);
			pos += count*bytes_per_pixel;
		}
	}
}

// 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 -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x20(%rbp), %rcx
addq -0x28(%rbp), %rcx
cmpq %rcx, %rax
jge 0x5dcb5
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x50(%rbp), %rsi
callq 0x165060
movb %al, -0x41(%rbp)
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movzbl -0x41(%rbp), %eax
cmpl $0x7f, %eax
jg 0x5dc6f
movzbl -0x41(%rbp), %eax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x5dc3c
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x50(%rbp), %rsi
movq %rsi, %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
callq 0x165060
movb %al, %cl
movq -0x40(%rbp), %rax
movb %cl, -0x5b(%rbp,%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x5dbfe
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x58(%rbp), %rax
jge 0x5dc6d
movq -0x18(%rbp), %rdi
leaq -0x5b(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x166170
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x5dc44
jmp 0x5dcb0
movzbl -0x41(%rbp), %eax
movl %eax, %ecx
movl $0x100, %eax            # imm = 0x100
subq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdx
imulq -0x30(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x166070
movq -0x58(%rbp), %rax
imulq -0x30(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x5dba8
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: populate_stdpal256
static void populate_stdpal256(lctx *d)
{
	UI k;

	if(d->have_stdpal256) return;
	d->have_stdpal256 = 1;

	for(k=0; k<256; k++) {
		d->stdpal256[k] = getpal256(k);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x28(%rax)
je 0x5df88
jmp 0x5dfc0
movq -0x8(%rbp), %rax
movb $0x1, 0x28(%rax)
movl $0x0, -0xc(%rbp)
cmpl $0x100, -0xc(%rbp)      # imm = 0x100
jae 0x5dfc0
movl -0xc(%rbp), %edi
callq 0x5e0c0
movl %eax, %edx
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
movl %edx, 0x2c(%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x5df97
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: decode_image_16bit
static void decode_image_16bit(deark *c, lctx *d, struct phys_image_ctx *pi,
	dbuf *unc_pixels, de_bitmap *img)
{
	i64 i, j;

	for(j=0; j<pi->height; j++) {
		for(i=0; i<pi->width; i++) {
			u8 cr;
			u32 n;
			de_color clr;

			n = (u32)dbuf_getu16le(unc_pixels, j*pi->src_rowspan + i*2);
			if(pi->is_mask) {
				cr = (u8)(n>>8);
				clr = DE_MAKE_RGB(cr, cr, cr);
			}
			else {
				clr = de_rgb565_to_888(n);
			}
			de_bitmap_setpixel_rgb(img, i, j, clr);
		}
	}
}

// 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 $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x5e0b8
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jge 0x5e0a5
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rax
imulq 0x28(%rax), %rsi
movq -0x30(%rbp), %rax
shlq %rax
addq %rax, %rsi
callq 0x165280
movl %eax, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x5e075
movl -0x40(%rbp), %eax
shrl $0x8, %eax
movb %al, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
shll $0x10, %eax
orl $0xff000000, %eax       # imm = 0xFF000000
movzbl -0x39(%rbp), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movzbl -0x39(%rbp), %ecx
orl %ecx, %eax
movl %eax, -0x44(%rbp)
jmp 0x5e080
movl -0x40(%rbp), %edi
callq 0x1618a0
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x44(%rbp), %ecx
callq 0x16b310
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x5e00e
jmp 0x5e0a7
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x5dff4
addq $0x50, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: getpal256
static de_color getpal256(UI k)
{
	UI x;
	u8 r, g, b;

	// The first and last 108 entries together make up the simple palette once
	// known as the "web safe" palette. The middle 40 entries are
	// supplementary grayscale and red/green/blue shades.

	if(k>=108 && k<148) {
		return supplpal[k-108];
	}

	x = k<108 ? k : k-40;
	r = (x%6)*0x33;
	g = ((x%36)/6)*0x33;
	b = (u8)((x/36)*0x33);

	return DE_MAKE_RGB(r,g,b);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x8(%rbp)
cmpl $0x6c, -0x8(%rbp)
jb 0x5e0ef
cmpl $0x94, -0x8(%rbp)
jae 0x5e0ef
movl -0x8(%rbp), %eax
subl $0x6c, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x149b29(%rip), %rax    # 0x1a7c10
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rbp)
jmp 0x5e16b
cmpl $0x6c, -0x8(%rbp)
jae 0x5e0fd
movl -0x8(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x5e106
movl -0x8(%rbp), %eax
subl $0x28, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl $0x6, %ecx
xorl %edx, %edx
divl %ecx
imull $0x33, %edx, %eax
movb %al, -0xd(%rbp)
movl -0xc(%rbp), %eax
movl $0x24, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movl $0x6, %ecx
xorl %edx, %edx
divl %ecx
imull $0x33, %eax, %eax
movb %al, -0xe(%rbp)
movl -0xc(%rbp), %eax
movl $0x24, %ecx
xorl %edx, %edx
divl %ecx
imull $0x33, %eax, %eax
movb %al, -0xf(%rbp)
movzbl -0xd(%rbp), %eax
shll $0x10, %eax
orl $0xff000000, %eax       # imm = 0xFF000000
movzbl -0xe(%rbp), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movzbl -0xf(%rbp), %ecx
orl %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq