LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/png.c
// Function: handler_caNv
static void handler_caNv(deark *c, lctx *d, struct handler_params *hp)
{
	i64 x0, x1;

	if(hp->dlen<16) return;
	x0 = de_geti32be(hp->dpos);
	x1 = de_geti32be(hp->dpos+4);
	de_dbg(c, "caNv dimensions: %dx%d", (int)x0, (int)x1);
	x0 = de_geti32be(hp->dpos+8);
	x1 = de_geti32be(hp->dpos+12);
	de_dbg(c, "caNv position: %d,%d", (int)x0, (int)x1);
}

// Assembly:
cmpq $0x10, 0x8(%rdx)
jge 0xb568d
retq
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq (%rdx), %rsi
callq 0xeedae
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
addq $0x4, %rsi
callq 0xeedae
leaq 0x822ac(%rip), %rsi     # 0x13796a
movq %rbx, %rdi
movl %r15d, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
addq $0x8, %rsi
callq 0xeedae
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
addq $0xc, %rsi
callq 0xeedae
leaq 0x8228a(%rip), %rsi     # 0x137981
movq %rbx, %rdi
movl %r15d, %edx
movl %eax, %ecx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0xe8617
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/png.c
// Function: handler_eXIf
static void handler_eXIf(deark *c, lctx *d, struct handler_params *hp)
{
	i64 pos = hp->dpos;
	i64 len = hp->dlen;

	if(len>=6 && !dbuf_memcmp(c->infile, pos, "Exif\0", 5)) {
		// Some versions of the PNG-Exif proposal had the Exif data starting with
		// an "Exif\0\0" identifier, and some files were created in this format.
		// So we'll support it.
		de_dbg(c, "[skipping JPEG app ID]");
		pos += 6;
		len -= 6;
	}
	if(len<8) return;

	fmtutil_handle_exif(c, pos, len);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x8(%rdx), %rbx
cmpq $0x6, %rbx
jl 0xb575b
movq %rdi, %r14
movq (%rdx), %r15
movq 0x18(%rdi), %rdi
leaq 0x81de9(%rip), %rdx     # 0x137514
movl $0x5, %ecx
movq %r15, %rsi
callq 0xefc85
testl %eax, %eax
jne 0xb5755
leaq 0x82253(%rip), %rsi     # 0x137996
movq %r14, %rdi
xorl %eax, %eax
callq 0xe8617
addq $0x6, %r15
addq $-0x6, %rbx
cmpq $0x8, %rbx
jae 0xb5761
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0xf7a67
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/png.c
// Function: handler_fcTL
static void handler_fcTL(deark *c, lctx *d, struct handler_params *hp)
{
	i64 n1, n2;
	i64 pos = hp->dpos;
	u8 b;

	d->found_fcTL = 1;
	finish_APNG_frame(c, d); // Finished previous frame
	if(hp->dlen<26) return;
	do_APNG_seqno(c, d, pos);
	pos += 4;
	d->curr_fcTL_width = de_getu32be_p(&pos);
	d->curr_fcTL_height = de_getu32be_p(&pos);
	de_dbg_dimensions(c, d->curr_fcTL_width, d->curr_fcTL_height);
	n1 = de_getu32be_p(&pos);
	n2 = de_getu32be_p(&pos);
	de_dbg(c, "offset: (%u, %u)", (unsigned int)n1, (unsigned int)n2);
	n1 = de_getu16be_p(&pos);
	n2 = de_getu16be_p(&pos);
	de_dbg(c, "delay: %d/%d seconds", (int)n1, (int)n2);
	b = de_getbyte_p(&pos);
	de_dbg(c, "disposal type: %u (%s)", (unsigned int)b, get_apng_disp_name(b));
	b = de_getbyte_p(&pos);
	de_dbg(c, "blend type: %u (%s)", (unsigned int)b, get_apng_blend_name(b));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdx), %r12
movb $0x1, 0xd(%rsi)
movq %rsi, %rdi
callq 0xb4ed6
cmpq $0x1a, 0x8(%r14)
jl 0xb58d3
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeed0d
leaq 0x8224c(%rip), %rsi     # 0x1379fe
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
addq $0x4, %r12
movq %rsp, %r14
movq %r12, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed31
movq %rax, 0x20(%r15)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed31
movq %rax, 0x28(%r15)
movq 0x20(%r15), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xe8f88
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed31
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed31
leaq 0x82194(%rip), %rsi     # 0x1379ad
movq %rbx, %rdi
movl %r15d, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb91
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb91
leaq 0x82174(%rip), %rsi     # 0x1379be
movq %rbx, %rdi
movl %r15d, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %edx
leaq 0x768e2(%rip), %r14     # 0x12c151
movq %r14, %rcx
cmpb $0x2, %dl
ja 0xb5887
movl %edx, %eax
leaq 0x81cd8(%rip), %rsi     # 0x137558
movslq (%rsi,%rax,4), %rcx
addq %rsi, %rcx
leaq 0x82145(%rip), %rsi     # 0x1379d3
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %rsp, %rsi
callq 0xeeb4b
movzbl %al, %edx
cmpb $0x1, %dl
leaq 0x72781(%rip), %rax     # 0x128032
cmoveq %rax, %r14
testb %dl, %dl
leaq 0x78c3e(%rip), %rcx     # 0x12e4fc
cmovneq %r14, %rcx
leaq 0x82121(%rip), %rsi     # 0x1379ea
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/png.c
// Function: handler_hIST
static void handler_hIST(deark *c, lctx *d, struct handler_params *hp)
{
	i64 i;
	i64 v;
	i64 nentries = hp->dlen/2;

	de_dbg(c, "number of histogram values: %d", (int)nentries);
	if(c->debug_level<2) return;
	for(i=0; i<nentries; i++) {
		v = de_getu16be(hp->dpos+i*2);
		de_dbg2(c, "freq[%3d] = %d", (int)i, (int)v);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movq 0x8(%rdx), %r12
movq %r12, %r15
shrq $0x3f, %r15
addq %r12, %r15
sarq %r15
leaq 0x81f1e(%rip), %rsi     # 0x137a20
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
cmpl $0x2, (%r14)
setl %al
cmpq $0x2, %r12
setl %cl
orb %al, %cl
jne 0xb5b57
leaq 0x81f1a(%rip), %r12     # 0x137a3f
xorl %ebp, %ebp
xorl %r13d, %r13d
movq 0x18(%r14), %rdi
movq (%rbx), %rsi
addq %rbp, %rsi
callq 0xeeb67
movq %r14, %rdi
movq %r12, %rsi
movl %r13d, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe87e4
incq %r13
addq $0x2, %rbp
cmpq %r13, %r15
jne 0xb5b2a
addq $0x8, %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/png.c
// Function: handler_htSP
static void handler_htSP(deark *c, lctx *d, struct handler_params *hp)
{
	i64 hotspot_x, hotspot_y;

	if(hp->dlen<24) return;
	hotspot_x = de_geti32be(hp->dpos+16);
	hotspot_y = de_geti32be(hp->dpos+20);
	de_dbg(c, "hotspot: (%d, %d)", (int)hotspot_x, (int)hotspot_y);
}

// Assembly:
cmpq $0x18, 0x8(%rdx)
jge 0xb5b6e
retq
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq (%rdx), %rsi
addq $0x10, %rsi
callq 0xeedae
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
addq $0x14, %rsi
callq 0xeedae
leaq 0x73773(%rip), %rsi     # 0x129316
movq %rbx, %rdi
movl %r15d, %edx
movl %eax, %ecx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0xe8617
// File: /workspace/github_c_makefile_star2_O3/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 0xeed0d
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq (%r12), %rsi
addq $0x4, %rsi
callq 0xeed0d
movq %rax, %r15
leaq 0x6f509(%rip), %rsi     # 0x1255c2
movq %rbx, %rdi
movl %r14d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq (%r12), %rsi
addq $0x8, %rsi
callq 0xeead3
movzbl %al, %ebp
cmpb $0x1, %bpl
leaq 0x81a59(%rip), %rax     # 0x137b41
leaq 0x76062(%rip), %rdx     # 0x12c151
cmoveq %rax, %rdx
testb %bpl, %bpl
leaq 0x71ef8(%rip), %rcx     # 0x127ff5
cmovneq %rdx, %rcx
leaq 0x81a43(%rip), %rsi     # 0x137b4b
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
cmpb $0x1, %bpl
jne 0xb614d
cvtsi2sd %r14, %xmm0
movsd 0x5f249(%rip), %xmm2    # 0x115370
cvtsi2sd %r15, %xmm1
mulsd %xmm2, %xmm0
mulsd %xmm2, %xmm1
leaq 0x81a1f(%rip), %rsi     # 0x137b5a
movq %rbx, %rdi
movb $0x2, %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xe8617
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x87944(%rip), %rax     # 0x13dab2
movq %rax, (%rsp)
leaq 0x819f9(%rip), %rax     # 0x137b72
movq %rax, 0x8(%rsp)
leaq 0x74eda(%rip), %rax     # 0x12b05f
movq %rax, 0x10(%rsp)
leaq 0x81705(%rip), %rax     # 0x137896
movq %rax, 0x18(%rsp)
movzbl 0x9(%rsi), %ecx
testb $-0x5, %cl
jne 0xb61af
leaq 0x60191(%rip), %rcx     # 0x116337
movq %rcx, (%rsp)
movq %rax, 0x8(%rsp)
leaq 0x819c2(%rip), %r15     # 0x137b78
xorl %r12d, %r12d
cmpq 0x8(%rbx), %r12
jge 0xb61eb
movq 0x18(%r14), %rdi
movq (%rbx), %rsi
addq %r12, %rsi
callq 0xeead3
movq (%rsp,%r12,8), %rdx
movzbl %al, %ecx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xe8617
incq %r12
cmpq $0x4, %r12
jne 0xb61b9
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xb6466
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq (%rdx), %rsi
callq 0xeead3
movzbl %al, %edx
cmpb $0x3, %dl
ja 0xb6467
movl %edx, %eax
leaq 0x81107(%rip), %rsi     # 0x137564
movslq (%rsi,%rax,4), %rcx
addq %rsi, %rcx
jmp 0xb646e
retq
leaq 0x75ce3(%rip), %rcx     # 0x12c151
leaq 0x7044b(%rip), %rsi     # 0x1268c0
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
jmp 0xe8617
// File: /workspace/github_c_makefile_star2_O3/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 0xeeb67
movq %rax, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
addq $0x2, %rsi
callq 0xeead3
movl %eax, %ebp
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
addq $0x3, %rsi
callq 0xeead3
movl %eax, %r12d
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
addq $0x4, %rsi
callq 0xeead3
movl %eax, %r13d
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
addq $0x5, %rsi
callq 0xeead3
movl %eax, %r14d
movq 0x18(%rbx), %rdi
movq (%r15), %rsi
addq $0x6, %rsi
callq 0xeead3
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 0xea98e
movb $0x1, 0x1(%r14)
leaq 0x20(%rsp), %r15
movl $0x40, %edx
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0xeaf46
leaq 0x68643(%rip), %rsi     # 0x11eb8f
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xe8617
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/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 0xb6627
cmpl $0x2, %eax
je 0xb65c5
testl %eax, %eax
jne 0xb6686
cmpq $0x2, 0x8(%r14)
jl 0xb6686
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
callq 0xeeb67
leaq 0x8164d(%rip), %rsi     # 0x137bfb
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe8617
cmpq $0x6, 0x8(%r14)
jl 0xb6686
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
callq 0xeeb67
movq %rax, %r15
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
addq $0x2, %rsi
callq 0xeeb67
movq %rax, %r12
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
addq $0x4, %rsi
callq 0xeeb67
leaq 0x81613(%rip), %rsi     # 0x137c1c
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 0xe8617
movl 0x8(%r14), %edx
leaq 0x81608(%rip), %rsi     # 0x137c3a
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
cmpl $0x2, (%rbx)
jl 0xb6686
cmpq $0x0, 0x8(%r14)
jle 0xb6686
leaq 0x81606(%rip), %r15     # 0x137c55
xorl %r12d, %r12d
movq 0x18(%rbx), %rdi
movq (%r14), %rsi
addq %r12, %rsi
callq 0xeead3
movzbl %al, %ecx
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe87e4
cmpq $0xfe, %r12
ja 0xb6686
incq %r12
cmpq 0x8(%r14), %r12
jl 0xb6652
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x811cd(%rip), %rax     # 0x137d4c
movq %rax, (%rsi)
leaq 0x811c7(%rip), %rax     # 0x137d50
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb6ba4
movq %rax, 0x18(%rsi)
leaq 0xa65(%rip), %rax       # 0xb7604
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/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
leaq 0xd(%rsp), %rbx
movl $0x3, %ecx
movq %rbx, %rsi
callq 0xee8d4
cmpb $0x50, (%rbx)
jne 0xb7687
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 0xb7689
leal -0x31(%rcx), %eax
cmpb $0x5, %al
ja 0xb7687
movzbl %dl, %eax
cmpl $0x20, %eax
ja 0xb7687
movl %eax, %eax
movabsq $0x100002600, %rdx      # imm = 0x100002600
btq %rax, %rdx
movl $0x0, %eax
jae 0xb7689
addl $-0x30, %ecx
movl %ecx, %eax
jmp 0xb7689
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xb7734
movq %rdx, %rbx
movq %rsi, %r14
addq $0x30, %r14
xorl %r12d, %r12d
movabsq $0x100003e00, %r13      # imm = 0x100003E00
movb $0x1, %bpl
movq %r14, %rsi
callq 0xeeb4b
testb $0x1, %bpl
je 0xb76df
cmpb $0x23, %al
jne 0xb76fc
xorl %ebp, %ebp
jmp 0xb76ed
cmpb $0xd, %al
sete %cl
cmpb $0xa, %al
sete %bpl
orb %cl, %bpl
movq (%r14), %rax
movq 0x18(%r15), %rdi
cmpq 0x18(%rdi), %rax
jl 0xb76c9
jmp 0xb7734
movzbl %al, %ecx
cmpl $0x20, %ecx
ja 0xb772b
movl %ecx, %ecx
btq %rcx, %r13
jae 0xb772b
testq %r12, %r12
jne 0xb7745
xorl %r12d, %r12d
movq (%r14), %rcx
movq 0x18(%r15), %rdi
xorl %eax, %eax
cmpq 0x18(%rdi), %rcx
jge 0xb7736
cmpq $0x63, %r12
jbe 0xb76c6
jmp 0xb7736
movb %al, (%rbx,%r12)
incq %r12
jmp 0xb7714
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x0, (%rbx,%r12)
movl $0x1, %eax
jmp 0xb7736
// File: /workspace/github_c_makefile_star2_O3/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 0xe9c2f
movq $0x0, 0x18(%rbx)
cmpb $0x1, (%rbx)
movq 0x10(%rbx), %rdi
jne 0xb7b0d
movzbl %al, %esi
callq 0xf0bd6
jmp 0xb7b15
movq %rax, %rsi
callq 0xf0fad
incq 0x8(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x803ba(%rip), %rax     # 0x137edd
movq %rax, (%rsi)
leaq 0x803b4(%rip), %rax     # 0x137ee1
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb7b48
movq %rax, 0x18(%rsi)
leaq 0x25b(%rip), %rax       # 0xb7d9e
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x80130(%rip), %rax     # 0x137efb
movq %rax, (%rsi)
leaq 0x8012d(%rip), %rax     # 0x137f02
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb7df0
movq %rax, 0x18(%rsi)
leaq 0x40(%rip), %rax        # 0xb7e2b
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x800ca(%rip), %rax     # 0x137f2a
movq %rax, (%rsi)
leaq 0x800c4(%rip), %rax     # 0x137f2e
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb7e85
movq %rax, 0x18(%rsi)
leaq 0xd3(%rip), %rax        # 0xb7f53
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x801b6(%rip), %rsi     # 0x13804e
callq 0xeb125
movl $0x780, %esi            # imm = 0x780
movq %r14, %rdi
movl $0x1, %edx
callq 0xf09c5
movq %rax, %rbx
movq 0x18(%r14), %rdi
cmpq $0x4, 0x18(%rdi)
jl 0xb7f1a
movl $0x3, %r15d
movq %r15, %rsi
callq 0xeead3
leaq 0x1(%r15), %r13
movl %eax, %ecx
andb $0x7f, %cl
movzbl %cl, %r12d
movq 0x18(%r14), %rdi
testb %al, %al
js 0xb7ef6
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0xef481
addq %r12, %r13
movq %r13, %r15
jmp 0xb7f10
movq %r13, %rsi
callq 0xeead3
addq $0x2, %r15
movzbl %al, %esi
movq %rbx, %rdi
movq %r12, %rdx
callq 0xf0eba
movq 0x18(%r14), %rdi
cmpq 0x18(%rdi), %r15
jl 0xb7ec3
movl $0xf0, %edx
movl $0x40, %ecx
movl $0x1e, %r8d
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %r9d
pushq $0x0
pushq $0x0
callq 0xf2a98
addq $0x10, %rsp
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xf052b
// File: /workspace/github_c_makefile_star2_O3/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 0x800ef(%rip), %rax     # 0x138072
movq %rax, (%rsi)
leaq 0x800ec(%rip), %rax     # 0x138079
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb7fa8
movq %rax, 0x18(%rsi)
leaq 0x50e(%rip), %rax       # 0xb84b1
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xf266a
movq %rax, %r12
movq 0x10(%r14), %rdx
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rcx
movl $0x1, %r8d
callq 0xf2a40
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xb854b
movq %r12, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xf228d
// File: /workspace/github_c_makefile_star2_O3/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 0xea504
movq %rax, %r15
movl $0x1, 0x78(%rax)
movaps 0x6ca3e(%rip), %xmm0    # 0x124fb0
movups %xmm0, 0x80(%rax)
cmpb $0x0, 0xd0(%rbx)
je 0xb85a0
movq 0x20(%r12), %rdx
testq %rdx, %rdx
je 0xb85a0
cmpq $0x0, 0x10(%rdx)
jle 0xb85a0
movq %rbx, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0xea53f
movq %r14, %rdi
movq %r15, %rsi
movl $0x8, %edx
callq 0xf22d0
movq %rbx, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xea50e
nop
// File: /workspace/github_c_makefile_star2_O3/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 0x7fb6a(%rip), %rax     # 0x138139
movq %rax, (%rsi)
leaq 0x7fb68(%rip), %rax     # 0x138141
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb85f4
movq %rax, 0x18(%rsi)
leaq 0xdc(%rip), %rax        # 0xb86cb
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x10, %esi
callq 0xe8b2b
movq %rax, %r14
leaq 0x6ad70(%rip), %rsi     # 0x12337f
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %rsp, %rsi
movq $0x5, (%rsi)
movq 0x18(%rbx), %rdi
callq 0xeed83
leal 0xc(%rax), %ecx
movl %ecx, (%r14)
leaq 0x7fb1b(%rip), %rsi     # 0x138163
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movl (%r14), %edx
cmpl $0x11, %edx
jb 0xb867c
leaq 0x7fb19(%rip), %rsi     # 0x13817c
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
jmp 0xb86af
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movl $0x2a, %esi
movq %rbx, %rdi
callq 0xf7205
movq %rax, 0x8(%r14)
movq %rsp, %r8
movl $0x9, %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0xb8720
movq 0x8(%r14), %rdi
callq 0xf7228
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7fb7a(%rip), %rdx     # 0x138257
xorl %ebx, %ebx
movl $0x5, %ecx
xorl %esi, %esi
callq 0xefc85
testl %eax, %eax
jne 0xb8716
movq 0x18(%r14), %rdi
movl $0x5, %esi
callq 0xeed61
movl $0x64, %ebx
cmpq $0x5, %rax
jl 0xb8716
xorl %ecx, %ecx
cmpq $0x9, %rax
movl $0xa, %ebx
cmovael %ecx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x79024(%rip), %rax     # 0x131de3
movq %rax, (%rsi)
leaq 0x7f494(%rip), %rax     # 0x13825d
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb8de4
movq %rax, 0x18(%rsi)
leaq 0x401(%rip), %rax       # 0xb91e0
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7f0fc(%rip), %rax     # 0x138333
movq %rax, (%rsi)
leaq 0x7f0f9(%rip), %rax     # 0x13833a
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xb925c
movq %rax, 0x18(%rsi)
leaq 0x540(%rip), %rax       # 0xb9797
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7ed17(%rip), %rdx     # 0x1384c0
xorl %ebx, %ebx
movl $0x3, %ecx
xorl %esi, %esi
callq 0xefc85
testl %eax, %eax
je 0xb97c5
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x18(%r14), %rdi
movl $0x3, %esi
callq 0xeead3
movl $0x64, %ebx
cmpb $0x34, %al
je 0xb97bb
movzbl %al, %ecx
cmpl $0x67, %ecx
je 0xb97bb
addb $-0x31, %al
xorl %ecx, %ecx
cmpb $0x7, %al
movl $0x23, %ebx
cmovael %ecx, %ebx
jmp 0xb97bb
// File: /workspace/github_c_makefile_star2_O3/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 0xf052b
movq 0x40(%rbx), %rsi
movq %r14, %rdi
callq 0xefaca
movq 0x38(%rbx), %rdi
callq 0xfc4de
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/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 0xb9bcf
movw $0x101, (%rbx)          # imm = 0x101
jmp 0xb9c5c
movq %rdx, %r12
addq %rax, %rsi
callq 0xeeb67
movq %rax, %r15
leaq 0x7e827(%rip), %rsi     # 0x13840b
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x8(%rbx), %rdi
callq 0xeb7fe
movq 0x8(%rbx), %rdi
movq 0x18(%r12), %rsi
movq 0xc8(%r12), %rdx
movq 0xe0(%r12), %rcx
addq 0xd0(%r12), %rcx
callq 0xeb944
movq 0x8(%rbx), %rdi
callq 0xeb865
movl %eax, %ebp
leaq 0x7e7fe(%rip), %rsi     # 0x138430
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
cmpl %r15d, %ebp
je 0xb9c5c
leaq 0x7e80d(%rip), %rsi     # 0x138457
movq %r14, %rdi
movl %r15d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0xe9295
movb $0x1, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7e809(%rip), %rax     # 0x1384c4
movq %rax, (%rsi)
leaq 0x7e803(%rip), %rax     # 0x1384c8
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xb9ceb
movq %rax, 0x18(%rsi)
leaq 0x546(%rip), %rax       # 0xba221
movq %rax, 0x20(%rsi)
leaq 0x561(%rip), %rax       # 0xba247
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x7e34a(%rip), %rax     # 0x1385a9
movq %rax, (%rsi)
leaq 0x7e347(%rip), %rax     # 0x1385b0
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0xba28f
movq %rax, 0x18(%rsi)
leaq 0x19db(%rip), %rax      # 0xbbc5a
movq %rax, 0x20(%rsi)
leaq 0x1a70(%rip), %rax      # 0xbbcfa
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xbbcf0
leaq 0x10(%rsp), %rsi
callq 0xbcf25
testl %eax, %eax
je 0xbbcf0
movq 0x18(%r14), %rdi
movq 0x10(%rsp), %rdx
cmpq $0x26, %rdx
jne 0xbbcb2
leaq 0x7d265(%rip), %rdx     # 0x138efd
movl $0x28, %esi
movl $0x8, %ecx
callq 0xefc85
testl %eax, %eax
jne 0xbbceb
movl $0x64, %ebx
jmp 0xbbcf0
addq $0x2, %rdx
leaq 0xc(%rsp), %rbx
movl $0x4, %ecx
movq %rbx, %rsi
callq 0xee8d4
cmpb $0x50, (%rbx)
jne 0xbbceb
movb 0xd(%rsp), %al
andb $-0x21, %al
cmpb $0x4b, %al
jne 0xbbceb
movb 0xe(%rsp), %al
andb $-0x21, %al
cmpb $0x4c, %al
jne 0xbbceb
movb 0xf(%rsp), %al
andb $-0x21, %al
cmpb $0x49, %al
je 0xbbcab
movl $0xf, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xeebc8
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 0x89355(%rip), %rdx     # 0x1450b0
leaq 0x7c9ee(%rip), %r9      # 0x138750
cmovaeq %rdx, %r9
btl $0xd, %eax
leaq 0x7c9e5(%rip), %rsi     # 0x138756
leaq 0x7c9db(%rip), %r10     # 0x138753
cmovaeq %rsi, %r10
btl $0xc, %eax
leaq 0x7c9d2(%rip), %r11     # 0x138759
cmovaeq %rdx, %r11
leaq 0x7c9b0(%rip), %rdx     # 0x138742
movl $0x28, %esi
movq %rbx, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0xe8193
addq $0x10, %rsp
leaq 0x7c976(%rip), %rsi     # 0x138726
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe8617
// File: /workspace/github_c_makefile_star2_O3/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 0xbc79b
popq %rbx
popq %r14
popq %r15
retq
movq %rsi, %r14
cmpq $0x0, 0x28(%rsi)
je 0xbc795
cmpq $0x0, 0xc8(%r14)
je 0xbc795
cmpq $0x0, 0xd8(%r14)
je 0xbc795
cmpq $0x0, 0xd0(%r14)
je 0xbc795
movq %rdi, %rbx
leaq 0x7c59e(%rip), %rsi     # 0x138d6b
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq 0x6714d(%rip), %rsi     # 0x123935
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xefda1
movq %rax, %r15
movb $0x1, 0x3(%r14)
movq 0x28(%r14), %rax
movq 0xc8(%r14), %rcx
movq 0x18(%rcx), %rdi
movq 0x30(%rax), %rsi
callq 0xe9c3b
movq 0xc8(%r14), %rdi
xorl %esi, %esi
movq %rax, %rdx
movq %r15, %rcx
callq 0xef481
movq 0x28(%r14), %rax
movq 0x30(%rax), %rsi
movq %r15, %rdi
callq 0xf0f27
movq 0xd0(%r14), %rdi
movq 0x18(%rdi), %rdx
xorl %esi, %esi
movq %r15, %rcx
callq 0xef481
movq 0x28(%r14), %rax
movq 0x38(%rax), %rsi
movq %r15, %rdi
callq 0xf0f27
movq 0xd8(%r14), %rdi
movq 0x18(%rdi), %rdx
xorl %esi, %esi
movq %r15, %rcx
callq 0xef481
movq 0x20(%r14), %rax
movq 0x50(%rax), %rdx
testq %rdx, %rdx
jle 0xbc8b0
movq 0x18(%r15), %rcx
movq 0x28(%r14), %rsi
cmpq 0x48(%rsi), %rcx
jne 0xbc89f
movq 0x18(%rbx), %rdi
movq 0x48(%rax), %rsi
movq %r15, %rcx
callq 0xef481
jmp 0xbc8b0
leaq 0x7c4e6(%rip), %rsi     # 0x138d8c
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8faa
movq %r15, %rdi
callq 0xf052b
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %r15
jmp 0xe8a15
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq 0x70(%rsi), %rax
testq %rax, %rax
je 0xbc908
movq 0x78(%r14), %rcx
testq %rcx, %rcx
je 0xbc908
movq %rdi, %rbx
xorl %edi, %edi
testq %rax, %rax
cmovgq %rax, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
cmpq %rsi, %rcx
cmovlq %rcx, %rsi
subq %rdi, %rsi
cmpq $0xa, %rsi
jg 0xbc918
movb $0x1, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x10c(%r14), %r15
addq %r15, %rdi
leaq 0x7c0cb(%rip), %rdx     # 0x1389f4
movq %rsp, %r9
movl $0xb, %ecx
movl $0x3f, %r8d
callq 0xeba66
testl %eax, %eax
je 0xbc961
xorl %eax, %eax
xorl %edx, %edx
movb %al, 0x18(%r14)
cmpb $0x0, (%r14)
jne 0xbc90c
leaq 0x7c0ba(%rip), %rsi     # 0x138a0f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
jmp 0xbc90c
movq 0x70(%r14), %rax
movq 0x78(%r14), %rcx
xorl %r12d, %r12d
testq %rax, %rax
cmovgq %rax, %r12
movl $0x3e8, %esi            # imm = 0x3E8
cmpq %rsi, %rcx
cmovlq %rcx, %rsi
subq %r12, %rsi
cmpq $0xe, %rsi
jl 0xbc908
leaq (%r15,%r12), %rdi
leaq 0x7c06d(%rip), %rdx     # 0x138a00
movq %rsp, %r9
movl $0xe, %ecx
movl $0x3f, %r8d
callq 0xeba66
testl %eax, %eax
je 0xbc908
addq (%rsp), %r12
movzbl 0x7(%r15,%r12), %eax
cmpl $0xf6, %eax
je 0xbc9e0
cmpl $0x32, %eax
jne 0xbc908
cmpb $-0x3e, 0x8(%r12,%r15)
jne 0xbc908
movl $0x1, %edx
movb $0x1, %al
jmp 0xbc944
cmpb $-0x30, 0x8(%r12,%r15)
jne 0xbc908
movl $0x2, %edx
movb $0x2, %al
jmp 0xbc944
// File: /workspace/github_c_makefile_star2_O3/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:
cmpb $0x0, 0x1a(%rsi)
je 0xbcc36
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x70(%rsi), %rax
cmpq $-0xc7, %rax
movq $-0xc8, %r15
cmovgeq %rax, %r15
movq 0x78(%rsi), %rcx
leaq 0xc8(%r15), %rax
movl $0x3e8, %esi            # imm = 0x3E8
cmpq %rsi, %rcx
cmovlq %rcx, %rsi
subq %rax, %rsi
cmpq $0x3, %rsi
jg 0xbcb9a
leaq 0x7bec6(%rip), %rsi     # 0x138a4f
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe8617
jmp 0xbcc2d
leaq 0x10c(%r14), %rdi
addq %rax, %rdi
leaq 0x7be9f(%rip), %rdx     # 0x138a4a
leaq 0x8(%rsp), %r9
movl $0x4, %ecx
movl $0x3f, %r8d
callq 0xeba66
movb 0x1a(%r14), %cl
testl %eax, %eax
je 0xbcc25
addq 0x8(%rsp), %r15
movb 0x1d6(%r14,%r15), %al
movb %al, 0x1b(%r14)
testb %cl, %cl
je 0xbcc2d
leaq 0x7be6b(%rip), %rsi     # 0x138a4f
movq %rbx, %rdi
movl $0x1, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movzbl 0x1b(%r14), %edx
leaq 0x7be5a(%rip), %rsi     # 0x138a66
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
jmp 0xbcc2d
testb %cl, %cl
jne 0xbcb82
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xbcd01
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x78(%rdi), %rcx
testq %rcx, %rcx
je 0xbccfa
xorl %edi, %edi
testq %rax, %rax
cmovgq %rax, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
cmpq %rsi, %rcx
cmovlq %rcx, %rsi
subq %rdi, %rsi
cmpq $0x5, %rsi
jle 0xbccfa
leaq 0x10c(%rbx), %r14
addq %r14, %rdi
leaq 0x7c3a9(%rip), %rdx     # 0x139034
movq %rsp, %r9
movl $0x6, %ecx
movl $0x3f, %r8d
callq 0xeba66
testl %eax, %eax
je 0xbccaa
movw $0x201, 0x8(%rbx)       # imm = 0x201
jmp 0xbccfa
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 0xbccfa
addq %rax, %r14
leaq 0x7c361(%rip), %rdx     # 0x13903b
movq %rsp, %r9
movl $0x6, %ecx
movq %r14, %rdi
movl $0x3f, %r8d
callq 0xeba66
testl %eax, %eax
je 0xbccfa
movw $0x101, 0x8(%rbx)       # imm = 0x101
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
movq (%rsi), %rax
cmpb $0x0, (%rax)
jne 0xbcd53
movq %rsi, %rbx
movq 0x8(%rsi), %rax
movq 0x28(%rsi), %rcx
addq $0x2, %rcx
cmpq 0x18(%rax), %rcx
jle 0xbcd59
leaq 0x7be2e(%rip), %rsi     # 0x138b72
xorl %eax, %eax
callq 0xe9295
movq (%rbx), %rax
movw $0x101, (%rax)          # imm = 0x101
popq %rbx
popq %r14
popq %r15
retq
leaq 0x28(%rbx), %r14
leaq 0x30(%rbx), %r15
movq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %esi
movq %r15, %rdi
callq 0xf1b5e
movq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %esi
movq %r15, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0xf1b5e
// File: /workspace/github_c_makefile_star2_O3/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 0xbcda5
xorl %ebx, %ebx
jmp 0xbcdce
movq %rsi, %r14
movq %rdi, %r15
leaq 0x30(%rsi), %rdi
movl $0x1, %esi
callq 0xf1b93
movq %rax, %rbx
cmpl $0x0, 0x34(%r14)
jne 0xbcdce
movq %r15, %rdi
movq %r14, %rsi
callq 0xbcd1b
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq