LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wmf.c
// Function: handler_colorref
static int handler_colorref(deark *c, lctx *d, struct decoder_params *dp)
{
	u32 colorref;

	if(dp->dlen<4) goto done;
	colorref = (u32)de_getu32le(dp->dpos);
	do_dbg_colorref(c, d, dp, colorref);
done:
	return 1;
}

// Assembly:
cmpq $0x4, 0x28(%rdx)
jl 0xd37d5
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x20(%rdx), %rsi
callq 0xef37e
movq %rbx, %rdi
movl %eax, %esi
callq 0xd4354
popq %rbx
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wmf.c
// Function: wmf_handler_TEXTOUT
static int wmf_handler_TEXTOUT(deark *c, lctx *d, struct decoder_params *dp)
{
	i64 pos = dp->dpos;
	i64 stringlen;
	de_ucstring *s = NULL;

	stringlen = de_getu16le(pos);
	pos += 2;

	if(pos+stringlen > dp->dpos+dp->dlen) goto done;
	s = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, pos, stringlen, DE_DBG_MAX_STRLEN, s,
		0, d->input_encoding);
	de_dbg(c, "text: \"%s\"", ucstring_getpsz(s));

done:
	ucstring_destroy(s);
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
movq 0x20(%rdx), %r15
movq 0x18(%rdi), %rdi
movq %r15, %rsi
callq 0xef1ca
movq %rax, %r12
addq %r15, %rax
addq $0x2, %rax
movq 0x28(%r14), %rcx
addq 0x20(%r14), %rcx
cmpq %rcx, %rax
jle 0xd381d
xorl %r14d, %r14d
jmp 0xd3869
addq $0x2, %r15
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r14
movq 0x18(%rbx), %rdi
movl 0x4(%r13), %eax
movl %eax, (%rsp)
movl $0x1f4, %ecx            # imm = 0x1F4
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %r8
xorl %r9d, %r9d
callq 0xf0203
movq %r14, %rdi
callq 0xf74bd
leaq 0x674b0(%rip), %rsi     # 0x13ad0c
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
callq 0xf6bb0
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wmf.c
// Function: handler_FILLREGION
static int handler_FILLREGION(deark *c, lctx *d, struct decoder_params *dp)
{
	unsigned int oi;
	i64 pos = dp->dpos;

	oi = (unsigned int)de_getu16le_p(&pos);
	de_dbg(c, "region object index: %u", oi);
	oi = (unsigned int)de_getu16le_p(&pos);
	de_dbg(c, "brush object index: %u", oi);
	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdx), %rax
movq %rsp, %r14
movq %rax, (%r14)
movq 0x18(%rdi), %rdi
movq %r14, %rsi
callq 0xef1ed
leaq 0x6ce88(%rip), %rsi     # 0x140c7b
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef1ed
leaq 0x6ce81(%rip), %rsi     # 0x140c93
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wmf.c
// Function: wmf_handler_EXTTEXTOUT
static int wmf_handler_EXTTEXTOUT(deark *c, lctx *d, struct decoder_params *dp)
{
	i64 pos = dp->dpos;
	i64 stringlen;
	de_ucstring *s = NULL;
	u32 fwOpts;

	pos += 4; // Y, X

	stringlen = de_getu16le(pos);
	pos += 2;

	fwOpts = (u32)de_getu16le(pos);
	pos += 2;

	if(fwOpts & 0x0004) {
		// My best guess is that this flag determines whether the
		// Rectangle field exists. The specification says the field is
		// optional, but AFAICT does not say how to tell whether it exists.
		pos += 8; // Rectangle
	}

	if(pos+stringlen > dp->dpos+dp->dlen) goto done;
	s = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, pos, stringlen, DE_DBG_MAX_STRLEN, s,
		0, d->input_encoding);
	de_dbg(c, "text: \"%s\"", ucstring_getpsz(s));

