LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/png.c
// Function: handler_pHYs
static void handler_pHYs(deark *c, lctx *d, struct handler_params *hp)
{
	i64 dx, dy;
	u8 u;
	const char *name;

	dx = de_getu32be(hp->dpos);
	dy = de_getu32be(hp->dpos+4);
	de_dbg(c, "density: %d"DE_CHAR_TIMES"%d", (int)dx, (int)dy);
	u = de_getbyte(hp->dpos+8);
	switch(u) {
	case 0: name="unspecified"; break;
	case 1: name="per meter"; break;
	default: name="?";
	}
	de_dbg(c, "units: %d (%s)", (int)u, name);
	if(u==1) {
		de_dbg(c, "approx. dpi: %.3f"DE_CHAR_TIMES"%.3f",
			(double)dx*0.0254, (double)dy*0.0254);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r12
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq (%rdx), %rsi
callq 0xef32a
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq (%r12), %rsi
addq $0x4, %rsi
callq 0xef32a
movq %rax, %r15
leaq 0x6e75d(%rip), %rsi     # 0x125392
movq %rbx, %rdi
movl %r14d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq (%r12), %rsi
addq $0x8, %rsi
callq 0xef0d5
movzbl %al, %ebp
cmpb $0x1, %bpl
leaq 0x80b55(%rip), %rax     # 0x1377b9
leaq 0x751fe(%rip), %rdx     # 0x12be69
cmoveq %rax, %rdx
testb %bpl, %bpl
leaq 0x7114c(%rip), %rcx     # 0x127dc5
cmovneq %rdx, %rcx
leaq 0x80b3f(%rip), %rsi     # 0x1377c3
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe9226
cmpb $0x1, %bpl
jne 0xb6cc9
cvtsi2sd %r14, %xmm0
movsd 0x5e61d(%rip), %xmm2    # 0x1152c0
cvtsi2sd %r15, %xmm1
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
leaq 0x80b1b(%rip), %rsi     # 0x1377d2
movq %rbx, %rdi
movb $0x2, %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xe9226
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/png.c
// Function: handler_sBIT
static void handler_sBIT(deark *c, lctx *d, struct handler_params *hp)
{
	const char *sbname[4];
	i64 i;

	sbname[0] = "red";
	sbname[1] = "green";
	sbname[2] = "blue";
	sbname[3] = "alpha";
	if(d->color_type==0 || d->color_type==4) {
		sbname[0] = "gray";
		sbname[1] = "alpha";
	}

	for(i=0; i<4 && i<hp->dlen; i++) {
		u8 n;
		n = de_getbyte(hp->dpos+i);
		de_dbg(c, "significant %s bits: %d", sbname[i], (int)n);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x869c8(%rip), %rax     # 0x13d6b2
movq %rax, (%rsp)
leaq 0x80af5(%rip), %rax     # 0x1377ea
movq %rax, 0x8(%rsp)
leaq 0x7408e(%rip), %rax     # 0x12ad8f
movq %rax, 0x10(%rsp)
leaq 0x80801(%rip), %rax     # 0x13750e
movq %rax, 0x18(%rsp)
movzbl 0x9(%rsi), %ecx
testb $-0x5, %cl
jne 0xb6d2b
leaq 0x5f565(%rip), %rcx     # 0x116287
movq %rcx, (%rsp)
movq %rax, 0x8(%rsp)
leaq 0x80abe(%rip), %r15     # 0x1377f0
xorl %r12d, %r12d
cmpq 0x8(%rbx), %r12
jge 0xb6d67
movq 0x18(%r14), %rdi
movq (%rbx), %rsi
addq %r12, %rsi
callq 0xef0d5
movq (%rsp,%r12,8), %rdx
movzbl %al, %ecx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xe9226
incq %r12
cmpq $0x4, %r12
jne 0xb6d35
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/png.c
// Function: handler_sRGB
static void handler_sRGB(deark *c, lctx *d, struct handler_params *hp)
{
	u8 intent;
	const char *name;

	if(hp->dlen<1) return;
	intent = de_getbyte(hp->dpos);
	switch(intent) {
	case 0: name="perceptual"; break;
	case 1: name="relative"; break;
	case 2: name="saturation"; break;
	case 3: name="absolute"; break;
	default: name="?";
	}
	de_dbg(c, "rendering intent: %d (%s)", (int)intent, name);
}

// Assembly:
cmpq $0x0, 0x8(%rdx)
jle 0xb6fe2
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq (%rdx), %rsi
callq 0xef0d5
movzbl %al, %edx
cmpb $0x3, %dl
ja 0xb6fe3
movl %edx, %eax
leaq 0x801fb(%rip), %rsi     # 0x1371d4
movslq (%rsi,%rax,4), %rcx
addq %rsi, %rcx
jmp 0xb6fea
retq
leaq 0x74e7f(%rip), %rcx     # 0x12be69
leaq 0x6f69f(%rip), %rsi     # 0x126690
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
jmp 0xe9226
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/png.c
// Function: handler_tIME
static void handler_tIME(deark *c, lctx *d, struct handler_params *hp)
{
	i64 yr;
	u8 mo, da, hr, mi, se;
	struct de_timestamp ts;
	char timestamp_buf[64];

	yr = de_getu16be(hp->dpos);
	mo = de_getbyte(hp->dpos+2);
	da = de_getbyte(hp->dpos+3);
	hr = de_getbyte(hp->dpos+4);
	mi = de_getbyte(hp->dpos+5);
	se = de_getbyte(hp->dpos+6);

	de_make_timestamp(&ts, yr, mo, da, hr, mi, se);
	ts.tzcode = DE_TZCODE_UTC;
	de_timestamp_to_string(&ts, timestamp_buf, sizeof(timestamp_buf), 0);
	de_dbg(c, "mod time: %s", timestamp_buf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq (%rdx), %rsi
callq 0xef169
movq %rax, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
addq $0x2, %rsi
callq 0xef0d5
movl %eax, %ebp
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
addq $0x3, %rsi
callq 0xef0d5
movl %eax, %r12d
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
addq $0x4, %rsi
callq 0xef0d5
movl %eax, %r13d
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
addq $0x5, %rsi
callq 0xef0d5
movl %eax, %r14d
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
addq $0x6, %rsi
callq 0xef0d5
movzbl %bpl, %edx
movzbl %r12b, %ecx
movzbl %r13b, %r8d
movzbl %r14b, %r9d
movzbl %al, %eax
movq %rax, (%rsp)
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0xeae97
movb $0x1, 0x1(%r14)
leaq 0x20(%rsp), %r15
movl $0x40, %edx
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0xeb4f8
leaq 0x679bf(%rip), %rsi     # 0x11ea87
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/png.c
// Function: handler_tRNS
static void handler_tRNS(deark *c, lctx *d, struct handler_params *hp)
{
	i64 r, g, b;

	if(d->color_type==0) {
		if(hp->dlen<2) return;
		r = de_getu16be(hp->dpos);
		de_dbg(c, "transparent color gray shade: %d", (int)r);
	}
	else if(d->color_type==2) {
		if(hp->dlen<6) return;
		r = de_getu16be(hp->dpos);
		g = de_getu16be(hp->dpos+2);
		b = de_getu16be(hp->dpos+4);
		de_dbg(c, "transparent color: (%d,%d,%d)", (int)r, (int)g, (int)b);
	}
	else if(d->color_type==3) {
		i64 i;
		u8 a;

		de_dbg(c, "number of alpha values: %d", (int)hp->dlen);
		if(c->debug_level<2) return;
		for(i=0; i<hp->dlen && i<256; i++) {
			a = de_getbyte(hp->dpos+i);
			de_dbg2(c, "alpha[%3d] = %d", (int)i, (int)a);
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
movzbl 0x9(%rsi), %eax
cmpl $0x3, %eax
je 0xb71a3
cmpl $0x2, %eax
je 0xb7141
testl %eax, %eax
jne 0xb7202
cmpq $0x2, 0x8(%r14)
jl 0xb7202
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
callq 0xef169
leaq 0x80749(%rip), %rsi     # 0x137873
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe9226
cmpq $0x6, 0x8(%r14)
jl 0xb7202
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
callq 0xef169
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
addq $0x2, %rsi
callq 0xef169
movq %rax, %r12
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
addq $0x4, %rsi
callq 0xef169
leaq 0x8070f(%rip), %rsi     # 0x137894
movq %rbx, %rdi
movl %r15d, %edx
movl %r12d, %ecx
movl %eax, %r8d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe9226
movl 0x8(%r14), %edx
leaq 0x80704(%rip), %rsi     # 0x1378b2
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
cmpl $0x2, (%rbx)
jl 0xb7202
cmpq $0x0, 0x8(%r14)
jle 0xb7202
leaq 0x80702(%rip), %r15     # 0x1378cd
xorl %r12d, %r12d
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
addq %r12, %rsi
callq 0xef0d5
movzbl %al, %ecx
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe93cf
cmpq $0xfe, %r12
ja 0xb7202
incq %r12
cmpq 0x8(%r14), %r12
jl 0xb71ce
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pnm.c
// Function: de_module_pnm
void de_module_pnm(deark *c, struct deark_module_info *mi)
{
	mi->id = "pnm";
	mi->desc = "Netpbm formats (PNM, PBM, PGM, PPM, PAM)";
	mi->run_fn = de_run_pnm;
	mi->identify_fn = de_identify_pnm;
}

// Assembly:
leaq 0x802dd(%rip), %rax     # 0x1379c0
movq %rax, (%rsi)
leaq 0x802d7(%rip), %rax     # 0x1379c4
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb7708
movq %rax, 0x18(%rsi)
leaq 0xaa6(%rip), %rax       # 0xb81a9
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pnm.c
// Function: identify_fmt
static int identify_fmt(deark *c, i64 pos)
{
	u8 buf[3];

	de_read(buf, pos, 3);
	if(buf[0]!='P') return 0;

	if(buf[1]=='7' && buf[2]==0x0a)
		return FMT_PAM;
	if(buf[1]>='1' && buf[1]<='6') {
		if(buf[2]==9 || buf[2]==10 || buf[2]==13 || buf[2]==32) {
			return (int)buf[1] - '0';
		}
	}
	return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rdx
movq 0x18(%rdi), %rdi
leaq 0xd(%rsp), %rbx
movl $0x3, %ecx
movq %rbx, %rsi
callq 0xeeee8
cmpb $0x50, (%rbx)
jne 0xb822c
movzbl 0xe(%rsp), %ecx
movl %ecx, %esi
xorb $0x37, %sil
movb 0xf(%rsp), %dl
movl %edx, %edi
xorb $0xa, %dil
movl $0x7, %eax
orb %sil, %dil
je 0xb822e
leal -0x31(%rcx), %eax
cmpb $0x5, %al
ja 0xb822c
movzbl %dl, %eax
cmpl $0x20, %eax
ja 0xb822c
movl %eax, %eax
movabsq $0x100002600, %rdx      # imm = 0x100002600
btq %rax, %rdx
movl $0x0, %eax
jae 0xb822e
addl $-0x30, %ecx
movl %ecx, %eax
jmp 0xb822e
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pnm.c
// Function: read_next_token
static int read_next_token(deark *c, lctx *d, struct page_ctx *pg,
	char *tokenbuf, size_t tokenbuflen)
{
	u8 b;
	size_t token_len = 0;
	int in_comment = 0;

	token_len = 0;
	while(1) {
		if(pg->hdr_parse_pos >= c->infile->len) return 0;

		if(token_len >= tokenbuflen) {
			return 0; // Token too long.
		}

		b = de_getbyte_p(&pg->hdr_parse_pos);

		if(in_comment) {
			if(b==10 || b==13) {
				in_comment = 0;
			}
			continue;
		}
		else if(b=='#') {
			in_comment = 1;
			continue;
		}
		else if(is_pnm_whitespace(b)) {
			if(token_len>0) {
				tokenbuf[token_len] = '\0';
				return 1;
			}
			else {
				continue; // Skip leading whitespace.
			}
		}
		else {
			// Append the character to the token.
			tokenbuf[token_len] = (char)b;
			token_len++;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movq 0x30(%rsi), %rax
movq 0x18(%rdi), %rdi
cmpq 0x18(%rdi), %rax
jge 0xb82ec
movq %rdx, %rbx
movq %rsi, %r14
addq $0x30, %r14
xorl %ebp, %ebp
xorl %r13d, %r13d
movb $0x1, %r12b
movq %r14, %rsi
callq 0xef14d
testb $0x1, %r12b
je 0xb827d
cmpb $0x23, %al
jne 0xb82a2
xorl %r12d, %r12d
jmp 0xb828b
cmpb $0xd, %al
sete %cl
cmpb $0xa, %al
sete %r12b
orb %cl, %r12b
movq (%r14), %rax
movq 0x18(%r15), %rdi
cmpq 0x18(%rdi), %rax
setge %al
orb %bpl, %al
testb $0x1, %al
je 0xb8266
jmp 0xb82ec
movzbl %al, %ecx
cmpl $0x20, %ecx
ja 0xb82e3
movl %ecx, %ecx
movabsq $0x100003e00, %rdx      # imm = 0x100003E00
btq %rcx, %rdx
jae 0xb82e3
testq %r13, %r13
jne 0xb82fd
xorl %r13d, %r13d
cmpq $0x64, %r13
setae %bpl
movq (%r14), %rcx
movq 0x18(%r15), %rdi
xorl %eax, %eax
cmpq 0x18(%rdi), %rcx
jge 0xb82ee
cmpq $0x63, %r13
jbe 0xb8263
jmp 0xb82ee
movb %al, (%rbx,%r13)
incq %r13
jmp 0xb82c4
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x0, (%rbx,%r13)
movl $0x1, %eax
jmp 0xb82ee
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pnm.c
// Function: pgm_ppm_ascii_handle_sample
static void pgm_ppm_ascii_handle_sample(struct pgm_ppm_ascii_ctx *actx)
{
	i64 v;

	actx->samplebuf[actx->samplebuf_used] = '\0'; // NUL terminate for de_atoi64()
	v = de_atoi64((const char*)actx->samplebuf);
	actx->samplebuf_used = 0;

	if(actx->intermed_nbytes_per_sample==1) {
		dbuf_writebyte(actx->intermed_img, (u8)v);
	}
	else {
		dbuf_writeu16be(actx->intermed_img, v);
	}

	actx->sample_count++;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0x20, %rdi
movq 0x18(%rbx), %rax
movb $0x0, 0x20(%rbx,%rax)
callq 0xea786
movq $0x0, 0x18(%rbx)
cmpb $0x1, (%rbx)
movq 0x10(%rbx), %rdi
jne 0xb8712
movzbl %al, %esi
callq 0xf11be
jmp 0xb871a
movq %rax, %rsi
callq 0xf15b0
incq 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/portfolio.c
// Function: de_module_pgx
void de_module_pgx(deark *c, struct deark_module_info *mi)
{
	mi->id = "pgx";
	mi->desc = "Atari Portfolio animation";
	mi->run_fn = de_run_pgx;
	mi->identify_fn = de_identify_pgx;
}

// Assembly:
leaq 0x7f42a(%rip), %rax     # 0x137b51
movq %rax, (%rsi)
leaq 0x7f424(%rip), %rax     # 0x137b55
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb874c
movq %rax, 0x18(%rsi)
leaq 0x242(%rip), %rax       # 0xb8989
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/portfolio.c
// Function: de_module_pf_pgf
void de_module_pf_pgf(deark *c, struct deark_module_info *mi)
{
	mi->id = "pf_pgf";
	mi->desc = "Atari Portfolio Graphics - uncompressed";
	mi->run_fn = de_run_pf_pgf;
	mi->identify_fn = de_identify_pf_pgf;
}

// Assembly:
leaq 0x7f1b9(%rip), %rax     # 0x137b6f
movq %rax, (%rsi)
leaq 0x7f1b6(%rip), %rax     # 0x137b76
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb89db
movq %rax, 0x18(%rsi)
leaq 0x40(%rip), %rax        # 0xb8a16
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/portfolio.c
// Function: de_module_pgc
void de_module_pgc(deark *c, struct deark_module_info *mi)
{
	mi->id = "pgc";
	mi->desc = "Atari Portfolio Graphics - compressed";
	mi->run_fn = de_run_pgc;
	mi->identify_fn = de_identify_pgc;
}

// Assembly:
leaq 0x7f153(%rip), %rax     # 0x137b9e
movq %rax, (%rsi)
leaq 0x7f14d(%rip), %rax     # 0x137ba2
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb8a70
movq %rax, 0x18(%rsi)
leaq 0xd3(%rip), %rax        # 0xb8b3e
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/portfolio.c
// Function: de_run_pgc
static void de_run_pgc(deark *c, de_module_params *mparams)
{
	dbuf *unc_pixels = NULL;
	i64 pos;
	i64 count;
	u8 b, b2;

	de_declare_fmt(c, "PGC (Portfolio graphics compressed)");
	unc_pixels = dbuf_create_membuf(c, 1920, 1);

	pos = 3;
	while(pos<c->infile->len) {
		b = de_getbyte(pos);
		pos++;
		count = (i64)(b & 0x7f);
		if(b & 0x80) {
			// compressed run
			b2 = de_getbyte(pos);
			pos++;
			dbuf_write_run(unc_pixels, b2, count);
		}
		else {
			// uncompressed run
			dbuf_copy(c->infile, pos, count, unc_pixels);
			pos += count;
		}
	}

	de_convert_and_write_image_bilevel(unc_pixels, 0, 240, 64, 240/8,
		DE_CVTF_WHITEISZERO, NULL, 0);
	dbuf_close(unc_pixels);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
leaq 0x7f23f(%rip), %rsi     # 0x137cc2
callq 0xeb6d6
movl $0x780, %esi            # imm = 0x780
movq %r14, %rdi
movl $0x1, %edx
callq 0xf0faf
movq %rax, %rbx
movq 0x18(%r14), %rdi
cmpq $0x4, 0x18(%rdi)
jl 0xb8b05
movl $0x3, %r15d
movq %r15, %rsi
callq 0xef0d5
leaq 0x1(%r15), %r13
movl %eax, %ecx
andb $0x7f, %cl
movzbl %cl, %r12d
movq 0x18(%r14), %rdi
testb %al, %al
js 0xb8ae1
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0xefabc
addq %r12, %r13
movq %r13, %r15
jmp 0xb8afb
movq %r13, %rsi
callq 0xef0d5
addq $0x2, %r15
movzbl %al, %esi
movq %rbx, %rdi
movq %r12, %rdx
callq 0xf14bd
movq 0x18(%r14), %rdi
cmpq 0x18(%rdi), %r15
jl 0xb8aae
movl $0xf0, %edx
movl $0x40, %ecx
movl $0x1e, %r8d
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %r9d
pushq $0x0
pushq $0x0
callq 0xf30d9
addq $0x10, %rsp
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xf0b13
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/printptnr.c
// Function: de_module_pp_gph
void de_module_pp_gph(deark *c, struct deark_module_info *mi)
{
	mi->id = "pp_gph";
	mi->desc = "PrintPartner .GPH";
	mi->run_fn = de_run_pp_gph;
	mi->identify_fn = de_identify_pp_gph;
}

// Assembly:
leaq 0x7f17b(%rip), %rax     # 0x137ce6
movq %rax, (%rsi)
leaq 0x7f178(%rip), %rax     # 0x137ced
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb8b90
movq %rax, 0x18(%rsi)
leaq 0x4d9(%rip), %rax       # 0xb9064
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/printptnr.c
// Function: do_write_image_fromuncpixels
static void do_write_image_fromuncpixels(deark *c, lctx *d, struct page_ctx *pg,
	dbuf *unc_pixels)
{
	de_bitmap *img = NULL;

	img = de_bitmap_create(c, pg->width, pg->height, 1);
	de_convert_image_bilevel(unc_pixels, 0, pg->width_raw, img, DE_CVTF_WHITEISZERO);
	do_write_image_frombitmap(c, d, pg, img);
	de_bitmap_destroy(img);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rsi), %rsi
movq 0x8(%r14), %rdx
movl $0x1, %ecx
callq 0xf2cab
movq %rax, %r12
movq 0x10(%r14), %rdx
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rcx
movl $0x1, %r8d
callq 0xf3081
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xb90fe
movq %r12, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xf28d4
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/printptnr.c
// Function: do_write_image_frombitmap
static void do_write_image_frombitmap(deark *c, lctx *d, struct page_ctx *pg,
	de_bitmap *img)
{
	de_finfo *fi = NULL;

	fi = de_finfo_create(c);
	fi->density.code = DE_DENSITY_UNK_UNITS;
	fi->density.xdens = 2;
	fi->density.ydens = 1;

	if(c->filenames_from_file && pg->imgname && (pg->imgname->len > 0)) {
		de_finfo_set_name_from_ucstring(c, fi, pg->imgname, 0);
	}
	de_bitmap_write_to_file_finfo(img, fi, DE_CREATEFLAG_IS_BWIMG);
	de_finfo_destroy(c, fi);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
callq 0xea9a9
movq %rax, %r15
movl $0x1, 0x78(%rax)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, 0x80(%r15)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x88(%r15)
cmpb $0x0, 0xd0(%rbx)
je 0xb9167
movq 0x20(%r12), %rdx
testq %rdx, %rdx
je 0xb9167
cmpq $0x0, 0x10(%rdx)
jle 0xb9167
movq %rbx, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0xea9e4
movq %r14, %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0xf2917
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xea9b3
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/packdir.c
// Function: de_module_packdir
void de_module_packdir(deark *c, struct deark_module_info *mi)
{
	mi->id = "packdir";
	mi->desc = "PackDir compressed archive format";
	mi->run_fn = de_run_packdir;
	mi->identify_fn = de_identify_packdir;
}

// Assembly:
leaq 0x7ec16(%rip), %rax     # 0x137dad
movq %rax, (%rsi)
leaq 0x7ec14(%rip), %rax     # 0x137db5
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb91bc
movq %rax, 0x18(%rsi)
leaq 0xee(%rip), %rax        # 0xb92a5
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/packdir.c
// Function: de_run_packdir
static void de_run_packdir(deark *c, de_module_params *mparams)
{
	struct pdctx_struct *d = NULL;
	i64 bytes_consumed;

	d = de_malloc(c, sizeof(struct pdctx_struct));

	if(!do_packdir_header(c, d)) goto done;
	d->curpath = de_strarray_create(c, MAX_NESTING_LEVEL+10);
	do_packdir_object(c, d, 9, 0, &bytes_consumed);

done:
	if(d) {
		de_strarray_destroy(d->curpath);
		de_free(c, d);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl $0x10, %esi
callq 0xe969b
movq %rax, %r14
leaq 0x8(%rsp), %r15
movq $0x0, (%r15)
leaq 0x69fb7(%rip), %rsi     # 0x12319f
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
addq $0x5, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef3a0
leal 0xc(%rax), %ecx
movl %ecx, (%r14)
leaq 0x7ebb9(%rip), %rsi     # 0x137dd7
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movl (%r14), %edx
cmpl $0x11, %edx
jb 0xb9252
leaq 0x7ebb7(%rip), %rsi     # 0x137df0
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
jmp 0xb9287
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movl $0x2a, %esi
movq %rbx, %rdi
callq 0xf7666
movq %rax, 0x8(%r14)
leaq 0x8(%rsp), %r8
movl $0x9, %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0xb92fa
movq 0x8(%r14), %rdi
callq 0xf7689
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/packdir.c
// Function: de_identify_packdir
static int de_identify_packdir(deark *c)
{
	i64 n;

	if(dbuf_memcmp(c->infile, 0, "PACK\0", 5)) return 0;
	n = de_getu32le(5);
	if(n<=4) return 100; // maxbits = 12...16
	if(n<=8) return 10; // Dunno what the "maxbits" limit is.
	return 0; // Could be Git pack format
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq 0x7ec14(%rip), %rdx     # 0x137ecb
xorl %ebx, %ebx
movl $0x5, %ecx
xorl %esi, %esi
callq 0xf025e
testl %eax, %eax
jne 0xb92f0
movq 0x18(%r14), %rdi
movl $0x5, %esi
callq 0xef37e
movl $0x64, %ebx
cmpq $0x5, %rax
jl 0xb92f0
xorl %ecx, %ecx
cmpq $0x9, %rax
movl $0xa, %ebx
cmovgel %ecx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pack.c
// Function: de_module_pack
void de_module_pack(deark *c, struct deark_module_info *mi)
{
	mi->id = "pack";
	mi->desc = "Unix pack (.z)";
	mi->run_fn = de_run_pack;
	mi->identify_fn = de_identify_pack;
}

// Assembly:
leaq 0x780b4(%rip), %rax     # 0x131a5f
movq %rax, (%rsi)
leaq 0x7e51c(%rip), %rax     # 0x137ed1
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb99d0
movq %rax, 0x18(%rsi)
leaq 0x3b5(%rip), %rax       # 0xb9d80
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/packit.c
// Function: de_module_packit
void de_module_packit(deark *c, struct deark_module_info *mi)
{
	mi->id = "packit";
	mi->desc = "PackIt";
	mi->run_fn = de_run_packit;
	mi->identify_fn = de_identify_packit;
}

// Assembly:
leaq 0x7e1d0(%rip), %rax     # 0x137fa7
movq %rax, (%rsi)
leaq 0x7e1cd(%rip), %rax     # 0x137fae
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb9dfc
movq %rax, 0x18(%rsi)
leaq 0x543(%rip), %rax       # 0xba33a
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/packit.c
// Function: de_identify_packit
static int de_identify_packit(deark *c)
{
	u8 t;

	if(dbuf_memcmp(c->infile, 0, (const void*)"PMa", 3)) {
		return 0;
	}
	t = de_getbyte(3);
	if(t=='g' || t=='4') return 100;
	if(t>='1' && t<='7') return 35;
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq 0x7dde8(%rip), %rdx     # 0x138134
xorl %ebx, %ebx
movl $0x3, %ecx
xorl %esi, %esi
callq 0xf025e
testl %eax, %eax
je 0xba368
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x18(%r14), %rdi
movl $0x3, %esi
callq 0xef0d5
movl $0x64, %ebx
cmpb $0x34, %al
je 0xba35e
movzbl %al, %ecx
cmpl $0x67, %ecx
je 0xba35e
addb $-0x31, %al
xorl %ecx, %ecx
cmpb $0x7, %al
movl $0x23, %ebx
cmovael %ecx, %ebx
jmp 0xba35e
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/packit.c
// Function: packit_destroy_pmd
static void packit_destroy_pmd(deark *c, struct packit_md *pmd)
{
	if(!pmd) return;
	dbuf_close(pmd->unc_data);
	de_destroy_stringreaderdata(c, pmd->fname);
	de_advfile_destroy(pmd->advf);
	de_free(c, pmd);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0xe8(%rsi), %rdi
callq 0xf0b13
movq 0x40(%rbx), %rsi
movq %r14, %rdi
callq 0xf00aa
movq 0x38(%rbx), %rdi
callq 0xfca9a
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe9752
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/packit.c
// Function: packit_scan_member_data
static void packit_scan_member_data(deark *c, struct packit_ctx *d,
	struct packit_md *pmd)
{
	u32 datarsrc_crc_reported;
	u32 datarsrc_crc_calc;

	if(pmd->rfork_pos + pmd->rfork_len + 2 > pmd->inf->len) {
		d->fatalerrflag = 1;
		d->need_errmsg = 1;
		goto done;
	}

	datarsrc_crc_reported = (u32)dbuf_getu16be(pmd->inf, pmd->rfork_pos +
		pmd->rfork_len);
	de_dbg(c, "data/resource crc (reported): 0x%04x", (UI)datarsrc_crc_reported);

	de_crcobj_reset(d->crco_datarsrc);
	de_crcobj_addslice(d->crco_datarsrc, pmd->inf, pmd->dfork_pos,
		pmd->dfork_len + pmd->rfork_len);
	datarsrc_crc_calc = de_crcobj_getval(d->crco_datarsrc);
	de_dbg(c, "data/resource crc (calculated): 0x%04x", (UI)datarsrc_crc_calc);
	if(datarsrc_crc_reported != datarsrc_crc_calc) {
		// TODO: Maybe should be a warning? Or nonfatal?
		de_err(c, "Bad data/resource CRC (reported 0x%04x, calculated 0x%04x)",
			(UI)datarsrc_crc_reported, (UI)datarsrc_crc_calc);
		d->fatalerrflag = 1;
		goto done;
	}

done:
	;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdx), %rdi
movq 0xd8(%rdx), %rax
movq 0xe0(%rdx), %rsi
leaq (%rsi,%rax), %rcx
addq $0x2, %rcx
cmpq 0x18(%rdi), %rcx
jle 0xba772
movw $0x101, (%rbx)          # imm = 0x101
jmp 0xba7ff
movq %rdx, %r12
addq %rax, %rsi
callq 0xef169
movq %rax, %r15
leaq 0x7d8f8(%rip), %rsi     # 0x13807f
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rbx), %rdi
callq 0xebdc3
movq 0x8(%rbx), %rdi
movq 0x18(%r12), %rsi
movq 0xc8(%r12), %rdx
movq 0xe0(%r12), %rcx
addq 0xd0(%r12), %rcx
callq 0xebf09
movq 0x8(%rbx), %rdi
callq 0xebe2a
movl %eax, %ebp
leaq 0x7d8cf(%rip), %rsi     # 0x1380a4
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
cmpl %r15d, %ebp
je 0xba7ff
leaq 0x7d8de(%rip), %rsi     # 0x1380cb
movq %r14, %rdi
movl %r15d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0xe9df7
movb $0x1, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pkm.c
// Function: de_module_pkm
void de_module_pkm(deark *c, struct deark_module_info *mi)
{
	mi->id = "pkm";
	mi->desc = "PKM (GrafX2)";
	mi->run_fn = de_run_pkm;
	mi->identify_fn = de_identify_pkm;
	mi->help_fn = de_help_pkm;
}

// Assembly:
leaq 0x7d8d9(%rip), %rax     # 0x138138
movq %rax, (%rsi)
leaq 0x7d8d3(%rip), %rax     # 0x13813c
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xba88f
movq %rax, 0x18(%rsi)
leaq 0x53a(%rip), %rax       # 0xbadb9
movq %rax, 0x20(%rsi)
leaq 0x555(%rip), %rax       # 0xbaddf
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: de_module_pklite
void de_module_pklite(deark *c, struct deark_module_info *mi)
{
	mi->id = "pklite";
	mi->desc = "PKLITE-compressed EXE/COM";
	mi->run_fn = de_run_pklite;
	mi->identify_fn = de_identify_pklite;
	mi->help_fn = de_help_pklite;
}

// Assembly:
leaq 0x7d67d(%rip), %rax     # 0x138474
movq %rax, (%rsi)
leaq 0x7d67a(%rip), %rax     # 0x13847b
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xbae27
movq %rax, 0x18(%rsi)
leaq 0x19d3(%rip), %rax      # 0xbc7ea
movq %rax, 0x20(%rsi)
leaq 0x1a77(%rip), %rax      # 0xbc899
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: de_identify_pklite
static int de_identify_pklite(deark *c)
{
	i64 verpos;

	if(c->infile->len>65280) return 0;
	if(detect_pklite_com_quick(c->infile, &verpos)) {
		if(pklite_com_has_copyright_string(c->infile, verpos)) {
			return 100;
		}
		// TODO: False positives may be possible. Maybe we should be more
		// discriminating.
		return 15;
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
cmpq $0xff00, 0x18(%rdi)     # imm = 0xFF00
jg 0xbc88f
leaq 0x10(%rsp), %rsi
callq 0xbdbdf
testl %eax, %eax
je 0xbc88f
movq 0x18(%r14), %rdi
movq 0x10(%rsp), %rdx
cmpq $0x26, %rdx
jne 0xbc84c
leaq 0x7c59c(%rip), %rdx     # 0x138dc8
movl $0x28, %esi
movl $0x8, %ecx
callq 0xf025e
testl %eax, %eax
movl $0x64, %eax
movl $0xf, %ebx
cmovel %eax, %ebx
jmp 0xbc88f
addq $0x2, %rdx
leaq 0xc(%rsp), %rbx
movl $0x4, %ecx
movq %rbx, %rsi
callq 0xeeee8
cmpb $0x50, (%rbx)
jne 0xbc88a
movb 0xd(%rsp), %al
andb $-0x21, %al
cmpb $0x4b, %al
jne 0xbc88a
movb 0xe(%rsp), %al
andb $-0x21, %al
cmpb $0x4c, %al
jne 0xbc88a
movb 0xf(%rsp), %al
andb $-0x21, %al
movl $0x64, %ebx
cmpb $0x49, %al
je 0xbc88f
movl $0xf, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: do_read_version_info
static void do_read_version_info(deark *c, lctx *d, i64 pos)
{
	UI ver_info;

	ver_info = (UI)de_getu16le(pos);
	info_bytes_to_version_struct(ver_info, &d->ver_reported);
	de_dbg(c, "reported PKLITE version: %s", d->ver_reported.pklver_str);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rdi
movq %rdx, %rsi
callq 0xef1ca
movl %eax, %ecx
andl $0xfff, %ecx            # imm = 0xFFF
movl %ecx, 0xe0(%rbx)
addq $0xe4, %rbx
shrl $0x8, %ecx
movzbl %al, %r8d
btl $0xe, %eax
leaq 0x882d6(%rip), %rdx     # 0x144bd0
leaq 0x7bd1a(%rip), %r9      # 0x13861b
cmovaeq %rdx, %r9
btl $0xd, %eax
leaq 0x7bd11(%rip), %rsi     # 0x138621
leaq 0x7bd07(%rip), %r10     # 0x13861e
cmovaeq %rsi, %r10
btl $0xc, %eax
leaq 0x7bcfe(%rip), %r11     # 0x138624
cmovaeq %rdx, %r11
leaq 0x7bcdc(%rip), %rdx     # 0x13860d
movl $0x28, %esi
movq %rbx, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0xe8d67
addq $0x10, %rsp
leaq 0x7bca2(%rip), %rsi     # 0x1385f1
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe9226
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: do_write_dcmpr
static void do_write_dcmpr(deark *c, lctx *d)
{
	dbuf *outf = NULL;
	i64 amt_to_copy;

	if(d->errflag || !d->guest_ei || !d->hdr_for_dcmpr_file || !d->dcmpr_code ||
		!d->guest_reloc_table)
	{
		return;
	}
	de_dbg(c, "generating decompressed EXE file");
	de_dbg_indent(c, 1);

	outf = dbuf_create_output_file(c, "exe", NULL, 0);
	d->wrote_exe = 1;

	// Write the original header, up to the relocation table
	amt_to_copy = de_min_int(d->hdr_for_dcmpr_file->len, d->guest_ei->reloc_table_pos);
	dbuf_copy(d->hdr_for_dcmpr_file, 0, amt_to_copy, outf);
	dbuf_truncate(outf, d->guest_ei->reloc_table_pos);

	// Write the relocation table
	dbuf_copy(d->guest_reloc_table, 0, d->guest_reloc_table->len, outf);

	// Pad up to the start of DOS code.
	// (Note that PKLITE does not record data between the end of the relocation
	// table, and the start of DOS code, so we can't reconstruct that.)
	dbuf_truncate(outf, d->guest_ei->start_of_dos_code);

	// Write the decompressed program code
	dbuf_copy(d->dcmpr_code, 0, d->dcmpr_code->len, outf);

	// "Overlay" segment
	if(d->host_ei->overlay_len>0) {
		if(outf->len == d->guest_ei->end_of_dos_code) {
			dbuf_copy(c->infile, d->host_ei->end_of_dos_code, d->host_ei->overlay_len, outf);
		}
		else {
			// We don't want to write the overlay to the wrong offset, but it's
			// not clear what to do here. This should not happen with pristine
			// files, but could happen if an overlay was added later.
			de_warn(c, "Overlay not copied to new file, due to inconsistent file "
				"structure");
		}
	}

	dbuf_close(outf);
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpb $0x0, (%rsi)
je 0xbd430
popq %rbx
popq %r14
popq %r15
retq
movq %rsi, %r14
cmpq $0x0, 0x28(%rsi)
je 0xbd42a
cmpq $0x0, 0xc8(%r14)
je 0xbd42a
cmpq $0x0, 0xd8(%r14)
je 0xbd42a
cmpq $0x0, 0xd0(%r14)
je 0xbd42a
movq %rdi, %rbx
leaq 0x7b7d4(%rip), %rsi     # 0x138c36
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0x662d8(%rip), %rsi     # 0x123755
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r15
movb $0x1, 0x3(%r14)
movq 0x28(%r14), %rax
movq 0xc8(%r14), %rcx
movq 0x18(%rcx), %rdi
movq 0x30(%rax), %rsi
callq 0xea792
movq 0xc8(%r14), %rdi
xorl %esi, %esi
movq %rax, %rdx
movq %r15, %rcx
callq 0xefabc
movq 0x28(%r14), %rax
movq 0x30(%rax), %rsi
movq %r15, %rdi
callq 0xf152a
movq 0xd0(%r14), %rdi
movq 0x18(%rdi), %rdx
xorl %esi, %esi
movq %r15, %rcx
callq 0xefabc
movq 0x28(%r14), %rax
movq 0x38(%rax), %rsi
movq %r15, %rdi
callq 0xf152a
movq 0xd8(%r14), %rdi
movq 0x18(%rdi), %rdx
xorl %esi, %esi
movq %r15, %rcx
callq 0xefabc
movq 0x20(%r14), %rax
movq 0x50(%rax), %rdx
testq %rdx, %rdx
jle 0xbd545
movq 0x18(%r15), %rcx
movq 0x28(%r14), %rsi
cmpq 0x48(%rsi), %rcx
jne 0xbd534
movq 0x18(%rbx), %rdi
movq 0x48(%rax), %rsi
movq %r15, %rcx
callq 0xefabc
jmp 0xbd545
leaq 0x7b71c(%rip), %rsi     # 0x138c57
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9b27
movq %r15, %rdi
callq 0xf0b13
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %r15
jmp 0xe9585
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: analyze_detect_extra_cmpr
static void analyze_detect_extra_cmpr(deark *c, lctx *d)
{
	int ret;
	i64 foundpos;

	if(d->decompr_pos==0 || d->approx_end_of_decompressor==0) {
		d->errflag = 1;
		goto done;
	}

	ret = pkl_search_match(d->epbytes, EPBYTES_LEN,
		d->decompr_pos, d->approx_end_of_decompressor,
		(const u8*)"\xad\x95\xb2\x10\x72\x08\xa4\xd1\xed\x4a\x74", 11, 0x3f,
		0, &foundpos);
	if(ret) {
		d->dparams.extra_cmpr = 0;
		goto done;
	}

	ret = pkl_search_match(d->epbytes, EPBYTES_LEN,
		d->decompr_pos, d->approx_end_of_decompressor,
		(const u8*)"\xad\x95\xb2\x10\x72\x0b\xac??\xaa\xd1\xed\x4a\x74", 14, 0x3f,
		0, &foundpos);
	if(ret) {
		if(d->epbytes[foundpos+7]==0x32 && d->epbytes[foundpos+8]==0xc2) {
			d->dparams.extra_cmpr = 1;
			goto done;
		}
		else if(d->epbytes[foundpos+7]==0xf6 && d->epbytes[foundpos+8]==0xd0) {
			// Customized "v1.23" format seen in files from RemoteAccess v1.11
			// BBS software by Andrew Milner / Continental Software.
			//  http://cd.textfiles.com/librisbritannia/
			//  https://archive.org/details/LibrisBritannia
			//   ... COMMUNIC/BULLETIN/3220A.ZIP
			//   ... COMMUNIC/BULLETIN/3220B.ZIP
			d->dparams.extra_cmpr = 2;
			goto done;
		}
	}

	d->errflag = 1;

done:
	if(!d->errflag) {
		de_dbg(c, "extra cmpr: %u", (UI)d->dparams.extra_cmpr);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x70(%rsi), %rax
testq %rax, %rax
je 0xbd673
movq 0x78(%r14), %rcx
testq %rcx, %rcx
je 0xbd673
leaq 0x10c(%r14), %r15
xorl %edi, %edi
testq %rax, %rax
cmovgq %rax, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
cmpq %rsi, %rcx
cmovlq %rcx, %rsi
subq %rdi, %rsi
cmpq $0xb, %rsi
jl 0xbd5dd
addq %r15, %rdi
leaq 0x7b305(%rip), %rdx     # 0x1388bf
leaq 0x8(%rsp), %r9
movl $0xb, %ecx
movl $0x3f, %r8d
callq 0xec044
testl %eax, %eax
je 0xbd5dd
movb $0x0, 0x18(%r14)
jmp 0xbd677
movq 0x70(%r14), %r12
movq 0x78(%r14), %rcx
xorl %eax, %eax
testq %r12, %r12
cmovleq %rax, %r12
movl $0x3e8, %esi            # imm = 0x3E8
cmpq %rsi, %rcx
cmovlq %rcx, %rsi
subq %r12, %rsi
movb $0x1, %bpl
cmpq $0xe, %rsi
jl 0xbd638
leaq (%r15,%r12), %rdi
leaq 0x7b2ba(%rip), %rdx     # 0x1388cb
leaq 0x8(%rsp), %r9
movl $0xe, %ecx
movl $0x3f, %r8d
callq 0xec044
testl %eax, %eax
je 0xbd636
addq 0x8(%rsp), %r12
xorl %ebp, %ebp
movq %r12, %rax
jmp 0xbd638
xorl %eax, %eax
testb %bpl, %bpl
jne 0xbd673
movzbl 0x7(%rax,%r15), %ecx
cmpl $0xf6, %ecx
je 0xbd664
cmpl $0x32, %ecx
jne 0xbd673
cmpb $-0x3e, 0x8(%rax,%r15)
jne 0xbd65f
movb $0x1, 0x18(%r14)
jmp 0xbd677
cmpb $-0xa, %cl
jne 0xbd673
cmpb $-0x30, 0x8(%rax,%r15)
jne 0xbd673
movb $0x2, 0x18(%r14)
jmp 0xbd677
movb $0x1, (%r14)
cmpb $0x0, (%r14)
jne 0xbd693
movzbl 0x18(%r14), %edx
leaq 0x7b251(%rip), %rsi     # 0x1388da
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: analyze_detect_obf_offsets
static void analyze_detect_obf_offsets(deark *c, lctx *d)
{
	i64 foundpos = 0;
	int ret;
	u8 has_obf_offsets = 0;

	if(!d->dparams.v120_cmpr) goto done;

	ret = pkl_search_match(d->epbytes, EPBYTES_LEN,
		d->decompr_pos+200, d->approx_end_of_decompressor,
		(const u8*)"\xac\x34?\x8a", 4, 0x3f,
		0, &foundpos);
	if(ret) {
		has_obf_offsets = 1;
		d->dparams.offset_xor_key = d->epbytes[foundpos+2];
	}

done:
	if(d->dparams.v120_cmpr) {
		de_dbg(c, "obfuscated offsets: %u", (UI)has_obf_offsets);
		if(has_obf_offsets) {
			de_dbg_indent(c, 1);
			de_dbg(c, "offsets key: 0x%02x", (UI)d->dparams.offset_xor_key);
			de_dbg_indent(c, -1);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorl %ebp, %ebp
cmpb $0x0, 0x1a(%rsi)
je 0xbd849
movq 0x70(%r14), %rax
movq 0x78(%r14), %rcx
cmpq $-0xc7, %rax
movq $-0xc8, %r13
cmovgeq %rax, %r13
leaq 0xc8(%r13), %rax
movl $0x3e8, %esi            # imm = 0x3E8
cmpq %rsi, %rcx
cmovlq %rcx, %rsi
subq %rax, %rsi
movb $0x1, %r15b
movl $0x2, %r12d
cmpq $0x4, %rsi
jge 0xbd84e
movb $0x1, %cl
jmp 0xbd889
movb $0x1, %r15b
jmp 0xbd8a1
leaq 0x10c(%r14), %rdi
addq %rax, %rdi
leaq 0x7b0b6(%rip), %rdx     # 0x138915
movq %rsp, %r9
movl $0x4, %ecx
movl $0x3f, %r8d
callq 0xec044
movb $0x1, %cl
testl %eax, %eax
je 0xbd889
movq (%rsp), %rax
leaq (%rax,%r13), %r12
addq $0xca, %r12
xorl %ecx, %ecx
testb %cl, %cl
jne 0xbd8a1
movb 0x10c(%r14,%r12), %al
movb %al, 0x1b(%r14)
movl $0x1, %ebp
xorl %r15d, %r15d
cmpb $0x0, 0x1a(%r14)
je 0xbd8f0
leaq 0x7b06b(%rip), %rsi     # 0x13891a
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe9226
testb %r15b, %r15b
jne 0xbd8f0
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movzbl 0x1b(%r14), %edx
leaq 0x7b058(%rip), %rsi     # 0x138931
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: analyze_detect_psp_sig
static void analyze_detect_psp_sig(deark *c, lctx *d)
{
	int ret;
	i64 foundpos;
	const u8 *pattern;

	if(d->decompr_pos==0 || d->approx_end_of_decompressor==0) {
		goto done;
	}

	// It's kind of overkill to always do this search, and always look for both
	// signatures. We could probably be much more discriminiating, e.g. by
	// by using the apparent correspondence to scramble_method. But we would
	// risk false negatives.

	pattern = (const u8*)"\xc7\x06\x5c\x00\x70\x6b"; // "pk"
	ret = pkl_search_match(d->epbytes, EPBYTES_LEN,
		d->decompr_pos, d->approx_end_of_decompressor,
		pattern, 6, 0x3f, 0, &foundpos);
	if(ret) {
		d->has_psp_sig = 1;
		d->psp_sig_type = 2;
		goto done;
	}

	pattern = (const u8*)"\xc7\x06\x5c\x00\x50\x4b"; // "PK"
	ret = pkl_search_match(d->epbytes, EPBYTES_LEN,
		d->decompr_pos, d->approx_end_of_decompressor,
		pattern, 6, 0x3f, 0, &foundpos);
	if(ret) {
		d->has_psp_sig = 1;
		d->psp_sig_type = 1;
	}

done:
	;
}

// Assembly:
movq 0x70(%rdi), %rax
testq %rax, %rax
je 0xbd9c5
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x78(%rdi), %rcx
testq %rcx, %rcx
je 0xbd9be
leaq 0x10c(%rbx), %r14
xorl %edi, %edi
testq %rax, %rax
cmovgq %rax, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
cmpq %rsi, %rcx
cmovlq %rcx, %rsi
subq %rdi, %rsi
cmpq $0x6, %rsi
jl 0xbd96e
addq %r14, %rdi
leaq 0x7a9cd(%rip), %rdx     # 0x13831c
movq %rsp, %r9
movl $0x6, %ecx
movl $0x3f, %r8d
callq 0xec044
testl %eax, %eax
je 0xbd96e
movw $0x201, 0x8(%rbx)       # imm = 0x201
jmp 0xbd9be
movq 0x70(%rbx), %rcx
movq 0x78(%rbx), %rdx
xorl %eax, %eax
testq %rcx, %rcx
cmovgq %rcx, %rax
movl $0x3e8, %esi            # imm = 0x3E8
cmpq %rsi, %rdx
cmovlq %rdx, %rsi
subq %rax, %rsi
cmpq $0x6, %rsi
jl 0xbd9be
addq %rax, %r14
leaq 0x7a985(%rip), %rdx     # 0x138323
movq %rsp, %r9
movl $0x6, %ecx
movq %r14, %rdi
movl $0x3f, %r8d
callq 0xec044
testl %eax, %eax
je 0xbd9be
movw $0x101, 0x8(%rbx)       # imm = 0x101
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: fill_bitbuf
static void fill_bitbuf(deark *c, struct decompr_internal_state *dctx)
{
	UI i;

	if(dctx->d->errflag) return;
	if(dctx->dcmpr_cur_ipos+2 > dctx->inf->len) {
		de_err(c, "Unexpected end of file during decompression");
		dctx->d->errflag = 1;
		dctx->d->errmsg_handled = 1;
		return;
	}

	for(i=0; i<2; i++) {
		u8 b;
		b = dbuf_getbyte_p(dctx->inf, &dctx->dcmpr_cur_ipos);
		de_bitbuf_lowlevel_add_byte(&dctx->bbll, b);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq (%rsi), %rax
cmpb $0x0, (%rax)
jne 0xbda43
movq %rsi, %rbx
movq 0x8(%rsi), %rax
movq 0x28(%rsi), %rcx
addq $0x2, %rcx
cmpq 0x18(%rax), %rcx
jle 0xbda1b
leaq 0x7b033(%rip), %rsi     # 0x138a3d
xorl %eax, %eax
callq 0xe9df7
movq (%rbx), %rax
movw $0x101, (%rax)          # imm = 0x101
jmp 0xbda43
leaq 0x28(%rbx), %r14
leaq 0x30(%rbx), %r15
movl $0x1, %ebp
movq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0xef14d
movzbl %al, %esi
movq %r15, %rdi
callq 0xf21e9
decl %ebp
je 0xbda28
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: pklite_getbit
static u8 pklite_getbit(deark *c, struct decompr_internal_state *dctx)
{
	u8 v;

	if(dctx->d->errflag) return 0;
	v = (u8)de_bitbuf_lowlevel_get_bits(&dctx->bbll, 1);

	if(dctx->bbll.nbits_in_bitbuf==0) {
		fill_bitbuf(c, dctx);
	}

	return v;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rsi), %rax
cmpb $0x0, (%rax)
je 0xbda5f
xorl %ebx, %ebx
jmp 0xbda88
movq %rsi, %r14
movq %rdi, %r15
leaq 0x30(%rsi), %rdi
movl $0x1, %esi
callq 0xf221e
movq %rax, %rbx
cmpl $0x0, 0x34(%r14)
jne 0xbda88
movq %r15, %rdi
movq %r14, %rsi
callq 0xbd9df
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: read_pklite_code_using_tree
static UI read_pklite_code_using_tree(deark *c, struct decompr_internal_state *dctx,
	struct fmtutil_huffman_decoder *ht)
{
	int ret;
	fmtutil_huffman_valtype val = 0;

	while(1) {
		u8 b;

		b = pklite_getbit(c, dctx);
		if(dctx->d->errflag) goto done;

		ret = fmtutil_huffman_decode_bit(ht->bk, ht->cursor, b, &val);
		if(ret==1) goto done; // finished the code
		if(ret!=2) {
			dctx->d->errflag = 1;
			goto done;
		}
	}
done:
	return val;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x4(%rsp), %r12
movl $0x0, (%r12)
movq %r15, %rdi
movq %rbx, %rsi
callq 0xbda4e
movq (%rbx), %rcx
cmpb $0x0, (%rcx)
jne 0xbdae3
movq (%r14), %rsi
movq 0x8(%r14), %rdi
movzbl %al, %edx
movq %r12, %rcx
callq 0x104aea
cmpl $0x2, %eax
je 0xbdaae
cmpl $0x1, %eax
je 0xbdae3
movq (%rbx), %rax
movb $0x1, (%rax)
movl 0x4(%rsp), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: huffman_make_tree_from_u16array
static void huffman_make_tree_from_u16array(deark *c,
	struct fmtutil_huffman_decoder **htp,
	const u16 *lengths_and_codes, UI ncodes,
	const char *dbgtitle)
{
	UI n;
	char b2buf[72];

	if(*htp) return;
	*htp = fmtutil_huffman_create_decoder(c, ncodes, ncodes);
	if(dbgtitle) {
		de_dbg3(c, "[%s codebook]", dbgtitle);
	}
	de_dbg_indent(c, 1);
	for(n=0; n<ncodes; n++) {
		UI nbits;
		u64 code;

		nbits = ((UI)lengths_and_codes[n])>>12;
		code = ((u64)lengths_and_codes[n]) & 0x0fff;

		if(dbgtitle && c->debug_level>=3) {
			de_dbg3(c, "code: \"%s\" = %d",
				de_print_base2_fixed(b2buf, sizeof(b2buf), code, nbits), (int)n);
		}
		fmtutil_huffman_add_code(c, (*htp)->bk, code, nbits,
			(fmtutil_huffman_valtype)n);
	}
	de_dbg_indent(c, -1);
}

// Assembly:
cmpq $0x0, (%rsi)
je 0xbdafa
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, %r13
movl %ecx, %ebx
movq %rsi, %r12
movq %rdi, %r14
movq %rdx, 0x8(%rsp)
movl %ecx, %edx
movq %rdx, %rsi
movq %rdx, (%rsp)
callq 0x105165
movq %rax, (%r12)
testq %r13, %r13
je 0xbdb43
leaq 0x7aef9(%rip), %rsi     # 0x138a2f
movq %r14, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0xe9461
movq %r14, %rdi
movl $0x1, %esi
callq 0xe9585
testl %ebx, %ebx
je 0xbdbc3
xorl %ebp, %ebp
movq 0x8(%rsp), %rax
movzwl (%rax,%rbp,2), %r15d
movl %r15d, %ebx
shrl $0xc, %ebx
andl $0xfff, %r15d           # imm = 0xFFF
testq %r13, %r13
je 0xbdba2
cmpl $0x3, (%r14)
jl 0xbdba2
movl $0x48, %esi
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
movl %ebx, %ecx
callq 0xea85a
movq %r14, %rdi
leaq 0x607be(%rip), %rsi     # 0x11e354
movq %rax, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0xe9461
movq (%r12), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdi
movq %r15, %rdx
movl %ebx, %ecx
movl %ebp, %r8d
callq 0x104901
incq %rbp
cmpq %rbp, (%rsp)
jne 0xbdb56
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pklite.c
// Function: detect_pklite_com_quick
static int detect_pklite_com_quick(dbuf *f, i64 *pverpos)
{
	u8 b[10];

	dbuf_read(f, b, 0, sizeof(b));
	if(b[0]==0xb8 && b[3]==0xba && b[6]==0x3b && b[7]==0xc4) {
		if(b[9]==0x67) { // Probably v1.00-1.14
			*pverpos = 44;
			return 1;
		}
		else if(b[9]==0x69) { // Probably v1.15 (usually mislabeled as 1.14)
			*pverpos = 46;
			return 1;
		}
	}
	else if(b[0]==0x50 && b[1]==0xb8 && b[4]==0xba && b[7]==0x3b) {
		*pverpos = 46; // v1.50-2.01
		return 1;
	}
	else if(b[0]==0xba && b[3]==0xa1 && b[6]==0x2d && b[7]==0x20) {
		*pverpos = 36; // v1.00beta
		return 1;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
xorl %r14d, %r14d
leaq 0x6(%rsp), %r15
movl $0xa, %ecx
movq %r15, %rsi
xorl %edx, %edx
callq 0xeeee8
movb (%r15), %dl
movb 0x3(%r15), %al
movl %edx, %ecx
xorb $-0x48, %cl
movl %eax, %esi
xorb $-0x46, %sil
orb %cl, %sil
movb 0x6(%r15), %cl
movl %ecx, %edi
xorb $0x3b, %dil
orb %sil, %dil
movb 0x7(%r15), %sil
movl %esi, %r8d
xorb $-0x3c, %r8b
orb %dil, %r8b
jne 0xbdc4a
movzbl 0xf(%rsp), %eax
cmpl $0x67, %eax
je 0xbdc98
cmpl $0x69, %eax
jne 0xbdca6
movl $0x2e, %edi
jmp 0xbdc9d
movl %edx, %edi
xorb $0x50, %dil
movb 0x7(%rsp), %r8b
movb 0xa(%rsp), %r9b
xorb $-0x48, %r8b
orb %dil, %r8b
xorb $-0x46, %r9b
orb %r8b, %r9b
movl %esi, %r8d
xorb $0x3b, %r8b
movl $0x2e, %edi
orb %r9b, %r8b
je 0xbdc9d
xorb $-0x46, %dl
xorb $-0x5f, %al
orb %dl, %al
xorb $0x2d, %cl
orb %al, %cl
xorb $0x20, %sil
xorl %r14d, %r14d
movl $0x24, %edi
orb %cl, %sil
je 0xbdc9d
jmp 0xbdca6
movl $0x2c, %edi
movq %rdi, (%rbx)
movl $0x1, %r14d
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pif.c
// Function: de_module_pif
void de_module_pif(deark *c, struct deark_module_info *mi)
{
	mi->id = "pif";
	mi->desc = "Windows Program Information File";
	mi->identify_fn = de_identify_pif;
	mi->run_fn = de_run_pif;
	mi->help_fn = de_help_pif;
}

// Assembly:
leaq 0x7b164(%rip), %rax     # 0x138e1f
movq %rax, (%rsi)
leaq 0x7b15e(%rip), %rax     # 0x138e23
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xbdceb
movq %rax, 0x20(%rsi)
leaq 0x88(%rip), %rax        # 0xbdd63
movq %rax, 0x18(%rsi)
leaq 0x84(%rip), %rax        # 0xbdd6a
movq %rax, 0x28(%rsi)
retq