LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcpaint.c
// Function: decompress_pic_pixels
static int decompress_pic_pixels(deark *c, lctx *d)
{
	i64 pos;
	int retval = 1;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	if(d->num_rle_blocks<1) {
		// Not compressed
		retval = 1;
		goto done;
	}

	d->unc_pixels = dbuf_create_membuf(c, 16384, 0);
	dbuf_set_length_limit(d->unc_pixels, (d->pdwidth+7) * d->height);

	de_dbg(c, "decompressing image");
	de_dbg_indent(c, 1);
	pos = d->header_size;

	if(!decompress_blocks(c, d, pos)) goto done;

	de_dbg_indent(c, -1);
	de_dbg(c, "decompressed to %"I64_FMT" bytes", d->unc_pixels->len);
	retval = 1;

done:
	de_dbg_indent_restore(c, saved_indent_level);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x15b580
movq -0x10(%rbp), %rax
cmpq $0x1, 0x80(%rax)
jge 0x1039be
movl $0x1, -0x1c(%rbp)
jmp 0x103a7b
movq -0x8(%rbp), %rdi
movl $0x4000, %esi           # imm = 0x4000
xorl %edx, %edx
callq 0x168020
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
addq $0x7, %rsi
movq -0x10(%rbp), %rax
imulq 0x28(%rax), %rsi
callq 0x168120
movq -0x8(%rbp), %rdi
leaq 0xbdc36(%rip), %rsi     # 0x1c1642
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x103a90
cmpl $0x0, %eax
jne 0x103a45
jmp 0x103a7b
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
movq 0x18(%rax), %rdx
leaq 0x9bd89(%rip), %rsi     # 0x19f7f6
movb $0x0, %al
callq 0x15b0d0
movl $0x1, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0x15b5a0
movl -0x1c(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcpaint.c
// Function: decompress_blocks
static int decompress_blocks(deark *c, lctx *d, i64 pos1)
{
	i64 i;
	i64 packed_block_size;
	i64 unpacked_block_size;
	i64 end_of_this_block;
	i64 pos = pos1;
	u8 run_marker;
	int retval = 0;

	for(i=0; i<d->num_rle_blocks; i++) {
		de_dbg3(c, "block #%d at %"I64_FMT, (int)i, pos);
		de_dbg_indent(c, 1);
		// start_of_this_block = pos;
		packed_block_size = de_getu16le(pos);
		// block size includes the 5-byte header, so it can't be < 5.
		if(packed_block_size<5) packed_block_size=5;
		end_of_this_block = pos + packed_block_size; // Remember where this block ends
		if(end_of_this_block > c->infile->len) goto done;
		unpacked_block_size = de_getu16le(pos+2);
		run_marker = de_getbyte(pos+4);
		pos+=5;

		de_dbg3(c, "packed size: %"I64_FMT, packed_block_size);
		de_dbg3(c, "unpacked size: %"I64_FMT, unpacked_block_size);
		de_dbg3(c, "run marker: 0x%02x", (UI)run_marker);

		if(!decompress_block(c, d, pos, packed_block_size-5, run_marker)) {
			goto done;
		}
		de_dbg_indent(c, -1);

		pos = end_of_this_block;
	}
	retval = 1;
done:
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x48(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jge 0x103c0c
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %edx
movq -0x40(%rbp), %rcx
leaq 0xbdf08(%rip), %rsi     # 0x1c19ed
movb $0x0, %al
callq 0x15b400
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x40(%rbp), %rsi
callq 0x165280
movq %rax, -0x28(%rbp)
cmpq $0x5, -0x28(%rbp)
jge 0x103b1e
movq $0x5, -0x28(%rbp)
movq -0x40(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jle 0x103b41
jmp 0x103c13
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x40(%rbp), %rsi
addq $0x2, %rsi
callq 0x165280
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x40(%rbp), %rsi
addq $0x4, %rsi
callq 0x165060
movb %al, -0x41(%rbp)
movq -0x40(%rbp), %rax
addq $0x5, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xbde73(%rip), %rsi     # 0x1c1a00
movb $0x0, %al
callq 0x15b400
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0xbde5b(%rip), %rsi     # 0x1c19fe
movb $0x0, %al
callq 0x15b400
movq -0x8(%rbp), %rdi
movzbl -0x41(%rbp), %edx
leaq 0xbda76(%rip), %rsi     # 0x1c162f
movb $0x0, %al
callq 0x15b400
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rcx
subq $0x5, %rcx
movzbl -0x41(%rbp), %r8d
callq 0x102540
cmpl $0x0, %eax
jne 0x103be5
jmp 0x103c13
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x103abb
movl $0x1, -0x48(%rbp)
movl -0x48(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: de_module_pcx
void de_module_pcx(deark *c, struct deark_module_info *mi)
{
	mi->id = "pcx";
	mi->desc = "PCX image";
	mi->run_fn = de_run_pcx;
	mi->identify_fn = de_identify_pcx;
	mi->help_fn = de_help_pcx;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xbdeef(%rip), %rcx     # 0x1c1b26
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xbdee5(%rip), %rcx     # 0x1c1b2a
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x2c(%rip), %rcx        # 0x103c80
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x6d(%rip), %rcx        # 0x103cd0
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
leaq 0x16e(%rip), %rcx       # 0x103de0
movq %rcx, 0x28(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: de_run_pcx
static void de_run_pcx(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));
	de_run_pcx_internal(c, d, mparams);
	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x4b8, %esi            # imm = 0x4B8
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x1043e0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: de_identify_pcx
static int de_identify_pcx(deark *c)
{
	u8 buf[8];

	de_read(buf, 0, 8);
	if(buf[0]==0x0a && (buf[1]==0 || buf[1]==2 || buf[1]==3
		|| buf[1]==4 || buf[1]==5) &&
		(buf[2]==0 || buf[2]==1) )
	{
		if(de_input_file_has_ext(c, "pcx"))
			return 100;
		return 16;
	}

	// VGAPaint 386 PCX SFX
	if(buf[0]==0xeb && buf[1]==0x0e && buf[2]==1 && buf[3]==8 &&
		(de_getbyte(16)==0xe8))
	{
		if(de_input_file_has_ext(c, "pcx"))
			return 80;
		return 8;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x8, %ecx
callq 0x164d10
movzbl -0x18(%rbp), %eax
cmpl $0xa, %eax
jne 0x103d65
movzbl -0x17(%rbp), %eax
cmpl $0x0, %eax
je 0x103d2c
movzbl -0x17(%rbp), %eax
cmpl $0x2, %eax
je 0x103d2c
movzbl -0x17(%rbp), %eax
cmpl $0x3, %eax
je 0x103d2c
movzbl -0x17(%rbp), %eax
cmpl $0x4, %eax
je 0x103d2c
movzbl -0x17(%rbp), %eax
cmpl $0x5, %eax
jne 0x103d65
movzbl -0x16(%rbp), %eax
cmpl $0x0, %eax
je 0x103d3e
movzbl -0x16(%rbp), %eax
cmpl $0x1, %eax
jne 0x103d65
movq -0x10(%rbp), %rdi
leaq 0xbdddd(%rip), %rsi     # 0x1c1b26
callq 0x15d180
cmpl $0x0, %eax
je 0x103d5c
movl $0x64, -0x4(%rbp)
jmp 0x103dd5
movl $0x10, -0x4(%rbp)
jmp 0x103dd5
movzbl -0x18(%rbp), %eax
cmpl $0xeb, %eax
jne 0x103dce
movzbl -0x17(%rbp), %eax
cmpl $0xe, %eax
jne 0x103dce
movzbl -0x16(%rbp), %eax
cmpl $0x1, %eax
jne 0x103dce
movzbl -0x15(%rbp), %eax
cmpl $0x8, %eax
jne 0x103dce
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x10, %esi
callq 0x165060
movzbl %al, %eax
cmpl $0xe8, %eax
jne 0x103dce
movq -0x10(%rbp), %rdi
leaq 0xbdd74(%rip), %rsi     # 0x1c1b26
callq 0x15d180
cmpl $0x0, %eax
je 0x103dc5
movl $0x50, -0x4(%rbp)
jmp 0x103dd5
movl $0x8, -0x4(%rbp)
jmp 0x103dd5
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: de_module_mswordscr
void de_module_mswordscr(deark *c, struct deark_module_info *mi)
{
	mi->id = "mswordscr";
	mi->desc = "MS Word for DOS Screen Capture";
	mi->run_fn = de_run_mswordscr;
	mi->identify_fn = de_identify_mswordscr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xbdced(%rip), %rcx     # 0x1c1b34
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xbdce9(%rip), %rcx     # 0x1c1b3e
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0x103e80
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x6d(%rip), %rcx        # 0x103ee0
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: de_run_mswordscr
static void de_run_mswordscr(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));
	d->is_mswordscr = 1;
	de_run_pcx_internal(c, d, mparams);
	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x4b8, %esi            # imm = 0x4B8
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movb $0x1, 0x90(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x1043e0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: de_identify_mswordscr
static int de_identify_mswordscr(deark *c)
{
	u8 buf[8];

	de_read(buf, 0, 8);
	if(buf[0]==0xcd && (buf[1]==0 || buf[1]==2 || buf[1]==3
		|| buf[1]==4 || buf[1]==5) &&
		buf[2]==1 )
	{
		if(de_input_file_has_ext(c, "scr") || de_input_file_has_ext(c, "mwg"))
			return 100;

		return 10;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x8, %ecx
callq 0x164d10
movzbl -0x18(%rbp), %eax
cmpl $0xcd, %eax
jne 0x103f83
movzbl -0x17(%rbp), %eax
cmpl $0x0, %eax
je 0x103f3e
movzbl -0x17(%rbp), %eax
cmpl $0x2, %eax
je 0x103f3e
movzbl -0x17(%rbp), %eax
cmpl $0x3, %eax
je 0x103f3e
movzbl -0x17(%rbp), %eax
cmpl $0x4, %eax
je 0x103f3e
movzbl -0x17(%rbp), %eax
cmpl $0x5, %eax
jne 0x103f83
movzbl -0x16(%rbp), %eax
cmpl $0x1, %eax
jne 0x103f83
movq -0x10(%rbp), %rdi
leaq 0xbdbe8(%rip), %rsi     # 0x1c1b3a
callq 0x15d180
cmpl $0x0, %eax
jne 0x103f71
movq -0x10(%rbp), %rdi
leaq 0xbe0cb(%rip), %rsi     # 0x1c2032
callq 0x15d180
cmpl $0x0, %eax
je 0x103f7a
movl $0x64, -0x4(%rbp)
jmp 0x103f8a
movl $0xa, -0x4(%rbp)
jmp 0x103f8a
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: de_module_dcx
void de_module_dcx(deark *c, struct deark_module_info *mi)
{
	mi->id = "dcx";
	mi->desc = "DCX (multi-image PCX)";
	mi->run_fn = de_run_dcx;
	mi->identify_fn = de_identify_dcx;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xbdba6(%rip), %rcx     # 0x1c1b5d
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xbdb9c(%rip), %rcx     # 0x1c1b61
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0x103ff0
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x18d(%rip), %rcx       # 0x104170
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: de_run_dcx
static void de_run_dcx(deark *c, de_module_params *mparams)
{
	u32 *page_offset;
	i64 num_pages;
	i64 page;
	i64 page_size;

	page_offset = de_mallocarray(c, 1023, sizeof(u32));
	num_pages = 0;
	while(num_pages < 1023) {
		page_offset[num_pages] = (u32)de_getu32le(4 + 4*num_pages);
		if(page_offset[num_pages]==0)
			break;
		num_pages++;
	}

	de_dbg(c, "number of pages: %d", (int)num_pages);

	for(page=0; page<num_pages; page++) {
		if(page == num_pages-1) {
			// Last page. Assume it goes to the end of file.
			page_size = c->infile->len - page_offset[page];
		}
		else {
			page_size = page_offset[page+1] - page_offset[page];
		}
		if(page_size<0) page_size=0;
		de_dbg(c, "page %d at %u, size=%"I64_FMT, (int)page, (UI)page_offset[page],
			page_size);

		dbuf_create_file_from_slice(c->infile, page_offset[page], page_size, "pcx", NULL, 0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl $0x3ff, %esi            # imm = 0x3FF
movl $0x4, %edx
callq 0x15c450
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
cmpq $0x3ff, -0x20(%rbp)     # imm = 0x3FF
jge 0x10406d
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
shlq $0x2, %rsi
addq $0x4, %rsi
callq 0x165540
movl %eax, %edx
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jne 0x10405f
jmp 0x10406d
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x10401f
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %edx
leaq 0xbdfb8(%rip), %rsi     # 0x1c2036
movb $0x0, %al
callq 0x15b0d0
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x10415d
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x1040cc
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
subq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x1040e9
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movl 0x4(%rax,%rcx,4), %eax
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rdx
subl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x1040f8
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x30(%rbp), %r8
leaq 0xbdf32(%rip), %rsi     # 0x1c204a
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, %esi
movq -0x30(%rbp), %rdx
leaq 0xbd9e7(%rip), %rcx     # 0x1c1b26
xorl %eax, %eax
movl %eax, %r8d
xorl %r9d, %r9d
callq 0x166be0
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x10408d
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: de_module_pcx2com
void de_module_pcx2com(deark *c, struct deark_module_info *mi)
{
	mi->id = "pcx2com";
	mi->desc = "PCX2COM self-displaying image";
	mi->run_fn = de_run_pcx2com;
	mi->identify_fn = de_identify_pcx2com;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xbd9a0(%rip), %rcx     # 0x1c1b77
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xbd99a(%rip), %rcx     # 0x1c1b7f
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0x104210
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x10d(%rip), %rcx       # 0x104310
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: de_run_pcx2com
static void de_run_pcx2com(deark *c, de_module_params *mparams)
{
	i64 pos;
	dbuf *outf = NULL;

	outf = dbuf_create_output_file(c, "pcx", NULL, 0);

	// header
	dbuf_enable_wbuffer(outf);
	dbuf_write(outf, (const u8*)"\x0a\x05\x01\x08\x00\x00\x00\x00\x3f\x01\xc7", 11);
	dbuf_truncate(outf, 64);
	dbuf_write(outf, (const u8*)"\x00\x01\x40\x01\x01\x00\x40\x01\xc8", 9);
	dbuf_truncate(outf, 128);

	// image data, and 0x0c palette marker
	dbuf_copy(c->infile, 920, c->infile->len-920, outf);

	// VGA palette
	pos = 152;
	while(pos < 152+768) {
		u8 x;

		x = de_getbyte_p(&pos);
		dbuf_writebyte(outf, de_scale_63_to_255(x));
	}

	dbuf_close(outf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xbd8f3(%rip), %rsi     # 0x1c1b26
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x166c60
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x167b90
movq -0x20(%rbp), %rdi
leaq 0xbd8ba(%rip), %rsi     # 0x1c1b10
movl $0xb, %edx
callq 0x166170
movq -0x20(%rbp), %rdi
movl $0x40, %esi
callq 0x168900
movq -0x20(%rbp), %rdi
leaq 0xbd8a3(%rip), %rsi     # 0x1c1b1c
movl $0x9, %edx
callq 0x166170
movq -0x20(%rbp), %rdi
movl $0x80, %esi
callq 0x168900
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rdx
subq $0x398, %rdx            # imm = 0x398
movq -0x20(%rbp), %rcx
movl $0x398, %esi            # imm = 0x398
callq 0x166070
movq $0x98, -0x18(%rbp)
cmpq $0x398, -0x18(%rbp)     # imm = 0x398
jge 0x1042ff
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x165170
movb %al, -0x21(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movzbl -0x21(%rbp), %edi
callq 0x161710
movq -0x30(%rbp), %rdi
movzbl %al, %esi
callq 0x168380
jmp 0x1042c2
movq -0x20(%rbp), %rdi
callq 0x1676a0
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: de_identify_pcx2com
static int de_identify_pcx2com(deark *c)
{
	if(c->infile->len<922 || c->infile->len>65280) return 0;

	if((UI)de_getu32be(0)!=0xb81300cdU) return 0;
	if(de_getbyte(c->infile->len-1) != 0x0c) return 0;

	// The is the substring "Self PCX", xor 0x80.
	if(dbuf_memcmp(c->infile, 104,
		(const u8*)"\xd3\xe5\xec\xe6\xa0\xd0\xc3\xd8", 8))
	{
		return 0;
	}

	return 100;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x39a, 0x18(%rax)      # imm = 0x39A
jl 0x104340
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0xff00, 0x18(%rax)     # imm = 0xFF00
jle 0x10434c
movl $0x0, -0x4(%rbp)
jmp 0x1043ce
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x165470
cmpl $0xb81300cd, %eax       # imm = 0xB81300CD
je 0x10436d
movl $0x0, -0x4(%rbp)
jmp 0x1043ce
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rsi
subq $0x1, %rsi
callq 0x165060
movzbl %al, %eax
cmpl $0xc, %eax
je 0x10439b
movl $0x0, -0x4(%rbp)
jmp 0x1043ce
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x68, %esi
leaq 0xbdcb8(%rip), %rdx     # 0x1c2067
movl $0x8, %ecx
callq 0x166ab0
cmpl $0x0, %eax
je 0x1043c7
movl $0x0, -0x4(%rbp)
jmp 0x1043ce
movl $0x64, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: do_bitmap
static void do_bitmap(deark *c, lctx *d)
{
	if(d->bits_per_pixel==1) {
		do_bitmap_1bpp(c, d);
	}
	else if(d->bits_per_pixel<=8) {
		do_bitmap_paletted(c, d);
	}
	else if(d->bits_per_pixel>=24) {
		do_bitmap_24bpp(c, d);
	}
	else {
		de_err(c, "Unsupported bits/pixel: %d", (int)d->bits_per_pixel);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x1, 0x10(%rax)
jne 0x10535a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x105ac0
jmp 0x1053ae
movq -0x10(%rbp), %rax
cmpq $0x8, 0x10(%rax)
jg 0x105374
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x105b20
jmp 0x1053ac
movq -0x10(%rbp), %rax
cmpq $0x18, 0x10(%rax)
jl 0x10538e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x105c30
jmp 0x1053aa
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl %eax, %edx
leaq 0x9a3c4(%rip), %rsi     # 0x19f767
movb $0x0, %al
callq 0x15bfb0
jmp 0x1053ac
jmp 0x1053ae
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: sane_screensize
static int sane_screensize(i64 h, i64 v)
{
	if(h<320 || v<200) return 0;
	if(h>4096 || v>4096) return 0;
	if((h%8 != 0) || (v%2 != 0)) return 0;
	if(v*5 < h) return 0;
	if(h*3 < v) return 0;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x140, -0x10(%rbp)     # imm = 0x140
jl 0x1053e0
cmpq $0xc8, -0x18(%rbp)
jge 0x1053e9
movl $0x0, -0x4(%rbp)
jmp 0x105466
cmpq $0x1000, -0x10(%rbp)    # imm = 0x1000
jg 0x1053fd
cmpq $0x1000, -0x18(%rbp)    # imm = 0x1000
jle 0x105406
movl $0x0, -0x4(%rbp)
jmp 0x105466
movq -0x10(%rbp), %rax
movl $0x8, %ecx
cqto
idivq %rcx
cmpq $0x0, %rdx
jne 0x10542e
movq -0x18(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
cmpq $0x0, %rdx
je 0x105437
movl $0x0, -0x4(%rbp)
jmp 0x105466
imulq $0x5, -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
jge 0x10544b
movl $0x0, -0x4(%rbp)
jmp 0x105466
imulq $0x3, -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x10545f
movl $0x0, -0x4(%rbp)
jmp 0x105466
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: do_decode_resolution
static void do_decode_resolution(deark *c, lctx *d, i64 hres, i64 vres)
{
	enum resmode_type resmode = d->resmode;

	if(hres==0 || vres==0) return;

	// TODO: Account for d->hscreensize, d->vscreensize.

	if(resmode==RESMODE_AUTO) {
		if((hres==320 && vres==200) ||
			(hres==640 && vres==480) ||
			(hres==640 && vres==350) ||
			(hres==640 && vres==200) ||
			(hres==800 && vres==600) ||
			(hres==1024 && vres==768))
		{
			if(d->reported_width<=hres && d->height<=hres) {
				// Looks like screen dimensions, and image fits on the screen
				resmode = RESMODE_SCREENDIMENSIONS;
			}
		}
		else if(hres==d->reported_width && vres==d->height) {
			;
		}
		else {
			if(hres==vres && hres>=50 && hres<=600) {
				resmode = RESMODE_DPI;
			}
		}
	}

	if(resmode==RESMODE_DPI) {
		d->fi->density.code = DE_DENSITY_DPI;
		d->fi->density.xdens = (double)hres;
		d->fi->density.ydens = (double)vres;
	}
	else if(resmode==RESMODE_SCREENDIMENSIONS) {
		set_density_from_screen_res(c, d, hres, vres);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x24(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1054a0
cmpq $0x0, -0x20(%rbp)
jne 0x1054a5
jmp 0x105601
cmpl $0x1, -0x24(%rbp)
jne 0x105598
cmpq $0x140, -0x18(%rbp)     # imm = 0x140
jne 0x1054c3
cmpq $0xc8, -0x20(%rbp)
je 0x105527
cmpq $0x280, -0x18(%rbp)     # imm = 0x280
jne 0x1054d7
cmpq $0x1e0, -0x20(%rbp)     # imm = 0x1E0
je 0x105527
cmpq $0x280, -0x18(%rbp)     # imm = 0x280
jne 0x1054eb
cmpq $0x15e, -0x20(%rbp)     # imm = 0x15E
je 0x105527
cmpq $0x280, -0x18(%rbp)     # imm = 0x280
jne 0x1054ff
cmpq $0xc8, -0x20(%rbp)
je 0x105527
cmpq $0x320, -0x18(%rbp)     # imm = 0x320
jne 0x105513
cmpq $0x258, -0x20(%rbp)     # imm = 0x258
je 0x105527
cmpq $0x400, -0x18(%rbp)     # imm = 0x400
jne 0x10554f
cmpq $0x300, -0x20(%rbp)     # imm = 0x300
jne 0x10554f
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
cmpq -0x18(%rbp), %rax
jg 0x10554d
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
cmpq -0x18(%rbp), %rax
jg 0x10554d
movl $0x3, -0x24(%rbp)
jmp 0x105596
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x70(%rcx), %rax
jne 0x105570
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x88(%rcx), %rax
jne 0x105570
jmp 0x105594
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x105592
cmpq $0x32, -0x18(%rbp)
jl 0x105592
cmpq $0x258, -0x18(%rbp)     # imm = 0x258
jg 0x105592
movl $0x2, -0x24(%rbp)
jmp 0x105594
jmp 0x105596
jmp 0x105598
cmpl $0x2, -0x24(%rbp)
jne 0x1055e4
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rax
movl $0x2, 0x78(%rax)
cvtsi2sdq -0x18(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rax
movsd %xmm0, 0x80(%rax)
cvtsi2sdq -0x20(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rax
movsd %xmm0, 0x88(%rax)
jmp 0x105601
cmpl $0x3, -0x24(%rbp)
jne 0x1055ff
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x105610
jmp 0x105601
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: set_density_from_screen_res
static void set_density_from_screen_res(deark *c, lctx *d, i64 hres, i64 vres)
{
	i64 xdens, ydens;

	d->fi->density.code = DE_DENSITY_UNK_UNITS;
	xdens = hres*3; // Assume 4:3 screen
	ydens = vres*4;

	simplify_dens(&xdens, &ydens, 2);
	simplify_dens(&xdens, &ydens, 3);
	simplify_dens(&xdens, &ydens, 5);

	d->fi->density.xdens = (double)xdens;
	d->fi->density.ydens = (double)ydens;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rax
movl $0x1, 0x78(%rax)
imulq $0x3, -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
shlq $0x2, %rax
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x2, %edx
callq 0x1056c0
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x3, %edx
callq 0x1056c0
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x5, %edx
callq 0x1056c0
cvtsi2sdq -0x28(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rax
movsd %xmm0, 0x80(%rax)
cvtsi2sdq -0x30(%rbp), %xmm0
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rax
movsd %xmm0, 0x88(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: simplify_dens
static void simplify_dens(i64 *pxdens, i64 *pydens, i64 factor)
{
	while(*pxdens>factor && *pydens>factor &&
		(*pxdens%factor==0) && (*pydens%factor==0))
	{
		*pxdens /= factor;
		*pydens /= factor;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
xorl %eax, %eax
cmpq -0x18(%rbp), %rcx
movb %al, -0x19(%rbp)
jle 0x105723
movq -0x10(%rbp), %rax
movq (%rax), %rcx
xorl %eax, %eax
cmpq -0x18(%rbp), %rcx
movb %al, -0x19(%rbp)
jle 0x105723
movq -0x8(%rbp), %rax
movq (%rax), %rax
cqto
idivq -0x18(%rbp)
xorl %eax, %eax
cmpq $0x0, %rdx
movb %al, -0x19(%rbp)
jne 0x105723
movq -0x10(%rbp), %rax
movq (%rax), %rax
cqto
idivq -0x18(%rbp)
cmpq $0x0, %rdx
sete %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0x10572c
jmp 0x10576d
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq (%rax), %rax
cqto
idivq %rcx
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq (%rax), %rax
cqto
idivq %rcx
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1056d0
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: do_read_vga_palette
static int do_read_vga_palette(deark *c, lctx *d)
{
	i64 pos;

	if(d->version<5) return 0;
	if(d->ncolors!=256) return 0;
	pos = c->infile->len - 769;
	if(pos<PCX_HDRSIZE) return 0;

	if(de_getbyte(pos) != 0x0c) {
		return 0;
	}

	de_dbg(c, "VGA palette at %"I64_FMT, pos);
	d->has_vga_pal = 1;
	pos++;
	de_dbg_indent(c, 1);
	de_read_palette_rgb(c->infile, pos, 256, 3, d->pal, 256, 0);
	de_dbg_indent(c, -1);

	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x5, %eax
jge 0x1059b8
movl $0x0, -0x4(%rbp)
jmp 0x105aa9
movq -0x18(%rbp), %rax
cmpq $0x100, 0x60(%rax)      # imm = 0x100
je 0x1059d2
movl $0x0, -0x4(%rbp)
jmp 0x105aa9
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
subq $0x301, %rax            # imm = 0x301
movq %rax, -0x20(%rbp)
cmpq $0x80, -0x20(%rbp)
jge 0x1059fe
movl $0x0, -0x4(%rbp)
jmp 0x105aa9
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x165060
movzbl %al, %eax
cmpl $0xc, %eax
je 0x105a23
movl $0x0, -0x4(%rbp)
jmp 0x105aa9
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0xbc4b7(%rip), %rsi     # 0x1c1ee9
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
movl $0x1, 0x94(%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %r8
addq $0xb8, %r8
movl $0x100, %r9d            # imm = 0x100
movl $0x3, %ecx
xorl %eax, %eax
movq %r9, %rdx
movl $0x0, (%rsp)
callq 0x16c0c0
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: do_bitmap_paletted
static void do_bitmap_paletted(deark *c, lctx *d)
{
	de_bitmap *img = NULL;

	img = de_bitmap_create(c, d->width_to_use, d->height, 3);

	// Impossible to get here unless one of the following conditions is true.
	if(d->planes==1) {
		de_convert_image_paletted(d->unc_pixels, 0, d->bits, d->rowspan,
			d->pal, img, 0);
	}
	else if(d->bits==1) {
		de_convert_image_paletted_planar(d->unc_pixels, 0, d->planes, d->rowspan,
			d->rowspan_raw, d->pal, img, 0x2);
	}

	de_bitmap_write_to_file_finfo(img, d->fi, DE_CREATEFLAG_OPT_IMAGE);
	de_bitmap_destroy(img);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rdx
movl $0x3, %ecx
callq 0x16b750
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x1, 0x48(%rax)
jne 0x105ba9
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x10(%rbp), %r8
addq $0xb8, %r8
movq -0x18(%rbp), %r9
xorl %eax, %eax
movl %eax, %esi
xorl %eax, %eax
movl $0x0, (%rsp)
callq 0x16c520
jmp 0x105bfb
movq -0x10(%rbp), %rax
cmpq $0x1, 0x8(%rax)
jne 0x105bf9
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %r8
movq -0x10(%rbp), %r9
addq $0xb8, %r9
movq -0x18(%rbp), %rax
xorl %esi, %esi
movq %rax, (%rsp)
movl $0x2, 0x8(%rsp)
callq 0x16c690
jmp 0x105bfb
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rsi
movl $0x2, %edx
callq 0x16afa0
movq -0x18(%rbp), %rdi
callq 0x16af60
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcx.c
// Function: do_bitmap_24bpp
static void do_bitmap_24bpp(deark *c, lctx *d)
{
	de_bitmap *img = NULL;
	i64 i, j;
	i64 plane;
	u8 s[4];

	de_memset(s, 0xff, sizeof(s));
	img = de_bitmap_create(c, d->width_to_use, d->height, d->has_transparency?4:3);

	for(j=0; j<d->height; j++) {
		for(i=0; i<d->width_to_use; i++) {
			for(plane=0; plane<d->planes; plane++) {
				s[plane] = dbuf_getbyte(d->unc_pixels, j*d->rowspan + plane*d->rowspan_raw +i);
			}
			de_bitmap_setpixel_rgba(img, i, j, DE_MAKE_RGBA(s[0], s[1], s[2], s[3]));
		}
	}

	de_bitmap_write_to_file_finfo(img, d->fi, 0);
	de_bitmap_destroy(img);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
leaq -0x34(%rbp), %rdi
movl $0xff, %esi
movl $0x4, %edx
callq 0x19140
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rdx
movq -0x10(%rbp), %rax
movl 0x98(%rax), %r8d
movl $0x3, %ecx
movl $0x4, %eax
cmpl $0x0, %r8d
cmovnel %eax, %ecx
callq 0x16b750
movq %rax, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x88(%rcx), %rax
jge 0x105d87
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jge 0x105d74
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jge 0x105d33
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rax
imulq 0x58(%rax), %rsi
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
imulq 0x50(%rcx), %rax
addq %rax, %rsi
addq -0x20(%rbp), %rsi
callq 0x165060
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, -0x34(%rbp,%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x105cdc
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movzbl -0x31(%rbp), %ecx
shll $0x18, %ecx
movzbl -0x34(%rbp), %eax
shll $0x10, %eax
orl %eax, %ecx
movzbl -0x33(%rbp), %eax
shll $0x8, %eax
orl %eax, %ecx
movzbl -0x32(%rbp), %eax
orl %eax, %ecx
callq 0x16b350
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x105cbf
jmp 0x105d76
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x105ca2
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rsi
xorl %edx, %edx
callq 0x16afa0
movq -0x18(%rbp), %rdi
callq 0x16af60
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pff2.c
// Function: de_module_pff2
void de_module_pff2(deark *c, struct deark_module_info *mi)
{
	mi->id = "pff2";
	mi->desc = "PFF2 font";
	mi->run_fn = de_run_pff2;
	mi->identify_fn = de_identify_pff2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0xbc2a9(%rip), %rcx     # 0x1c2070
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xbc2a0(%rip), %rcx     # 0x1c2075
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x1c(%rip), %rcx        # 0x105e00
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x18d(%rip), %rcx       # 0x105f80
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pff2.c
// Function: de_run_pff2
static void de_run_pff2(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	struct de_iffctx *ictx = NULL;
	i64 i;

	d = de_malloc(c, sizeof(lctx));
	ictx = fmtutil_create_iff_decoder(c);

	ictx->userdata = (void*)d;
	ictx->alignment = 1;
	ictx->preprocess_chunk_fn = my_preprocess_pff2_chunk_fn;
	ictx->handle_chunk_fn = my_pff2_chunk_handler;
	ictx->f = c->infile;

	d->font = de_create_bitmap_font(c);
	d->font->has_nonunicode_codepoints = 0;
	d->font->has_unicode_codepoints = 1;
	d->font->prefer_unicode = 1;

	fmtutil_read_iff_format(ictx, 0, c->infile->len);

	if(d->font) {
		if(d->font->char_array) {
			for(i=0; i<d->font->num_chars; i++) {
				de_free(c, d->font->char_array[i].bitmap);
			}
			de_free(c, d->font->char_array);
		}
		de_destroy_bitmap_font(c, d->font);
	}

	fmtutil_destroy_iff_decoder(ictx);
	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl $0x10, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x18c8b0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq $0x1, 0x48(%rax)
movq -0x20(%rbp), %rax
leaq 0x16e(%rip), %rcx       # 0x105fd0
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rax
leaq 0x1ef(%rip), %rcx       # 0x106060
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rdi
callq 0x16f6f0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movb $0x0, 0x10(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movb $0x1, 0x11(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movb $0x1, 0x12(%rax)
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x18c920
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x105f55
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x20(%rax)
je 0x105f45
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
cmpq 0x18(%rcx), %rax
jge 0x105f31
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
imulq $0x28, -0x28(%rbp), %rcx
addq %rcx, %rax
movq 0x20(%rax), %rsi
callq 0x15b820
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x105ef2
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rsi
callq 0x15b820
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x16f730
movq -0x20(%rbp), %rdi
callq 0x18c8f0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pff2.c
// Function: my_preprocess_pff2_chunk_fn
static int my_preprocess_pff2_chunk_fn(struct de_iffctx *ictx)
{
	const struct pff2_sectiontype_info *si;

	si = find_pffs_sectiontype_info(ictx->chunkctx->chunk4cc.id);
	if(si) {
		ictx->chunkctx->chunk_name = si->name;
	}

	if(ictx->chunkctx->dlen==0xffffffffU) {
		// The 'DATA' chunk's length is usually set to the special value 0xffffffff.
		// We are allowed to adjust ictx->chunkctx->dlen here.
		ictx->chunkctx->dlen = ictx->f->len - ictx->chunkctx->dpos;
	}
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x128(%rax), %rax
movl 0x4(%rax), %edi
callq 0x1061e0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x106011
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x128(%rax), %rax
movq %rcx, 0x58(%rax)
movq -0x8(%rbp), %rax
movq 0x128(%rax), %rax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, 0x48(%rax)
jne 0x106051
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x128(%rax), %rax
subq 0x40(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x128(%rax), %rax
movq %rcx, 0x48(%rax)
movl $0x1, %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pff2.c
// Function: my_pff2_chunk_handler
static int my_pff2_chunk_handler(struct de_iffctx *ictx)
{
	deark *c = ictx->c;
	lctx *d = (lctx*)ictx->userdata;
	const struct pff2_sectiontype_info *si;

	si = find_pffs_sectiontype_info(ictx->chunkctx->chunk4cc.id);
	if(!si) goto done;
	ictx->handled = 1;

	// Default value decoders:
	if(si->flags&0x1) {
		de_ucstring *str;
		str = ucstring_create(c);
		dbuf_read_to_ucstring_n(ictx->f,
			ictx->chunkctx->dpos, ictx->chunkctx->dlen,
			DE_DBG_MAX_STRLEN, str, 0, DE_ENCODING_ASCII);
		de_dbg(c, "value: \"%s\"", ucstring_getpsz_d(str));
		ucstring_destroy(str);
	}
	else if(si->flags&0x2) {
		i64 n;
		n = dbuf_getu16be(ictx->f, ictx->chunkctx->dpos);
		de_dbg(c, "value: %d", (int)n);
	}

	if(si->hfn) {
		si->hfn(c, d, si, ictx->chunkctx->dpos, ictx->chunkctx->dlen);
	}

done:
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x128(%rax), %rax
movl 0x4(%rax), %edi
callq 0x1061e0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x1060a6
jmp 0x1061c9
movq -0x8(%rbp), %rax
movl $0x1, 0x130(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x10613f
movq -0x10(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x40(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x48(%rax), %rdx
movq -0x28(%rbp), %r8
movl $0x1f4, %ecx            # imm = 0x1F4
xorl %r9d, %r9d
movl $0x1, (%rsp)
callq 0x166a40
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
callq 0x172650
movq -0x38(%rbp), %rdi
movq %rax, %rdx
leaq 0x986fe(%rip), %rsi     # 0x19e82b
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rdi
callq 0x171750
jmp 0x106188
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x106186
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x128(%rax), %rax
movq 0x40(%rax), %rsi
callq 0x1651d0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movl %eax, %edx
leaq 0xb05b5(%rip), %rsi     # 0x1b6734
movb $0x0, %al
callq 0x15b0d0
jmp 0x106188
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x1061c7
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x8(%rbp), %rcx
movq 0x128(%rcx), %rcx
movq 0x40(%rcx), %rcx
movq -0x8(%rbp), %r8
movq 0x128(%r8), %r8
movq 0x48(%r8), %r8
callq *%rax
jmp 0x1061c9
movl $0x1, %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pff2.c
// Function: find_pffs_sectiontype_info
static const struct pff2_sectiontype_info *find_pffs_sectiontype_info(u32 id)
{
	size_t i;

	for(i=0; i<DE_ARRAYCOUNT(pff2_sectiontype_info_arr); i++) {
		if(pff2_sectiontype_info_arr[i].id == id) {
			return &pff2_sectiontype_info_arr[i];
		}
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0xc(%rbp)
movq $0x0, -0x18(%rbp)
cmpq $0xc, -0x18(%rbp)
jae 0x106231
leaq 0x116153(%rip), %rax    # 0x21c350
imulq $0x18, -0x18(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x106221
leaq 0x11613d(%rip), %rax    # 0x21c350
imulq $0x18, -0x18(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x106239
jmp 0x106223
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x1061ef
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pict.c
// Function: de_module_pict
void de_module_pict(deark *c, struct deark_module_info *mi)
{
	mi->id = "pict";
	mi->desc = "Macintosh PICT";
	mi->run_fn = de_run_pict;
	mi->identify_fn = de_identify_pict;
	mi->help_fn = de_help_pict;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x9b721(%rip), %rcx     # 0x1a1d28
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0xbbbad(%rip), %rcx     # 0x1c21c2
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x2c(%rip), %rcx        # 0x106650
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x18d(%rip), %rcx       # 0x1067c0
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
leaq 0x1de(%rip), %rcx       # 0x106820
movq %rcx, 0x28(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pict.c
// Function: de_run_pict
static void de_run_pict(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos = 0;
	i64 picsize;

	d = de_malloc(c, sizeof(lctx));

	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_MACROMAN);
	d->decode_qt = de_get_ext_option_bool(c, "pict:decodeqt", 0);

	do_detect_version(c, &d->dti, 1);
	if(d->dti.file_version>0) {
		de_declare_fmtf(c, "PICT v%d%s", d->dti.file_version,
			d->dti.has_fileheader?"":", without file header");
	}

	d->version = 1;

	if(d->dti.has_fileheader) {
		pos += 512;
	}

	picsize = de_getu16be_p(&pos);
	de_dbg(c, "picSize: %"I64_FMT, picsize);
	pict_read_rect(c->infile, pos, &d->framerect, "picFrame");
	pos+=8;

	do_read_items(c, d, pos);

	dbuf_close(d->iccprofile_file);
	de_free(c, d);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl $0x40, %esi
callq 0x15b780
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x11, %edx
callq 0x15e4a0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rdi
leaq 0xbbb29(%rip), %rsi     # 0x1c21d1
xorl %edx, %edx
callq 0x15cbc0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %edx
callq 0x106850
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
jle 0x106707
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %edx
movq -0x18(%rbp), %rax
movl 0x4(%rax), %esi
leaq 0xbbaff(%rip), %rcx     # 0x1c21ea
leaq 0xca4de(%rip), %rax     # 0x1d0bd0
cmpl $0x0, %esi
cmovneq %rax, %rcx
leaq 0xbbadf(%rip), %rsi     # 0x1c21df
movb $0x0, %al
callq 0x15e3d0
movq -0x18(%rbp), %rax
movl $0x1, 0xc(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0x10672a
movq -0x20(%rbp), %rax
addq $0x200, %rax            # imm = 0x200
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x165210
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0xbbab2(%rip), %rsi     # 0x1c2200
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x20, %rdx
leaq 0xbba9d(%rip), %rcx     # 0x1c220d
callq 0x106a40
movq -0x20(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x106b20
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x1676a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x15b820
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pict.c
// Function: de_identify_pict
static int de_identify_pict(deark *c)
{
	struct detection_info dti;

	do_detect_version(c, &dti, 0);
	if(dti.file_version==2) {
		return 85;
	}
	else if(dti.file_version==1) {
		if(dti.has_fileheader) return 25;
		return 15;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x106850
cmpl $0x2, -0x18(%rbp)
jne 0x1067ea
movl $0x55, -0x4(%rbp)
jmp 0x106811
cmpl $0x1, -0x18(%rbp)
jne 0x106808
cmpl $0x0, -0x14(%rbp)
je 0x1067ff
movl $0x19, -0x4(%rbp)
jmp 0x106811
movl $0xf, -0x4(%rbp)
jmp 0x106811
jmp 0x10680a
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pict.c
// Function: pict_read_rect
static void pict_read_rect(dbuf *f, i64 pos,
	struct pict_rect *rect, const char *dbgname)
{
	rect->t = dbuf_geti16be(f, pos);
	rect->l = dbuf_geti16be(f, pos+2);
	rect->b = dbuf_geti16be(f, pos+4);
	rect->r = dbuf_geti16be(f, pos+6);

	if(dbgname) {
		de_dbg(f->c, "%s: (%d,%d)-(%d,%d)", dbgname, (int)rect->l, (int)rect->t,
			(int)rect->r, (int)rect->b);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x165310
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x2, %rsi
callq 0x165310
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
callq 0x165310
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x6, %rsi
callq 0x165310
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x106b0e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl %eax, %r8d
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %r9d
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
leaq 0xb88a4(%rip), %rsi     # 0x1bf3a8
movl %eax, (%rsp)
movb $0x0, %al
callq 0x15b0d0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)