LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: de_run_lzhuf
static void de_run_lzhuf(deark *c, de_module_params *mparams)
{
	i64 unc_filesize;
	dbuf *outf = NULL;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;

	// We're assuming the size field is 4 bytes, little-endian. (But it could
	// be platform-specific.)
#define LZHUF_HDRSIZE 4
#define LZHUF_IS_LE   1

	if(c->infile->len<LZHUF_HDRSIZE) goto done;
	unc_filesize = dbuf_getint_ext(c->infile, 0, LZHUF_HDRSIZE, LZHUF_IS_LE, 0);
	de_dbg(c, "orig filesize: %"I64_FMT, unc_filesize);

	outf = dbuf_create_output_file(c, "unc", NULL, 0);
	dbuf_enable_wbuffer(outf);
	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = c->infile;
	dcmpri.pos = LZHUF_HDRSIZE;
	dcmpri.len = c->infile->len-LZHUF_HDRSIZE;
	dcmpro.f = outf;
	dcmpro.len_known = 1;
	dcmpro.expected_len = unc_filesize;

	fmtutil_lh1_codectype1(c, &dcmpri, &dcmpro, &dres, NULL);
	dbuf_flush(outf);
	if(dres.errcode) {
		de_err(c, "Decompression failed: %s", de_dfilter_get_errmsg(c, &dres));
	}
done:
	dbuf_close(outf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
cmpq $0x4, 0x18(%rdi)
jge 0x630ba
xorl %r14d, %r14d
jmp 0x6318b
pushq $0x4
popq %rdx
pushq $0x1
popq %rcx
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xe424b
movq %rax, %r15
leaq 0xb4811(%rip), %rsi     # 0x1178e5
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
leaq 0xdcea2(%rip), %rsi     # 0x13ff8a
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %r14
movq %rax, %rdi
callq 0xe589c
leaq 0x18(%rsp), %r12
movq %rsp, %r13
leaq 0x38(%rsp), %rbp
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0xee7ee
movq 0x18(%rbx), %rax
movq %rax, (%r12)
movq $0x4, 0x8(%r12)
movq 0x18(%rax), %rax
addq $-0x4, %rax
movq %rax, 0x10(%r12)
movq %r14, (%r13)
movb $0x1, 0x8(%r13)
movq %r15, 0x10(%r13)
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
callq 0xfa3ca
movq %r14, %rdi
callq 0xe58e8
cmpl $0x0, (%rbp)
je 0x6318b
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0xee7bc
leaq 0xa4043(%rip), %rsi     # 0x1071c1
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xdf2a5
movq %r14, %rdi
callq 0xe5591
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: de_module_compress_lzh
void de_module_compress_lzh(deark *c, struct deark_module_info *mi)
{
	mi->id = "compress_lzh";
	mi->desc = "SCO compress LZH";
	mi->run_fn = de_run_compress_lzh;
	mi->identify_fn = de_identify_compress_lzh;
}

// Assembly:
leaq 0xb416e(%rip), %rax     # 0x11731a
movq %rax, (%rsi)
leaq 0xb4171(%rip), %rax     # 0x117327
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x631d1
movq %rax, 0x18(%rsi)
leaq 0xf6(%rip), %rax        # 0x632c2
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: de_run_compress_lzh
static void de_run_compress_lzh(deark *c, de_module_params *mparams)
{
	dbuf *outf = NULL;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;
	struct de_lh5x_params lzhparams;

#define SCOLZH_HDRSIZE 2
	if(c->infile->len<SCOLZH_HDRSIZE) goto done;
	outf = dbuf_create_output_file(c, "unc", NULL, 0);
	dbuf_enable_wbuffer(outf);
	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = c->infile;
	dcmpri.pos = SCOLZH_HDRSIZE;
	dcmpri.len = c->infile->len-SCOLZH_HDRSIZE;
	dcmpro.f = outf;

	de_zeromem(&lzhparams, sizeof(struct de_lh5x_params));
	lzhparams.fmt = DE_LH5X_FMT_LH5;
	lzhparams.zero_codes_block_behavior = DE_LH5X_ZCB_STOP;

	fmtutil_decompress_lh5x(c, &dcmpri, &dcmpro, &dres, &lzhparams);
	dbuf_flush(outf);
	if(dres.errcode) {
		de_err(c, "Decompression failed: %s", de_dfilter_get_errmsg(c, &dres));
	}
done:
	dbuf_close(outf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb0, %rsp
movq 0x18(%rdi), %rax
cmpq $0x2, 0x18(%rax)
jge 0x631f3
xorl %ebx, %ebx
jmp 0x632a9
movq %rdi, %r14
leaq 0xdcd8d(%rip), %rsi     # 0x13ff8a
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %rbx
movq %rax, %rdi
callq 0xe589c
leaq 0x30(%rsp), %r12
leaq 0x18(%rsp), %r13
leaq 0x50(%rsp), %r15
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0xee7ee
movq 0x18(%r14), %rax
movq %rax, (%r12)
movq $0x2, 0x8(%r12)
movq 0x18(%rax), %rax
addq $-0x2, %rax
movq %rax, 0x10(%r12)
movq %rbx, (%r13)
xorps %xmm0, %xmm0
movq %rsp, %r8
movaps %xmm0, (%r8)
movl $0x5, (%r8)
movb $0x1, 0x4(%r8)
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq 0xf2dac
movq %rbx, %rdi
callq 0xe58e8
cmpl $0x0, (%r15)
je 0x632a9
leaq 0x50(%rsp), %rsi
movq %r14, %rdi
callq 0xee7bc
leaq 0xa3f25(%rip), %rsi     # 0x1071c1
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xdf2a5
movq %rbx, %rdi
callq 0xe5591
addq $0xb0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: de_module_npack
void de_module_npack(deark *c, struct deark_module_info *mi)
{
	mi->id = "npack";
	mi->desc = "NPack compressed file";
	mi->run_fn = de_run_npack;
	mi->identify_fn = de_identify_npack;
}

// Assembly:
leaq 0xb4020(%rip), %rax     # 0x11735e
movq %rax, (%rsi)
leaq 0xb401c(%rip), %rax     # 0x117364
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x63363
movq %rax, 0x18(%rsi)
leaq 0x1c(%rip), %rax        # 0x6337a
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: de_module_lzs221
void de_module_lzs221(deark *c, struct deark_module_info *mi)
{
	mi->id = "lzs221";
	mi->desc = "LZS221 compressed file";
	mi->run_fn = de_run_lzs221;
	mi->identify_fn = de_identify_lzs221;
}

// Assembly:
leaq 0xb3fd7(%rip), %rax     # 0x11737a
movq %rax, (%rsi)
leaq 0xb3fd4(%rip), %rax     # 0x117381
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x633c8
movq %rax, 0x18(%rsi)
leaq 0x1b(%rip), %rax        # 0x633de
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: de_module_xpk
void de_module_xpk(deark *c, struct deark_module_info *mi)
{
	mi->id = "xpk";
	mi->desc = "XPK compressed file";
	mi->run_fn = de_run_xpk;
	mi->identify_fn = de_identify_xpk;
	mi->flags |= DE_MODFLAG_HIDDEN;
}

// Assembly:
leaq 0xb3f91(%rip), %rax     # 0x117398
movq %rax, (%rsi)
leaq 0xb3f8b(%rip), %rax     # 0x11739c
movq %rax, 0x8(%rsi)
leaq 0x14(%rip), %rax        # 0x63430
movq %rax, 0x18(%rsi)
leaq 0xf7(%rip), %rax        # 0x6351e
movq %rax, 0x20(%rsi)
orb $0x1, 0x30(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: xor_cbfn
static int xor_cbfn(struct de_bufferedreadctx *brctx, const u8 *buf,
	i64 buf_len)
{
	i64 i;
	struct xorctx_struct *xorctx = (struct xorctx_struct*)brctx->userdata;

	for(i=0; i<buf_len; i++) {
		dbuf_writebyte(xorctx->outf, buf[i] ^ xorctx->key[xorctx->key_pos]);
		if(xorctx->key_len>1) {
			xorctx->key_pos = (xorctx->key_pos+1) % xorctx->key_len;
		}
	}
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq (%rdi), %r15
xorl %r12d, %r12d
testq %rdx, %rdx
cmovleq %r12, %rbx
cmpq %r12, %rbx
je 0x6358d
movq (%r15), %rdi
movl 0xc(%r15), %eax
movb 0x10(%r15,%rax), %al
xorb (%r14,%r12), %al
movzbl %al, %esi
callq 0xe5bc5
movl 0x8(%r15), %ecx
cmpl $0x2, %ecx
jb 0x63588
movl 0xc(%r15), %eax
incl %eax
xorl %edx, %edx
divl %ecx
movl %edx, 0xc(%r15)
incq %r12
jmp 0x63554
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: cp437_cbfn
static int cp437_cbfn(struct de_bufferedreadctx *brctx, const u8 *buf,
	i64 buf_len)
{
	i32 u;
	i64 i;
	u8 ch;
	struct cp437ctx_struct *cp437ctx = (struct cp437ctx_struct*)brctx->userdata;

	for(i=0; i<buf_len; i++) {
		ch = buf[i];
		if(ch==0x09 || ch==0x0a || ch==0x0c || ch==0x0d) {
			// Leave HT, NL, FF, CR as-is.
			u = (i32)ch;
		}
		else if(ch==0x1a) {
			// Lots of CP437 files end with a Ctrl+Z character, but modern files
			// don't use any in-band character to signify end-of-file.
			// I don't just want to delete the character, though, so I guess I'll
			// change it to U+2404 SYMBOL FOR END OF TRANSMISSION.
			u = 0x2404;
		}
		else {
			u = de_char_to_unicode_ex((i32)ch, &cp437ctx->es);
		}
		dbuf_write_uchar_as_utf8(cp437ctx->outf, u);
	}

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq (%rdi), %r12
leaq 0x8(%r12), %r15
xorl %r13d, %r13d
testq %rdx, %rdx
cmovleq %r13, %rbx
movl $0x3600, %ebp           # imm = 0x3600
cmpq %r13, %rbx
je 0x63600
movzbl (%r14,%r13), %esi
cmpl $0x1a, %esi
ja 0x635f2
btl %esi, %ebp
jae 0x635e6
movq (%r12), %rdi
callq 0xe1790
incq %r13
jmp 0x635c4
cmpl $0x1a, %esi
jne 0x635f2
movl $0x2404, %esi           # imm = 0x2404
jmp 0x635d8
movl %esi, %edi
movq %r15, %rsi
callq 0xe1679
movl %eax, %esi
jmp 0x635d8
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: crc_cbfn
static int crc_cbfn(struct de_bufferedreadctx *brctx, const u8 *buf,
	i64 buf_len)
{
	struct crcctx_struct *crcctx = (struct crcctx_struct*)brctx->userdata;
	size_t n;

	for(n=0; n<CRCM_NUMCRCS; n++) {
		if(!crcctx->crcos[n]) continue;
		de_crcobj_addbuf(crcctx->crcos[n], buf, buf_len);
	}

	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq (%rdi), %r15
pushq $0x1
popq %r12
cmpq $0xc, %r12
je 0x63646
movq (%r15,%r12,8), %rdi
testq %rdi, %rdi
je 0x63641
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe0ecf
incq %r12
jmp 0x63627
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: bytefreq_cbfn
static int bytefreq_cbfn(struct de_bufferedreadctx *brctx, const u8 *buf,
	i64 buf_len)
{
	i64 k;
	struct bytefreqctx_struct *bfctx = (struct bytefreqctx_struct*)brctx->userdata;

	for(k=0; k<buf_len; k++) {
		struct bytefreqentry *bf = &bfctx->e[(unsigned int)buf[k]];

		// Save the location of the first few occurrences of this byte value.
		if(bf->count<DE_BYTEFREQ_NUMLOC) {
			bf->locations[bf->count] = brctx->offset + k;
		}
		bf->count++;
	}
	return 1;
}

// Assembly:
movq (%rdi), %rax
xorl %ecx, %ecx
testq %rdx, %rdx
cmovleq %rcx, %rdx
cmpq %rcx, %rdx
je 0x636da
movzbl (%rsi,%rcx), %r9d
shll $0x5, %r9d
leaq (%rax,%r9), %r8
movq (%rax,%r9), %r9
cmpq $0x2, %r9
jg 0x636cf
movq 0x10(%rdi), %r10
addq %rcx, %r10
movq %r10, 0x8(%r8,%r9,8)
movq (%r8), %r9
incq %r9
movq %r9, (%r8)
incq %rcx
jmp 0x636a4
pushq $0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: run_deflate_internal
static void run_deflate_internal(deark *c, UI flags)
{
	dbuf *outf = NULL;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;
	struct de_deflate_params deflparams;

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	de_zeromem(&deflparams, sizeof(struct de_deflate_params));
	deflparams.flags = flags;

	outf = dbuf_create_output_file(c, "unc", NULL, 0);
	dbuf_enable_wbuffer(outf);
	dcmpri.f = c->infile;
	dcmpri.pos = 0;
	dcmpri.len = c->infile->len;
	dcmpro.f = outf;
	fmtutil_decompress_deflate_ex(c, &dcmpri, &dcmpro, &dres, &deflparams);
	dbuf_flush(outf);
	if(dres.errcode) {
		de_err(c, "Decompression failed: %s", de_dfilter_get_errmsg(c, &dres));
		goto done;
	}
	if(dres.bytes_consumed_valid) {
		de_dbg(c, "decompressed %"I64_FMT" bytes to %"I64_FMT, dres.bytes_consumed,
			outf->len);
	}

done:
	dbuf_close(outf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x88(%rsp), %r12
leaq 0x70(%rsp), %r13
leaq 0x10(%rsp), %rcx
movq %r12, %rsi
movq %r13, %rdx
callq 0xee7ee
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, (%r15)
movl %ebp, (%r15)
leaq 0xdc865(%rip), %rsi     # 0x13ff8a
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %r14
movq %rax, %rdi
callq 0xe589c
movq 0x18(%rbx), %rax
movq %rax, (%r12)
andq $0x0, 0x8(%r12)
movq 0x18(%rax), %rax
movq %rax, 0x10(%r12)
movq %r14, (%r13)
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
leaq 0x10(%rsp), %r12
movq %r12, %rcx
movq %r15, %r8
callq 0xf4633
movq %r14, %rdi
callq 0xe58e8
cmpl $0x0, (%r12)
je 0x637a2
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xee7bc
leaq 0xa3a2e(%rip), %rsi     # 0x1071c1
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xdf2a5
jmp 0x637c3
cmpb $0x0, 0x14(%rsp)
je 0x637c3
movq 0x18(%rsp), %rdx
movq 0x18(%r14), %rcx
leaq 0xa24bf(%rip), %rsi     # 0x105c78
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq %r14, %rdi
callq 0xe5591
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: vgafont_common_config1
static void vgafont_common_config1(deark *c, struct vgafont_ctx *d)
{
	d->encoding_req = de_get_input_encoding(c, NULL, DE_ENCODING_UNKNOWN);
	if(d->encoding_req!=DE_ENCODING_UNKNOWN)
		d->encoding_to_use = d->encoding_req;
	else
		d->encoding_to_use = DE_ENCODING_CP437;

	d->font = de_create_bitmap_font(c);
	d->font->num_chars = 256;
	d->font->has_nonunicode_codepoints = 1;
	d->font->has_unicode_codepoints = 1;
	d->font->prefer_unicode = (d->encoding_req!=DE_ENCODING_UNKNOWN);
	d->font->nominal_width = 8;
	d->font->nominal_height = (int)d->height;
	d->font->char_array = de_mallocarray(c, d->font->num_chars,
		sizeof(struct de_bitmap_font_char));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
xorl %esi, %esi
xorl %edx, %edx
callq 0xe08d2
movl %eax, (%rbx)
testl %eax, %eax
pushq $0xd
popq %rcx
cmovnel %eax, %ecx
movl %ecx, 0x4(%rbx)
movq %r14, %rdi
callq 0xe9d18
movq %rax, 0x8(%rbx)
movq $0x100, 0x18(%rax)      # imm = 0x100
movw $0x101, 0x10(%rax)      # imm = 0x101
cmpl $0x0, (%rbx)
setne 0x12(%rax)
movl $0x8, (%rax)
movl 0x10(%rbx), %ecx
movl %ecx, 0x4(%rax)
pushq $0x28
popq %rdx
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
callq 0xdf66f
movq 0x8(%rbx), %rcx
movq %rax, 0x20(%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: vgafont_common_config2
static void vgafont_common_config2(deark *c, struct vgafont_ctx *d)
{
	i64 i;
	struct de_encconv_state es;

	de_encconv_init(&es, d->encoding_to_use);

	for(i=0; i<d->font->num_chars; i++) {
		d->font->char_array[i].codepoint_nonunicode = (i32)i;
		if(d->font->has_unicode_codepoints) {
			d->font->char_array[i].codepoint_unicode = de_char_to_unicode_ex((i32)i, &es);
		}
		d->font->char_array[i].width = d->font->nominal_width;
		d->font->char_array[i].height = d->font->nominal_height;
		d->font->char_array[i].rowspan = 1;
		d->font->char_array[i].bitmap = &d->fontdata[i*d->font->nominal_height];
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl 0x4(%rdi), %esi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xe11fc
movq 0x8(%rbx), %rcx
xorl %r12d, %r12d
xorl %r15d, %r15d
cmpq 0x18(%rcx), %r15
jge 0x638cd
movq 0x20(%rcx), %rdx
movl %r15d, (%rdx,%r12)
cmpb $0x0, 0x11(%rcx)
je 0x6389e
movl %r15d, %edi
movq %r14, %rsi
callq 0xe1679
movq 0x8(%rbx), %rcx
movq 0x20(%rcx), %rdx
movl %eax, 0x4(%rdx,%r12)
movl (%rcx), %eax
movl %eax, 0x8(%rdx,%r12)
movslq 0x4(%rcx), %rax
movl %eax, 0xc(%rdx,%r12)
movq $0x1, 0x18(%rdx,%r12)
imulq %r15, %rax
addq 0x28(%rbx), %rax
movq %rax, 0x20(%rdx,%r12)
incq %r15
addq $0x28, %r12
jmp 0x63872
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: vgafont_main
static void vgafont_main(deark *c, struct vgafont_ctx *d, de_finfo *fi, UI createflags)
{
	u8 to_fontfmt = 0;

	de_font_decide_output_fmt(c);

	if(c->font_fmt_req!=DE_FONTFMT_IMAGE) {
		if(d->font->nominal_width==8 &&
			(d->font->nominal_height>=1 && d->font->nominal_height<=32))
		{
			to_fontfmt = 1;
		}
	}

	if(to_fontfmt) {
		// TODO? Most of the relevant formats are very similar to the PSF format
		// that this function will create. It's not ideal to go to all the trouble
		// to convert them to our internal format, only to convert them right
		// back to their original format.
		// (But since we want the option to convert them to an image, this is
		// maybe the easiest way.)
		d->font->force_fontfile_output = 1;
	}

	de_font_bitmap_font_write(c, d->font, fi, createflags);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
callq 0xeab2d
cmpb $0x3, 0xd5(%r15)
movq 0x8(%r12), %rsi
je 0x63913
cmpl $0x8, (%rsi)
jne 0x63913
movl 0x4(%rsi), %eax
decl %eax
cmpl $0x1f, %eax
ja 0x63913
movb $0x1, 0x13(%rsi)
movq %r15, %rdi
movq %r14, %rdx
movl %ebx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xea0f6
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: destroy_vgafont_ctx
static void destroy_vgafont_ctx(deark *c, struct vgafont_ctx *d)
{
	if(!d) return;
	if(d->font) {
		de_free(c, d->font->char_array);
		de_destroy_bitmap_font(c, d->font);
	}
	de_free(c, d->fontdata);
}

// Assembly:
testq %rsi, %rsi
je 0x6396e
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x6395b
movq 0x20(%rax), %rsi
movq %rbx, %rdi
callq 0xded32
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0xe9d28
movq 0x28(%r14), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xded32
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: dclimplode_main
static void dclimplode_main(deark *c, i64 cmpr_pos, i64 cmpr_len,
	u8 orig_len_known, i64 orig_len)
{
	dbuf *outf = NULL;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;

	outf = dbuf_create_output_file(c, "unc", NULL, 0);
	dbuf_enable_wbuffer(outf);
	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = c->infile;
	dcmpri.pos = cmpr_pos;
	dcmpri.len = cmpr_len;
	dcmpro.f = outf;
	if(orig_len_known) {
		dcmpro.len_known = 1;
		dcmpro.expected_len = orig_len;
	}

	fmtutil_dclimplode_codectype1(c, &dcmpri, &dcmpro, &dres, NULL);
	dbuf_flush(outf);
	if(dres.errcode) {
		de_err(c, "Decompression failed: %s", de_dfilter_get_errmsg(c, &dres));
	}

	dbuf_close(outf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r8, 0x8(%rsp)
movl %ecx, 0x4(%rsp)
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq 0xdc5f1(%rip), %rsi     # 0x13ff8a
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %r14
movq %rax, %rdi
callq 0xe589c
leaq 0x28(%rsp), %r15
leaq 0x10(%rsp), %rbp
leaq 0x48(%rsp), %rcx
movq %rbx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0xee7ee
movq 0x18(%rbx), %rax
movq %rax, (%r15)
movq %r13, 0x8(%r15)
movq %r12, 0x10(%r15)
movq %r14, (%rbp)
cmpl $0x0, 0x4(%rsp)
je 0x639f3
movb $0x1, 0x18(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x28(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x48(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rcx
xorl %r8d, %r8d
callq 0xf4aaa
movq %r14, %rdi
callq 0xe58e8
cmpl $0x0, (%r15)
je 0x63a3f
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0xee7bc
leaq 0xa378f(%rip), %rsi     # 0x1071c1
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xdf2a5
movq %r14, %rdi
callq 0xe5591
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc.c
// Function: do_lzstac_internal
static void do_lzstac_internal(deark *c, i64 cmpr_pos, i64 cmpr_len, UI flags)
{
	dbuf *outf = NULL;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;
	struct de_lzstac_params lzstacparams;

	outf = dbuf_create_output_file(c, "unc", NULL, 0);
	dbuf_enable_wbuffer(outf);
	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = c->infile;
	dcmpri.pos = cmpr_pos;
	dcmpri.len = cmpr_len;
	dcmpro.f = outf;

	de_zeromem(&lzstacparams, sizeof(struct de_lzstac_params));
	lzstacparams.flags = flags;
	fmtutil_lzstac_codectype1(c, &dcmpri, &dcmpro, &dres, (void*)&lzstacparams);

	dbuf_flush(outf);
	if(dres.errcode) {
		de_err(c, "Decompression failed: %s", de_dfilter_get_errmsg(c, &dres));
		goto done;
	}
	if(dres.bytes_consumed_valid) {
		de_dbg(c, "decompressed %"I64_FMT" bytes to %"I64_FMT, dres.bytes_consumed,
			outf->len);
		if(dres.bytes_consumed<cmpr_len) {
			de_warn(c, "%"I64_FMT" extra bytes at end of file. File might not "
				"have decompressed correctly.", cmpr_len - dres.bytes_consumed);
		}
	}

done:
	dbuf_close(outf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %ecx, 0xc(%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, %r12
movq %rdi, %r14
leaq 0xdc50a(%rip), %rsi     # 0x13ff8a
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %rbx
movq %rax, %rdi
callq 0xe589c
leaq 0x98(%rsp), %r13
leaq 0x80(%rsp), %r15
leaq 0x20(%rsp), %rbp
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq 0xee7ee
movq 0x18(%r14), %rax
movq %rax, (%r13)
movq %r12, 0x8(%r13)
movq 0x10(%rsp), %r12
movq %r12, 0x10(%r13)
movq %rbx, (%r15)
leaq 0x1c(%rsp), %r8
movl 0xc(%rsp), %eax
movl %eax, (%r8)
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq 0xf52d8
movq %rbx, %rdi
callq 0xe58e8
cmpl $0x0, (%rbp)
je 0x63b38
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0xee7bc
leaq 0xa36b0(%rip), %rsi     # 0x1071c1
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xdf2a5
movq %rbx, %rdi
callq 0xe5591
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x24(%rsp)
je 0x63b1e
movq 0x28(%rsp), %rdx
movq 0x18(%rbx), %rcx
leaq 0xa2129(%rip), %rsi     # 0x105c78
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
subq 0x28(%rsp), %r12
jle 0x63b1e
leaq 0xb3d91(%rip), %rsi     # 0x1178f8
movq %r14, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0xdf05a
jmp 0x63b1e
nop
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_module_hpicn
void de_module_hpicn(deark *c, struct deark_module_info *mi)
{
	mi->id = "hpicn";
	mi->desc = "HP 100LX/200LX .ICN icon";
	mi->run_fn = de_run_hpicn;
	mi->identify_fn = de_identify_hpicn;
}

// Assembly:
leaq 0xb4241(%rip), %rax     # 0x117dc0
movq %rax, (%rsi)
leaq 0xb423d(%rip), %rax     # 0x117dc6
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x63ba4
movq %rax, 0x18(%rsi)
leaq 0x5d(%rip), %rax        # 0x63bfc
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_identify_hpicn
static int de_identify_hpicn(deark *c)
{
	struct hpicn_params icnp;

	if(dbuf_memcmp(c->infile, 0, "\x01\x00\x01\x00", 4))
		return 0;
	read_hpicn_params(c, &icnp);
	if(8 + icnp.rowspan*icnp.h != c->infile->len) return 0;
	if(icnp.w<1 || icnp.w>2048 || icnp.h<1 || icnp.h>2048) return 0;
	if(icnp.w==44 && icnp.h==32) return 100;
	return 60;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq 0xb3dc5(%rip), %rdx     # 0x1179d8
xorl %ebx, %ebx
pushq $0x4
popq %rcx
xorl %esi, %esi
callq 0xe4d48
testl %eax, %eax
jne 0x63c8d
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x68e50
movq 0x8(%r15), %rax
movq 0x10(%r15), %rcx
imulq %rax, %rcx
addq $0x8, %rcx
movq 0x18(%r14), %rdx
cmpq 0x18(%rdx), %rcx
jne 0x63c8d
movq 0x8(%rsp), %rcx
movq $-0x801, %rdx           # imm = 0xF7FF
leaq (%rcx,%rdx), %rsi
movq $-0x800, %rdi           # imm = 0xF800
cmpq %rdi, %rsi
setb %sil
addq %rax, %rdx
cmpq %rdi, %rdx
setb %dl
orb %sil, %dl
jne 0x63c8d
xorq $0x2c, %rcx
xorq $0x20, %rax
orq %rcx, %rax
pushq $0x64
popq %rax
pushq $0x3c
popq %rbx
cmovel %eax, %ebx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_module_xpuzzle
void de_module_xpuzzle(deark *c, struct deark_module_info *mi)
{
	mi->id = "xpuzzle";
	mi->desc = "X11 \"puzzle\" image";
	mi->run_fn = de_run_xpuzzle;
	mi->identify_fn = de_identify_xpuzzle;
}

// Assembly:
leaq 0xb413f(%rip), %rax     # 0x117ddf
movq %rax, (%rsi)
leaq 0xb413d(%rip), %rax     # 0x117de7
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x63cc5
movq %rax, 0x18(%rsi)
leaq 0xe3(%rip), %rax        # 0x63da3
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_run_xpuzzle
static void de_run_xpuzzle(deark *c, de_module_params *mparams)
{
	de_bitmap *img = NULL;
	struct xpuzzhdr hdr;
	de_color pal[256];
	i64 p;

	xpuzz_read_header(c, &hdr);
	de_dbg_dimensions(c, hdr.w, hdr.h);
	if(!de_good_image_dimensions(c, hdr.w, hdr.h)) goto done;

	img = de_bitmap_create(c,  hdr.w,  hdr.h, 3);

	// Read the palette
	p = 9;
	de_read_simple_palette(c, c->infile, p,  hdr.palentries, 3, pal, 256,
		DE_RDPALTYPE_24BIT, DE_RDPALFLAG_INITPAL);
	p += 3*hdr.palentries;

	// Read the bitmap
	de_convert_image_paletted(c->infile, p, 8, hdr.w, pal, img, 0);

	de_bitmap_write_to_file(img, NULL, 0);

done:
	de_bitmap_destroy(img);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x420, %rsp            # imm = 0x420
movq %rdi, %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x68e94
movq (%r15), %r14
movq 0x8(%r15), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xdf038
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xe6be1
testl %eax, %eax
je 0x63d87
pushq $0x3
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xe7437
movq %rax, %r15
movq 0x18(%rbx), %rsi
movq 0x18(%rsp), %r12
subq $0x8, %rsp
pushq $0x9
popq %rdx
pushq $0x3
popq %r8
leaq 0x28(%rsp), %r13
movq %rbx, %rdi
movq %r12, %rcx
movq %r13, %r9
pushq $0x10
pushq $0x1
pushq $0x100                  # imm = 0x100
callq 0xe79ca
addq $0x20, %rsp
leaq (%r12,%r12,2), %rsi
addq $0x9, %rsi
movq 0x18(%rbx), %rdi
subq $0x8, %rsp
pushq $0x8
popq %rdx
movq %r14, %rcx
movq %r13, %r8
movq %r15, %r9
pushq $0x0
callq 0xe7cbc
popq %rax
popq %rcx
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xe70b7
jmp 0x63d8a
xorl %r15d, %r15d
movq %r15, %rdi
callq 0xe7084
addq $0x420, %rsp            # imm = 0x420
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_identify_xpuzzle
static int de_identify_xpuzzle(deark *c)
{
	struct xpuzzhdr hdr;
	int retval = 0;

	xpuzz_read_header(c, &hdr);
	// 4096 is an arbitrary limit.
	if(hdr.w<1 || hdr.w>4096 || hdr.h<1 || hdr.h>4096) goto done;
	if(hdr.w * hdr.h + 3*hdr.palentries + 9 == c->infile->len) {
		retval = 20;
	}

done:
	return retval;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movq %r14, %rsi
callq 0x68e94
movq (%r14), %rdx
movq 0x8(%r14), %rcx
movq $-0x1001, %rax          # imm = 0xEFFF
leaq (%rdx,%rax), %rsi
movq $-0x1000, %rdi          # imm = 0xF000
cmpq %rdi, %rsi
setb %sil
addq %rcx, %rax
cmpq %rdi, %rax
setb %dil
xorl %eax, %eax
orb %sil, %dil
jne 0x63e0a
imulq %rdx, %rcx
imulq $0x3, 0x10(%rsp), %rax
addq %rcx, %rax
addq $0x9, %rax
movq 0x18(%rbx), %rcx
xorl %edx, %edx
cmpq 0x18(%rcx), %rax
pushq $0x14
popq %rax
cmovnel %edx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_module_bob
void de_module_bob(deark *c, struct deark_module_info *mi)
{
	mi->id = "bob";
	mi->desc = "Bob Ray Tracer bitmap image";
	mi->run_fn = de_run_bob;
	mi->identify_fn = de_identify_bob;
}

// Assembly:
leaq 0xb73ea(%rip), %rax     # 0x11b203
movq %rax, (%rsi)
leaq 0xb3fd7(%rip), %rax     # 0x117dfa
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x63e3e
movq %rax, 0x18(%rsi)
leaq 0xd1(%rip), %rax        # 0x63f0a
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_run_bob
static void de_run_bob(deark *c, de_module_params *mparams)
{
	de_bitmap *img = NULL;
	i64 w, h;
	u32 pal[256];
	i64 p;

	w = de_getu16le(0);
	h = de_getu16le(2);
	if(!de_good_image_dimensions(c, w, h)) goto done;
	img = de_bitmap_create(c, w, h, 3);

	// Read the palette
	p = 4;
	de_read_simple_palette(c, c->infile, p, 256, 3, pal, 256, DE_RDPALTYPE_24BIT, 0);
	p += 256*3;

	// Read the bitmap
	de_convert_image_paletted(c->infile, p, 8, w, pal, img, 0);

	de_bitmap_write_to_file(img, NULL, 0);

done:
	de_bitmap_destroy(img);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0xe3fa3
movq %rax, %r15
movq 0x18(%r14), %rdi
pushq $0x2
popq %rsi
callq 0xe3fa3
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xe6be1
testl %eax, %eax
je 0x63ef3
pushq $0x3
popq %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xe7437
movq %rax, %rbx
movq 0x18(%r14), %rsi
subq $0x8, %rsp
pushq $0x4
popq %rdx
pushq $0x3
popq %r8
leaq 0x8(%rsp), %r12
movl $0x100, %ecx            # imm = 0x100
movq %r14, %rdi
movq %r12, %r9
pushq $0x0
pushq $0x1
pushq $0x100                  # imm = 0x100
callq 0xe79ca
addq $0x20, %rsp
movq 0x18(%r14), %rdi
subq $0x8, %rsp
pushq $0x8
popq %rdx
movl $0x304, %esi            # imm = 0x304
movq %r15, %rcx
movq %r12, %r8
movq %rbx, %r9
pushq $0x0
callq 0xe7cbc
popq %rax
popq %rcx
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xe70b7
movq %rbx, %rdi
callq 0xe7084
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_identify_bob
static int de_identify_bob(deark *c)
{
	i64 w, h;

	if(!de_input_file_has_ext(c, "bob")) return 0;

	w = de_getu16le(0);
	h = de_getu16le(2);
	if(c->infile->len == 4 + 768 + w*h) {
		return 100;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xb72ea(%rip), %rsi     # 0x11b203
callq 0xdfcd5
testl %eax, %eax
je 0x63f5a
movq 0x18(%rbx), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0xe3fa3
movq %rax, %r14
movq 0x18(%rbx), %rdi
pushq $0x2
popq %rsi
callq 0xe3fa3
movq 0x18(%rbx), %rcx
imulq %r14, %rax
addq $0x304, %rax            # imm = 0x304
cmpq %rax, 0x18(%rcx)
pushq $0x64
popq %rax
cmovnel %r15d, %eax
jmp 0x63f5c
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_module_alias_pix
void de_module_alias_pix(deark *c, struct deark_module_info *mi)
{
	mi->id = "alias_pix";
	mi->id_alias[0] = "vivid";
	mi->desc = "Alias PIX image, Vivid .IMG";
	mi->run_fn = de_run_alias_pix;
	mi->identify_fn = de_identify_alias_pix;
}

// Assembly:
leaq 0xb3ead(%rip), %rax     # 0x117e16
movq %rax, (%rsi)
leaq 0xb3ead(%rip), %rax     # 0x117e20
movq %rax, 0x38(%rsi)
leaq 0xb3ea8(%rip), %rax     # 0x117e26
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x63f99
movq %rax, 0x18(%rsi)
leaq 0x14c(%rip), %rax       # 0x640e0
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_run_alias_pix
static void de_run_alias_pix(deark *c, de_module_params *mparams)
{
	de_bitmap *img = NULL;
	i64 w, h;
	i64 i;
	i64 pos;
	i64 firstline;
	i64 depth;
	i64 xpos, ypos;
	i64 runlen;
	u32 clr;

	w = de_getu16be(0);
	h = de_getu16be(2);
	firstline = de_getu16be(4);
	depth = de_getu16be(8);

	if(!de_good_image_dimensions(c, w, h)) goto done;
	if(firstline >= h) goto done;
	if(depth!=24) {
		de_err(c, "Unsupported image type");
		goto done;
	}

	img = de_bitmap_create(c, w, h, 3);

	pos = 10;
	xpos = 0;
	// I don't know for sure what to do with the "first scanline" field, in the
	// unlikely event it is not 0. The documentation doesn't say.
	ypos = firstline;
	while(1) {
		if(pos+4 > c->infile->len) {
			break; // EOF
		}
		runlen = (i64)de_getbyte(pos);
		clr = dbuf_getRGB(c->infile, pos+1, DE_GETRGBFLAG_BGR);
		pos+=4;

		for(i=0; i<runlen; i++) {
			de_bitmap_setpixel_rgb(img, xpos, ypos, clr);
			xpos++; // Runs are not allowed to span rows
		}

		if(xpos >= w) {
			xpos=0;
			ypos++;
		}
	}

	de_bitmap_write_to_file(img, NULL, 0);
done:
	de_bitmap_destroy(img);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0xe3f46
movq %rax, %r15
movq 0x18(%rbx), %rdi
pushq $0x2
popq %rsi
callq 0xe3f46
movq %rax, %r13
movq 0x18(%rbx), %rdi
pushq $0x4
popq %rsi
callq 0xe3f46
movq %rax, %r12
movq 0x18(%rbx), %rdi
pushq $0x8
popq %rsi
callq 0xe3f46
movq %rax, %rbp
movq %rbx, %rdi
movq %r15, 0x8(%rsp)
movq %r15, %rsi
movq %r13, %rdx
callq 0xe6be1
testl %eax, %eax
setne %al
cmpq %r13, %r12
setl %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x640ca
cmpq $0x18, %rbp
jne 0x640a8
pushq $0x3
popq %rcx
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
movq %r13, %rdx
callq 0xe7437
movq %rax, %r14
pushq $0xa
popq %rbp
xorl %r13d, %r13d
movq %rbx, 0x10(%rsp)
leaq 0x4(%rbp), %r15
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %r15
jg 0x640be
movq %rbp, %rsi
callq 0xe3eb4
movq %rbx, %rcx
movzbl %al, %ebx
movq 0x18(%rcx), %rdi
orq $0x1, %rbp
movq %rbp, %rsi
pushq $0x1
popq %rdx
callq 0xe45a4
movl %eax, %ebp
subq $0x1, %rbx
jb 0x64088
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movl %ebp, %ecx
callq 0xe7287
incq %r13
jmp 0x6406d
xorl %eax, %eax
cmpq 0x8(%rsp), %r13
setge %al
movl $0x0, %ecx
cmovgeq %rcx, %r13
addq %rax, %r12
movq %r15, %rbp
movq 0x10(%rsp), %rbx
jmp 0x6403c
leaq 0xa65db(%rip), %rsi     # 0x10a68a
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0x640ca
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xe70b7
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe7084
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_identify_alias_pix
static int de_identify_alias_pix(deark *c)
{
	i64 w, h, firstline, lastline, depth;

	if(!de_input_file_has_ext(c, "img") &&
		!de_input_file_has_ext(c, "als") &&
		!de_input_file_has_ext(c, "pix"))
	{
		return 0;
	}

	w = de_getu16be(0);
	h = de_getu16be(2);
	firstline = de_getu16be(4);
	lastline = de_getu16be(6);
	depth = de_getu16be(8);

	if(depth!=24) return 0;
	if(firstline>lastline) return 0;
	// 'lastline' should usually be h-1, but XnView apparently sets it to h.
	if(firstline>h-1 || lastline>h) return 0;
	if(!de_good_image_dimensions_noerr(c, w, h)) return 0;
	return 30;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xae8b2(%rip), %rsi     # 0x1129a7
callq 0xdfcd5
testl %eax, %eax
jne 0x64128
leaq 0xda222(%rip), %rsi     # 0x13e327
movq %rbx, %rdi
callq 0xdfcd5
testl %eax, %eax
jne 0x64128
leaq 0xb96ee(%rip), %rsi     # 0x11d806
movq %rbx, %rdi
callq 0xdfcd5
testl %eax, %eax
je 0x641bd
movq 0x18(%rbx), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0xe3f46
movq %rax, %r15
movq 0x18(%rbx), %rdi
pushq $0x2
popq %rsi
callq 0xe3f46
movq %rax, %r12
movq 0x18(%rbx), %rdi
pushq $0x4
popq %rsi
callq 0xe3f46
movq %rax, %r13
movq 0x18(%rbx), %rdi
pushq $0x6
popq %rsi
callq 0xe3f46
movq %rax, %rbp
movq 0x18(%rbx), %rdi
pushq $0x8
popq %rsi
callq 0xe3f46
cmpq $0x18, %rax
setne %al
cmpq %rbp, %r13
setg %cl
orb %al, %cl
jne 0x641ab
cmpq %r12, %r13
setge %al
cmpq %r12, %rbp
setg %cl
orb %al, %cl
jne 0x641ab
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xe6bb4
testl %eax, %eax
pushq $0x1e
popq %r14
cmovel %eax, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
jmp 0x641ab
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_module_applevol
void de_module_applevol(deark *c, struct deark_module_info *mi)
{
	mi->id = "applevol";
	mi->desc = "Apple volume label image";
	mi->run_fn = de_run_applevol;
	mi->identify_fn = de_identify_applevol;
}

// Assembly:
leaq 0xb3c79(%rip), %rax     # 0x117e42
movq %rax, (%rsi)
leaq 0xb3c78(%rip), %rax     # 0x117e4b
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x641ee
movq %rax, 0x18(%rsi)
leaq 0x172(%rip), %rax       # 0x6435b
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_run_applevol
static void de_run_applevol(deark *c, de_module_params *mparams)
{
	de_bitmap *img = NULL;
	i64 w, h;
	i64 i, j;
	i64 p;
	u8 palent;

	w = de_getu16be(1);
	h = de_getu16be(3);
	if(!de_good_image_dimensions(c, w, h)) goto done;
	img = de_bitmap_create(c, w, h, 1);

	p = 5;
	for(j=0; j<h; j++) {
		for(i=0; i<w; i++) {
			palent = de_getbyte(p+w*j+i);
			de_bitmap_setpixel_gray(img, i, j, applevol_get_gray_shade(palent));
		}
	}

	de_bitmap_write_to_file(img, NULL, 0);

done:
	de_bitmap_destroy(img);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
pushq $0x1
popq %rsi
callq 0xe3f46
movq %rax, %rbp
movq 0x18(%rbx), %rdi
pushq $0x3
popq %rsi
callq 0xe3f46
movq %rax, %r15
movq %rbx, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xe6be1
testl %eax, %eax
je 0x64342
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xe7437
movq %rax, %r12
xorl %r13d, %r13d
testq %rbp, %rbp
movl $0x0, %r14d
cmovgq %rbp, %r14
testq %r15, %r15
cmovleq %r13, %r15
movq %r15, 0x10(%rsp)
pushq $0x5
popq %r15
movq %rbp, 0x8(%rsp)
cmpq 0x10(%rsp), %r13
je 0x64334
xorl %ebp, %ebp
cmpq %rbp, %r14
je 0x64324
movq 0x18(%rbx), %rdi
leaq (%r15,%rbp), %rsi
callq 0xe3eb4
movzbl %al, %ecx
leal -0xf6(%rcx), %eax
cmpl $0x9, %eax
ja 0x642b1
leaq 0xb370c(%rip), %rcx     # 0x1179b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $-0x12, %al
jmp 0x6430b
cmpl $0x2a, %ecx
je 0x64305
cmpl $0x55, %ecx
je 0x642dd
cmpl $0x80, %ecx
je 0x642f5
cmpl $0xab, %ecx
je 0x642e9
movb $-0x1, %al
cmpl $0xd6, %ecx
jne 0x6430b
xorl %eax, %eax
jmp 0x6430b
movb $-0x78, %al
jmp 0x6430b
movb $-0x67, %al
jmp 0x6430b
movb $0x11, %al
jmp 0x6430b
movb $-0x45, %al
jmp 0x6430b
movb $0x33, %al
jmp 0x6430b
movb $-0x56, %al
jmp 0x6430b
movb $0x44, %al
jmp 0x6430b
movb $0x66, %al
jmp 0x6430b
movb $-0x23, %al
jmp 0x6430b
movb $0x77, %al
jmp 0x6430b
movb $0x55, %al
jmp 0x6430b
movb $-0x34, %al
jmp 0x6430b
movb $0x22, %al
movzbl %al, %ecx
movq %r12, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xe71da
incq %rbp
jmp 0x64279
incq %r13
movq 0x8(%rsp), %rbp
addq %rbp, %r15
jmp 0x6426c
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xe70b7
jmp 0x64345
xorl %r12d, %r12d
movq %r12, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe7084
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_module_hr
void de_module_hr(deark *c, struct deark_module_info *mi)
{
	mi->id = "hr";
	mi->desc = "TRS-80 HR (High Resolution) image";
	mi->run_fn = de_run_hr;
	mi->identify_fn = de_identify_hr;
}

// Assembly:
leaq 0xb3ac7(%rip), %rax     # 0x117e64
movq %rax, (%rsi)
leaq 0xb3ac0(%rip), %rax     # 0x117e67
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x643c2
movq %rax, 0x18(%rsi)
leaq 0x7c(%rip), %rax        # 0x64439
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_run_hr
static void de_run_hr(deark *c, de_module_params *mparams)
{
	de_bitmap *img = NULL;
	de_finfo *fi = NULL;

	fi = de_finfo_create(c);
	fi->density.code = DE_DENSITY_UNK_UNITS;
	fi->density.xdens = 2;
	fi->density.ydens = 1;
	img = de_bitmap_create(c, 640, 240, 1);
	de_convert_image_bilevel(c->infile, 0, 640/8, img, 0);
	de_bitmap_write_to_file_finfo(img, fi, DE_CREATEFLAG_IS_BWIMG);
	de_bitmap_destroy(img);
	de_finfo_destroy(c, fi);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0xdfd1a
movq %rax, %r14
movl $0x1, 0x78(%rax)
movaps 0xb39d0(%rip), %xmm0    # 0x117db0
movups %xmm0, 0x80(%rax)
pushq $0x1
popq %rcx
movl $0x280, %esi            # imm = 0x280
movl $0xf0, %edx
movq %rbx, %rdi
callq 0xe7437
movq %rax, %r15
movq 0x18(%rbx), %rdi
pushq $0x50
popq %rdx
xorl %esi, %esi
movq %rax, %rcx
xorl %r8d, %r8d
callq 0xe77b7
pushq $0x8
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0xe70ab
movq %r15, %rdi
callq 0xe7084
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xdfd24
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_identify_hr
static int de_identify_hr(deark *c)
{
	if(de_input_file_has_ext(c, "hr")) {
		if(c->infile->len==19200) return 70;
		if(c->infile->len>19200 && c->infile->len<=19456) return 30;
	}
	return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xb3a20(%rip), %rsi     # 0x117e64
callq 0xdfcd5
testl %eax, %eax
je 0x64474
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
cmpq $0x4b00, %rax           # imm = 0x4B00
jne 0x64461
pushq $0x46
jmp 0x64471
addq $-0x4b01, %rax          # imm = 0xB4FF
cmpq $0x100, %rax            # imm = 0x100
jae 0x64474
pushq $0x1e
popq %rax
jmp 0x64476
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_module_ripicon
void de_module_ripicon(deark *c, struct deark_module_info *mi)
{
	mi->id = "ripicon";
	mi->desc = "RIP/RIPscrip/RIPterm Icon / BGI image";
	mi->run_fn = de_run_ripicon;
	mi->identify_fn = de_identify_ripicon;
}

// Assembly:
leaq 0xb3a0a(%rip), %rax     # 0x117e89
movq %rax, (%rsi)
leaq 0xb3a08(%rip), %rax     # 0x117e91
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x644a4
movq %rax, 0x18(%rsi)
leaq 0x42(%rip), %rax        # 0x644e1
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_identify_ripicon
static int de_identify_ripicon(deark *c)
{
	int has_ext = 0;
	i64 pos = 0;
	size_t i;
	static const char *exts[] = { "icn", "hot", "msk", "bgi" };

	for(i=0; i<DE_ARRAYCOUNT(exts); i++) {
		if(de_input_file_has_ext(c, exts[i])) {
			has_ext = 1;
			break;
		}
	}
	if(!has_ext) return 0;

	while(1) {
		i64 bytes_consumed = 0;

		if(!do_one_ripicon(c, pos, &bytes_consumed, 1)) break;
		pos += bytes_consumed;
		if(pos == c->infile->len) return 50;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
xorl %ebx, %ebx
leaq 0xb34e7(%rip), %r15     # 0x1179e0
xorl %r12d, %r12d
cmpq $0x10, %r12
je 0x64554
movslq (%r12,%r15), %rsi
addq %r15, %rsi
movq %r14, %rdi
callq 0xdfcd5
addq $0x4, %r12
testl %eax, %eax
je 0x644fc
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
pushq $0x1
popq %rbp
pushq $0x32
popq %rbx
andq $0x0, 0x8(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl %ebp, %ecx
callq 0x68ee2
testl %eax, %eax
je 0x64552
addq 0x8(%rsp), %r15
movq 0x18(%r14), %rax
cmpq 0x18(%rax), %r15
jne 0x64527
jmp 0x64554
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_module_lss16
void de_module_lss16(deark *c, struct deark_module_info *mi)
{
	mi->id = "lss16";
	mi->desc = "SYSLINUX LSS16 image";
	mi->run_fn = de_run_lss16;
	mi->identify_fn = de_identify_lss16;
}

// Assembly:
leaq 0xb394d(%rip), %rax     # 0x117eb7
movq %rax, (%rsi)
leaq 0xb3949(%rip), %rax     # 0x117ebd
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x6458f
movq %rax, 0x18(%rsi)
leaq 0x1ec(%rip), %rax       # 0x64776
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_module_vbm
void de_module_vbm(deark *c, struct deark_module_info *mi)
{
	mi->id = "vbm";
	mi->desc = "C64/128 VBM (VDC BitMap)";
	mi->run_fn = de_run_vbm;
	mi->identify_fn = de_identify_vbm;
}

// Assembly:
leaq 0xb3733(%rip), %rax     # 0x117ed2
movq %rax, (%rsi)
leaq 0xb372d(%rip), %rax     # 0x117ed6
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x647c4
movq %rax, 0x18(%rsi)
leaq 0x80(%rip), %rax        # 0x6483f
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_run_vbm
static void de_run_vbm(deark *c, de_module_params *mparams)
{
	i64 width, height;
	u8 ver;

	ver = de_getbyte(3);
	if(ver!=2) {
		// TODO: Support VBM v3.
		de_err(c, "Unsupported VBM version (%d)", (int)ver);
		return;
	}
	width = de_getu16be(4);
	height = de_getu16be(6);
	de_convert_and_write_image_bilevel2(c->infile, 8, width, height, (width+7)/8,
		DE_CVTF_WHITEISZERO, NULL, 0);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
pushq $0x3
popq %rsi
callq 0xe3eb4
cmpb $0x2, %al
jne 0x64824
movq 0x18(%rbx), %rdi
pushq $0x4
popq %rsi
callq 0xe3f46
movq %rax, %r14
movq 0x18(%rbx), %rdi
pushq $0x6
popq %rsi
callq 0xe3f46
movq %rax, %rcx
movq 0x18(%rbx), %rdi
leaq 0x7(%r14), %rax
pushq $0x8
popq %rsi
cqto
idivq %rsi
pushq $0x1
popq %r9
movq %r14, %rdx
movq %rax, %r8
pushq $0x0
pushq $0x0
callq 0xe78af
addq $0x18, %rsp
popq %rbx
popq %r14
retq
movzbl %al, %edx
leaq 0xb39d7(%rip), %rsi     # 0x118205
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xdf2a5
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_identify_vbm
static int de_identify_vbm(deark *c)
{
	u8 b[4];
	de_read(b, 0, 4);
	if(de_memcmp(b, "BM\xcb", 3)) return 0;
	if(b[3]!=2 && b[3]!=3) return 0;
	if(de_input_file_has_ext(c, "vbm")) return 100;
	return 80;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
leaq 0xc(%rsp), %r15
pushq $0x4
popq %rcx
movq %r15, %rsi
xorl %edx, %edx
callq 0xe3cb7
leaq 0xb39b8(%rip), %rsi     # 0x118222
pushq $0x3
popq %rdx
movq %r15, %rdi
callq 0x18230
testl %eax, %eax
jne 0x6489d
movb 0xf(%rsp), %al
addb $-0x4, %al
cmpb $-0x2, %al
jb 0x6489d
leaq 0xb3648(%rip), %rsi     # 0x117ed2
movq %r14, %rdi
callq 0xdfcd5
testl %eax, %eax
pushq $0x50
popq %rax
pushq $0x64
popq %rbx
cmovel %eax, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/misc2.c
// Function: de_module_fp_art
void de_module_fp_art(deark *c, struct deark_module_info *mi)
{
	mi->id = "fp_art";
	mi->desc = "PFS: 1st Publisher clip art (.ART)";
	mi->run_fn = de_run_fp_art;
	mi->identify_fn = de_identify_fp_art;
}

// Assembly:
leaq 0xb363f(%rip), %rax     # 0x117eef
movq %rax, (%rsi)
leaq 0xb363c(%rip), %rax     # 0x117ef6
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x648d5
movq %rax, 0x18(%rsi)
leaq 0x2f2(%rip), %rax       # 0x64bc2
movq %rax, 0x20(%rsi)
retq