LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/cpio.c
// Function: identify_cpio_internal
static int identify_cpio_internal(deark *c, i64 pos, int *subfmt)
{
	u8 b[6];

	*subfmt = 0;
	de_read(b, pos, sizeof(b));

	if(!de_memcmp(b, "070707", 6)) {
		*subfmt = SUBFMT_ASCII_PORTABLE;
		return 100;
	}
	if(!de_memcmp(b, "070701", 6)) {
		*subfmt = SUBFMT_ASCII_NEW;
		return 100;
	}
	if(!de_memcmp(b, "070702", 6)) {
		*subfmt = SUBFMT_ASCII_NEWCRC;
		return 100;
	}
	if(b[0]==0xc7 && b[1]==0x71) {
		*subfmt = SUBFMT_BINARY_LE;
		return 70;
	}
	if(b[0]==0x71 && b[1]==0xc7) {
		*subfmt = SUBFMT_BINARY_BE;
		return 70;
	}

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %rdx
movl $0x0, (%rbx)
movq 0x18(%rdi), %rdi
leaq 0x2(%rsp), %r14
movl $0x6, %ecx
movq %r14, %rsi
callq 0xeeee8
movl $0x37303730, %eax       # imm = 0x37303730
movl (%r14), %edx
xorl %eax, %edx
movzwl 0x4(%r14), %esi
xorl $0x3730, %esi           # imm = 0x3730
movl $0x64, %ecx
orl %edx, %esi
je 0x3fac9
xorl 0x2(%rsp), %eax
movzwl 0x6(%rsp), %edx
xorl $0x3130, %edx           # imm = 0x3130
orl %eax, %edx
je 0x3fad0
movl $0x37303730, %eax       # imm = 0x37303730
xorl 0x2(%rsp), %eax
movzwl 0x6(%rsp), %edx
xorl $0x3230, %edx           # imm = 0x3230
orl %eax, %edx
je 0x3fad7
movb 0x2(%rsp), %sil
movb 0x3(%rsp), %dil
movl %esi, %eax
xorb $-0x39, %al
movl %edi, %r8d
xorb $0x71, %r8b
movl $0x46, %ecx
movl $0x1, %edx
orb %al, %r8b
je 0x3fadc
xorb $0x71, %sil
xorb $-0x39, %dil
xorl %eax, %eax
movl $0x2, %edx
orb %sil, %dil
je 0x3fadc
jmp 0x3fae0
movl $0x3, %edx
jmp 0x3fadc
movl $0x4, %edx
jmp 0x3fadc
movl $0x5, %edx
movl %edx, (%rbx)
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/d64.c
// Function: de_module_d64
void de_module_d64(deark *c, struct deark_module_info *mi)
{
	mi->id = "d64";
	mi->desc = "D64 (C64 disk image)";
	mi->run_fn = de_run_d64;
	mi->identify_fn = de_identify_d64;
}

// Assembly:
leaq 0xda785(%rip), %rax     # 0x11a3e4
movq %rax, (%rsi)
leaq 0xda77f(%rip), %rax     # 0x11a3e8
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x3fc84
movq %rax, 0x18(%rsi)
leaq 0x59b(%rip), %rax       # 0x4021a
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/d64.c
// Function: de_identify_d64
static int de_identify_d64(deark *c)
{
	if(!de_input_file_has_ext(c, "d64")) return 0;
	if(!dbuf_memcmp(c->infile, 357*256, "\x12\x01\x41\x00", 4)) {
		return 100;
	}
	if(c->infile->len==683*256) return 30;
	if(c->infile->len==683*256+683) return 30;
	return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xda1bf(%rip), %rsi     # 0x11a3e4
callq 0xea936
testl %eax, %eax
je 0x40271
movq 0x18(%rbx), %rdi
leaq 0xda197(%rip), %rdx     # 0x11a3d0
movl $0x16500, %esi          # imm = 0x16500
movl $0x4, %ecx
callq 0xf025e
testl %eax, %eax
je 0x40275
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rcx
xorl %eax, %eax
cmpq $0x2adab, %rcx          # imm = 0x2ADAB
movl $0x1e, %edx
cmovel %edx, %eax
cmpq $0x2ab00, %rcx          # imm = 0x2AB00
cmovel %edx, %eax
jmp 0x4027a
xorl %eax, %eax
jmp 0x4027a
movl $0x64, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/drhalo.c
// Function: de_module_drhalocut
void de_module_drhalocut(deark *c, struct deark_module_info *mi)
{
	mi->id = "drhalocut";
	mi->desc = "Dr. Halo .CUT image";
	mi->run_fn = de_run_drhalocut;
	mi->identify_fn = de_identify_drhalocut;
	mi->help_fn = de_help_drhalocut;
}

// Assembly:
leaq 0xda30d(%rip), %rax     # 0x11a590
movq %rax, (%rsi)
leaq 0xda30d(%rip), %rax     # 0x11a59a
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x402b3
movq %rax, 0x18(%rsi)
leaq 0x385(%rip), %rax       # 0x40628
movq %rax, 0x20(%rsi)
leaq 0x3f4(%rip), %rax       # 0x406a2
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/drhalo.c
// Function: de_identify_drhalocut
static int de_identify_drhalocut(deark *c)
{
	i64 n;

	if(!de_input_file_has_ext(c, "cut")) return 0;
	n = de_getu16le(4);
	if(n!=0) return 0;
	n = de_getu16le(0);
	if(n<1 || n>4096) return 0;
	n = de_getu16le(2);
	if(n<1 || n>4096) return 0;
	return 10;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xd9f60(%rip), %rsi     # 0x11a596
callq 0xea936
xorl %r14d, %r14d
testl %eax, %eax
je 0x40697
movq 0x18(%rbx), %rdi
movl $0x4, %esi
callq 0xef1ca
testq %rax, %rax
jne 0x40697
movq 0x18(%rbx), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0xef1ca
addq $-0x1001, %rax          # imm = 0xEFFF
cmpq $-0x1000, %rax          # imm = 0xF000
jb 0x40697
movq 0x18(%rbx), %rdi
movl $0x2, %esi
callq 0xef1ca
addq $-0x1001, %rax          # imm = 0xEFFF
xorl %ecx, %ecx
cmpq $-0x1000, %rax          # imm = 0xF000
movl $0xa, %r14d
cmovbl %ecx, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/drhalo.c
// Function: de_module_drhalopic
void de_module_drhalopic(deark *c, struct deark_module_info *mi)
{
	mi->id = "drhalopic";
	mi->desc = "Dr. Halo .PIC image";
	mi->run_fn = de_run_drhalopic;
	mi->identify_fn = de_identify_drhalopic;
	mi->help_fn = de_help_drhalopic;
}

// Assembly:
leaq 0xd9ee1(%rip), %rax     # 0x11a5ae
movq %rax, (%rsi)
leaq 0xd9ee1(%rip), %rax     # 0x11a5b8
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x406fd
movq %rax, 0x18(%rsi)
leaq 0x78a(%rip), %rax       # 0x40e77
movq %rax, 0x20(%rsi)
leaq 0x7d4(%rip), %rax       # 0x40ecc
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/drhalo.c
// Function: do_write_image_pal
static void do_write_image_pal(deark *c, lctx *d, dbuf *unc_pixels)
{
	de_bitmap *img = NULL;

	img = de_bitmap_create(c, d->w, d->h, 3);
	de_convert_image_paletted(unc_pixels, 0, 8, d->w, d->pal, img, 0);
	de_bitmap_write_to_file(img, NULL, DE_CREATEFLAG_OPT_IMAGE);
	de_bitmap_destroy(img);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq (%rsi), %rsi
movq 0x8(%r14), %rdx
movl $0x3, %ecx
callq 0xf2cab
movq %rax, %r15
movq (%r14), %rcx
addq $0x18, %r14
movl $0x0, (%rsp)
movl $0x8, %edx
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %r8
movq %rax, %r9
callq 0xf35b8
movq %r15, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0xf2923
movq %r15, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xf28d4
nop
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/ebml.c
// Function: de_module_ebml
void de_module_ebml(deark *c, struct deark_module_info *mi)
{
	mi->id = "ebml";
	mi->desc = "EBML";
	mi->run_fn = de_run_ebml;
	mi->identify_fn = de_identify_ebml;
	mi->help_fn = de_help_ebml;
}

// Assembly:
leaq 0xd9795(%rip), %rax     # 0x11aa10
movq %rax, (%rsi)
leaq 0xd9790(%rip), %rax     # 0x11aa15
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x412ab
movq %rax, 0x18(%rsi)
leaq 0x7f(%rip), %rax        # 0x4131a
movq %rax, 0x20(%rsi)
leaq 0x9a(%rip), %rax        # 0x41340
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/ebml.c
// Function: de_run_ebml
static void de_run_ebml(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos;

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

	if(de_get_ext_option(c, "ebml:encodedid")) {
		d->show_encoded_id = 1;
	}

	pos = 0;
	do_element_sequence(c, d, pos, c->infile->len);

	if(d) {
		destroy_attachment_data(c, d);
		de_free(c, d);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x10, %esi
callq 0xe969b
movq %rax, %r14
leaq 0xd9754(%rip), %rsi     # 0x11aa1a
movq %rbx, %rdi
callq 0xea6cb
testq %rax, %rax
je 0x412db
movl $0x1, 0x4(%r14)
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rcx
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x4134e
testq %r14, %r14
je 0x41312
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4182e
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe9752
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/ebml.c
// Function: destroy_attachment_data
static void destroy_attachment_data(deark *c, lctx *d)
{
	if(!d->attachmentctx) return;
	ucstring_destroy(d->attachmentctx->filename);
	de_free(c, d->attachmentctx);
	d->attachmentctx = NULL;
}

// Assembly:
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x41864
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rax), %rdi
callq 0xf6bb0
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0xe9752
movq $0x0, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/ebml.c
// Function: get_var_size_int
static int get_var_size_int(dbuf *f, i64 *val, i64 *pos,
	i64 nbytes_avail)
{
	i64 pos1;
	u8 b;
	u8 mask;
	unsigned int k;
	int retval = 0;
	u8 test_bit;
	unsigned int initial_zero_bits;

	pos1 = *pos;
	if(nbytes_avail<1) goto done;

	// This is an unsigned int. In a i64, we can support up to 63
	// bits.
	// For now we'll hope that 8 octets is the most we'll have to support,
	// but it's possible we'll have to support 9 or even more, which will
	// require additional logic.
	//
	//  1xxxxxxx width_nbits=0, octets=1, data_bits=7
	//  01xxxxxx width_nbits=1, octets=2, data_bits=14
	//  ...
	//  00000001 width_nbits=7, octets=8, data_bits=56
	//  00000000 1xxxxxxx width_nbits=8, octets=9, data_bits=63

	b = dbuf_getbyte(f, *pos);
	(*pos)++;

	test_bit = 0x80;
	initial_zero_bits = 0;
	while(1) {
		if(b>=test_bit) {
			break;
		}

		// "Not it". Try the next-larger number of initial 0 bits.
		initial_zero_bits++;
		test_bit >>= 1;
		if(test_bit==0) {
			goto done;
		}
	}

	mask = 0x7f >> initial_zero_bits;

	*val = (i64)(b & mask);

	// Read remaining bytes, if any.
	for(k=0; k<initial_zero_bits; k++) {
		if(*pos >= pos1+nbytes_avail) goto done;
		b = dbuf_getbyte(f, *pos);
		(*pos)++;
		if(*val > 0x07ffffffffffffffLL) {
			goto done;
		}
		*val = ((*val)<<8) | ((i64)b);
	}

	if(initial_zero_bits==0 && (*val)==0x7f) {
		// TODO: Fully handle "reserved" element value of all 1 bits.
		retval = 2;
		goto done;
	}

	retval = 1;

done:
	if(retval!=1) {
		*val = 0;
	}
	return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
testq %rcx, %rcx
jle 0x418a6
movq %rcx, %r13
movq %rdx, %r14
movq %rdi, %r15
movq (%rdx), %r12
movq %r12, %rsi
callq 0xef0d5
incq (%r14)
movzbl %al, %eax
xorl %ebp, %ebp
movl $0x80, %ecx
cmpl %eax, %ecx
jbe 0x418c4
incl %ebp
shrl %ecx
cmpl $0x8, %ebp
jne 0x41899
xorl %ecx, %ecx
xorl %eax, %eax
testb %cl, %cl
jne 0x418b5
movq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x7f, %edx
movl %ebp, %ecx
shrl %cl, %edx
andl %eax, %edx
movq %rdx, (%rbx)
testl %ebp, %ebp
je 0x41911
addq %r13, %r12
movabsq $0x7ffffffffffffff, %r13 # imm = 0x7FFFFFFFFFFFFFF
movq (%r14), %rsi
cmpq %r12, %rsi
jge 0x418a6
movq %r15, %rdi
callq 0xef0d5
incq (%r14)
movq (%rbx), %rcx
cmpq %r13, %rcx
jg 0x418a6
shlq $0x8, %rcx
movzbl %al, %eax
orq %rcx, %rax
movq %rax, (%rbx)
decl %ebp
jne 0x418e3
jmp 0x41920
cmpq $0x7f, (%rbx)
jne 0x41920
movl $0x2, %eax
xorl %ecx, %ecx
jmp 0x418aa
movl $0x1, %eax
movb $0x1, %cl
jmp 0x418aa
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/ebml.c
// Function: decode_uint
static void decode_uint(deark *c, lctx *d, const struct ele_id_info *ele_id,
	  i64 pos, i64 len1)
{
	unsigned int k;
	unsigned int len;
	u64 v = 0;

	if(len1==0) goto done;
	if(len1<1 || len1>8) return;
	len = (unsigned int)len1;

	v = 0;
	for(k=0; k<len; k++) {
		u64 x;
		x = (u64)de_getbyte(pos+(i64)k);
		v |= x<<((len-1-k)*8);
	}

done:
	de_dbg(c, "value: %"U64_FMT, v);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
testq %rdx, %rdx
je 0x41951
movq %rdx, %r14
leaq -0x9(%rdx), %rax
cmpq $-0x8, %rax
jae 0x41956
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
xorl %r12d, %r12d
jmp 0x4198b
movq %rsi, %r15
leaq -0x8(,%r14,8), %r13
xorl %r12d, %r12d
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef0d5
movzbl %al, %eax
movl %r13d, %ecx
andb $-0x8, %cl
shlq %cl, %rax
orq %rax, %r12
addq $-0x8, %r13
incq %r15
decq %r14
jne 0x41964
leaq 0xd9661(%rip), %rsi     # 0x11aff3
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xe9226
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/ebml.c
// Function: decode_float
static void decode_float(deark *c, lctx *d, const struct ele_id_info *ele_id,
	  i64 pos, i64 len)
{
	double v;

	if(len==4) {
		v = dbuf_getfloat32x(c->infile, pos, 0);
	}
	else if(len==8) {
		v = dbuf_getfloat64x(c->infile, pos, 0);
	}
	else {
		return;
	}
	de_dbg(c, "value: %f", v);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq $0x8, %rdx
je 0x419c5
cmpq $0x4, %rdx
jne 0x419e2
movq 0x18(%rbx), %rdi
xorl %edx, %edx
callq 0xef935
jmp 0x419d0
movq 0x18(%rbx), %rdi
xorl %edx, %edx
callq 0xef9cf
leaq 0xd9627(%rip), %rsi     # 0x11affe
movq %rbx, %rdi
movb $0x1, %al
popq %rbx
jmp 0xe9226
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/ebml.c
// Function: decode_string
static void decode_string(deark *c, lctx *d, const struct ele_id_info *ele_id,
	  i64 pos, i64 len, de_ext_encoding ee)
{
	de_ucstring *s = NULL;

	s = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, pos, len, DE_DBG_MAX_STRLEN, s,
		DE_CONVFLAG_STOP_AT_NUL, ee);
	de_dbg(c, "value: \"%s\"", ucstring_getpsz_d(s));

	ucstring_destroy(s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
callq 0xf6870
movq %rax, %rbx
movq 0x18(%r12), %rdi
movl %ebp, (%rsp)
movl $0x1f4, %ecx            # imm = 0x1F4
movq %r15, %rsi
movq %r14, %rdx
movq %rax, %r8
movl $0x1, %r9d
callq 0xf0203
movq %rbx, %rdi
callq 0xf7557
leaq 0xd0d28(%rip), %rsi     # 0x11275b
movq %r12, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xf6bb0
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/ebml.c
// Function: decode_date
static void decode_date(deark *c, lctx *d, const struct ele_id_info *ele_id,
	  i64 pos, i64 len)
{
	i64 dt_int;
	struct de_timestamp ts;
	char buf[64];

	if(len!=8) return;
	dt_int = de_geti64be(pos);
	EBMLdate_to_timestamp(dt_int, &ts);
	de_timestamp_to_string(&ts, buf, sizeof(buf), 0);
	de_dbg(c, "value: %"I64_FMT" (%s)", dt_int, buf);
}

// Assembly:
cmpq $0x8, %rdx
jne 0x41b10
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0xef4c3
movq %rax, %r14
movabsq $0x112e0be826d694b3, %rcx # imm = 0x112E0BE826D694B3
imulq %rcx
movq %rdx, %r15
movq %rdx, %r13
shrq $0x3f, %r13
sarq $0x1a, %r15
leaq (%r15,%r13), %rdi
addq $0x3a4fc880, %rdi       # imm = 0x3A4FC880
movq %rsp, %r12
movq %r12, %rsi
movl $0x1, %edx
callq 0xeace2
addq %r13, %r15
imulq $0x3b9aca00, %r15, %rax # imm = 0x3B9ACA00
movq %r14, %rcx
subq %rax, %rcx
cvtsi2sd %rcx, %xmm0
divsd 0xd8f3b(%rip), %xmm0    # 0x11aa08
movq %r12, %rdi
callq 0xead3a
leaq 0x10(%rsp), %r15
movl $0x40, %edx
movq %r12, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0xeb4f8
leaq 0xd0caa(%rip), %rsi     # 0x11279d
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0xe9226
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/ebml.c
// Function: handler_filename
static void handler_filename(deark *c, lctx *d, struct handler_params *hp)
{
	if(!d->attachmentctx) return;
	if(d->attachmentctx->filename) return;
	if(hp->dlen<1) return;

	d->attachmentctx->filename = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, hp->dpos, hp->dlen, 300,
		d->attachmentctx->filename,
		DE_CONVFLAG_STOP_AT_NUL, DE_ENCODING_UTF8);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x41ba9
cmpq $0x0, (%rax)
jne 0x41ba9
movq %rdx, %rbx
cmpq $0x0, 0x8(%rdx)
jle 0x41ba9
movq %rsi, %r15
movq %rdi, %r14
callq 0xf6870
movq 0x8(%r15), %rcx
movq %rax, (%rcx)
movq 0x18(%r14), %rdi
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movl $0x2, (%rsp)
movl $0x12c, %ecx            # imm = 0x12C
movq %rax, %r8
movl $0x1, %r9d
callq 0xf0203
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/ebml.c
// Function: handler_attachedfile
static void handler_attachedfile(deark *c, lctx *d, struct handler_params *hp)
{
	if(hp->end_flag) {
		handler_attachedfile_end(c, d);
	}
	else {
		handler_attachedfile_start(c, d, hp);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x0, 0x10(%rdx)
movq 0x8(%rsi), %rax
je 0x41c10
testq %rax, %rax
je 0x41c0b
cmpq $0x0, 0x8(%rax)
je 0x41c0b
movq %r14, %rdi
callq 0xea9a9
movq %rax, %r15
movq 0x8(%rbx), %rax
movq (%rax), %rdx
testq %rdx, %rdx
je 0x41c37
cmpq $0x0, 0x10(%rdx)
jle 0x41c37
cmpb $0x0, 0xd0(%r14)
je 0x41c37
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0xea9e4
jmp 0x41c51
xorl %r15d, %r15d
jmp 0x41c71
testq %rax, %rax
je 0x41c20
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4182e
movl $0x18, %esi
movq %r14, %rdi
callq 0xe969b
movq %rax, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
leaq 0xf37f3(%rip), %rdx     # 0x135431
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0xeac7c
movq 0x18(%r14), %rdi
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
xorl %ecx, %ecx
movq %r15, %r8
movl $0x1, %r9d
callq 0xf0321
movq %r14, %rdi
movq %r15, %rsi
callq 0xea9b3
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x4182e
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/emf.c
// Function: de_module_emf
void de_module_emf(deark *c, struct deark_module_info *mi)
{
	mi->id = "emf";
	mi->desc = "Enhanced Windows Metafile";
	mi->desc2 = "extract bitmaps only";
	mi->run_fn = de_run_emf;
	mi->identify_fn = de_identify_emf;
}

// Assembly:
leaq 0xd9392(%rip), %rax     # 0x11b04d
movq %rax, (%rsi)
leaq 0xd938c(%rip), %rax     # 0x11b051
movq %rax, 0x8(%rsi)
leaq 0xd939b(%rip), %rax     # 0x11b06b
movq %rax, 0x10(%rsi)
leaq 0x10(%rip), %rax        # 0x41ceb
movq %rax, 0x18(%rsi)
leaq 0x24c(%rip), %rax       # 0x41f32
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/emf.c
// Function: handler_CREATEPEN
static int handler_CREATEPEN(deark *c, lctx *d, struct decoder_params *dp)
{
	i64 pos = dp->dpos;

	if(dp->dlen<20) return 1;
	read_object_index_p(c, d, &pos);
	read_LogPen(c, d, pos);
	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq 0x18(%rdx), %rax
movq %rax, 0x8(%rsp)
cmpq $0x14, 0x20(%rdx)
jl 0x42238
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x42e58
movq (%r14), %rax
leaq 0x10(%rsp), %r14
movq %rax, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef3a0
leaq 0xd9657(%rip), %rsi     # 0x11b84a
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef475
leaq 0xdcdbd(%rip), %rsi     # 0x11efcf
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
addq $0x4, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef3a0
movq %rbx, %rdi
movl %eax, %esi
callq 0x42dfe
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/emf.c
// Function: handler_CREATEBRUSHINDIRECT
static int handler_CREATEBRUSHINDIRECT(deark *c, lctx *d, struct decoder_params *dp)
{
	i64 pos = dp->dpos;

	if(dp->dlen<16) return 1;
	read_object_index_p(c, d, &pos);
	read_LogBrushEx(c, d, pos);
	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq 0x18(%rdx), %rax
movq %rax, 0x8(%rsp)
cmpq $0x10, 0x20(%rdx)
jl 0x422ac
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x42e58
movq (%r14), %rax
leaq 0x10(%rsp), %r14
movq %rax, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef3a0
leaq 0xd95c0(%rip), %rsi     # 0x11b84a
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef3a0
movq %rbx, %rdi
movl %eax, %esi
callq 0x42dfe
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/emf.c
// Function: emf_handler_4c
static int emf_handler_4c(deark *c, lctx *d, struct decoder_params *dp)
{
	i64 rop;
	i64 bmi_offs;
	i64 bmi_len;
	i64 bits_offs;
	i64 bits_len;

	if(dp->recsize_bytes<100) return 1;

	rop = de_getu32le(dp->recpos+40);
	de_dbg(c, "raster operation: 0x%08x", (UI)rop);

	bmi_offs = de_getu32le(dp->recpos+84);
	bmi_len = de_getu32le(dp->recpos+88);
	de_dbg(c, "bmi offset=%"I64_FMT", len=%"I64_FMT, bmi_offs, bmi_len);
	bits_offs = de_getu32le(dp->recpos+92);
	bits_len = de_getu32le(dp->recpos+96);
	de_dbg(c, "bits offset=%"I64_FMT", len=%"I64_FMT, bits_offs, bits_len);

	if(bmi_len<12) return 1;
	if(bmi_offs<100) return 1;
	if(bmi_offs+bmi_len>dp->recsize_bytes) return 1;
	if(bits_len<1) return 1;
	if(bits_offs<100) return 1;
	if(bits_offs+bits_len>dp->recsize_bytes) return 1;
	extract_dib(c, d, dp->recpos+bmi_offs, bmi_len, dp->recpos+bits_offs, bits_len);
	return 1;
}

// Assembly:
cmpq $0x64, 0x10(%rdx)
jl 0x42bea
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x8(%rdx), %rsi
addq $0x28, %rsi
callq 0xef37e
leaq 0xd9236(%rip), %rsi     # 0x11bd35
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rsi
addq $0x54, %rsi
callq 0xef37e
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rsi
addq $0x58, %rsi
callq 0xef37e
movq %rax, %r12
leaq 0xd9214(%rip), %rsi     # 0x11bd4e
movq %rbx, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rsi
addq $0x5c, %rsi
callq 0xef37e
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rsi
addq $0x60, %rsi
callq 0xef37e
movq %rax, %rbp
leaq 0xd91ed(%rip), %rsi     # 0x11bd66
movq %rbx, %rdi
movq %r13, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
cmpq $0xc, %r12
setl %al
cmpq $0x64, %r15
setl %cl
orb %al, %cl
jne 0x42bdc
testq %rbp, %rbp
jle 0x42bdc
leaq (%r12,%r15), %rcx
movq 0x10(%r14), %rax
cmpq %rax, %rcx
jg 0x42bdc
cmpq $0x64, %r13
jl 0x42bdc
movq %rbp, %rcx
addq %r13, %rcx
cmpq %rax, %rcx
jg 0x42bdc
movq 0x8(%r14), %rax
addq %rax, %r15
addq %rax, %r13
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
callq 0x42ec3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/emf.c
// Function: emf_handler_50_51
static int emf_handler_50_51(deark *c, lctx *d, struct decoder_params *dp)
{
	i64 rop;
	i64 bmi_offs;
	i64 bmi_len;
	i64 bits_offs;
	i64 bits_len;
	i64 fixed_header_len;
	i64 num_scans;

	if(dp->rectype==0x50)
		fixed_header_len = 76;
	else
		fixed_header_len = 80;

	if(dp->recsize_bytes<fixed_header_len) return 1;

	bmi_offs = de_getu32le(dp->recpos+48);
	bmi_len = de_getu32le(dp->recpos+52);
	de_dbg(c, "bmi offset=%"I64_FMT", len=%"I64_FMT, bmi_offs, bmi_len);
	bits_offs = de_getu32le(dp->recpos+56);
	bits_len = de_getu32le(dp->recpos+60);
	de_dbg(c, "bits offset=%"I64_FMT", len=%"I64_FMT, bits_offs, bits_len);

	if(dp->rectype==0x51) {
		rop = de_getu32le(dp->recpos+68);
		de_dbg(c, "raster operation: 0x%08x", (UI)rop);
	}

	if(dp->rectype==0x50) {
		num_scans = de_getu32le(dp->recpos+72);
		de_dbg(c, "number of scanlines: %u", (UI)num_scans);
	}

	if(bmi_len<12) return 1;
	if(bmi_offs<fixed_header_len) return 1;
	if(bmi_offs+bmi_len>dp->recsize_bytes) return 1;
	if(bits_len<1) return 1;
	if(bits_offs<fixed_header_len) return 1;
	if(bits_offs+bits_len>dp->recsize_bytes) return 1;
	extract_dib(c, d, dp->recpos+bmi_offs, bmi_len, dp->recpos+bits_offs, bits_len);

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %eax, %eax
cmpl $0x50, (%rdx)
setne %al
leaq 0x4c(,%rax,4), %r12
cmpq %r12, 0x10(%rdx)
jge 0x42c25
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x8(%rdx), %rsi
addq $0x30, %rsi
callq 0xef37e
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rsi
addq $0x34, %rsi
callq 0xef37e
leaq 0xd90f7(%rip), %rsi     # 0x11bd4e
movq %rbx, %rdi
movq %r15, %rdx
movq %rax, (%rsp)
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rsi
addq $0x38, %rsi
callq 0xef37e
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rsi
addq $0x3c, %rsi
callq 0xef37e
movq %rax, %rbp
leaq 0xd90cc(%rip), %rsi     # 0x11bd66
movq %rbx, %rdi
movq %r13, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
cmpl $0x51, (%r14)
jne 0x42cd4
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rsi
addq $0x44, %rsi
callq 0xef37e
leaq 0xd906d(%rip), %rsi     # 0x11bd35
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
cmpl $0x50, (%r14)
jne 0x42cfe
movq 0x18(%rbx), %rdi
movq 0x8(%r14), %rsi
addq $0x48, %rsi
callq 0xef37e
leaq 0xd909c(%rip), %rsi     # 0x11bd8e
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq (%rsp), %rdx
cmpq $0xc, %rdx
jl 0x42c11
cmpq %r12, %r15
jl 0x42c11
testq %rbp, %rbp
jle 0x42c11
leaq (%rdx,%r15), %rcx
movq 0x10(%r14), %rax
cmpq %rax, %rcx
jg 0x42c11
cmpq %r12, %r13
jl 0x42c11
movq %rbp, %rcx
addq %r13, %rcx
cmpq %rax, %rcx
jg 0x42c11
movq 0x8(%r14), %rax
addq %rax, %r15
addq %rax, %r13
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rcx
movq %rbp, %r8
callq 0x42ec3
jmp 0x42c11
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/emf.c
// Function: handler_EXTCREATEFONTINDIRECTW
static int handler_EXTCREATEFONTINDIRECTW(deark *c, lctx *d, struct decoder_params *dp)
{
	i64 pos = dp->dpos;
	i64 elw_size;

	read_object_index_p(c, d, &pos); // ihFonts

	// "If the size of the elw field is equal to or less than the size of a
	// LogFontPanose object, elw MUST be treated as a fixed-length LogFont object.
	// [Else LogFontExDv.] The size of a LogFontPanose object is 320 decimal."
	elw_size = dp->dlen - 4;

	if(elw_size<=320) {
		do_LogFont(c, d, dp, pos, elw_size);
	}
	else {
		do_LogFontExDv(c, d, dp, pos, elw_size);
	}

	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movq 0x18(%rdx), %rax
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movq %r15, %rsi
callq 0x42e58
movq 0x20(%rbx), %rdx
addq $-0x4, %rdx
movq (%r15), %rsi
movq %r14, %rdi
callq 0x43064
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/emf.c
// Function: emf_handler_53
static int emf_handler_53(deark *c, lctx *d, struct decoder_params *dp)
{
	i64 pos = dp->recpos;

	pos += 8; // type, size
	pos += 16; // bounds
	pos += 12; // iGraphicsMode, exScale, eyScale
	do_emf_aEmrText(c, d, dp->recpos, pos, dp->recpos+dp->recsize_bytes - pos);
	return 1;
}

// Assembly:
pushq %rax
movq 0x8(%rdx), %rax
movq 0x10(%rdx), %rcx
leaq 0x24(%rax), %rdx
addq $-0x24, %rcx
movl (%rsi), %r9d
movl $0x1, %r8d
movq %rax, %rsi
callq 0x43147
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/emf.c
// Function: emf_handler_54
static int emf_handler_54(deark *c, lctx *d, struct decoder_params *dp)
{
	i64 pos = dp->recpos;

	pos += 8; // type, size
	pos += 16; // bounds
	pos += 12; // iGraphicsMode, exScale, eyScale
	do_emf_wEmrText(c, d, dp->recpos, pos, dp->recpos+dp->recsize_bytes - pos);
	return 1;
}

// Assembly:
pushq %rax
movq 0x8(%rdx), %rsi
movq 0x10(%rdx), %rcx
leaq 0x24(%rsi), %rdx
addq $-0x24, %rcx
movl $0x2, %r8d
movl $0x3, %r9d
callq 0x43147
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/emf.c
// Function: do_dbg_colorref
static void do_dbg_colorref(deark *c, lctx *d, u32 colorref)
{
	u32 clr;
	char csamp[16];

	clr = colorref_to_color(colorref);
	de_get_colorsample_code(c, clr, csamp, sizeof(csamp));
	de_dbg(c, "colorref: 0x%08x%s", (UI)colorref, csamp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
andl $0xff00, %eax           # imm = 0xFF00
movl %esi, %ecx
shrl $0x10, %ecx
movzbl %cl, %ecx
shll $0x10, %esi
orl %eax, %esi
orl %ecx, %esi
orl $0xff000000, %esi       # imm = 0xFF000000
movq %rsp, %r15
movl $0x10, %ecx
movq %r15, %rdx
callq 0xe9bb8
leaq 0xd88f4(%rip), %rsi     # 0x11b733
movq %r14, %rdi
movl %ebx, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0xe9226
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0xef3a0
testl %eax, %eax
js 0x42e7d
leaq 0xfdf4d(%rip), %rsi     # 0x140dbd
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
popq %rbx
jmp 0xe9226
movl %eax, %ecx
andl $0x7ffffffc, %ecx       # imm = 0x7FFFFFFC
cmpl $0x13, %ecx
ja 0x42e9f
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leaq 0x13e227(%rip), %rdx    # 0x1810c0
movq (%rdx,%rcx,8), %rdx
jmp 0x42ea1
xorl %edx, %edx
testq %rdx, %rdx
leaq 0xe8fbe(%rip), %rcx     # 0x12be69
cmovneq %rdx, %rcx
leaq 0xd8890(%rip), %rsi     # 0x11b746
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
popq %rbx
jmp 0xe9226
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
cmpq $0x5c, %rdx
jge 0x4307d
xorl %r15d, %r15d
jmp 0x43134
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0xef475
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef475
leaq 0xd8d01(%rip), %rsi     # 0x11bda6
movq %rbx, %rdi
movl %r15d, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe9226
addq $0xf, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %ebp
movl %ebp, %edi
callq 0xf93a2
leaq 0xd8ce5(%rip), %rsi     # 0x11bdba
movq %rbx, %rdi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
addq $0x4, (%r14)
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
movl $0x40, %edx
movq %rax, %rcx
xorl %r8d, %r8d
movl $0x3, %r9d
callq 0xf01b0
movq %r15, %rdi
callq 0xf68c1
movq %r15, %rdi
callq 0xf7557
leaq 0xd8ca8(%rip), %rsi     # 0x11bdcf
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r15, %rdi
callq 0xf6bb0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, 0xc(%rsp)
movq %r8, 0x10(%rsp)
movq %rcx, %r14
movq %rdx, %rbp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rdx), %rsi
movq 0x18(%rdi), %rdi
callq 0xef37e
movq %rax, %r12
leaq 0xc(%rbp), %rsi
movq 0x18(%rbx), %rdi
callq 0xef37e
movq %rax, %r13
addq %r15, %r13
movq 0x10(%rsp), %r15
imulq %r15, %r12
leaq (%r12,%r13), %rax
addq %rbp, %r14
cmpq %r14, %rax
jle 0x431a8
xorl %r14d, %r14d
jmp 0x431fa
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r14
movq 0x18(%rbx), %rdi
imulq $0x1f4, %r15, %rcx      # imm = 0x1F4
movl 0xc(%rsp), %eax
movl %eax, (%rsp)
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %r8
xorl %r9d, %r9d
callq 0xf0203
movq %r14, %rdi
callq 0xf68e3
movq %r14, %rdi
callq 0xf74bd
leaq 0xf7b1f(%rip), %rsi     # 0x13ad0c
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf6bb0
// File: /workspace/github_c_makefile_star2_O1/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:
leaq 0xd8dad(%rip), %rax     # 0x11bfc4
movq %rax, (%rsi)
leaq 0xd8dad(%rip), %rax     # 0x11bfce
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x4323c
movq %rax, 0x18(%rsi)
leaq 0x756(%rip), %rax       # 0x4398d
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbx
subq $0x10, %rsp
movq 0x18(%rdi), %rdi
leaq 0x4(%rsp), %rbx
movl $0xc, %ecx
movq %rbx, %rsi
xorl %edx, %edx
callq 0xeeee8
movabsq $0x1000004210000037, %rax # imm = 0x1000004210000037
cmpq %rax, (%rbx)
je 0x43a25
movabsq $0x1000008a10000037, %rax # imm = 0x1000008A10000037
cmpq %rax, 0x4(%rsp)
je 0x43a2c
movabsq $0x1000006d10000037, %rax # imm = 0x1000006D10000037
xorq 0x4(%rsp), %rax
movl 0xc(%rsp), %ecx
xorq $0x1000007d, %rcx       # imm = 0x1000007D
orq %rax, %rcx
je 0x43a33
movabsq $0x1000006a10000037, %rax # imm = 0x1000006A10000037
cmpq %rax, 0x4(%rsp)
je 0x43a3a
movabsq $0x10003a3810000037, %rcx # imm = 0x10003A3810000037
xorl %eax, %eax
cmpq %rcx, 0x4(%rsp)
sete %al
shll $0x2, %eax
jmp 0x43a3f
movl $0x1, %eax
jmp 0x43a3f
movl $0x2, %eax
jmp 0x43a3f
movl $0x3, %eax
jmp 0x43a3f
movl $0x4, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movl $0x440, %esi            # imm = 0x440
callq 0xe969b
movq %rax, %r15
movl $0x0, 0x20(%rax)
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
movq %r12, %rcx
callq 0x43bf5
movq 0x30(%r15), %rdi
testq %rdi, %rdi
je 0x43bd7
xorl %esi, %esi
xorl %edx, %edx
callq 0xf2923
movq 0x38(%r15), %rax
movq %rax, 0x8(%r14)
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x442fa
// File: /workspace/github_c_makefile_star2_O1/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:
testq %rsi, %rsi
je 0x44329
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x30(%rsi), %rdi
testq %rdi, %rdi
je 0x44317
callq 0xf28d4
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe9752
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x10(%rsp)
testq %rcx, %rcx
jle 0x443e7
movq %r8, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
addq %rdx, 0x10(%rsp)
leaq 0xd(%rsp), %rbp
movq 0x18(%r13), %rdi
movq %r15, %rsi
callq 0xef0d5
incq %r15
testb %al, %al
js 0x443b7
testq %rbx, %rbx
jle 0x4439c
movb %al, 0xc(%rsp)
xorl %r14d, %r14d
leaq (%r15,%r14), %rsi
movq 0x18(%r13), %rdi
callq 0xef0d5
movb %al, 0xd(%rsp,%r14)
incq %r14
cmpq %r14, %rbx
jne 0x4437b
addq %r14, %r15
movb 0xc(%rsp), %al
incb %al
movzbl %al, %r14d
movq %r12, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0xefb82
decq %r14
jne 0x443a2
jmp 0x443dc
movzbl %al, %eax
movl $0x100, %r14d           # imm = 0x100
subq %rax, %r14
movq 0x18(%r13), %rdi
imulq %rbx, %r14
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0xefabc
addq %r14, %r15
cmpq 0x10(%rsp), %r15
jl 0x4435c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/eps.c
// Function: de_module_eps
void de_module_eps(deark *c, struct deark_module_info *mi)
{
	mi->id = "eps";
	mi->desc = "Encapsulated PostScript";
	mi->desc2 = "extract preview image";
	mi->run_fn = de_run_eps;
	mi->identify_fn = de_identify_eps;
}

// Assembly:
leaq 0xd7fd7(%rip), %rax     # 0x11c3d6
movq %rax, (%rsi)
leaq 0xd7fd1(%rip), %rax     # 0x11c3da
movq %rax, 0x8(%rsi)
leaq 0xd7fde(%rip), %rax     # 0x11c3f2
movq %rax, 0x10(%rsi)
leaq 0x10(%rip), %rax        # 0x4442f
movq %rax, 0x18(%rsi)
leaq 0x51c(%rip), %rax       # 0x44946
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/eps.c
// Function: de_identify_eps
static int de_identify_eps(deark *c)
{
	u8 b[20];
	de_read(b, 0, (i64)sizeof(b));

	if(b[0]==0xc5 && b[1]==0xd0 && b[2]==0xd3 && b[3]==0xc6)
		return 100;

	if(!de_memcmp(b, "%!PS-Adobe-", 11) &&
		!de_memcmp(&b[14], " EPSF-", 6) )
	{
		return 100;
	}

	return 0;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq 0x18(%rdi), %rdi
movq %rsp, %rbx
movl $0x14, %ecx
movq %rbx, %rsi
xorl %edx, %edx
callq 0xeeee8
cmpb $-0x3b, (%rbx)
movl $0x64, %eax
jne 0x44980
cmpb $-0x30, 0x1(%rsp)
jne 0x44980
cmpb $-0x2d, 0x2(%rsp)
jne 0x44980
cmpb $-0x3a, 0x3(%rsp)
je 0x449bc
movabsq $0x6f64412d53502125, %rcx # imm = 0x6F64412D53502125
xorq (%rsp), %rcx
movabsq $0x2d65626f64412d53, %rdx # imm = 0x2D65626F64412D53
xorq 0x3(%rsp), %rdx
orq %rcx, %rdx
jne 0x449ba
movl $0x53504520, %ecx       # imm = 0x53504520
xorl 0xe(%rsp), %ecx
movzwl 0x12(%rsp), %edx
xorl $0x2d46, %edx           # imm = 0x2D46
orl %ecx, %edx
je 0x449bc
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/exe.c
// Function: de_module_exe
void de_module_exe(deark *c, struct deark_module_info *mi)
{
	mi->id = "exe";
	mi->desc = "EXE executable (PE, NE, etc.)";
	mi->run_fn = de_run_exe;
	mi->identify_fn = de_identify_exe;
	mi->help_fn = de_help_exe;
}

// Assembly:
leaq 0xded8a(%rip), %rax     # 0x123755
movq %rax, (%rsi)
leaq 0xd7bcf(%rip), %rax     # 0x11c5a4
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x449fb
movq %rax, 0x18(%rsi)
leaq 0x2010(%rip), %rax      # 0x469fb
movq %rax, 0x20(%rsi)
leaq 0x2089(%rip), %rax      # 0x46a7f
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/exe.c
// Function: de_identify_exe
static int de_identify_exe(deark *c)
{
	UI sig;
	UI lfb;
	int exe_ext;
	u8 sigMZ;

	sig = (UI)de_getu16be(0);
	if(sig==0x4d5aU) { sigMZ = 1; }
	else if(sig==0x5a4d) { sigMZ = 0; }
	else { return 0; }
	lfb = (UI)de_getu16le(2); // lenFinal

	exe_ext = de_input_file_has_ext(c, "exe");
	if(lfb>511) {
		return exe_ext ? 15 : 0;
	}
	if(exe_ext) return 80;
	return sigMZ ? 80 : 50;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0xef169
movq %rax, %rbx
cmpl $0x5a4d, %ebx           # imm = 0x5A4D
je 0x46a24
cmpl $0x4d5a, %ebx           # imm = 0x4D5A
jne 0x46a76
movq 0x18(%r14), %rdi
movl $0x2, %esi
callq 0xef1ca
movq %rax, %r15
leaq 0xdcd19(%rip), %rsi     # 0x123755
movq %r14, %rdi
callq 0xea936
testl $0xfffffe00, %r15d      # imm = 0xFFFFFE00
je 0x46a5b
testl %eax, %eax
movl $0xf, %r15d
cmovel %eax, %r15d
jmp 0x46a76
cmpl $0x4d5a, %ebx           # imm = 0x4D5A
movl $0x50, %ecx
movl $0x32, %r15d
cmovel %ecx, %r15d
testl %eax, %eax
cmovnel %ecx, %r15d
movl %r15d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/exe.c
// Function: do_execomp
static void do_execomp(deark *c, lctx *d)
{
	struct fmtutil_specialexe_detection_data edd;

	if(d->execomp_mode!=1) {
		if(d->sfx_only_mode) return;
		if((!c->show_infomessages) && (c->debug_level<1)) return;
	}

	if(!d->ei) {
		d->ei = de_malloc(c, sizeof(struct fmtutil_exe_info));
		fmtutil_collect_exe_info(c, c->infile, d->ei);
	}

	de_zeromem(&edd, sizeof(struct fmtutil_specialexe_detection_data));
	edd.flags_in |= 0x1;
	fmtutil_detect_execomp(c, d->ei, &edd);
	if(!edd.detected_fmt) return;
	de_dbg(c, "detected executable compression: %s", edd.detected_fmt_name);

	if(d->execomp_mode==1) {
		try_execomp_decompress(c, d, &edd);
	}
	else if(d->execomp_mode!=0) {
		if(edd.modname) {
			de_info(c, "Note: File seems to be compressed with %s. Use \"-m %s\" "
				"or \"-opt execomp\" to attempt decompression.",
				edd.detected_fmt_name, edd.modname);
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x1, 0x2(%rsi)
jne 0x46bc7
cmpq $0x0, 0x8(%r14)
jne 0x46af7
movl $0xf0, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x8(%r14)
movq 0x18(%rbx), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x1053ee
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, (%r15)
movaps %xmm0, 0x60(%r15)
movaps %xmm0, 0x50(%r15)
movaps %xmm0, 0x40(%r15)
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movq $0x0, 0x70(%r15)
orb $0x1, 0x8(%r15)
movq 0x8(%r14), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x1055db
cmpb $0x0, 0x1(%r15)
je 0x46c27
leaq 0x50(%rsp), %r15
leaq 0xd63fd(%rip), %rsi     # 0x11cf4f
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movb 0x2(%r14), %al
cmpb $0x1, %al
jne 0x46be6
cmpb $0x0, 0x1(%rsp)
je 0x46c27
movq 0x48(%rsp), %rdx
testq %rdx, %rdx
je 0x46c13
leaq 0xd649d(%rip), %rsi     # 0x11d024
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x48(%rsp), %rsi
movq 0x18(%rbx), %rcx
movq 0x18(%rcx), %r9
movq %rbx, %rdi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0xea66a
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
jmp 0x46c27
cmpb $0x0, 0x3(%r14)
jne 0x46c27
cmpl $0x0, 0xc0(%rbx)
jne 0x46ad0
cmpl $0x0, (%rbx)
jg 0x46ad0
jmp 0x46c27
testb %al, %al
setne %al
movq 0x48(%rsp), %rcx
testq %rcx, %rcx
setne %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x46c27
leaq 0xd636f(%rip), %rsi     # 0x11cf73
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9ef5
jmp 0x46c27
leaq 0xd63bc(%rip), %rsi     # 0x11cfd6
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9ef5
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/exe.c
// Function: do_extract_CURSOR
static void do_extract_CURSOR(deark *c, lctx *d, i64 pos, i64 len, de_finfo *fi)
{
	UI firstword;
	i64 hotspot_x, hotspot_y;

	if(len<8) return;
	firstword = (UI)de_getu16le(pos);

	// For Win3 icons, the first word is the x hotspot.
	// For Win1 icons, it is one of the type codes below.
	if(d->fmt==EXE_FMT_NE && (firstword==0x0003 || firstword==0x0103 ||
		firstword==0x0203))
	{
		UI fourthword;
		// For Win3 icons, the 4th word is the high word of the
		// bitmap-info-header-size (definitely 0).
		// For Win1 icons, it is the width (definitely not 0).
		fourthword = (UI)de_getu16le(pos+6);
		if(fourthword!=0) {
			dbuf_create_file_from_slice(c->infile, pos, len, "win1.cur", fi, 0);
			return;
		}
	}

	hotspot_x = (i64)firstword;
	hotspot_y = de_getu16le(pos+2);
	de_dbg(c, "hotspot: %d,%d", (int)hotspot_x, (int)hotspot_y);
	do_extract_ico_cur(c, d, pos+4, len-4, 1, hotspot_x, hotspot_y, fi);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpq $0x8, %rcx
jl 0x475c0
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbp
movq %rdi, %r12
movq 0x18(%rdi), %rdi
movq %rdx, %rsi
callq 0xef1ca
movq %rax, %r13
cmpb $0x2, (%rbp)
jne 0x4756a
cmpl $0x3, %r13d
je 0x4752d
cmpl $0x203, %r13d           # imm = 0x203
je 0x4752d
cmpl $0x103, %r13d           # imm = 0x103
jne 0x4756a
movq 0x18(%r12), %rdi
leaq 0x6(%r15), %rsi
callq 0xef1ca
testl %eax, %eax
je 0x4756a
movq 0x18(%r12), %rdi
leaq 0xd5d33(%rip), %rcx     # 0x11d27e
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %r8
xorl %r9d, %r9d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf0321
movl %r13d, %eax
movq %rax, 0x10(%rsp)
movq 0x18(%r12), %rdi
leaq 0x2(%r15), %rsi
callq 0xef1ca
movq %rax, %rbp
leaq 0xd5cfd(%rip), %rsi     # 0x11d287
movq %r12, %rdi
movl %r13d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0xe9226
addq $0x4, %r15
addq $-0x4, %r14
movq %rbx, (%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl $0x1, %ecx
movq 0x10(%rsp), %r8
movq %rbp, %r9
callq 0x478e1
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq