LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/applesd.c
// Function: de_module_applesd
void de_module_applesd(deark *c, struct deark_module_info *mi)
{
	mi->id = "applesd";
	mi->id_alias[0] = "applesingle";
	mi->id_alias[1] = "appledouble";
	mi->desc = "AppleSingle/AppleDouble";
	mi->run_fn = de_run_applesd;
	mi->identify_fn = de_identify_applesd;
	mi->help_fn = de_help_applesd;
}

// Assembly:
leaq 0xe7efb(%rip), %rax     # 0x1169fe
movq %rax, (%rsi)
leaq 0xe7ef9(%rip), %rax     # 0x116a06
movq %rax, 0x38(%rsi)
leaq 0xe7efa(%rip), %rax     # 0x116a12
movq %rax, 0x40(%rsi)
leaq 0xe7efb(%rip), %rax     # 0x116a1e
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x2eb49
movq %rax, 0x18(%rsi)
leaq 0x311(%rip), %rax       # 0x2ee4a
movq %rax, 0x20(%rsi)
leaq 0x32f(%rip), %rax       # 0x2ee73
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/applesd.c
// Function: handler_data
static void handler_data(deark *c, lctx *d, struct entry_struct *e)
{
	if(d->is_appledouble) {
		de_warn(c, "AppleDouble header files should not have a data fork.");
	}

	d->advf->mainfork.fork_exists = 1;
	d->data_fork_pos = e->offset;
	d->advf->mainfork.fork_len = e->length;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
cmpb $0x0, 0x4(%rsi)
je 0x2ef03
leaq 0xe7c7e(%rip), %rsi     # 0x116b7a
xorl %eax, %eax
callq 0xe8faa
movq 0x10(%r14), %rax
movb $0x1, 0x10(%rax)
movq 0x8(%rbx), %rcx
movq %rcx, 0x20(%r14)
movq 0x10(%rbx), %rcx
movq %rcx, 0x18(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/applesd.c
// Function: handler_rsrc
static void handler_rsrc(deark *c, lctx *d, struct entry_struct *e)
{
	if(d->extract_rsrc) {
		do_extract_rsrc(c, d, e);
	}
	else {
		do_decode_rsrc(c, d, e);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
cmpl $0x0, 0xc(%rsi)
movq 0x10(%rdx), %rax
je 0x2ef68
testq %rax, %rax
jle 0x2ef50
movq 0x10(%rsi), %rcx
movb $0x1, 0x38(%rcx)
movq 0x8(%r14), %rdx
movq %rdx, 0x18(%rsi)
movq %rax, 0x40(%rcx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0xea50e
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xf6753
testq %rax, %rax
jle 0x2efbc
leaq 0xe7c3c(%rip), %rsi     # 0x116bb0
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rcx
movq 0x8(%r14), %r8
movq 0x10(%r14), %r9
leaq 0xe7c2e(%rip), %rsi     # 0x116bcc
movq %rbx, %rdi
xorl %edx, %edx
callq 0xe9b13
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe8a15
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/applesd.c
// Function: handler_string
static void handler_string(deark *c, lctx *d, struct entry_struct *e)
{
	struct de_stringreaderdata *srd = NULL;
	u8 firstbyte;

	if(e->length<1) goto done;

	firstbyte = de_getbyte(e->offset);

	if(firstbyte==0x00) {
		de_dbg(c, "string is apparently empty");
		goto done;
	}
	else if(is_pascal_string(c, d, e, firstbyte)) {
		i64 slen = (i64)firstbyte;

		de_dbg(c, "guessing this is a Pascal string, len: %u", (unsigned int)slen);
		srd = dbuf_read_string(c->infile, e->offset+1, slen, slen, 0, d->input_encoding);
	}
	else {
		srd = dbuf_read_string(c->infile, e->offset, e->length, 1024,
			DE_CONVFLAG_STOP_AT_NUL, d->input_encoding);
	}

	de_dbg(c, "%s: \"%s\"", e->eid->name, ucstring_getpsz_d(srd->str));

	if(e->id==3 && srd->str->len>0) { // id 3 = real name
		ucstring_empty(d->advf->filename);
		ucstring_append_ucstring(d->advf->filename, srd->str);
		d->advf->original_filename_flag = 1;
		de_advfile_set_orig_filename(d->advf, srd->sz, srd->sz_strlen);
	}

done:
	de_destroy_stringreaderdata(c, srd);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x10(%rdx)
jle 0x2f03c
movq %rdx, %r15
movq %rsi, %r14
movq 0x18(%rbx), %rdi
movq 0x8(%rdx), %rsi
callq 0xeead3
testb %al, %al
je 0x2f044
movq 0x10(%r15), %rdx
cmpb $0x1f, %al
ja 0x2f05d
movzbl %al, %r12d
cmpq %r12, %rdx
jle 0x2f05d
leaq -0x101(%rdx), %rax
cmpq $-0x100, %rax
jb 0x2f05d
leaq 0xe7bda(%rip), %rsi     # 0x116bef
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq 0x8(%r15), %rsi
incq %rsi
movl 0x8(%r14), %r9d
movq %r12, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
jmp 0x2f074
xorl %r12d, %r12d
jmp 0x2f0ee
leaq 0xe7b89(%rip), %rsi     # 0x116bd4
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
jmp 0x2f0ee
movq 0x18(%rbx), %rdi
movq 0x8(%r15), %rsi
movl 0x8(%r14), %r9d
movl $0x400, %ecx            # imm = 0x400
movl $0x1, %r8d
callq 0xef87c
movq %rax, %r12
movq 0x18(%r15), %rax
movq 0x8(%rax), %r13
movq 0x18(%r12), %rdi
callq 0xf70f6
leaq 0xfd095(%rip), %rsi     # 0x12c12a
movq %rbx, %rdi
movq %r13, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
cmpl $0x3, 0x4(%r15)
jne 0x2f0ee
movq 0x18(%r12), %rax
cmpq $0x0, 0x10(%rax)
jle 0x2f0ee
movq 0x10(%r14), %rax
movq 0x68(%rax), %rdi
callq 0xf6423
movq 0x10(%r14), %rax
movq 0x68(%rax), %rdi
movq 0x18(%r12), %rsi
callq 0xf6509
movq 0x10(%r14), %rdi
movb $0x1, 0x79(%rdi)
movq 0x8(%r12), %rsi
movq 0x10(%r12), %rdx
callq 0xfc530
movq %rbx, %rdi
movq %r12, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xefaca
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/applesd.c
// Function: handler_dates
static void handler_dates(deark *c, lctx *d, struct entry_struct *e)
{
	if(e->length<16) return;
	do_one_date(c, d, e->offset, "creation date", &d->advf->mainfork.fi->timestamp[DE_TIMESTAMPIDX_CREATE]);
	do_one_date(c, d, e->offset+4, "mod date", &d->advf->mainfork.fi->timestamp[DE_TIMESTAMPIDX_MODIFY]);
	do_one_date(c, d, e->offset+8, "backup date", &d->advf->mainfork.fi->timestamp[DE_TIMESTAMPIDX_BACKUP]);
	do_one_date(c, d, e->offset+12, "access date", &d->advf->mainfork.fi->timestamp[DE_TIMESTAMPIDX_ACCESS]);
}

// Assembly:
cmpq $0x10, 0x10(%rdx)
jge 0x2f10a
retq
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdx), %rsi
movq 0x10(%r14), %rax
movq 0x20(%rax), %rcx
addq $0x28, %rcx
leaq 0xfe5ad(%rip), %rdx     # 0x12d6dc
callq 0x2f60e
movq 0x8(%r15), %rsi
addq $0x4, %rsi
movq 0x10(%r14), %rax
movq 0x20(%rax), %rcx
addq $0x18, %rcx
leaq 0xf1a6f(%rip), %rdx     # 0x120bbe
movq %rbx, %rdi
callq 0x2f60e
movq 0x8(%r15), %rsi
addq $0x8, %rsi
movq 0x10(%r14), %rax
movq 0x20(%rax), %rcx
addq $0x58, %rcx
leaq 0xe7aa7(%rip), %rdx     # 0x116c19
movq %rbx, %rdi
callq 0x2f60e
movq 0x8(%r15), %rsi
addq $0xc, %rsi
movq 0x10(%r14), %rax
movq 0x20(%rax), %rcx
addq $0x38, %rcx
leaq 0xe7a90(%rip), %rdx     # 0x116c25
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2f60e
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/applesd.c
// Function: do_one_date
static void do_one_date(deark *c, lctx *d, i64 pos, const char *name,
	struct de_timestamp *returned_ts)
{
	i64 dt;
	struct de_timestamp ts;
	char timestamp_buf[64];

	de_zeromem(&ts, sizeof(struct de_timestamp));
	dt = de_geti32be(pos);
	if(dt == -0x80000000LL) {
		de_strlcpy(timestamp_buf, "unknown", sizeof(timestamp_buf));
	}
	else {
		// Epoch is Jan 1, 2001. There are 30 years, with 7 leap days, between
		// that and the Unix time epoch.
		de_unix_time_to_timestamp(dt + ((365*30 + 7)*86400), &ts, 0x1);
		de_timestamp_to_string(&ts, timestamp_buf, sizeof(timestamp_buf), 0);
	}
	de_dbg(c, "%s: %"I64_FMT" (%s)", name, dt, timestamp_buf);
	if(returned_ts) {
		*returned_ts = ts;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq 0x18(%rdi), %rdi
callq 0xeedae
movq %rax, %r12
cmpq $-0x80000000, %rax      # imm = 0x80000000
jne 0x2f657
leaq 0xe2e56(%rip), %rsi     # 0x11249c
leaq 0x10(%rsp), %rdi
movl $0x40, %edx
callq 0xe8219
jmp 0x2f685
movq %r12, %rdi
addq $0x386d4380, %rdi       # imm = 0x386D4380
movq %rsp, %r13
movq %r13, %rsi
movl $0x1, %edx
callq 0xea7f5
leaq 0x10(%rsp), %rsi
movl $0x40, %edx
movq %r13, %rdi
xorl %ecx, %ecx
callq 0xeaf46
leaq 0xe75a5(%rip), %rsi     # 0x116c31
leaq 0x10(%rsp), %r8
movq %r15, %rdi
movq %r14, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe8617
testq %rbx, %rbx
je 0x2f6ad
movaps (%rsp), %xmm0
movups %xmm0, (%rbx)
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/binhex.c
// Function: de_module_binhex
void de_module_binhex(deark *c, struct deark_module_info *mi)
{
	mi->id = "binhex";
	mi->desc = "Macintosh BinHex (.hqx) archive";
	mi->run_fn = de_run_binhex;
	mi->identify_fn = de_identify_binhex;
}

// Assembly:
leaq 0xe76c1(%rip), %rax     # 0x116d84
movq %rax, (%rsi)
leaq 0xe76be(%rip), %rax     # 0x116d8b
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x2f6e8
movq %rax, 0x18(%rsi)
leaq 0x610(%rip), %rax       # 0x2fcf3
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/binhex.c
// Function: de_identify_binhex
static int de_identify_binhex(deark *c)
{
	u8 b0;
	int ret;
	i64 foundpos;

	b0 = de_getbyte(0);
	if(b0==g_binhex_intro1[0]) {
		if(!dbuf_memcmp(c->infile, 0, g_binhex_intro1, INTRO1_LEN)) {
			return 100;
		}
	}

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

	// File has .hqx extension. Try harder to identify it.
	ret = find_start(c, &foundpos);
	if(ret) {
		if(foundpos<=1) {
			// Possible BinHex, but no intro
			if(looks_like_binhex_eof(c)) {
				return 75;
			}
		}
		else {
			return 100;
		}
	}

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0xeead3
cmpb $0x28, %al
jne 0x2fd29
movq 0x18(%r14), %rdi
leaq 0xe70bd(%rip), %rdx     # 0x116dd6
movl $0x28, %ecx
xorl %esi, %esi
callq 0xefc85
testl %eax, %eax
je 0x2fd8c
leaq 0xe721f(%rip), %rsi     # 0x116f4f
movq %r14, %rdi
callq 0xea491
testl %eax, %eax
je 0x2fdc0
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x2fdca
testl %eax, %eax
je 0x2fdbe
movl $0x64, %ebx
cmpq $0x1, 0x10(%rsp)
jg 0x2fdc0
movq 0x18(%r14), %rdi
movq 0x18(%rdi), %rdx
addq $-0x3, %rdx
leaq 0xd(%rsp), %rbx
movl $0x3, %ecx
movq %rbx, %rsi
callq 0xee8d4
movzbl 0x2(%rbx), %eax
cmpl $0x3a, %eax
jne 0x2fd93
movl $0x4b, %ebx
jmp 0x2fdc0
movl $0x64, %ebx
jmp 0x2fdc0
movb 0xe(%rsp), %cl
cmpb $0x3a, %cl
jne 0x2fda8
cmpl $0xa, %eax
je 0x2fd85
cmpl $0xd, %eax
je 0x2fd85
jmp 0x2fdbe
cmpl $0xa, %eax
jne 0x2fdbe
cmpb $0xd, %cl
jne 0x2fdbe
movl $0x4b, %ebx
cmpb $0x3a, 0xd(%rsp)
je 0x2fdc0
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/binhex.c
// Function: find_start
static int find_start(deark *c, i64 *foundpos)
{
	i64 pos;
	u8 b;
	int ret;

	*foundpos = 0;

	ret = dbuf_search(c->infile, g_binhex_intro1, INTRO1_LEN, 0, 8192, &pos);
	if(ret) pos += INTRO1_LEN;
	if(!ret) {
		ret = dbuf_search(c->infile, g_binhex_intro2, INTRO2_LEN, 0, 8192, &pos);
		if(ret) pos += INTRO2_LEN;
	}
	if(!ret) {
		ret = dbuf_search(c->infile, g_binhex_intro3, INTRO3_LEN, 0, 8192, &pos);
		if(ret) pos += INTRO3_LEN;
	}
	if(!ret) {
		if(de_getbyte(0)==':') {
			*foundpos = 1;
			return 1;
		}
	}
	if(!ret) {
		return 0;
	}

	// Find the next CR/LF byte
	while(1) {
		if(pos>=c->infile->len) return 0;
		b = de_getbyte(pos);
		pos++;
		if(b=='\x0a' || b=='\x0d') {
			break;
		}
	}

	// Skip any number of additional whitespace
	while(1) {
		b = de_getbyte(pos);
		if(b=='\x0a' || b=='\x0d' || b==' ' || b=='\t') {
			pos++;
		}
		else {
			break;
		}
	}

	// Current byte should be a colon (:)
	b = de_getbyte(pos);
	if(b==':') {
		*foundpos = pos+1;
		return 1;
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq $0x0, (%rsi)
movq 0x18(%rdi), %rdi
leaq 0xe6fec(%rip), %rsi     # 0x116dd6
movq %rsp, %r9
movl $0x28, %edx
movl $0x2000, %r8d           # imm = 0x2000
xorl %ecx, %ecx
callq 0xf149c
testl %eax, %eax
je 0x2fe0d
movq (%rsp), %rsi
addq $0x28, %rsi
jmp 0x2fe6e
movq 0x18(%r14), %rdi
leaq 0xe6fe7(%rip), %rsi     # 0x116dff
movq %rsp, %r9
movl $0x17, %edx
movl $0x2000, %r8d           # imm = 0x2000
xorl %ecx, %ecx
callq 0xf149c
testl %eax, %eax
je 0x2fe3b
movq (%rsp), %rsi
addq $0x17, %rsi
jmp 0x2fe6e
movq 0x18(%r14), %rdi
leaq 0xe6fd1(%rip), %rsi     # 0x116e17
xorl %r15d, %r15d
movq %rsp, %r9
movl $0x2a, %edx
movl $0x2000, %r8d           # imm = 0x2000
xorl %ecx, %ecx
callq 0xf149c
testl %eax, %eax
je 0x2fef8
movq (%rsp), %rsi
addq $0x2a, %rsi
movq %rsi, (%rsp)
movq 0x18(%r14), %rdi
xorl %r15d, %r15d
cmpq 0x18(%rdi), %rsi
jge 0x2fee9
callq 0xeead3
movq (%rsp), %rsi
incq %rsi
movq %rsi, (%rsp)
cmpb $0xd, %al
je 0x2fe9b
movzbl %al, %eax
cmpl $0xa, %eax
jne 0x2fe72
movabsq $0x100002600, %r12      # imm = 0x100002600
movq 0x18(%r14), %rdi
callq 0xeead3
cmpb $0x20, %al
ja 0x2fec8
movzbl %al, %eax
btq %rax, %r12
jae 0x2fec8
movq (%rsp), %rsi
incq %rsi
movq %rsi, (%rsp)
jmp 0x2fea5
movq 0x18(%r14), %rdi
movq (%rsp), %rsi
callq 0xeead3
cmpb $0x3a, %al
jne 0x2fee9
movq (%rsp), %rcx
incq %rcx
movq %rcx, (%rbx)
movl $0x1, %r15d
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x18(%r14), %rdi
xorl %esi, %esi
callq 0xeead3
movl $0x1, %ecx
cmpb $0x3a, %al
je 0x2fee0
jmp 0x2fee9
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/binhex.c
// Function: do_pre_extract_fork
static int do_pre_extract_fork(deark *c, lctx *d, dbuf *inf, struct binhex_forkinfo *fki,
	struct de_advfile_forkinfo *advfki)
{
	fki->crc_reported = (u32)dbuf_getu16be(inf, fki->pos + fki->len);
	de_dbg(c, "%s fork crc (reported): 0x%04x", fki->forkname,
		(unsigned int)fki->crc_reported);

	advfki->writelistener_cb = de_writelistener_for_crc;
	advfki->userdata_for_writelistener = (void*)fki->crco;

	if((fki->pos + fki->len > inf->len) && fki->len!=0) {
		de_err(c, "%s fork goes beyond end of file", fki->forkname);
		fki->len = 0;
		return 0;
	}
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x8(%rdx), %rsi
addq (%rdx), %rsi
movq %r15, %rdi
callq 0xeeb67
movl %eax, 0x10(%rbx)
movq 0x20(%rbx), %rdx
leaq 0xe6f93(%rip), %rsi     # 0x116ed2
movq %r14, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
leaq 0xc14ff(%rip), %rax     # 0xf1451
movq %rax, 0x20(%r12)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r12)
movq 0x8(%rbx), %rax
movl $0x1, %ebp
testq %rax, %rax
je 0x2ff96
addq (%rbx), %rax
cmpq 0x18(%r15), %rax
jle 0x2ff96
movq 0x20(%rbx), %rdx
leaq 0xe6f6f(%rip), %rsi     # 0x116ef1
xorl %ebp, %ebp
movq %r14, %rdi
xorl %eax, %eax
callq 0xe9295
movq $0x0, 0x8(%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/binhex.c
// Function: do_post_extract_fork
static void do_post_extract_fork(deark *c, lctx *d, struct binhex_forkinfo *fki)
{
	u32 crc_calc;

	// Here, the BinHex spec says we should feed two 0x00 bytes to the CRC
	// calculation, to account for the CRC field itself. However, if I do
	// that, none of files I've tested have the correct CRC. If I don't,
	// all of them have the correct CRC.
	//de_crcobj_addbuf(fki->crco, (const u8*)"\0\0", 2);

	crc_calc = de_crcobj_getval(fki->crco);
	de_dbg(c, "%s fork crc (calculated): 0x%04x", fki->forkname,
		(unsigned int)crc_calc);
	if(crc_calc != fki->crc_reported) {
		de_err(c, "CRC check failed for %s fork", fki->forkname);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rsi), %rdi
callq 0xeb865
movl %eax, %ebp
movq 0x20(%r14), %rdx
leaq 0xe6f02(%rip), %rsi     # 0x116f11
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
cmpl 0x10(%r14), %ebp
jne 0x30026
popq %rbx
popq %r14
popq %rbp
retq
movq 0x20(%r14), %rdx
leaq 0xe6f01(%rip), %rsi     # 0x116f32
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0xe9295
nop
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_module_xbin
void de_module_xbin(deark *c, struct deark_module_info *mi)
{
	mi->id = "xbin";
	mi->desc = "XBIN character graphics";
	mi->run_fn = de_run_xbin;
	mi->identify_fn = de_identify_xbin;
	mi->help_fn = de_help_xbin;
}

// Assembly:
leaq 0xe7019(%rip), %rax     # 0x117060
movq %rax, (%rsi)
leaq 0xe7014(%rip), %rax     # 0x117065
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x30077
movq %rax, 0x18(%rsi)
leaq 0x64c(%rip), %rax       # 0x306b3
movq %rax, 0x20(%rsi)
leaq 0x667(%rip), %rax       # 0x306d9
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_module_bintext
void de_module_bintext(deark *c, struct deark_module_info *mi)
{
	mi->id = "bintext";
	mi->desc = "Binary Text character graphics";
	mi->run_fn = de_run_bintext;
	mi->identify_fn = de_identify_bintext;
	mi->help_fn = de_help_bintext;
}

// Assembly:
leaq 0xe6979(%rip), %rax     # 0x11707d
movq %rax, (%rsi)
leaq 0xe6977(%rip), %rax     # 0x117085
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x30734
movq %rax, 0x18(%rsi)
leaq 0x25b(%rip), %rax       # 0x3097f
movq %rax, 0x20(%rsi)
leaq 0x284(%rip), %rax       # 0x309b3
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_identify_bintext
static int de_identify_bintext(deark *c)
{
	if(!c->detection_data->SAUCE_detection_attempted) {
		// FIXME?: This is known to happen if "-disablemods sauce" was used.
		de_err(c, "bintext detection requires sauce module");
		return 0;
	}
	if(c->detection_data->sauce.has_SAUCE) {
		if(c->detection_data->sauce.data_type==5)
		{
			return 100;
		}
	}
	return 0;
}

// Assembly:
pushq %rbx
movq 0x28(%rdi), %rax
cmpb $0x0, 0x5(%rax)
je 0x3099f
cmpb $0x0, 0x10(%rax)
je 0x3099b
movl $0x64, %ebx
cmpb $0x5, 0x11(%rax)
je 0x309af
xorl %ebx, %ebx
jmp 0x309af
leaq 0xe6a2d(%rip), %rsi     # 0x1173d3
xorl %ebx, %ebx
xorl %eax, %eax
callq 0xe9295
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_module_artworx_adf
void de_module_artworx_adf(deark *c, struct deark_module_info *mi)
{
	mi->id = "artworx_adf";
	mi->desc = "ArtWorx Data Format (ADF)";
	mi->run_fn = de_run_artworx_adf;
	mi->identify_fn = de_identify_artworx_adf;
	mi->help_fn = de_help_artworx_adf;
}

// Assembly:
leaq 0xe66b5(%rip), %rax     # 0x1170a4
movq %rax, (%rsi)
leaq 0xe66b7(%rip), %rax     # 0x1170b0
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x30a1f
movq %rax, 0x18(%rsi)
leaq 0x1b0(%rip), %rax       # 0x30bbf
movq %rax, 0x20(%rsi)
leaq 0x21f(%rip), %rax       # 0x30c39
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_identify_artworx_adf
static int de_identify_artworx_adf(deark *c)
{
	u8 ver;

	// TODO: This detection algorithm will fail if there is a SAUCE record.

	if(c->infile->len < 1+192+4096+160) {
		return 0;
	}
	if((c->infile->len - (1+192+4096))%160 != 0) {
		return 0;
	}
	if(!de_input_file_has_ext(c, "adf")) return 0;
	ver = de_getbyte(0);
	// I don't know what version numbers are allowed, but I'll assume the
	// version number should be small.
	if(ver>4) return 0;
	return 75;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x18(%rdi), %rax
movq 0x18(%rax), %rax
xorl %ebx, %ebx
cmpq $0x1161, %rax           # imm = 0x1161
jl 0x30c2f
movabsq $-0x3333333333333333, %rcx # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
movabsq $-0x333333333333368d, %rcx # imm = 0xCCCCCCCCCCCCC973
addq %rax, %rcx
rorq $0x5, %rcx
movabsq $0x199999999999999, %rax # imm = 0x199999999999999
cmpq %rax, %rcx
ja 0x30c2f
movq %rdi, %r14
leaq 0x11a245(%rip), %rsi    # 0x14ae52
callq 0xea491
testl %eax, %eax
je 0x30c2f
movq 0x18(%r14), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0xeead3
cmpb $0x5, %al
movl $0x4b, %ebx
cmovael %r14d, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_module_icedraw
void de_module_icedraw(deark *c, struct deark_module_info *mi)
{
	mi->id = "icedraw";
	mi->desc = "iCEDraw character graphics format";
	mi->run_fn = de_run_icedraw;
	mi->identify_fn = de_identify_icedraw;
	mi->flags |= DE_MODFLAG_NONWORKING;
}

// Assembly:
leaq 0xe6455(%rip), %rax     # 0x1170ca
movq %rax, (%rsi)
leaq 0xe6453(%rip), %rax     # 0x1170d2
movq %rax, 0x8(%rsi)
leaq 0x14(%rip), %rax        # 0x30c9e
movq %rax, 0x18(%rsi)
leaq 0x84(%rip), %rax        # 0x30d19
movq %rax, 0x20(%rsi)
orb $0x2, 0x30(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_module_thedraw_com
void de_module_thedraw_com(deark *c, struct deark_module_info *mi)
{
	mi->id = "thedraw_com";
	mi->desc = "TheDraw COM file";
	mi->run_fn = de_run_thedraw_com;
	mi->identify_fn = de_identify_thedraw_com;
}

// Assembly:
leaq 0xe63ae(%rip), %rax     # 0x1170f4
movq %rax, (%rsi)
leaq 0xe63b0(%rip), %rax     # 0x117100
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x30d6b
movq %rax, 0x18(%rsi)
leaq 0x3e8(%rip), %rax       # 0x3114e
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_identify_thedraw_com
static int de_identify_thedraw_com(deark *c)
{
	u8 n1, n2;

	if(c->infile->len>65280) return 0;
	n1 = de_getbyte(0);
	if(n1!=0xeb) return 0;

	n1 = de_getbyte(1);
	n2 = de_getbyte(6);
	// Check format subtype & viewer start position.
	if((n2==0 && n1==0x3d) ||
		(n2==1 && n1==0x18) ||
		(n2==2 && n1==0x3d))
	{
		;
	}
	else {
		return 0;
	}

	if(!dbuf_memcmp(c->infile, 9, (const void*)"TheDraw COM file", 16)) {
		return 100;
	}

	if(n2==0) {
		if(!dbuf_memcmp(c->infile, 0x3f,
			(const void*)"\xb4\x0f\xcd\x10\x8c\xcb\x8e\xdb\xbb\x00", 10))
		{
			// An extra check to defend against lookalike formats, particularly
			// P-Screen (search for pscrn_55.zip).
			if(de_getbyte(0x3f+76)==0xad) {
				return 40;
			}
		}
	}
	else if(n2==1) {
		if(!dbuf_memcmp(c->infile, 0x1a,
			(const void*)"\xb4\x0f\xcd\x10\x8b\x3e\x07\x01\xbe\x5e", 10))
		{
			return 40;
		}
	}
	else if(n2==2) {
		if(!dbuf_memcmp(c->infile, 0x3f,
			(const void*)"\xb4\x0f\xcd\x10\xbb\x00\xb8\x3c\x02\x74", 10))
		{
			return 40;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
xorl %r14d, %r14d
cmpq $0xff00, 0x18(%rdi)     # imm = 0xFF00
jg 0x31269
xorl %r14d, %r14d
xorl %esi, %esi
callq 0xeead3
cmpb $-0x15, %al
jne 0x31269
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0xeead3
movl %eax, %r15d
movq 0x18(%rbx), %rdi
movl $0x6, %esi
callq 0xeead3
movl %eax, %ebp
movl %r15d, %eax
xorb $0x3d, %al
movl %ebp, %ecx
orb %al, %cl
jne 0x311e6
movq 0x18(%rbx), %rdi
leaq 0xe5f4a(%rip), %rdx     # 0x117100
movl $0x9, %esi
movl $0x10, %ecx
callq 0xefc85
testl %eax, %eax
je 0x31204
testb %bpl, %bpl
je 0x3120c
movq 0x18(%rbx), %rdi
cmpb $0x1, %bpl
jne 0x31244
leaq 0xe634f(%rip), %rdx     # 0x11752e
movl $0x1a, %esi
jmp 0x31250
movl %ebp, %ecx
xorb $0x1, %cl
xorb $0x18, %r15b
movl %ebp, %edx
xorb $0x2, %dl
orb %al, %dl
sete %al
orb %cl, %r15b
je 0x311ab
testb %al, %al
je 0x31269
jmp 0x311ab
movl $0x64, %r14d
jmp 0x31269
movq 0x18(%rbx), %rdi
leaq 0xe5db1(%rip), %rdx     # 0x116fc8
movl $0x3f, %esi
movl $0xa, %ecx
callq 0xefc85
testl %eax, %eax
jne 0x3125e
movq 0x18(%rbx), %rdi
movl $0x8b, %esi
callq 0xeead3
movl $0x28, %r14d
cmpb $-0x53, %al
jne 0x3125e
jmp 0x31269
leaq 0xe5d88(%rip), %rdx     # 0x116fd3
movl $0x3f, %esi
movl $0xa, %ecx
callq 0xefc85
testl %eax, %eax
je 0x31263
xorl %r14d, %r14d
jmp 0x31269
movl $0x28, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_module_aciddraw_com
void de_module_aciddraw_com(deark *c, struct deark_module_info *mi)
{
	mi->id = "aciddraw_com";
	mi->desc = "ACiDDraw COM file";
	mi->run_fn = de_run_aciddraw_com;
	mi->identify_fn = de_identify_aciddraw_com;
}

// Assembly:
leaq 0xe5e93(%rip), %rax     # 0x117111
movq %rax, (%rsi)
leaq 0xe5e96(%rip), %rax     # 0x11711e
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x312a3
movq %rax, 0x18(%rsi)
leaq 0x297(%rip), %rax       # 0x31535
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_identify_aciddraw_com
static int de_identify_aciddraw_com(deark *c)
{
	u8 n1;
	struct aciddraw_id_data adi;

	if(c->infile->len>65280) return 0;
	n1 = de_getbyte(0);
	if(n1!=0xe9 && n1!=0xeb) return 0;
	aciddraw_id(c, n1, &adi);
	if(adi.is_aciddraw) {
		return 92;
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
xorl %r14d, %r14d
cmpq $0xff00, 0x18(%rdi)     # imm = 0xFF00
jg 0x31587
xorl %r14d, %r14d
xorl %esi, %esi
callq 0xeead3
movl %eax, %ecx
andb $-0x3, %cl
cmpb $-0x17, %cl
jne 0x31587
movzbl %al, %esi
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x32189
xorl %eax, %eax
cmpb $0x0, (%r14)
movl $0x5c, %r14d
cmovel %eax, %r14d
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_module_ldog_com
void de_module_ldog_com(deark *c, struct deark_module_info *mi)
{
	mi->id = "ldog_com";
	mi->desc = "Laughing Dog COM file";
	mi->run_fn = de_run_ldog_com;
	mi->identify_fn = de_identify_ldog_com;
}

// Assembly:
leaq 0xe5b97(%rip), %rax     # 0x117130
movq %rax, (%rsi)
leaq 0xe5b96(%rip), %rax     # 0x117139
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x315be
movq %rax, 0x18(%rsi)
leaq 0x167(%rip), %rax       # 0x31720
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_run_ldog_com
static void de_run_ldog_com(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	struct de_char_context *charctx = NULL;
	u8 b;

	d = de_malloc(c, sizeof(lctx));
	d->csctx.input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_CP437);

	charctx = de_create_charctx(c, 0);
	charctx->screen_image_flag = 1;

	b = de_getbyte(22);
	if(b != 0xbe) {
		d->need_errmsg = 1;
		goto done;
	}
	b = de_getbyte(65);
	if(b != 0xb6) {
		d->need_errmsg = 1;
		goto done;
	}

	d->csctx.inf_pos = de_getu16le(23);
	d->csctx.inf_pos -= 0x100;
	de_dbg(c, "data pos: %"I64_FMT, d->csctx.inf_pos);

	d->csctx.height_in_chars = (i64)de_getbyte(66);
	d->csctx.width_in_chars = (i64)de_getbyte(68);
	de_dbg_dimensions(c, d->csctx.width_in_chars, d->csctx.height_in_chars);
	d->csctx.inf_len = d->csctx.width_in_chars * d->csctx.height_in_chars * 2;
	if(d->csctx.inf_pos+d->csctx.inf_len > c->infile->len) {
		d->need_errmsg = 1;
		goto done;
	}

	if(d->csctx.width_in_chars>80 || d->csctx.height_in_chars>25) {
		charctx->no_density = 1;
	}

	d->csctx.use_default_pal = 1;
	d->csctx.inf = c->infile;
	fmtutil_char_simple_run(c, &d->csctx, charctx);

done:
	if(d) {
		if(d->need_errmsg) {
			de_err(c, "Unsupported LDOG COM format");
		}
		free_lctx(c, d);
	}
	de_free_charctx(c, charctx);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x70, %esi
callq 0xe8b2b
movq %rax, %r12
movq %rax, %r14
movq %rbx, %rdi
xorl %esi, %esi
movl $0xd, %edx
callq 0xeb220
movl %eax, 0x48(%r12)
movq %rbx, %rdi
xorl %esi, %esi
callq 0xf3eb8
movq %rax, %r15
movb $0x1, 0x2(%rax)
movq 0x18(%rbx), %rdi
movl $0x16, %esi
callq 0xeead3
cmpb $-0x42, %al
jne 0x316ae
movq 0x18(%rbx), %rdi
movl $0x41, %esi
callq 0xeead3
cmpb $-0x4a, %al
jne 0x316ae
movq 0x18(%rbx), %rdi
movl $0x17, %esi
callq 0xeebc8
leaq -0x100(%rax), %rdx
movq %rdx, 0x38(%r14)
leaq 0xf49eb(%rip), %rsi     # 0x126035
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movl $0x42, %esi
callq 0xeead3
movzbl %al, %eax
movq %rax, 0x58(%r14)
movq 0x18(%rbx), %rdi
movl $0x44, %esi
callq 0xeead3
movzbl %al, %esi
movq %rsi, 0x50(%r14)
movq 0x58(%r14), %rdx
movq %rbx, %rdi
callq 0xe8f88
movq 0x50(%r14), %rdx
movq 0x58(%r14), %rcx
movq %rdx, %rsi
imulq %rcx, %rsi
addq %rsi, %rsi
movq %rsi, 0x40(%r14)
addq 0x38(%r14), %rsi
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %rsi
jle 0x316e5
movb $0x1, 0x1(%r14)
leaq 0xe5edb(%rip), %rsi     # 0x117595
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31e6b
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xf3fb8
addq $0x30, %r12
cmpq $0x51, %rdx
setl %dl
cmpq $0x1a, %rcx
setl %cl
testb %cl, %dl
jne 0x31700
movb $0x1, 0x3(%r15)
movb $0x1, 0x4c(%r14)
movq %rax, 0x30(%r14)
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xf9c77
cmpb $0x0, 0x1(%r14)
jne 0x316b3
jmp 0x316c4
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_identify_ldog_com
static int de_identify_ldog_com(deark *c)
{
	if(c->infile->len>65280) return 0;
	if(de_getbyte(0) != 0x06) return 0;

	if(dbuf_memcmp(c->infile, 1,
		(const void*)"\xb4\x0f\xcd\x10\x3c\x07\x74\x06\xb8\x00\xb8\xeb\x04\x90\xb8", 15))
	{
		return 0;
	}
	return 100;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
cmpq $0xff00, 0x18(%rdi)     # imm = 0xFF00
jg 0x3176a
xorl %ebx, %ebx
xorl %esi, %esi
callq 0xeead3
cmpb $0x6, %al
jne 0x3176a
movq 0x18(%r14), %rdi
leaq 0xe5eb9(%rip), %rdx     # 0x117608
movl $0x1, %esi
movl $0xf, %ecx
callq 0xefc85
xorl %ecx, %ecx
testl %eax, %eax
movl $0x64, %ebx
cmovnel %ecx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_module_grabber
void de_module_grabber(deark *c, struct deark_module_info *mi)
{
	mi->id = "grabber";
	mi->desc = "GRABBER";
	mi->run_fn = de_run_grabber;
	mi->identify_fn = de_identify_grabber;
	mi->flags |= DE_MODFLAG_HIDDEN;
}

// Assembly:
leaq 0xe59d4(%rip), %rax     # 0x11714f
movq %rax, (%rsi)
leaq 0xe59d2(%rip), %rax     # 0x117157
movq %rax, 0x8(%rsi)
leaq 0x14(%rip), %rax        # 0x317a4
movq %rax, 0x18(%rsi)
leaq 0x2b2(%rip), %rax       # 0x31a4d
movq %rax, 0x20(%rsi)
orb $0x1, 0x30(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: de_identify_grabber
static int de_identify_grabber(deark *c)
{
	struct grabber_id_data gi;
	u8 b0;

	if(c->infile->len>65280) return 0;
	b0 = de_getbyte(0);
	if(b0!=0xe9 && b0!=0xfb) return 0;

	grabber_id_com(c, b0, &gi);
	if(gi.is_grabber) return 100;
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
xorl %r14d, %r14d
cmpq $0xff00, 0x18(%rdi)     # imm = 0xFF00
jg 0x31aa3
xorl %r14d, %r14d
xorl %esi, %esi
callq 0xeead3
movzbl %al, %esi
cmpb $-0x5, %sil
je 0x31a83
cmpl $0xe9, %esi
jne 0x31aa3
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x321fd
xorl %eax, %eax
cmpb $0x0, (%r14)
movl $0x64, %r14d
cmovel %eax, %r14d
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: do_read_palette
static void do_read_palette(deark *c, lctx *d,struct de_char_context *charctx,
	i64 pos, int adf_style)
{
	i64 k;
	u8 cr1, cg1, cb1;
	u8 cr2, cg2, cb2;
	i64 cpos;
	char tmps[64];

	de_dbg(c, "palette at %"I64_FMT, pos);

	for(k=0; k<16; k++) {
		i64 idx = k;

		if(adf_style) {
			if(k>=8) idx = 48+k;
			else if(k==6) idx = 20;
		}
		cpos = pos + idx*3;
		cr1 = de_getbyte(cpos);
		cg1 = de_getbyte(cpos+1);
		cb1 = de_getbyte(cpos+2);
		cr2 = de_scale_63_to_255(cr1);
		cg2 = de_scale_63_to_255(cg1);
		cb2 = de_scale_63_to_255(cb1);
		charctx->pal[k] = DE_MAKE_RGB(cr2, cg2, cb2);
		de_snprintf(tmps, sizeof(tmps), "(%2d,%2d,%2d) "DE_CHAR_RIGHTARROW" ",
			(int)cr1, (int)cg1, (int)cb1);
		de_dbg_pal_entry2(c, k, charctx->pal[k], tmps, NULL, NULL);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, (%rsp)
movq %rsi, 0x10(%rsp)
leaq 0x104b20(%rip), %rsi    # 0x1365eb
movq %rdi, 0x8(%rsp)
movq %rdx, 0x18(%rsp)
xorl %eax, %eax
callq 0xe8617
xorl %r13d, %r13d
movq 0x8(%rsp), %rbx
movq %r13, %rax
cmpl $0x0, (%rsp)
je 0x31b09
cmpq $0x8, %r13
jb 0x31af9
leaq 0x30(%r13), %rax
jmp 0x31b09
cmpq $0x6, %r13
movq %r13, %rax
movl $0x14, %ecx
cmoveq %rcx, %rax
leaq (%rax,%rax,2), %r14
movq 0x18(%rsp), %r15
leaq (%r14,%r15), %rsi
movq 0x18(%rbx), %rdi
callq 0xeead3
movl %eax, %r12d
movq 0x18(%rbx), %rdi
leaq (%r15,%r14), %rsi
incq %rsi
callq 0xeead3
movl %eax, %ebp
movq 0x18(%rbx), %rdi
leaq (%r15,%r14), %rsi
addq $0x2, %rsi
callq 0xeead3
movl %eax, %r15d
movzbl %r12b, %edi
movl %edi, 0x4(%rsp)
callq 0xec78a
movl %eax, %r14d
movzbl %bpl, %ebp
movl %ebp, %edi
callq 0xec78a
movl %eax, %r12d
movzbl %r15b, %r15d
movl %r15d, %edi
callq 0xec78a
movzbl %r14b, %ecx
shll $0x10, %ecx
movzbl %r12b, %edx
shll $0x8, %edx
orl %ecx, %edx
movzbl %al, %eax
orl %edx, %eax
orl $0xff000000, %eax       # imm = 0xFF000000
movq 0x10(%rsp), %r14
movl %eax, 0x20(%r14,%r13,4)
movl $0x40, %esi
leaq 0x20(%rsp), %r12
movq %r12, %rdi
leaq 0xdf3ee(%rip), %rdx     # 0x110f98
movl 0x4(%rsp), %ecx
movl %ebp, %r8d
movl %r15d, %r9d
xorl %eax, %eax
callq 0xe8193
movl 0x20(%r14,%r13,4), %edx
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xe90a3
incq %r13
cmpq $0x10, %r13
jne 0x31ae4
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: do_read_font_data
static void do_read_font_data(deark *c, lctx *d, i64 pos)
{
	u32 crc;
	struct de_crcobj *crco;

	de_dbg(c, "font at %"I64_FMT", %"I64_FMT" bytes", pos, d->font_data_len);
	de_dbg_indent(c, 1);
	d->font_data = de_malloc(c, d->font_data_len);
	de_read(d->font_data, pos, d->font_data_len);

	crco = de_crcobj_create(c, DE_CRCOBJ_CRC32_IEEE);
	de_crcobj_addbuf(crco, d->font_data, d->font_data_len);
	crc = de_crcobj_getval(crco);
	de_crcobj_destroy(crco);

	d->is_standard_font = de_font_is_standard_vga_font(c, crc);
	de_dbg(c, "font crc: 0x%08x (%s)", (UI)crc,
		d->is_standard_font?"known CP437 font":"unrecognized");

	// TODO: This feature should probably be moved to the PSF module, or
	// removed.
	if(de_get_ext_option(c, "font:dumpvgafont")) {
		dbuf *df;
		df = dbuf_create_output_file(c, "font.dat", NULL, DE_CREATEFLAG_IS_AUX);
		dbuf_write(df, d->font_data, d->font_data_len);
		dbuf_close(df);
	}
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rsi), %rcx
leaq 0xe5664(%rip), %rsi     # 0x11726f
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, 0x18(%r14)
movq 0x18(%rbx), %rdi
movq 0x10(%r14), %rcx
movq %rax, %rsi
movq %r15, %rdx
callq 0xee8d4
movq %rbx, %rdi
movl $0x10, %esi
callq 0xeb499
movq %rax, %r15
movq 0x10(%r14), %rdx
movq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0xeb8ad
movq %r15, %rdi
callq 0xeb865
movl %eax, %ebp
movq %r15, %rdi
callq 0xeb858
movq %rbx, %rdi
movl %ebp, %esi
callq 0xf5736
movl %eax, 0x20(%r14)
testl %eax, %eax
leaq 0xe5622(%rip), %rax     # 0x1172ad
leaq 0xe560a(%rip), %rcx     # 0x11729c
cmoveq %rax, %rcx
leaq 0xe55e9(%rip), %rsi     # 0x117286
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0xe560a(%rip), %rsi     # 0x1172ba
movq %rbx, %rdi
callq 0xe9b74
testq %rax, %rax
je 0x31cee
leaq 0xe5607(%rip), %rsi     # 0x1172cb
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xefda1
movq %rax, %r15
movq 0x10(%r14), %rdx
movq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0xef547
movq %r15, %rdi
callq 0xf052b
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe8a15
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: do_generate_font
static int do_generate_font(deark *c, lctx *d)
{
	i64 i;
	struct de_encconv_state es;

	if(!d->font) return 0;
	if(d->font->num_chars!=256) {
		de_err(c, "Only 256-character fonts are supported");
		return 0;
	}
	if(d->font_data_len!=d->font->num_chars*d->font_height) {
		de_err(c, "Incorrect font data size");
		return 0;
	}
	d->font->nominal_width = 8;
	d->font->nominal_height = (int)d->font_height;
	d->font->char_array = de_mallocarray(c, d->font->num_chars, sizeof(struct de_bitmap_font_char));
	de_encconv_init(&es, DE_ENCODING_CP437_G);

	for(i=0; i<d->font->num_chars; i++) {
		d->font->char_array[i].codepoint_nonunicode = (i32)i;
		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->font_data[i*d->font_height];
	}

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq 0x28(%rsi), %rax
testq %rax, %rax
je 0x31ddb
cmpq $0x100, 0x18(%rax)      # imm = 0x100
jne 0x31ddf
movq %rsi, %rbx
movq 0x8(%rsi), %rcx
movq %rcx, %rdx
shlq $0x8, %rdx
cmpq %rdx, 0x10(%rsi)
jne 0x31de8
movl $0x8, (%rax)
movl %ecx, 0x4(%rax)
movl $0x100, %esi            # imm = 0x100
movl $0x28, %edx
callq 0xe96f7
movq 0x28(%rbx), %rcx
movq %rax, 0x20(%rcx)
movq %rsp, %rdi
movl $0xd, %esi
callq 0xebbf7
movq 0x28(%rbx), %rax
movl $0x1, %ebp
cmpq $0x0, 0x18(%rax)
jle 0x31df8
movq 0x20(%rax), %rcx
xorl %r12d, %r12d
movq %rsp, %r14
xorl %r15d, %r15d
movl %r15d, (%rcx,%r12)
movl %r15d, %edi
movq %r14, %rsi
callq 0xec0ad
movq 0x28(%rbx), %rdx
movq 0x20(%rdx), %rcx
movl %eax, 0x4(%rcx,%r12)
movq (%rdx), %rax
movq %rax, 0x8(%rcx,%r12)
movq $0x1, 0x18(%rcx,%r12)
movq 0x8(%rbx), %rax
imulq %r15, %rax
addq 0x18(%rbx), %rax
movq %rax, 0x20(%rcx,%r12)
incq %r15
addq $0x28, %r12
cmpq 0x18(%rdx), %r15
jl 0x31d8e
jmp 0x31df8
xorl %ebp, %ebp
jmp 0x31df8
leaq 0xe54ee(%rip), %rsi     # 0x1172d4
jmp 0x31def
leaq 0xe550c(%rip), %rsi     # 0x1172fb
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xe9295
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: do_extract_font
static void do_extract_font(deark *c, lctx *d)
{
	de_finfo *fi = NULL;

	if(!d->has_font || !d->font) return;
	fi = de_finfo_create(c);
	de_finfo_set_name_from_sz(c, fi, "font", 0, DE_ENCODING_ASCII);

	de_font_bitmap_font_to_image(c, d->font, fi, DE_CREATEFLAG_IS_AUX);

	de_finfo_destroy(c, fi);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpb $0x0, 0x3(%rsi)
je 0x31e65
movq %rsi, %r14
cmpq $0x0, 0x28(%rsi)
je 0x31e65
movq %rdi, %rbx
callq 0xea504
movq %rax, %r15
leaq 0x10494a(%rip), %rdx    # 0x136778
movq %rbx, %rdi
movq %rax, %rsi
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xea78f
movq 0x28(%r14), %rsi
movq %rbx, %rdi
movq %r15, %rdx
movl $0x1, %ecx
callq 0xf576f
movq %rbx, %rdi
movq %r15, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xea50e
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: free_lctx
static void free_lctx(deark *c, lctx *d)
{
	if(d->font) {
		de_free(c, d->font->char_array);
		de_destroy_bitmap_font(c, d->font);
	}
	de_free(c, d->font_data);
	de_free(c, d);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x28(%rsi), %rax
testq %rax, %rax
je 0x31e96
movq 0x20(%rax), %rsi
movq %r14, %rdi
callq 0xe8be2
movq 0x28(%rbx), %rsi
movq %r14, %rdi
callq 0xf536d
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xe8be2
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe8be2
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: tdc_decrunch_emit_char
static void tdc_decrunch_emit_char(deark *c, struct thedrawcom_ctx *tdc, u8 ch)
{
	if(!tdc->dc.prescan_mode) {
		dbuf_writebyte(tdc->unc_data, ch);
		dbuf_writebyte(tdc->unc_data, (u8)(tdc->dc.curr_blink_code |
			tdc->dc.curr_bg_code | tdc->dc.curr_fg_code));
	}
	if(tdc->dc.next_xpos > tdc->dc.max_xpos) {
		tdc->dc.max_xpos = tdc->dc.next_xpos;
	}
	if(tdc->dc.next_ypos > tdc->dc.max_ypos) {
		tdc->dc.max_ypos = tdc->dc.next_ypos;
	}
	if(ch!=0 && ch!=32 && tdc->dc.next_ypos>tdc->dc.ypos_of_last_nonblank) {
		tdc->dc.ypos_of_last_nonblank = tdc->dc.next_ypos;
	}
	tdc->dc.next_xpos++;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
cmpb $0x0, 0x58(%rdi)
jne 0x32149
movq 0x10(%rbx), %rdi
movzbl %bpl, %esi
callq 0xf0bd6
movb 0x5a(%rbx), %al
orb 0x5b(%rbx), %al
movq 0x10(%rbx), %rdi
orb 0x59(%rbx), %al
movzbl %al, %esi
callq 0xf0bd6
movq 0x60(%rbx), %rax
cmpq 0x70(%rbx), %rax
jle 0x32157
movq %rax, 0x70(%rbx)
movq 0x68(%rbx), %rcx
cmpq 0x78(%rbx), %rcx
jle 0x32165
movq %rcx, 0x78(%rbx)
testb $-0x21, %bpl
je 0x3217b
cmpq 0x80(%rbx), %rcx
jle 0x3217b
movq %rcx, 0x80(%rbx)
incq %rax
movq %rax, 0x60(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: aciddraw_id
static void aciddraw_id(deark *c, u8 b0, struct aciddraw_id_data *adi)
{
	de_zeromem(adi, sizeof(struct aciddraw_id_data));
	if(b0==0xe9) {
		adi->jmppos = de_geti16le(1) + 3;
	}
	else if(b0==0xeb) {
		adi->jmppos = de_getbyte(1) + 2;
	}
	else {
		return;
	}

	if(dbuf_memcmp(c->infile, adi->jmppos,
		(const void*)"\xb8\x03\x00\xcd\x10\xb4\x01\xb9\x00\x20\xcd\x10\xe8", 13))
	{
		return;
	}
	adi->is_aciddraw = 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
cmpl $0xeb, %esi
je 0x321c0
cmpl $0xe9, %esi
jne 0x321f5
movq 0x18(%r14), %rdi
movl $0x1, %esi
callq 0xeec55
movq %rax, %rsi
addq $0x3, %rsi
jmp 0x321d5
movq 0x18(%r14), %rdi
movl $0x1, %esi
callq 0xeead3
movzbl %al, %esi
addq $0x2, %rsi
movq %rsi, 0x8(%rbx)
movq 0x18(%r14), %rdi
leaq 0xe4dfa(%rip), %rdx     # 0x116fde
movl $0xd, %ecx
callq 0xefc85
testl %eax, %eax
jne 0x321f5
movb $0x1, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bintext.c
// Function: grabber_id_com
static void grabber_id_com(deark *c, u8 b0, struct grabber_id_data *gi)
{
	de_zeromem(gi, sizeof(struct grabber_id_data));

	if(b0==0xfb) {
		if(!dbuf_memcmp(c->infile, 1,
			(const void*)"\xbe\x81\x00\x8a\x4c\xff\x30\xed\x09\xc9\x74", 11)) {
			gi->is_grabber = 1;
			gi->fmt_class = 200;
		}
		return;
	}

	if(b0!=0xe9) return;
	gi->jmppos = de_geti16le(1) + 3;

	if(!dbuf_memcmp(c->infile, gi->jmppos,
		(const void*)"\xbe\x81\x00\xad\x80\xfc\x0d\x74\x17\x3c\x0d\x74", 12))
	{
		gi->is_grabber = 1;
		gi->fmt_class = 300;
		return;
	}
	if(!dbuf_memcmp(c->infile, gi->jmppos,
		(const void*)"\xbe\x81\x00\xfc\xad\x80\xfc\x0d\x74\x1c\x3c\x0d\x74", 13))
	{
		gi->is_grabber = 1;
		gi->fmt_class = 334;
		return;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
cmpl $0xe9, %esi
je 0x32246
cmpl $0xfb, %esi
jne 0x322a4
movq 0x18(%r14), %rdi
leaq 0xe4dc0(%rip), %rdx     # 0x116fec
movl $0x1, %esi
movl $0xb, %ecx
callq 0xefc85
testl %eax, %eax
jne 0x322a4
movl $0xc8, %eax
jmp 0x3229e
movq 0x18(%r14), %rdi
movl $0x1, %esi
callq 0xeec55
leaq 0x3(%rax), %rsi
movq %rsi, 0x8(%rbx)
movq 0x18(%r14), %rdi
leaq 0xe4d91(%rip), %rdx     # 0x116ff8
movl $0xc, %ecx
callq 0xefc85
testl %eax, %eax
je 0x32299
movq 0x18(%r14), %rdi
movq 0x8(%rbx), %rsi
leaq 0xe4d81(%rip), %rdx     # 0x117005
movl $0xd, %ecx
callq 0xefc85
testl %eax, %eax
jne 0x322a4
movl $0x14e, %eax            # imm = 0x14E
jmp 0x3229e
movl $0x12c, %eax            # imm = 0x12C
movb $0x1, (%rbx)
movl %eax, 0x4(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bmi.c
// Function: de_module_bmi
void de_module_bmi(deark *c, struct deark_module_info *mi)
{
	mi->id = "bmi";
	mi->desc = "Zoner BMI bitmap";
	mi->run_fn = de_run_bmi;
	mi->identify_fn = de_identify_bmi;
}

// Assembly:
leaq 0xe5365(%rip), %rax     # 0x117618
movq %rax, (%rsi)
leaq 0xe535f(%rip), %rax     # 0x11761c
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x322d8
movq %rax, 0x18(%rsi)
leaq 0x752(%rip), %rax       # 0x32a25
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bmi.c
// Function: read_palette
static void read_palette(deark *c, lctx *d, struct imageinfo *ii, i64 pos1)
{
	if(ii->num_pal_entries<1) return;
	de_dbg(c, "palette at %"I64_FMT", %d entries", pos1, (int)ii->num_pal_entries);
	de_dbg_indent(c, 1);
	de_read_palette_rgb(c->infile, pos1, ii->num_pal_entries, 4,
		ii->pal, 256, DE_GETRGBFLAG_BGR);
	de_dbg_indent(c, -1);
}

// Assembly:
movq 0x20(%rsi), %rcx
testq %rcx, %rcx
jle 0x32ac0
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xe4be6(%rip), %rsi     # 0x117653
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rdi
movq 0x20(%r14), %rdx
addq $0x28, %r14
movl $0x1, (%rsp)
movl $0x4, %ecx
movl $0x100, %r9d            # imm = 0x100
movq %r15, %rsi
movq %r14, %r8
callq 0xf2c4e
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xe8a15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/bmp.c
// Function: de_module_bmp
void de_module_bmp(deark *c, struct deark_module_info *mi)
{
	mi->id = "bmp";
	mi->desc = "BMP (Windows or OS/2 bitmap)";
	mi->run_fn = de_run_bmp;
	mi->identify_fn = de_identify_bmp;
}

// Assembly:
leaq 0xee697(%rip), %rax     # 0x121162
movq %rax, (%rsi)
leaq 0xe4e7b(%rip), %rax     # 0x117950
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x32af0
movq %rax, 0x18(%rsi)
leaq 0x16b5(%rip), %rax      # 0x341a0
movq %rax, 0x20(%rsi)
retq