done:
	ucstring_destroy(s);
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq 0x20(%rdx), %r13
leaq 0x4(%r13), %rsi
movq 0x18(%rdi), %rdi
callq 0xef1ca
movq %rax, %r14
leaq 0x6(%r13), %rsi
movq 0x18(%rbx), %rdi
callq 0xef1ca
andl $0x4, %eax
leaq (,%rax,2), %rcx
addq %r13, %rcx
addq %r14, %rcx
addq $0x8, %rcx
movq 0x28(%r15), %rdx
addq 0x20(%r15), %rdx
cmpq %rdx, %rcx
jle 0xd3eb4
xorl %r15d, %r15d
jmp 0xd3f02
leaq 0x8(%r13,%rax,2), %r13
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r15
movq 0x18(%rbx), %rdi
movl 0x4(%r12), %eax
movl %eax, (%rsp)
movl $0x1f4, %ecx            # imm = 0x1F4
movq %r13, %rsi
movq %r14, %rdx
movq %r15, %r8
xorl %r9d, %r9d
callq 0xf0203
movq %r15, %rdi
callq 0xf74bd
leaq 0x66e17(%rip), %rsi     # 0x13ad0c
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r15, %rdi
callq 0xf6bb0
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wmf.c
// Function: wmf_handler_DIBSTRETCHBLT_STRETCHDIB
static int wmf_handler_DIBSTRETCHBLT_STRETCHDIB(deark *c, lctx *d, struct decoder_params *dp)
{
	i64 dib_pos;
	i64 dib_len;
	int hdrsize;
	int has_src_bitmap = 1;

	if(dp->rectype==0x41) { // DIBSTRETCHBLT
		has_src_bitmap = (dp->recsize_words != ((i64)(dp->recfunc>>8)+3));
		de_dbg(c, "has src bitmap: %d", has_src_bitmap);
	}

	if(!has_src_bitmap) goto done;
	if(dp->rectype==0x41) // DIBSTRETCHBLT
		hdrsize = 26;
	else
		hdrsize = 28;

	if(dp->recsize_bytes < hdrsize) goto done;
	dib_pos = dp->recpos + hdrsize;
	dib_len = dp->recsize_bytes - hdrsize;
	if(dib_len < 12) goto done;
	de_dbg(c, "DIB at %d, size=%d", (int)dib_pos, (int)dib_len);

	de_dbg_indent(c, 1);
	de_run_module_by_id_on_slice(c, "dib", NULL, c->infile, dib_pos, dib_len);
	de_dbg_indent(c, -1);

done:
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
cmpb $0x41, 0x2(%rdx)
jne 0xd3f5c
movq 0x10(%r14), %r15
movzbl 0x1(%r14), %r12d
addq $0x3, %r12
xorl %edx, %edx
cmpq %r12, %r15
setne %dl
leaq 0x6c7c6(%rip), %rsi     # 0x140713
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
cmpq %r12, %r15
je 0xd3fcd
xorl %eax, %eax
cmpb $0x41, 0x2(%r14)
setne %al
leaq 0x1a(,%rax,2), %r12
movq 0x18(%r14), %r15
subq %r12, %r15
jl 0xd3fcd
cmpq $0xc, %r15
jl 0xd3fcd
addq 0x8(%r14), %r12
leaq 0x6c7fe(%rip), %rsi     # 0x140786
movq %rbx, %rdi
movl %r12d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rcx
leaq 0x4f27f(%rip), %rsi     # 0x12322f
movq %rbx, %rdi
xorl %edx, %edx
movq %r12, %r8
movq %r15, %r9
callq 0xea5fa
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wmf.c
// Function: handler_DELETEOBJECT
static int handler_DELETEOBJECT(deark *c, lctx *d, struct decoder_params *dp)
{
	unsigned int oi;
	oi = (unsigned int)de_getu16le(dp->dpos);
	de_dbg(c, "object index: %u", oi);
	if(d->object_table && oi<d->num_objects) {
		d->object_table[oi] = 0; // Mark this index as available
	}
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
movq 0x18(%rdi), %rdi
movq 0x20(%rdx), %rsi
callq 0xef1ca
movq %rax, %r14
leaq 0x6cdbd(%rip), %rsi     # 0x140dbd
movq %r15, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x28(%rbx), %rax
testq %rax, %rax
je 0xd4023
cmpl %r14d, 0x18(%rbx)
jbe 0xd4023
movl %r14d, %ecx
movb $0x0, (%rax,%rcx)
movl $0x1, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wmf.c
// Function: handler_CREATEPENINDIRECT
static int handler_CREATEPENINDIRECT(deark *c, lctx *d, struct decoder_params *dp)
{
	u32 colorref;
	i64 pos = dp->dpos;
	unsigned int width;
	unsigned int style;
	unsigned int base_style;
	de_ucstring *style_descr = NULL;

	if(dp->dlen<10) goto done;
	style = (unsigned int)de_getu16le_p(&pos);
	base_style = style&0x0f; // ?
	style_descr = ucstring_create(c);
	ucstring_append_flags_item(style_descr, get_penbasestyle_name(base_style));
	if((style&0x0f00)==0x0100) ucstring_append_flags_item(style_descr, "PS_ENDCAP_SQUARE");
	if((style&0x0f00)==0x0200) ucstring_append_flags_item(style_descr, "PS_ENDCAP_FLAG");
	if((style&0xf000)==0x1000) ucstring_append_flags_item(style_descr, "PS_JOIN_BEVEL");
	if((style&0xf000)==0x2000) ucstring_append_flags_item(style_descr, "PS_JOIN_MITER");
	de_dbg(c, "style: 0x%04x (%s)", style, ucstring_getpsz(style_descr));

	if(base_style!=0x5) {
		width = (unsigned int)de_getu32le(pos);
		width &= 0x0000ffffU;
		de_dbg(c, "width: %u", width);
	}
	pos += 4;

	if(base_style!=0x5) {
		colorref = (u32)de_getu32le(pos);
		do_dbg_colorref(c, d, dp, colorref);
	}

done:
	ucstring_destroy(style_descr);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq 0x20(%rdx), %rax
movq %rax, 0x8(%rsp)
cmpq $0xa, 0x28(%rdx)
jge 0xd4052
xorl %r14d, %r14d
jmp 0xd417a
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef1ed
movq %rax, %r15
movl %r15d, %ebp
movl %r15d, %r12d
andl $0xf, %r12d
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r14
cmpl $0x8, %r12d
ja 0xd4097
movl %r15d, %eax
andl $0xf, %eax
leaq 0x6cd5e(%rip), %rcx     # 0x140dec
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmp 0xd4099
xorl %eax, %eax
testq %rax, %rax
leaq 0x57dc6(%rip), %rsi     # 0x12be69
cmovneq %rax, %rsi
movq %r14, %rdi
callq 0xf7566
movl %ebp, %eax
andl $0xf00, %eax            # imm = 0xF00
cmpl $0x100, %eax            # imm = 0x100
je 0xd40cd
cmpl $0x200, %eax            # imm = 0x200
jne 0xd40dc
leaq 0x6cbf0(%rip), %rsi     # 0x140cbb
jmp 0xd40d4
leaq 0x6cbd6(%rip), %rsi     # 0x140caa
movq %r14, %rdi
callq 0xf7566
andl $0xf000, %r15d          # imm = 0xF000
cmpl $0x1000, %r15d          # imm = 0x1000
je 0xd40fe
cmpl $0x2000, %r15d          # imm = 0x2000
jne 0xd410d
leaq 0x6cbdc(%rip), %rsi     # 0x140cd8
jmp 0xd4105
leaq 0x6cbc5(%rip), %rsi     # 0x140cca
movq %r14, %rdi
callq 0xf7566
movq %r14, %rdi
callq 0xf74bd
leaq 0x6cbca(%rip), %rsi     # 0x140ce6
movq %rbx, %rdi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
cmpl $0x5, %r12d
je 0xd4153
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
callq 0xef37e
movzwl %ax, %edx
leaq 0x6cbb0(%rip), %rsi     # 0x140cf9
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rsp), %rsi
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
cmpl $0x5, %r12d
je 0xd417a
movq 0x18(%rbx), %rdi
callq 0xef37e
movq %rbx, %rdi
movl %eax, %esi
callq 0xd4354
movq %r14, %rdi
callq 0xf6bb0
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wmf.c
// Function: handler_CREATEFONTINDIRECT
static int handler_CREATEFONTINDIRECT(deark *c, lctx *d, struct decoder_params *dp)
{
	i64 facename_size;
	i64 n, n2;
	u8 b;
	i64 pos = dp->dpos;

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

	facename_size = dp->dlen-18;
	if(facename_size>32) facename_size=32;
	if(facename_size>=2) {
		de_ucstring *facename = NULL;
		facename = ucstring_create(c);
		dbuf_read_to_ucstring(c->infile, dp->dpos+18, facename_size, facename,
			DE_CONVFLAG_STOP_AT_NUL, DE_ENCODING_WINDOWS1252);
		de_dbg(c, "facename: \"%s\"", ucstring_getpsz_d(facename));
		ucstring_destroy(facename);
	}
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rdi, %rbx
movq 0x20(%rdx), %rax
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movq 0x18(%rdi), %rdi
movq %r15, %rsi
callq 0xef2dd
movq %rax, %r12
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef2dd
leaq 0x47bd2(%rip), %rsi     # 0x11bda6
movq %rbx, %rdi
movl %r12d, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe9226
addq $0x9, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef14d
movzbl %al, %ebp
movl %ebp, %edi
callq 0xf93a2
leaq 0x47bb6(%rip), %rsi     # 0x11bdba
movq %rbx, %rdi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x28(%r14), %rax
cmpq $0x14, %rax
jl 0xd4281
cmpq $0x32, %rax
movl $0x32, %r15d
cmovlq %rax, %r15
addq $-0x12, %r15
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r12
movq 0x18(%rbx), %rdi
movq 0x20(%r14), %rsi
addq $0x12, %rsi
movq %r15, %rdx
movq %rax, %rcx
movl $0x1, %r8d
movl $0x9, %r9d
callq 0xf01b0
movq %r12, %rdi
callq 0xf7557
leaq 0x47b63(%rip), %rsi     # 0x11bdcf
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r12, %rdi
callq 0xf6bb0
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wmf.c
// Function: handler_CREATEBRUSHINDIRECT
static int handler_CREATEBRUSHINDIRECT(deark *c, lctx *d, struct decoder_params *dp)
{
	unsigned int style;
	i64 pos = dp->dpos;

	if(dp->dlen<8) goto done;
	style = (unsigned int)de_getu16le_p(&pos);
	de_dbg(c, "style: 0x%04x (%s)", style, get_brushstyle_name(style));

	if(style==0x0 || style==0x2) {
		u32 colorref;
		colorref = (u32)de_getu32le(pos);
		do_dbg_colorref(c, d, dp, colorref);
	}
	pos += 4;

	if(style==0x2) {
		unsigned int h;
		h = (unsigned int)de_getu16le(pos);
		de_dbg(c, "hatch: %u", h);
	}

done:
	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x20(%rdx), %rax
movq %rax, (%rsp)
cmpq $0x8, 0x28(%rdx)
jl 0xd4347
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq %rsp, %rsi
callq 0xef1ed
movq %rax, %r14
cmpl $0x6, %r14d
ja 0xd42d5
movl %r14d, %eax
andl $0x7, %eax
leaq 0xb9881(%rip), %rcx     # 0x18db50
movq (%rcx,%rax,8), %rax
jmp 0xd42d7
xorl %eax, %eax
testq %rax, %rax
leaq 0x57b88(%rip), %rcx     # 0x12be69
cmovneq %rax, %rcx
leaq 0x6c9fa(%rip), %rsi     # 0x140ce6
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0xe9226
testl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
jne 0xd4319
movq 0x18(%rbx), %rdi
movq (%rsp), %rsi
callq 0xef37e
movq %rbx, %rdi
movl %eax, %esi
callq 0xd4354
movq (%rsp), %rsi
addq $0x4, %rsi
movq %rsi, (%rsp)
cmpl $0x2, %r14d
jne 0xd4347
movq 0x18(%rbx), %rdi
callq 0xef1ca
leaq 0x6ca2a(%rip), %rsi     # 0x140d65
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wpg.c
// Function: de_module_wpg
void de_module_wpg(deark *c, struct deark_module_info *mi)
{
	mi->id = "wpg";
	mi->desc = "WordPerfect Graphics";
	mi->run_fn = de_run_wpg;
	mi->identify_fn = de_identify_wpg;
}

// Assembly:
leaq 0x6ca59(%rip), %rax     # 0x140e10
movq %rax, (%rsi)
leaq 0x6ca53(%rip), %rax     # 0x140e14
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xd43dc
movq %rax, 0x18(%rsi)
leaq 0x32a(%rip), %rax       # 0xd4701
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wpg.c
// Function: handler_colormap
static void handler_colormap(deark *c, lctx *d, u8 rectype, i64 dpos1, i64 dlen)
{
	i64 start_index;
	i64 num_entries;
	i64 pos = dpos1;

	d->has_pal = 1;
	start_index = de_getu16le(pos);
	de_dbg(c, "start index: %d", (int)start_index);
	pos += 2;

	num_entries = de_getu16le(pos);
	de_dbg(c, "num entries: %d", (int)num_entries);
	pos += 2;

	if(start_index+num_entries>256) num_entries = 256 - start_index;
	if(start_index<0 || start_index+num_entries>256) return;

	if(num_entries > d->num_pal_entries) {
		d->num_pal_entries = num_entries;
	}

	de_read_palette_rgb(c->infile, pos, num_entries, 3, &d->pal[start_index],
		256-start_index, 0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, 0x10(%rsi)
movq 0x18(%rdi), %rdi
movq %rcx, %rsi
callq 0xef1ca
movq %rax, %r12
leaq 0x6c457(%rip), %rsi     # 0x14114c
movq %r15, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
leaq 0x2(%rbx), %rsi
movq 0x18(%r15), %rdi
callq 0xef1ca
movq %rax, %r13
leaq 0x4506e(%rip), %rsi     # 0x119d87
movq %r15, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe9226
leaq (%r12,%r13), %rax
movl $0x100, %r9d            # imm = 0x100
subq %r12, %r9
cmpq $0x101, %rax            # imm = 0x101
cmovgeq %r9, %r13
testq %r12, %r12
js 0xd4d85
leaq (%r12,%r13), %rax
cmpq $0x100, %rax            # imm = 0x100
jg 0xd4d85
addq $0x4, %rbx
cmpq 0x418(%r14), %r13
jle 0xd4d62
movq %r13, 0x418(%r14)
movq 0x18(%r15), %rdi
leaq (%r14,%r12,4), %r8
addq $0x14, %r8
movl $0x0, (%rsp)
movl $0x3, %ecx
movq %rbx, %rsi
movq %r13, %rdx
callq 0xf328f
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wri.c
// Function: de_module_wri
void de_module_wri(deark *c, struct deark_module_info *mi)
{
	mi->id = "wri";
	mi->desc = "Microsoft Write";
	mi->run_fn = de_run_wri;
	mi->identify_fn = de_identify_wri;
	mi->help_fn = de_help_wri;
}

// Assembly:
leaq 0x6c36e(%rip), %rax     # 0x141161
movq %rax, (%rsi)
leaq 0x6c368(%rip), %rax     # 0x141165
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xd4e23
movq %rax, 0x18(%rsi)
leaq 0x1086(%rip), %rax      # 0xd5e99
movq %rax, 0x20(%rsi)
leaq 0x10e9(%rip), %rax      # 0xd5f07
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wri.c
// Function: de_identify_wri
static int de_identify_wri(deark *c)
{
	u8 buf[6];
	de_read(buf, 0, 6);

	if((buf[0]==0x31 || buf[0]==0x32) &&
		!de_memcmp(&buf[1], "\xbe\x00\x00\x00\xab", 5))
	{
		i64 pnMac;
		pnMac = de_getu16le(48*2);
		if(pnMac==0) return 0; // Apparently MSWord, not Write
		return 100;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
leaq 0xa(%rsp), %r15
movl $0x6, %ecx
movq %r15, %rsi
xorl %edx, %edx
callq 0xeeee8
movb (%r15), %al
addb $-0x31, %al
cmpb $0x1, %al
ja 0xd5efb
movl $0xbe, %eax
xorl 0xb(%rsp), %eax
movzbl 0xf(%rsp), %ecx
xorl $0xab, %ecx
orl %eax, %ecx
jne 0xd5efb
movq 0x18(%r14), %rdi
movl $0x60, %esi
callq 0xef1ca
xorl %ecx, %ecx
testq %rax, %rax
movl $0x64, %ebx
cmovel %ecx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wri.c
// Function: do_emit_raw_sz
static void do_emit_raw_sz(deark *c, lctx *d, struct para_info *pinfo, const char *sz)
{
	size_t sz_len = de_strlen(sz);
	if(sz_len<1) return;
	dbuf_write(d->html_outf, (const u8*)sz, (i64)sz_len);
	if(sz[sz_len-1]=='\n') {
		pinfo->xpos = 0;
	}
	else {
		pinfo->xpos += (int)sz_len;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
movq %rdx, %rdi
callq 0x180e0
testq %rax, %rax
je 0xd5f71
movq %rax, %r15
movq 0x70(%r12), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0xefb82
cmpb $0xa, -0x1(%r14,%r15)
jne 0xd5f6d
movl $0x0, 0x20(%rbx)
jmp 0xd5f71
addl %r15d, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wri.c
// Function: end_para
static void end_para(deark *c, lctx *d, struct para_info *pinfo)
{
	if(!pinfo->in_para) return;

	if(pinfo->in_span) {
		do_emit_raw_sz(c, d, pinfo, "</span>");
		pinfo->in_span = 0;
	}

	if(!pinfo->has_content) {
		// No empty paragraphs allowed. HTML will collapse them, but Write does not.
		do_emit_codepoint(c, d, pinfo, 0xa0);
	}
	do_emit_raw_sz(c, d, pinfo, "</p>\n");
	pinfo->in_para = 0;
	default_text_styles(&pinfo->text_styles_current);
}

// Assembly:
cmpl $0x0, 0x1c(%rdx)
je 0xd5feb
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
cmpl $0x0, 0x2c(%rdx)
je 0xd5fb0
leaq 0x736fa(%rip), %rdx     # 0x149698
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd5f2b
movl $0x0, 0x2c(%rbx)
cmpl $0x0, 0x24(%rbx)
jne 0xd5fc9
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movl $0xa0, %ecx
callq 0xd5fec
leaq 0x6b76a(%rip), %rdx     # 0x14173a
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd5f2b
movl $0x0, 0x1c(%rbx)
movb $0x0, 0x31(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wri.c
// Function: do_emit_codepoint
static void do_emit_codepoint(deark *c, lctx *d, struct para_info *pinfo, i32 outcp)
{
	int styles_changed;

	if(!pinfo->in_para) {
		ensure_in_para(c, d, pinfo);
	}

	styles_changed = text_styles_differ(&pinfo->text_styles_current, &pinfo->text_styles_wanted);

	if(pinfo->in_span && styles_changed) {
		do_emit_raw_sz(c, d, pinfo, "</span>");
		pinfo->in_span = 0;
	}
	if(styles_changed) {
		if(pinfo->text_styles_wanted.tab_style) {
			do_emit_raw_sz(c, d, pinfo, "<span class=c>");
			pinfo->in_span = 1;
		}
		pinfo->text_styles_current = pinfo->text_styles_wanted; // struct copy
	}

	de_write_codepoint_to_html(c, d->html_outf, outcp);

	// FIXME: We'd like to know how many characters (not bytes) were written,
	// but we don't currently have a good way to do that in the case where the
	// codepoint was written as an HTML entity.
	pinfo->xpos++;

	if(outcp!=32) {
		pinfo->has_content = 1;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpl $0x0, 0x1c(%rdx)
jne 0xd6013
movq %r15, %rdi
movq %rbx, %rsi
callq 0xd609e
movb 0x30(%rbx), %r12b
movb 0x31(%rbx), %r13b
cmpb %r12b, %r13b
setne %al
cmpl $0x0, 0x2c(%rbx)
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xd6048
leaq 0x73662(%rip), %rdx     # 0x149698
movq %r15, %rdi
movq %rbx, %rsi
callq 0xd5f2b
movl $0x0, 0x2c(%rbx)
cmpb %r12b, %r13b
je 0xd6072
cmpb $0x0, 0x30(%rbx)
je 0xd606c
leaq 0x6b6a5(%rip), %rdx     # 0x1416ff
movq %r15, %rdi
movq %rbx, %rsi
callq 0xd5f2b
movl $0x1, 0x2c(%rbx)
movb 0x30(%rbx), %al
movb %al, 0x31(%rbx)
movq 0x70(%r15), %rsi
movq %r14, %rdi
movl %ebp, %edx
callq 0xed0ce
incl 0x20(%rbx)
cmpl $0x20, %ebp
je 0xd608f
movl $0x1, 0x24(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/wri.c
// Function: ensure_in_para
static void ensure_in_para(deark *c, lctx *d, struct para_info *pinfo)
{
	if(pinfo->in_para) return;
	do_emit_raw_sz(c, d, pinfo, "<p");
	switch(pinfo->justification) {
	case 1: do_emit_raw_sz(c, d, pinfo, " class=tc"); break;
	case 2: do_emit_raw_sz(c, d, pinfo, " class=tr"); break;
	case 3: do_emit_raw_sz(c, d, pinfo, " class=tj"); break;
	}
	do_emit_raw_sz(c, d, pinfo, ">");
	pinfo->in_para = 1;
}

// Assembly:
cmpl $0x0, 0x1c(%rsi)
je 0xd60a5
retq
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x6b658(%rip), %rdx     # 0x14170e
callq 0xd5f2b
movb 0x19(%rbx), %al
decb %al
cmpb $0x2, %al
ja 0xd60e0
movzbl %al, %eax
leaq 0x6b70a(%rip), %rcx     # 0x1417d8
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd5f2b
leaq 0x73f22(%rip), %rdx     # 0x14a009
movq %r14, %rdi
movq %rbx, %rsi
callq 0xd5f2b
movl $0x1, 0x1c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xface.c
// Function: de_module_xface
void de_module_xface(deark *c, struct deark_module_info *mi)
{
	mi->id = "xface";
	mi->desc = "X-Face icon/avatar";
	mi->run_fn = de_run_xface;
	mi->identify_fn = de_identify_xface;
}

// Assembly:
leaq 0x6b6d9(%rip), %rax     # 0x1417e4
movq %rax, (%rsi)
leaq 0x6b6d5(%rip), %rax     # 0x1417ea
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xd6130
movq %rax, 0x18(%rsi)
leaq 0x5ad(%rip), %rax       # 0xd66d8
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xface.c
// Function: de_run_compfacei
static void de_run_compfacei(deark *c, de_module_params *mparams)
{
	i64 image_bytes_processed = 0;
	struct compfacei_ctx *cfictx = NULL;

	cfictx = de_malloc(c, sizeof(struct compfacei_ctx));
	cfictx->img = de_bitmap_create(c, XFACE_WIDTH, XFACE_HEIGHT, 1);

	while(1) {
		if(image_bytes_processed>=(XFACE_WIDTH*XFACE_HEIGHT)/8) break;
		if(!cfi_get_next_token(c, cfictx)) {
			goto done;
		}
		if(cfictx->token_numdigits==2) {
			cfi_set_image_byte(c, cfictx, (u8)cfictx->token_val);
		}
		else { // Assume numdigits==4
			cfi_set_image_byte(c, cfictx, (u8)(cfictx->token_val>>8));
			cfi_set_image_byte(c, cfictx, (u8)(cfictx->token_val&0xff));
		}
		image_bytes_processed += cfictx->token_numdigits/2;
	}

	de_bitmap_write_to_file_finfo(cfictx->img, NULL, DE_CREATEFLAG_IS_BWIMG);
done:
	de_bitmap_destroy(cfictx->img);
	de_free(c, cfictx);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl $0x50, %esi
callq 0xe969b
movq %rax, %r14
movl $0x30, %esi
movl $0x30, %edx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0xf2cab
movq %rax, (%r14)
movq %r14, %r15
addq $0x30, %r15
xorl %r12d, %r12d
movabsq $0x100002600, %r13      # imm = 0x100002600
movq $0x0, 0x20(%r14)
movq 0x18(%rbx), %rdi
movq 0x18(%r14), %rsi
leaq 0x1(%rsi), %rax
movq %rax, 0x18(%r14)
callq 0xef0d5
cmpb $0x20, %al
ja 0xd67ad
movzbl %al, %ecx
btq %rcx, %r13
jb 0xd678b
leal -0x3a(%rax), %ecx
cmpb $-0xb, %cl
ja 0xd67c2
movl %eax, %ecx
andb $-0x21, %cl
addb $-0x5b, %cl
cmpb $-0x1a, %cl
jb 0xd6807
movq 0x20(%r14), %rcx
cmpq $0x1e, %rcx
ja 0xd68c5
leaq 0x1(%rcx), %rdx
movq %rdx, 0x20(%r14)
movb %al, 0x30(%r14,%rcx)
movq 0x18(%rbx), %rdi
movq 0x18(%r14), %rsi
leaq 0x1(%rsi), %rax
movq %rax, 0x18(%r14)
callq 0xef0d5
leal -0x3a(%rax), %ecx
cmpb $-0xb, %cl
ja 0xd67c2
movl %eax, %ecx
andb $-0x21, %cl
addb $-0x5b, %cl
cmpb $-0x1b, %cl
ja 0xd67c2
movq 0x20(%r14), %rcx
movb $0x0, 0x30(%r14,%rcx)
cmpq $0x4, 0x20(%r14)
jb 0xd68c5
cmpb $0x2c, %al
ja 0xd68c5
movzbl %al, %eax
btq %rax, %r13
jae 0xd6844
movq 0x18(%rbx), %rdi
movq 0x18(%r14), %rsi
leaq 0x1(%rsi), %rax
movq %rax, 0x18(%r14)
callq 0xef0d5
jmp 0xd681c
cmpq $0x2c, %rax
jne 0xd68c5
cmpq $0x4, 0x20(%r14)
ja 0xd685b
movl $0x2, 0x28(%r14)
jmp 0xd6863
movl $0x4, 0x28(%r14)
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x109895
movl %eax, 0x2c(%r14)
cmpl $0x2, 0x28(%r14)
je 0xd6887
movzbl 0x2d(%r14), %esi
movq %r14, %rdi
callq 0xd6ce9
movzbl 0x2c(%r14), %esi
movq %r14, %rdi
callq 0xd6ce9
movl 0x28(%r14), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rax
addq %rax, %r12
cmpq $0x120, %r12            # imm = 0x120
jl 0xd6783
movq (%r14), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0xf2917
jmp 0xd68d6
leaq 0x6afdc(%rip), %rsi     # 0x1418a8
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq (%r14), %rdi
callq 0xf28d4
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xe9752
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xface.c
// Function: has_x_header
static int has_x_header(dbuf *f)
{
	char b[8];

	dbuf_read(f, (u8*)b, 0, 8);
	if((b[0]=='X' || b[0]=='x') &&
		(b[1]=='-') &&
		(b[2]=='F' || b[2]=='f') &&
		(b[3]=='A' || b[3]=='a') &&
		(b[4]=='C' || b[4]=='c') &&
		(b[5]=='E' || b[5]=='e') &&
		(b[6]==':') &&
		(b[7]==' ' || b[7]=='\t'))
	{
		return 1;
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
movq %rsp, %r14
movl $0x8, %ecx
movq %r14, %rsi
xorl %edx, %edx
callq 0xeeee8
movb (%r14), %al
andb $-0x21, %al
cmpb $0x58, %al
jne 0xd695c
cmpb $0x2d, 0x1(%rsp)
jne 0xd695c
movb 0x2(%rsp), %al
andb $-0x21, %al
cmpb $0x46, %al
jne 0xd695c
movb 0x3(%rsp), %al
andb $-0x21, %al
cmpb $0x41, %al
jne 0xd695c
movb 0x4(%rsp), %al
andb $-0x21, %al
cmpb $0x43, %al
jne 0xd695c
movb 0x5(%rsp), %al
andb $-0x21, %al
cmpb $0x45, %al
jne 0xd695c
cmpb $0x3a, 0x6(%rsp)
jne 0xd695c
movb 0x7(%rsp), %al
cmpb $0x20, %al
sete %cl
cmpb $0x9, %al
sete %al
orb %cl, %al
movzbl %al, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/../foreign/uncompface.h
// Function: UnCompress
static void
UnCompress(struct xfacectx *ctx, char *f, int wid, int hei, int lev)
{
	int ret;

	ret = BigPop(ctx, &gg_levels[lev][0]);
	if(ctx->errflag) return;

	switch (ret)
	{
		case WHITE :
			return;
		case BLACK :
			PopGreys(ctx, f, wid, hei);
			return;
		default :
			wid /= 2;
			hei /= 2;
			lev++;
			UnCompress(ctx, f, wid, hei, lev);
			if(ctx->errflag) return;
			UnCompress(ctx, &f[wid], wid, hei, lev);
			if(ctx->errflag) return;
			UnCompress(ctx, &f[hei * XFACE_WIDTH], wid, hei, lev);
			if(ctx->errflag) return;
			UnCompress(ctx, &f[wid + hei * XFACE_WIDTH], wid, hei, lev);
			return;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %ebp
movq %rsi, (%rsp)
movq %rdi, %r15
movslq %r8d, %r12
leaq (%r12,%r12,2), %rax
leaq 0x6af46(%rip), %rcx     # 0x1418d0
leaq (%rcx,%rax,2), %rsi
incl %r12d
movq %r15, %rdi
movq %rsi, %r14
callq 0xd6b8f
cmpl $0x0, 0x8(%r15)
jne 0xd6a28
cmpl $0x2, %eax
je 0xd6a28
testl %eax, %eax
je 0xd6a37
shrl %ebp
shrl %ebx
movq %r15, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %ebx, %ecx
movl %r12d, %r8d
callq 0xd6966
cmpl $0x0, 0x8(%r15)
jne 0xd6a28
movl %ebp, %esi
addq (%rsp), %rsi
movq %r15, %rdi
movl %ebp, %edx
movl %ebx, %ecx
movl %r12d, %r8d
callq 0xd6966
cmpl $0x0, 0x8(%r15)
jne 0xd6a28
movl %ebx, %eax
shll $0x4, %eax
leal (%rax,%rax,2), %r13d
movq (%rsp), %rax
leaq (%rax,%r13), %rsi
movq %r15, %rdi
movl %ebp, %edx
movl %ebx, %ecx
movl %r12d, %r8d
callq 0xd6966
cmpl $0x0, 0x8(%r15)
jne 0xd6a28
addl %ebp, %r13d
addq %r13, (%rsp)
movq %r14, %rsi
addq $0x6, %rsi
jmp 0xd698e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq (%rsp), %rsi
movl %ebp, %edx
movl %ebx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd6c33
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/../foreign/uncompface.h
// Function: BigMul
static void
BigMul(struct xfacectx *ctx, XFACE_WORD a)
{
	int i;
	XFACE_WORD *w;
	XFACE_COMP c;

	a &= WORDMASK;
	if ((a == 1) || (ctx->gg_B.b_words == 0))
		return;
	if (a == 0)	/* treat this as a == WORDCARRY */
	{			/* and just shift everything left a XFACE_WORD */
		if ((i = ctx->gg_B.b_words++) >= MAXWORDS - 1) {
			de_err(ctx->c, "xface: Internal error (1)");
			ctx->errflag = 1;
			return;
		}
		w = ctx->gg_B.b_word + i;
		while (i--)
		{
			*w = *(w - 1);
			w--;
		}
		*w = 0;
		return;
	}
	i = ctx->gg_B.b_words;
	w = ctx->gg_B.b_word;
	c = 0;
	while (i--)
	{
		c += (XFACE_COMP)*w * (XFACE_COMP)a;
		*(w++) = (XFACE_WORD)(c & WORDMASK);
		c >>= BITSPERWORD;
	}
	if (c)
	{
		if (ctx->gg_B.b_words++ >= MAXWORDS) {
			de_err(ctx->c, "Invalid or oversized X-Face image");
			ctx->errflag = 1;
			return;
		}
		*w = (XFACE_COMP)(c & WORDMASK);
	}
}

// Assembly:
cmpl $0x1, %esi
je 0xd6aff
pushq %rbx
movq %rdi, %rbx
movslq 0x20(%rdi), %rax
testq %rax, %rax
je 0xd6afe
testb %sil, %sil
je 0xd6aba
movl %eax, %edx
xorl %eax, %eax
xorl %ecx, %ecx
movzbl 0x24(%rbx,%rax), %edi
imull %esi, %edi
addl %ecx, %edi
movb %dil, 0x24(%rbx,%rax)
movl %edi, %ecx
shrl $0x8, %ecx
incq %rax
cmpl %eax, %edx
jne 0xd6a7a
cmpl $0x100, %edi            # imm = 0x100
jb 0xd6afe
movl 0x20(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x20(%rbx)
cmpl $0x240, %edx            # imm = 0x240
jl 0xd6afa
movq (%rbx), %rdi
leaq 0x6ad9a(%rip), %rsi     # 0x141852
jmp 0xd6ad1
leal 0x1(%rax), %ecx
movl %ecx, 0x20(%rbx)
cmpl $0x23f, %eax            # imm = 0x23F
jl 0xd6ae1
movq (%rbx), %rdi
leaq 0x6ad67(%rip), %rsi     # 0x141838
xorl %eax, %eax
callq 0xe9df7
movl $0x1, 0x8(%rbx)
jmp 0xd6afe
leaq (%rbx,%rax), %rcx
addq $0x24, %rcx
movb -0x1(%rcx), %dl
movb %dl, (%rcx)
decq %rcx
decl %eax
jne 0xd6ae9
movb $0x0, (%rcx)
jmp 0xd6afe
movb %cl, 0x24(%rbx,%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/../foreign/uncompface.h
// Function: BigAdd
static void
BigAdd(struct xfacectx *ctx, XFACE_WORD a)
{
	int i;
	XFACE_WORD *w;
	XFACE_COMP c;

	a &= WORDMASK;
	if (a == 0)
		return;
	i = 0;
	w = ctx->gg_B.b_word;
	c = a;
	while ((i < ctx->gg_B.b_words) && c)
	{
		c += (XFACE_COMP)*w;
		*w++ = (XFACE_WORD)(c & WORDMASK);
		c >>= BITSPERWORD;
		i++;
	}
	if ((i == ctx->gg_B.b_words) && c)
	{
		if (ctx->gg_B.b_words++ >= MAXWORDS) {
			de_err(ctx->c, "xface: Internal error (3)");
			ctx->errflag = 1;
			return;
		}
		*w = (XFACE_COMP)(c & WORDMASK);
	}
}

// Assembly:
testl %esi, %esi
je 0xd6b8e
pushq %rbx
movq %rdi, %rbx
leaq 0x24(%rdi), %rax
movl 0x20(%rdi), %edx
testl %edx, %edx
jle 0xd6b54
movzbl %sil, %esi
xorl %ecx, %ecx
movzbl 0x24(%rbx,%rcx), %r8d
addl %esi, %r8d
movb %r8b, 0x24(%rbx,%rcx)
movl %r8d, %esi
shrl $0x8, %esi
incq %rcx
movl 0x20(%rbx), %edx
cmpl $0x100, %r8d            # imm = 0x100
setae %dil
cmpl %edx, %ecx
jge 0xd6b4f
cmpl $0xff, %r8d
ja 0xd6b1d
addq %rcx, %rax
jmp 0xd6b59
movb $0x1, %dil
xorl %ecx, %ecx
cmpl %edx, %ecx
jne 0xd6b8d
testb %dil, %dil
je 0xd6b8d
leal 0x1(%rdx), %ecx
movl %ecx, 0x20(%rbx)
cmpl $0x240, %edx            # imm = 0x240
jl 0xd6b8a
movq (%rbx), %rdi
leaq 0x6acfa(%rip), %rsi     # 0x141874
xorl %eax, %eax
callq 0xe9df7
movl $0x1, 0x8(%rbx)
jmp 0xd6b8d
movb %sil, (%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/../foreign/uncompface.h
// Function: BigPop
static int
BigPop(struct xfacectx *ctx, const Prob *p)
{
	XFACE_WORD tmp = 0;
	int i;

	BigRSH(ctx, &tmp);
	i = 0;
	while ((tmp < p->p_offset) || (tmp >= p->p_range + p->p_offset))
	{
		p++;
		i++;
	}
	BigMul(ctx, p->p_range);
	if(ctx->errflag) return 0;
	BigAdd(ctx, tmp - p->p_offset);
	if(ctx->errflag) return 0;
	return i;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x20(%rdi), %r15d
testl %r15d, %r15d
je 0xd6bd3
leaq 0x24(%rbx), %rdi
movl %r15d, %eax
decl %eax
movl %eax, 0x20(%rbx)
movb 0x24(%rbx), %bpl
je 0xd6bce
leaq 0x25(%rbx), %rsi
movl %eax, %edx
callq 0x18270
addl $-0x2, %r15d
leaq (%rbx,%r15), %rdi
addq $0x25, %rdi
movb $0x0, (%rdi)
jmp 0xd6bd5
xorl %ebp, %ebp
movzbl %bpl, %eax
xorl %r15d, %r15d
movzbl 0x1(%r14,%r15,2), %edx
cmpb %dl, %bpl
jb 0xd6bf2
movzbl (%r14,%r15,2), %ecx
addl %ecx, %edx
cmpl %eax, %edx
ja 0xd6bf7
incq %r15
jmp 0xd6bdc
movzbl %cl, %esi
movq %rbx, %rdi
callq 0xd6a55
xorl %eax, %eax
cmpl $0x0, 0x8(%rbx)
jne 0xd6c28
subb 0x1(%r14,%r15,2), %bpl
movzbl %bpl, %esi
movq %rbx, %rdi
callq 0xd6b00
xorl %eax, %eax
cmpl $0x0, 0x8(%rbx)
cmovnel %eax, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/../foreign/uncompface.h
// Function: PopGreys
static void
PopGreys(struct xfacectx *ctx, char *f, int wid, int hei)
{
	if (wid > 3)
	{
		wid /= 2;
		hei /= 2;
		PopGreys(ctx, f, wid, hei);
		if(ctx->errflag) return;
		PopGreys(ctx, &f[wid], wid, hei);
		if(ctx->errflag) return;
		PopGreys(ctx, &f[XFACE_WIDTH * hei], wid, hei);
		if(ctx->errflag) return;
		PopGreys(ctx, &f[XFACE_WIDTH * hei + wid], wid, hei);
		if(ctx->errflag) return;
	}
	else
	{
		wid = BigPop(ctx, gg_freqs);
		if(ctx->errflag) return;
		if (wid & 1)
			f[0] = 1;
		if (wid & 2)
			f[1] = 1;
		if (wid & 4)
			f[XFACE_WIDTH] = 1;
		if (wid & 8)
			f[XFACE_WIDTH + 1] = 1;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0x4, %r15d
jl 0xd6cab
shrl %r15d
shrl %ebp
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
movl %ebp, %ecx
callq 0xd6c33
cmpl $0x0, 0x8(%r14)
jne 0xd6ce0
movl %r15d, %esi
addq %rbx, %rsi
movq %r14, %rdi
movl %r15d, %edx
movl %ebp, %ecx
callq 0xd6c33
cmpl $0x0, 0x8(%r14)
jne 0xd6ce0
movl %ebp, %eax
shll $0x4, %eax
leal (%rax,%rax,2), %r12d
leaq (%rbx,%r12), %rsi
movq %r14, %rdi
movl %r15d, %edx
movl %ebp, %ecx
callq 0xd6c33
cmpl $0x0, 0x8(%r14)
jne 0xd6ce0
addl %r15d, %r12d
addq %r12, %rbx
jmp 0xd6c46
leaq 0x6ac3e(%rip), %rsi     # 0x1418f0
movq %r14, %rdi
callq 0xd6b8f
cmpl $0x0, 0x8(%r14)
jne 0xd6ce0
testb $0x1, %al
je 0xd6cc8
movb $0x1, (%rbx)
testb $0x2, %al
je 0xd6cd0
movb $0x1, 0x1(%rbx)
testb $0x4, %al
je 0xd6cd8
movb $0x1, 0x30(%rbx)
testb $0x8, %al
je 0xd6ce0
movb $0x1, 0x31(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xface.c
// Function: cfi_set_image_byte
static void cfi_set_image_byte(deark *c, struct compfacei_ctx *cfictx, u8 ch)
{
	de_unpack_pixels_bilevel_from_byte(cfictx->img, cfictx->imgpos_x, cfictx->imgpos_y,
		ch, 8, DE_CVTF_WHITEISZERO);
	cfictx->imgpos_x += 8;
	if(cfictx->imgpos_x>=XFACE_WIDTH) {
		cfictx->imgpos_x=0;
		cfictx->imgpos_y++;
	}
}

// Assembly:
pushq %rbx
movl %esi, %ecx
movq %rdi, %rbx
movq (%rdi), %rdi
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movl $0x8, %r8d
movl $0x1, %r9d
callq 0xf2f6b
movq 0x8(%rbx), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rbx)
cmpq $0x28, %rax
jl 0xd6d29
movq $0x0, 0x8(%rbx)
incq 0x10(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/stuffit.c
// Function: de_module_stuffit
void de_module_stuffit(deark *c, struct deark_module_info *mi)
{
	mi->id = "stuffit";
	mi->desc = "StuffIt archive";
	mi->run_fn = de_run_stuffit;
	mi->identify_fn = de_identify_stuffit;
}

// Assembly:
leaq 0x6aec6(%rip), %rax     # 0x141bf9
movq %rax, (%rsi)
leaq 0x6aec4(%rip), %rax     # 0x141c01
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xd6d58
movq %rax, 0x18(%rsi)
leaq 0xacd(%rip), %rax       # 0xd7820
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/stuffit.c
// Function: de_identify_stuffit
static int de_identify_stuffit(deark *c)
{
	u8 buf[9];

	de_read(buf, 0, sizeof(buf));
	if(!de_memcmp(buf, "SIT!", 4)) {
		return 100;
	}
	if(!de_memcmp(buf, "StuffIt (", 9)) {
		if(de_getbyte(82)==0x05) return 100;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq 0x7(%rsp), %r15
movl $0x9, %ecx
movq %r15, %rsi
xorl %edx, %edx
callq 0xeeee8
movl $0x64, %ebx
cmpl $0x21544953, (%r15)     # imm = 0x21544953
je 0xd7883
movabsq $0x2074496666757453, %rax # imm = 0x2074496666757453
xorq 0x7(%rsp), %rax
movzbl 0xf(%rsp), %ecx
xorq $0x28, %rcx
orq %rax, %rcx
jne 0xd7881
movq 0x18(%r14), %rdi
movl $0x52, %esi
callq 0xef0d5
cmpb $0x5, %al
je 0xd7883
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/stuffit.c
// Function: do_extract_folder
static void do_extract_folder(deark *c, lctx *d, struct member_data *md)
{
	dbuf *outf = NULL;
	de_finfo *fi = NULL;

	if(!md->is_folder) goto done;
	fi = de_finfo_create(c);
	fi->is_directory = 1;
	de_finfo_set_name_from_ucstring(c, fi, md->full_fname, DE_SNFLAG_FULLPATH);
	fi->original_filename_flag = 1;
	fi->timestamp[DE_TIMESTAMPIDX_MODIFY] = md->mod_time;
	fi->timestamp[DE_TIMESTAMPIDX_CREATE] = md->create_time;
	outf = dbuf_create_output_file(c, NULL, fi, 0x0);
done:
	dbuf_close(outf);
	de_finfo_destroy(c, fi);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x0, (%rsi)
je 0xd78f9
movq %rsi, %r15
movq %rbx, %rdi
callq 0xea9a9
movq %rax, %r14
movb $0x1, %bpl
movb %bpl, 0x9(%rax)
movq 0x18(%r15), %rdx
movq %rbx, %rdi
movq %rax, %rsi
movl $0x1, %ecx
callq 0xea9e4
movb %bpl, 0x8(%r14)
movups 0x80(%r15), %xmm0
movups %xmm0, 0x18(%r14)
movups 0x90(%r15), %xmm0
movups %xmm0, 0x28(%r14)
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %rdi
jmp 0xd78fe
xorl %edi, %edi
xorl %r14d, %r14d
callq 0xf0b13
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xea9b3
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/stuffit.c
// Function: do_extract_member_file
static void do_extract_member_file(deark *c, lctx *d, struct member_data *md)
{
	struct advfudata u;

	ucstring_append_ucstring(md->advf->filename, md->full_fname);
	md->advf->original_filename_flag = 1;
	md->advf->snflags = DE_SNFLAG_FULLPATH;
	de_advfile_set_orig_filename(md->advf, md->fname->sz, md->fname->sz_strlen);

	// resource fork
	if(md->rfork.cmpr_len>0) {
		de_dbg(c, "rsrc fork data at %"I64_FMT", len=%"I64_FMT,
			md->rfork.cmpr_pos, md->rfork.cmpr_len);
		md->advf->rsrcfork.fork_len = md->rfork.unc_len;
		de_dbg_indent(c, 1);
		do_pre_decompress_fork(c, d, md, &md->rfork);
		de_dbg_indent(c, -1);
	}

	// data fork
	if(md->dfork.cmpr_len>0) {
		de_dbg(c, "data fork data at %"I64_FMT", len=%"I64_FMT,
			md->dfork.cmpr_pos, md->dfork.cmpr_len);
		md->advf->mainfork.fork_len = md->dfork.unc_len;
		de_dbg_indent(c, 1);
		do_pre_decompress_fork(c, d, md, &md->dfork);
		de_dbg_indent(c, -1);
	}

	u.d = d;
	u.md = md;
	md->advf->userdata = (void*)&u;
	md->advf->writefork_cbfn = my_advfile_cbfn;
	de_advfile_run(md->advf);

	if(md->advf->rsrcfork.fork_exists) {
		do_post_decompress_fork(c, d, md, &md->rfork);
	}
	if(md->advf->mainfork.fork_exists) {
		do_post_decompress_fork(c, d, md, &md->dfork);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdx), %rax
movq 0x18(%rdx), %rsi
movq 0x68(%rax), %rdi
callq 0xf6969
movq 0x8(%rbx), %rdi
movb $0x1, 0x79(%rdi)
movl $0x1, 0x70(%rdi)
movq 0x10(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0xfcaec
leaq 0xa0(%rbx), %r12
movq 0xc0(%rbx), %rcx
testq %rcx, %rcx
jle 0xd79c4
movq 0xb8(%rbx), %rdx
leaq 0x6a5c2(%rip), %rsi     # 0x141f42
movq %r15, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rbx), %rax
movq 0xb0(%rbx), %rcx
movq %rcx, 0x40(%rax)
movq %r15, %rdi
movl $0x1, %esi
callq 0xe9585
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0xd8250
movq %r15, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
leaq 0xe0(%rbx), %r13
movq 0x100(%rbx), %rcx
testq %rcx, %rcx
jle 0xd7a29
movq 0xf8(%rbx), %rdx
leaq 0x6a57c(%rip), %rsi     # 0x141f61
movq %r15, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rbx), %rax
movq 0xf0(%rbx), %rcx
movq %rcx, 0x18(%rax)
movq %r15, %rdi
movl $0x1, %esi
callq 0xe9585
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0xd8250
movq %r15, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %rsp, %rax
movq %r14, (%rax)
movq %rbx, 0x8(%rax)
movq 0x8(%rbx), %rdi
movq %rax, 0x8(%rdi)
leaq 0x959(%rip), %rax       # 0xd839b
movq %rax, 0x60(%rdi)
callq 0xfcb73
movq 0x8(%rbx), %rax
cmpb $0x0, 0x38(%rax)
je 0xd7a66
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0xd83d5
movq 0x8(%rbx), %rax
cmpb $0x0, 0x10(%rax)
je 0xd7a81
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0xd83d5
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/stuffit.c
// Function: decode_cmpr_meth
static void decode_cmpr_meth(deark *c, lctx *d, struct fork_data *fk,
	de_ucstring *s)
{
	const char *name = NULL;
	u8 cmpr = fk->cmpr_meth_etc;

	if(d->file_fmt==1 && cmpr<32 && (cmpr & 16)) {
		fk->is_encrypted = 1;
		cmpr -= 16;
	}

	if(d->file_fmt==2 || cmpr<16) {
		fk->is_a_file = 1;
		fk->cmpr_meth = cmpr;
	}

	if(fk->is_a_file) {
		fk->cmi = find_cmpr_meth_info(c, fk->cmpr_meth);
	}

	if(fk->cmi) {
		name = fk->cmi->name;
	}
	else if(d->file_fmt==1 && fk->cmpr_meth_etc==32) {
		name = "folder";
	}
	else if(d->file_fmt==1 && fk->cmpr_meth_etc==33) {
		name = "end of folder marker";
	}

	if(!name) name="?";
	ucstring_append_flags_item(s, name);
	if(d->file_fmt==1 && fk->is_encrypted) {
		ucstring_append_flags_item(s, "encrypted");
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movb 0x1(%rsi), %al
movl (%rdi), %ecx
cmpl $0x1, %ecx
sete %dl
movl %eax, %esi
andb $-0x10, %sil
cmpb $0x10, %sil
sete %sil
andb %dl, %sil
movl %eax, %edx
cmpb $0x1, %sil
jne 0xd7ac9
movb $0x1, 0x4(%r14)
leal -0x10(%rax), %edx
cmpl $0x2, %ecx
sete %sil
cmpb $0x10, %dl
setb %dil
orb %sil, %dil
cmpb $0x1, %dil
jne 0xd7ae9
movb $0x1, 0x2(%r14)
movb %dl, 0x3(%r14)
cmpb $0x0, 0x2(%r14)
je 0xd7b1f
movb 0x3(%r14), %dil
xorl %edx, %edx
leaq 0xb6303(%rip), %rsi     # 0x18de00
xorl %r8d, %r8d
cmpb %dil, (%r8,%rsi)
je 0xd7b15
addq $0x18, %r8
cmpq $0xf0, %r8
jne 0xd7b00
jmp 0xd7b1b
addq %r8, %rsi
movq %rsi, %rdx
movq %rdx, 0x30(%r14)
movq 0x30(%r14), %rdx
testq %rdx, %rdx
je 0xd7b2e
movq 0x8(%rdx), %rdx
jmp 0xd7b5f
xorl %esi, %esi
cmpb $0x20, %al
sete %dil
leaq 0x4237c(%rip), %rdx     # 0x119eb9
cmovneq %rsi, %rdx
cmpl $0x1, %ecx
setne %cl
cmovneq %rsi, %rdx
orb %dil, %cl
jne 0xd7b5f
xorl %edx, %edx
cmpb $0x21, %al
leaq 0x6a277(%rip), %rax     # 0x141dd2
cmoveq %rax, %rdx
testq %rdx, %rdx
leaq 0x54300(%rip), %rsi     # 0x12be69
cmovneq %rdx, %rsi
movq %rbx, %rdi
callq 0xf7566
cmpl $0x1, (%r15)
jne 0xd7b96
cmpb $0x0, 0x4(%r14)
je 0xd7b96
leaq 0x6a25e(%rip), %rsi     # 0x141de7
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0xf7566
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/stuffit.c
// Function: do_decompr_lzw
static void do_decompr_lzw(deark *c, struct de_dfilter_in_params *dcmpri,
	struct de_dfilter_out_params *dcmpro, struct de_dfilter_results *dres)
{
	struct de_lzw_params delzwp;

	de_zeromem(&delzwp, sizeof(struct de_lzw_params));
	delzwp.fmt = DE_LZWFMT_UNIXCOMPRESS;
	// TODO: What are the right lzw settings?
	delzwp.max_code_size = 14;
	fmtutil_decompress_lzw(c, dcmpri, dcmpro, dres, &delzwp);
}

// Assembly:
subq $0x18, %rsp
xorps %xmm0, %xmm0
movq %rsp, %r8
movaps %xmm0, (%r8)
movl $0x0, 0x10(%r8)
movl $0x1, (%r8)
movl $0xe, 0xc(%r8)
callq 0x102cf0
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/stuffit.c
// Function: do_post_decompress_fork
static void do_post_decompress_fork(deark *c, lctx *d, struct member_data *md,
	struct fork_data *frk)
{
	u32 crc_calc;

	if(!frk->decompress_succeeded) goto done;

	if(frk->is_rsrc_fork) {
		crc_calc = de_crcobj_getval(d->crco_rfork);
	}
	else {
		crc_calc = de_crcobj_getval(d->crco_dfork);
	}
	de_dbg(c, "%s crc (calculated): 0x%04x", frk->forkname, (unsigned int)crc_calc);
	if(crc_calc != frk->crc_reported) {
		de_err(c, "CRC check failed for file %s[%s fork]", ucstring_getpsz_d(md->full_fname),
			frk->forkname);
	}
done:
	;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x0, 0x38(%rcx)
je 0xd841c
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %rbx
xorl %eax, %eax
cmpb $0x0, (%rcx)
sete %al
movq 0x28(%rsi,%rax,8), %rdi
callq 0xebe2a
movl %eax, %ebp
movq 0x28(%r14), %rdx
leaq 0x571ff(%rip), %rsi     # 0x12f609
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0xe9226
cmpl 0x8(%r14), %ebp
jne 0xd8427
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%r15), %rdi
callq 0xf7557
movq 0x28(%r14), %rcx
leaq 0x69b99(%rip), %rsi     # 0x141fd4
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe9df7