LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: do_epocmbm_header
static void do_epocmbm_header(deark *c, lctx *d, i64 pos)
{
	de_dbg(c, "header section at %"I64_FMT, pos);
	de_dbg_indent(c, 1);
	d->jumptable_offset = de_getu32le(pos+16);
	de_dbg(c, "MBM jumptable offset: %"I64_FMT, d->jumptable_offset);
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x149b89(%rip), %rsi    # 0x1a7d1c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
callq 0x165540
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x149dff(%rip), %rsi    # 0x1a7fda
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: do_epocmbm_jumptable
static void do_epocmbm_jumptable(deark *c, lctx *d, i64 pos)
{
	i64 num_images;
	i64 i;

	de_dbg(c, "MBM jumptable at %"I64_FMT, pos);
	de_dbg_indent(c, 1);

	num_images = de_getu32le(pos);
	de_dbg(c, "number of images: %"I64_FMT, num_images);
	if(!de_good_image_count(c, num_images)) {
		de_err(c, "Too many images");
		goto done;
	}

	for(i=0; i<num_images; i++) {
		do_epocmbm_jumptable_entry(c, d, i, pos + 4 + 4*i);
	}

done:
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x149dd1(%rip), %rsi    # 0x1a7ff4
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x165540
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x149dad(%rip), %rsi    # 0x1a8009
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x16a9a0
cmpl $0x0, %eax
jne 0x5e289
movq -0x8(%rbp), %rdi
leaq 0x149d9f(%rip), %rsi    # 0x1a801f
movb $0x0, %al
callq 0x15bfb0
jmp 0x5e2cf
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x5e2cd
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rcx
addq $0x4, %rcx
movq -0x28(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rcx
callq 0x5e2f0
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x5e291
jmp 0x5e2cf
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/epocimage.c
// Function: do_epocmbm_jumptable_entry
static void do_epocmbm_jumptable_entry(deark *c, lctx *d, i64 entry_index,
	i64 pos)
{
	i64 img_pos;

	img_pos = de_getu32le(pos);
	de_dbg(c, "image #%d, pos=%"I64_FMT, (int)entry_index, pos);
	de_dbg_indent(c, 1);
	do_read_and_write_paint_data_section(c, d, img_pos);
	de_dbg_indent(c, -1);
}

// 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), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x165540
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movq -0x20(%rbp), %rcx
leaq 0x149cfd(%rip), %rsi    # 0x1a802f
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x5d390
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/eps.c
// Function: de_module_eps
void de_module_eps(deark *c, struct deark_module_info *mi)
{
	mi->id = "eps";
	mi->desc = "Encapsulated PostScript";
	mi->desc2 = "extract preview image";
	mi->run_fn = de_run_eps;
	mi->identify_fn = de_identify_eps;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x149b0b(%rip), %rcx    # 0x1a80c2
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0x149b01(%rip), %rcx    # 0x1a80c6
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x149b0a(%rip), %rcx    # 0x1a80de
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
leaq 0x1d(%rip), %rcx        # 0x5e600
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x9e(%rip), %rcx        # 0x5e690
movq %rcx, 0x20(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/eps.c
// Function: de_run_eps
static void de_run_eps(deark *c, de_module_params *mparams)
{
	u8 b[2];

	de_read(b, 0, (i64)sizeof(b));

	if(b[0]==0xc5 && b[1]==0xd0) {
		de_run_eps_binary(c);
	}
	else if(b[0]=='%' && b[1]=='!') {
		de_run_eps_normal(c);
	}
	else {
		de_err(c, "Not an EPS file");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x12(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x2, %ecx
callq 0x164d10
movzbl -0x12(%rbp), %eax
cmpl $0xc5, %eax
jne 0x5e64b
movzbl -0x11(%rbp), %eax
cmpl $0xd0, %eax
jne 0x5e64b
movq -0x8(%rbp), %rdi
callq 0x5e740
jmp 0x5e67c
movzbl -0x12(%rbp), %eax
cmpl $0x25, %eax
jne 0x5e668
movzbl -0x11(%rbp), %eax
cmpl $0x21, %eax
jne 0x5e668
movq -0x8(%rbp), %rdi
callq 0x5e8d0
jmp 0x5e67a
movq -0x8(%rbp), %rdi
leaq 0x149a81(%rip), %rsi    # 0x1a80f4
movb $0x0, %al
callq 0x15bfb0
jmp 0x5e67c
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/eps.c
// Function: de_identify_eps
static int de_identify_eps(deark *c)
{
	u8 b[20];
	de_read(b, 0, (i64)sizeof(b));

	if(b[0]==0xc5 && b[1]==0xd0 && b[2]==0xd3 && b[3]==0xc6)
		return 100;

	if(!de_memcmp(b, "%!PS-Adobe-", 11) &&
		!de_memcmp(&b[14], " EPSF-", 6) )
	{
		return 100;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x30(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x14, %ecx
callq 0x164d10
movzbl -0x30(%rbp), %eax
cmpl $0xc5, %eax
jne 0x5e6eb
movzbl -0x2f(%rbp), %eax
cmpl $0xd0, %eax
jne 0x5e6eb
movzbl -0x2e(%rbp), %eax
cmpl $0xd3, %eax
jne 0x5e6eb
movzbl -0x2d(%rbp), %eax
cmpl $0xc6, %eax
jne 0x5e6eb
movl $0x64, -0x4(%rbp)
jmp 0x5e733
leaq -0x30(%rbp), %rdi
leaq 0x149b2d(%rip), %rsi    # 0x1a8223
movl $0xb, %edx
callq 0x19170
cmpl $0x0, %eax
jne 0x5e72c
leaq -0x30(%rbp), %rdi
addq $0xe, %rdi
leaq 0x149b1b(%rip), %rsi    # 0x1a822f
movl $0x6, %edx
callq 0x19170
cmpl $0x0, %eax
jne 0x5e72c
movl $0x64, -0x4(%rbp)
jmp 0x5e733
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/eps.c
// Function: de_run_eps_binary
static void de_run_eps_binary(deark *c)
{
	i64 eps_offset, eps_len;
	i64 wmf_offset, wmf_len;
	i64 tiff_offset, tiff_len;

	de_declare_fmt(c, "EPS binary");

	eps_offset  = de_getu32le(4);
	eps_len     = de_getu32le(8);
	wmf_offset  = de_getu32le(12);
	wmf_len     = de_getu32le(16);
	tiff_offset = de_getu32le(20);
	tiff_len    = de_getu32le(24);

	if(eps_len>0) {
		de_dbg(c, "Extracting EPS offs=%d len=%d", (int)eps_offset, (int)eps_len);
		dbuf_create_file_from_slice(c->infile, eps_offset, eps_len, "eps", NULL, 0);
	}
	if(wmf_len>0) {
		de_dbg(c, "Extracting WMF offs=%d len=%d", (int)wmf_offset, (int)wmf_len);
		dbuf_create_file_from_slice(c->infile, wmf_offset, wmf_len, "preview.wmf", NULL, DE_CREATEFLAG_IS_AUX);
	}
	if(tiff_len>0) {
		de_dbg(c, "Extracting TIFF offs=%d len=%d", (int)tiff_offset, (int)tiff_len);
		dbuf_create_file_from_slice(c->infile, tiff_offset, tiff_len, "preview.tif", NULL, DE_CREATEFLAG_IS_AUX);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x1499ad(%rip), %rsi    # 0x1a8104
callq 0x15e380
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x4, %esi
callq 0x165540
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x8, %esi
callq 0x165540
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0xc, %esi
callq 0x165540
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x10, %esi
callq 0x165540
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x14, %esi
callq 0x165540
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x18, %esi
callq 0x165540
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x18(%rbp)
jle 0x5e829
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl %eax, %edx
movq -0x18(%rbp), %rax
movl %eax, %ecx
leaq 0x149911(%rip), %rsi    # 0x1a810f
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq 0x1498a6(%rip), %rcx    # 0x1a80c2
xorl %eax, %eax
movl %eax, %r8d
xorl %r9d, %r9d
callq 0x166be0
cmpq $0x0, -0x28(%rbp)
jle 0x5e875
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %edx
movq -0x28(%rbp), %rax
movl %eax, %ecx
leaq 0x1498e6(%rip), %rsi    # 0x1a812d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq 0x1498e6(%rip), %rcx    # 0x1a814b
xorl %eax, %eax
movl %eax, %r8d
movl $0x1, %r9d
callq 0x166be0
cmpq $0x0, -0x38(%rbp)
jle 0x5e8c1
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movl %eax, %edx
movq -0x38(%rbp), %rax
movl %eax, %ecx
leaq 0x1498c4(%rip), %rsi    # 0x1a8157
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq 0x1498c5(%rip), %rcx    # 0x1a8176
xorl %eax, %eax
movl %eax, %r8d
movl $0x1, %r9d
callq 0x166be0
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/eps.c
// Function: de_run_eps_normal
static void de_run_eps_normal(deark *c)
{
	i64 pos;
	u8 linebuf[1024];
	i64 content_len, total_len;

	de_declare_fmt(c, "Encapsulated PostScript");

	pos = 0;
	while(dbuf_find_line(c->infile, pos, &content_len, &total_len)) {
		de_dbg2(c, "line: pos=%d c_len=%d t_len=%d", (int)pos, (int)content_len, (int)total_len);

		if(content_len > (i64)(sizeof(linebuf)-1))
			content_len = sizeof(linebuf)-1;

		de_read(linebuf, pos, content_len);
		linebuf[content_len] = '\0';

		if(!de_memcmp(linebuf, "%%BeginPreview:", 15)) {
			do_decode_epsi(c, (const char*)(linebuf+15), pos+total_len);
			break;
		}

		pos += total_len;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x420, %rsp            # imm = 0x420
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x1497dc(%rip), %rsi    # 0x1a80c6
callq 0x15e380
movq $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rsi
leaq -0x418(%rbp), %rdx
leaq -0x420(%rbp), %rcx
callq 0x169640
cmpl $0x0, %eax
je 0x5e9e2
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl %eax, %edx
movq -0x418(%rbp), %rax
movl %eax, %ecx
movq -0x420(%rbp), %rax
movl %eax, %r8d
leaq 0x14983f(%rip), %rsi    # 0x1a8182
movb $0x0, %al
callq 0x15b350
cmpq $0x3ff, -0x418(%rbp) # imm = 0x3FF
jle 0x5e962
movq $0x3ff, -0x418(%rbp) # imm = 0x3FF
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x410(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x418(%rbp), %rcx
callq 0x164d10
movq -0x418(%rbp), %rax
movb $0x0, -0x410(%rbp,%rax)
leaq -0x410(%rbp), %rdi
leaq 0x149803(%rip), %rsi    # 0x1a81a1
movl $0xf, %edx
callq 0x19170
cmpl $0x0, %eax
jne 0x5e9ce
movq -0x8(%rbp), %rdi
leaq -0x410(%rbp), %rsi
addq $0xf, %rsi
movq -0x10(%rbp), %rdx
addq -0x420(%rbp), %rdx
callq 0x5e9f0
jmp 0x5e9e2
movq -0x420(%rbp), %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x5e8f7
addq $0x420, %rsp            # imm = 0x420
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/eps.c
// Function: process_hex_digit
static void process_hex_digit(deark *c, lctx *d, u8 hexdigit, dbuf *outf)
{
	u8 x;
	int errorflag;

	x = de_decode_hex_digit(hexdigit, &errorflag);
	if(errorflag) return; // Ignore non hex-digits

	if(d->hex_digit_count%2 == 0) {
		d->pending_byte = x;
		d->hex_digit_count++;
		// Wait for the next hex digit
		return;
	}

	dbuf_writebyte(outf, (d->pending_byte<<4) | x);
	d->hex_digit_count++;
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0x28(%rbp), %rsi
movzbl -0x11(%rbp), %edi
callq 0x1600b0
movb %al, -0x21(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x5edd1
jmp 0x5ee32
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl $0x2, %ecx
cqto
idivq %rcx
cmpq $0x0, %rdx
jne 0x5ee05
movb -0x21(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x48(%rax)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x30(%rax)
jmp 0x5ee32
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x48(%rax), %eax
shll $0x4, %eax
movzbl -0x21(%rbp), %ecx
orl %ecx, %eax
movzbl %al, %esi
callq 0x168380
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x30(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: de_module_exe
void de_module_exe(deark *c, struct deark_module_info *mi)
{
	mi->id = "exe";
	mi->desc = "EXE executable (PE, NE, etc.)";
	mi->run_fn = de_run_exe;
	mi->identify_fn = de_identify_exe;
	mi->help_fn = de_help_exe;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
leaq 0x15040f(%rip), %rcx    # 0x1af266
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
leaq 0x149400(%rip), %rcx    # 0x1a8265
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
leaq 0x2c(%rip), %rcx        # 0x5eea0
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
leaq 0x25d(%rip), %rcx       # 0x5f0e0
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
leaq 0x30e(%rip), %rcx       # 0x5f1a0
movq %rcx, 0x28(%rax)
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: de_identify_exe
static int de_identify_exe(deark *c)
{
	UI sig;
	UI lfb;
	int exe_ext;
	u8 sigMZ;

	sig = (UI)de_getu16be(0);
	if(sig==0x4d5aU) { sigMZ = 1; }
	else if(sig==0x5a4d) { sigMZ = 0; }
	else { return 0; }
	lfb = (UI)de_getu16le(2); // lenFinal

	exe_ext = de_input_file_has_ext(c, "exe");
	if(lfb>511) {
		return exe_ext ? 15 : 0;
	}
	if(exe_ext) return 80;
	return sigMZ ? 80 : 50;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1651d0
movl %eax, -0x14(%rbp)
cmpl $0x4d5a, -0x14(%rbp)    # imm = 0x4D5A
jne 0x5f10f
movb $0x1, -0x1d(%rbp)
jmp 0x5f129
cmpl $0x5a4d, -0x14(%rbp)    # imm = 0x5A4D
jne 0x5f11e
movb $0x0, -0x1d(%rbp)
jmp 0x5f127
movl $0x0, -0x4(%rbp)
jmp 0x5f195
jmp 0x5f129
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x2, %esi
callq 0x165280
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x15011d(%rip), %rsi    # 0x1af266
callq 0x15d180
movl %eax, -0x1c(%rbp)
cmpl $0x1ff, -0x18(%rbp)     # imm = 0x1FF
jbe 0x5f16f
movl -0x1c(%rbp), %edx
xorl %eax, %eax
movl $0xf, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x5f195
cmpl $0x0, -0x1c(%rbp)
je 0x5f17e
movl $0x50, -0x4(%rbp)
jmp 0x5f195
movzbl -0x1d(%rbp), %edx
movl $0x32, %eax
movl $0x50, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_all_headers
static int do_all_headers(deark *c, lctx *d)
{
	int retval;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	retval = do_mz_fileheader(c, d);
	if(!retval) goto done;

	do_reloc_table(c, d);

	d->ext_header_offset = de_getu32le(60);
	do_identify_exe_format(c, d);

	if(d->fmt!=EXE_FMT_DOS) {
		de_dbg(c, "extended header offset: %"I64_FMT, d->ext_header_offset);
		do_ext_header(c, d);
	}

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)
movq -0x8(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5fde0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x5f225
jmp 0x5f291
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x60340
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x3c, %esi
callq 0x165540
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x604f0
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x5f28f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
leaq 0x149025(%rip), %rsi    # 0x1a82a0
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x606c0
jmp 0x5f291
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x15b5a0
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_execomp
static void do_execomp(deark *c, lctx *d)
{
	struct fmtutil_specialexe_detection_data edd;

	if(d->execomp_mode!=1) {
		if(d->sfx_only_mode) return;
		if((!c->show_infomessages) && (c->debug_level<1)) return;
	}

	if(!d->ei) {
		d->ei = de_malloc(c, sizeof(struct fmtutil_exe_info));
		fmtutil_collect_exe_info(c, c->infile, d->ei);
	}

	de_zeromem(&edd, sizeof(struct fmtutil_specialexe_detection_data));
	edd.flags_in |= 0x1;
	fmtutil_detect_execomp(c, d->ei, &edd);
	if(!edd.detected_fmt) return;
	de_dbg(c, "detected executable compression: %s", edd.detected_fmt_name);

	if(d->execomp_mode==1) {
		try_execomp_decompress(c, d, &edd);
	}
	else if(d->execomp_mode!=0) {
		if(edd.modname) {
			de_info(c, "Note: File seems to be compressed with %s. Use \"-m %s\" "
				"or \"-opt execomp\" to attempt decompression.",
				edd.detected_fmt_name, edd.modname);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x1, %eax
je 0x5f2fc
movq -0x10(%rbp), %rax
cmpb $0x0, 0x3(%rax)
je 0x5f2df
jmp 0x5f3f1
movq -0x8(%rbp), %rax
cmpl $0x0, 0xc0(%rax)
jne 0x5f2fa
movq -0x8(%rbp), %rax
cmpl $0x1, (%rax)
jge 0x5f2fa
jmp 0x5f3f1
jmp 0x5f2fc
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x5f339
movq -0x8(%rbp), %rdi
movl $0xf0, %esi
callq 0x15b780
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
callq 0x188930
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
movl $0x78, %edx
callq 0x19140
movl -0x80(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x80(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x88(%rbp), %rdx
callq 0x188c80
cmpb $0x0, -0x87(%rbp)
jne 0x5f378
jmp 0x5f3f1
movq -0x8(%rbp), %rdi
leaq -0x88(%rbp), %rdx
addq $0x50, %rdx
leaq 0x149882(%rip), %rsi    # 0x1a8c10
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x1, %eax
jne 0x5f3b8
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x61b50
jmp 0x5f3f1
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x5f3ef
cmpq $0x0, -0x40(%rbp)
je 0x5f3ed
movq -0x8(%rbp), %rdi
leaq -0x88(%rbp), %rdx
addq $0x50, %rdx
movq -0x40(%rbp), %rcx
leaq 0x14984e(%rip), %rsi    # 0x1a8c34
movb $0x0, %al
callq 0x15c0c0
jmp 0x5f3ef
jmp 0x5f3f1
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_pe_section_table
static void do_pe_section_table(deark *c, lctx *d)
{
	i64 pos;
	i64 i;

	pos = d->pe_sections_offset;
	de_dbg(c, "section table at %"I64_FMT, pos);
	de_dbg_indent(c, 1);
	for(i=0; i<d->pe_number_of_sections; i++) {
#define PE_MAX_SECTIONS 100
		if(i>=PE_MAX_SECTIONS) goto done;
		if(d->rsrc_errflag) goto done;
		do_pe_section_header(c, d, i, pos + 40*i);
	}

done:
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x14891e(%rip), %rsi    # 0x1a7d4c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0xe0(%rcx), %rax
jge 0x5f49c
cmpq $0x64, -0x20(%rbp)
jl 0x5f465
jmp 0x5f49e
movq -0x10(%rbp), %rax
cmpb $0x0, 0x6(%rax)
je 0x5f471
jmp 0x5f49e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
imulq $0x28, -0x20(%rbp), %rax
addq %rax, %rcx
callq 0x61c10
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x5f44b
jmp 0x5f49e
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_lx_or_le_rsrc_tbl
static void do_lx_or_le_rsrc_tbl(deark *c, lctx *d)
{
	i64 i;
	i64 lpos;
	i64 type_id;
	i64 name_id;
	i64 rsrc_size;
	i64 rsrc_object;
	i64 rsrc_offset;

	de_dbg(c, "%s resource table at %"I64_FMT, d->fmt==EXE_FMT_LE?"LE":"LX", d->lx_rsrc_tbl_offset);
	if(d->lx_rsrc_tbl_entries>MAX_RESOURCES) {
		de_err(c, "Too many resources.");
		return;
	}

	for(i=0; i<d->lx_rsrc_tbl_entries; i++) {
		lpos = d->lx_rsrc_tbl_offset + 14*i;

		type_id = de_getu16le(lpos);
		name_id = de_getu16le(lpos+2);
		rsrc_size = de_getu32le(lpos+4);
		rsrc_object = de_getu16le(lpos+8);
		rsrc_offset = de_getu32le(lpos+10);

		de_dbg(c, "resource #%d: type=%d name=%d size=%"I64_FMT" obj=%d offset=%"I64_FMT, (int)i,
			(int)type_id, (int)name_id, rsrc_size, (int)rsrc_object, rsrc_offset);

		de_dbg_indent(c, 1);
		do_lx_rsrc(c, d, rsrc_object, rsrc_offset, rsrc_size, type_id);
		de_dbg_indent(c, -1);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl (%rax), %ecx
leaq 0x148c2c(%rip), %rdx    # 0x1a857e
leaq 0x148dcd(%rip), %rax    # 0x1a8726
cmpl $0x6, %ecx
cmoveq %rax, %rdx
movq -0x10(%rbp), %rax
movq 0xb8(%rax), %rcx
leaq 0x14984a(%rip), %rsi    # 0x1a91bc
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
cmpq $0x2710, 0xc0(%rax) # imm = 0x2710
jle 0x5f9a1
movq -0x8(%rbp), %rdi
leaq 0x149840(%rip), %rsi    # 0x1a91d5
movb $0x0, %al
callq 0x15bfb0
jmp 0x5fad5
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0xc0(%rcx), %rax
jge 0x5fad5
movq -0x10(%rbp), %rax
movq 0xb8(%rax), %rax
imulq $0xe, -0x18(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x165280
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x2, %rsi
callq 0x165280
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x4, %rsi
callq 0x165540
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x8, %rsi
callq 0x165280
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0xa, %rsi
callq 0x165540
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movq -0x28(%rbp), %rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %eax, %r8d
movq -0x38(%rbp), %r9
movq -0x40(%rbp), %rax
movl %eax, %r10d
movq -0x48(%rbp), %rax
leaq 0x14976e(%rip), %rsi    # 0x1a91e9
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0x28(%rbp), %r9
callq 0x63150
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x5f9a9
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_specialexe
static void do_specialexe(deark *c, lctx *d)
{
	struct fmtutil_specialexe_detection_data edd;

	if(!d->ei) return;
	de_zeromem(&edd, sizeof(struct fmtutil_specialexe_detection_data));
	edd.flags_in |= 0x1;
	fmtutil_detect_specialexe(c, d->ei, &edd);
	if(!edd.detected_fmt) goto done;

	de_dbg(c, "detected special exe: %s", edd.detected_fmt_name);

	if(edd.modname) {
		de_dbg(c, "attempting to decode %s", edd.modname);
		de_dbg_indent(c, 1);
		de_run_module_by_id_on_slice2(c, edd.modname, NULL, c->infile, 0, c->infile->len);
		de_dbg_indent(c, -1);
	}

done:
	;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x5fd13
jmp 0x5fdd6
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
movl $0x78, %edx
callq 0x19140
movl -0x80(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x80(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x88(%rbp), %rdx
callq 0x189890
cmpb $0x0, -0x87(%rbp)
jne 0x5fd55
jmp 0x5fdd6
movq -0x8(%rbp), %rdi
leaq -0x88(%rbp), %rdx
addq $0x50, %rdx
leaq 0x149800(%rip), %rsi    # 0x1a956b
movb $0x0, %al
callq 0x15b0d0
cmpq $0x0, -0x40(%rbp)
je 0x5fdd4
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0x1497fc(%rip), %rsi    # 0x1a9584
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %r9
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
callq 0x15cab0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
jmp 0x5fdd6
addq $0x90, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_ext_header
static void do_ext_header(deark *c, lctx *d)
{
	switch(d->fmt) {
	case EXE_FMT_PE:
		do_Rich_segment(c, d);
		do_pe_coff_header(c, d, d->ext_header_offset);
		// If do_pe_coff_header didn't figure out the (sub)format...
		de_declare_fmt(c, "PE");
		break;
	case EXE_FMT_NE:
		de_declare_fmt(c, "NE");
		// TODO: Do "Rich" segments ever exist in files that are not PE files?
		do_ne_ext_header(c, d, d->ext_header_offset);
		break;
	case EXE_FMT_LX:
		de_declare_fmt(c, "LX Linear Executable");
		do_lx_or_le_ext_header(c, d, d->ext_header_offset);
		break;
	case EXE_FMT_LE:
		de_declare_fmt(c, "LE Linear Executable");
		do_lx_or_le_ext_header(c, d, d->ext_header_offset);
		break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0x4, %eax
ja 0x607a4
movq -0x18(%rbp), %rax
leaq 0x147b44(%rip), %rcx    # 0x1a8238
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x60920
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0x60b50
movq -0x8(%rbp), %rdi
leaq 0x146c4b(%rip), %rsi    # 0x1a7375
callq 0x15e380
jmp 0x607a4
movq -0x8(%rbp), %rdi
leaq 0x146790(%rip), %rsi    # 0x1a6ecc
callq 0x15e380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0x60d00
jmp 0x607a4
movq -0x8(%rbp), %rdi
leaq 0x147e45(%rip), %rsi    # 0x1a85a8
callq 0x15e380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0x60f90
jmp 0x607a4
movq -0x8(%rbp), %rdi
leaq 0x147e33(%rip), %rsi    # 0x1a85bd
callq 0x15e380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0x60f90
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_checksum
static void do_checksum(deark *c, lctx *d)
{
	struct de_crcobj *crco = NULL;
	UI checksum_calc1;
	UI checksum_calc2;

	if(d->end_of_dos_code>c->infile->len) goto done;

	crco = de_crcobj_create(c, DE_CRCOBJ_SUM_U16LE);
	de_crcobj_addslice(crco, c->infile, 0, 18);
	de_crcobj_addslice(crco, c->infile, 20, d->end_of_dos_code-20);

	checksum_calc1 = de_crcobj_getval(crco);
	checksum_calc1 &= 0xffff;
	checksum_calc1 ^= 0xffff;

	// I don't know if the overlay is supposed to be included in the checksummed
	// bytes (best guess is no). But some EXE files do it one way, and some do
	// it the other way, and that's reason enough to calculate it both ways.

	de_crcobj_addslice(crco, c->infile, d->end_of_dos_code,
		c->infile->len - d->end_of_dos_code);
	checksum_calc2 = de_crcobj_getval(crco);
	checksum_calc2 &= 0xffff;
	checksum_calc2 ^= 0xffff;

	de_dbg(c, "checksum (calculated): 0x%04x", checksum_calc1);
	if(checksum_calc2 != checksum_calc1) {
		de_dbg(c, "checksum (calculated, including overlay): 0x%04x", checksum_calc2);
	}

done:
	de_crcobj_destroy(crco);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jle 0x607e3
jmp 0x608d6
movq -0x8(%rbp), %rdi
movl $0x31, %esi
callq 0x15eac0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
movl $0x12, %ecx
callq 0x15f500
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rcx
subq $0x14, %rcx
movl $0x14, %edx
callq 0x15f500
movq -0x18(%rbp), %rdi
callq 0x15f340
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
xorl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdx
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
subq 0x30(%rax), %rcx
callq 0x15f500
movq -0x18(%rbp), %rdi
callq 0x15f340
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
xorl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq 0x175fa3(%rip), %rsi    # 0x1d6853
movb $0x0, %al
callq 0x15b0d0
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
je 0x608d4
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %edx
leaq 0x147c4a(%rip), %rsi    # 0x1a8517
movb $0x0, %al
callq 0x15b0d0
jmp 0x608d6
movq -0x18(%rbp), %rdi
callq 0x15f2e0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_pe_coff_header
static void do_pe_coff_header(deark *c, lctx *d, i64 pos)
{
	UI arch;
	i64 n;

	de_dbg(c, "PE header at %"I64_FMT, d->ext_header_offset);
	de_dbg_indent(c, 1);

	// a.k.a. "Machine". TODO: Decode this.
	arch = (UI)de_getu16le(pos+4+0);
	de_dbg(c, "target architecture: 0x%04x (%s)", arch,
		get_machine_type_name(arch));

	d->pe_number_of_sections = de_getu16le(pos+4+2);
	de_dbg(c, "number of sections: %d", (int)d->pe_number_of_sections);

	d->pe_opt_hdr_size = de_getu16le(pos+4+16);
	de_dbg(c, "optional header size: %"I64_FMT, d->pe_opt_hdr_size);

	n = de_getu16le(pos+4+18);
	do_pe_characteristics(c, d, (UI)n);

	if(d->pe_opt_hdr_size>0) {
		do_opt_coff_header(c, d, pos+4+20, d->pe_opt_hdr_size);
		d->pe_sections_offset = pos+4+20+d->pe_opt_hdr_size;
	}

	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
leaq 0x147aba(%rip), %rsi    # 0x1a8631
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
addq $0x0, %rsi
callq 0x165280
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x1c(%rbp), %edi
callq 0x61260
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %edx
movq %rax, %rcx
leaq 0x147a73(%rip), %rsi    # 0x1a8642
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
addq $0x2, %rsi
callq 0x165280
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xe0(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xe0(%rax), %rax
movl %eax, %edx
leaq 0x147a4e(%rip), %rsi    # 0x1a8663
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
addq $0x10, %rsi
callq 0x165280
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xd0(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xd0(%rax), %rdx
leaq 0x147a21(%rip), %rsi    # 0x1a867a
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
addq $0x12, %rsi
callq 0x165280
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movl %eax, %edx
callq 0x612d0
movq -0x10(%rbp), %rax
cmpq $0x0, 0xd0(%rax)
jle 0x60ce4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x4, %rdx
addq $0x14, %rdx
movq -0x10(%rbp), %rax
movq 0xd0(%rax), %rcx
callq 0x61420
movq -0x18(%rbp), %rcx
addq $0x4, %rcx
addq $0x14, %rcx
movq -0x10(%rbp), %rax
addq 0xd0(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xd8(%rax)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_pe_characteristics
static void do_pe_characteristics(deark *c, lctx *d, UI v)
{
	de_ucstring *s = NULL;
	s = ucstring_create(c);

	if(v&0x0001) ucstring_append_flags_item(s, "relocs_stripped");
	if(v&0x0002) ucstring_append_flags_item(s, "valid_executable");
	if(v&0x0004) ucstring_append_flags_item(s, "COFF_line_numbers_stripped");
	if(v&0x0008) ucstring_append_flags_item(s, "COFF_local_stripped");
	if(v&0x0020) ucstring_append_flags_item(s, "large_address_aware");
	if(v&0x0100) ucstring_append_flags_item(s, "32-bit");
	if(v&0x0200) ucstring_append_flags_item(s, "stripped");
	if(v&0x2000) ucstring_append_flags_item(s, "DLL");
	// TODO: There are more flags than this.
	de_dbg(c, "characteristics: 0x%04x (%s)", v, ucstring_getpsz(s));
	ucstring_destroy(s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x61313
movq -0x20(%rbp), %rdi
leaq 0x147488(%rip), %rsi    # 0x1a8796
callq 0x172680
movl -0x14(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x6132e
movq -0x20(%rbp), %rdi
leaq 0x14747d(%rip), %rsi    # 0x1a87a6
callq 0x172680
movl -0x14(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x61349
movq -0x20(%rbp), %rdi
leaq 0x147473(%rip), %rsi    # 0x1a87b7
callq 0x172680
movl -0x14(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x61364
movq -0x20(%rbp), %rdi
leaq 0x147473(%rip), %rsi    # 0x1a87d2
callq 0x172680
movl -0x14(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x6137f
movq -0x20(%rbp), %rdi
leaq 0x14746c(%rip), %rsi    # 0x1a87e6
callq 0x172680
movl -0x14(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x6139c
movq -0x20(%rbp), %rdi
leaq 0x147463(%rip), %rsi    # 0x1a87fa
callq 0x172680
movl -0x14(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x613b9
movq -0x20(%rbp), %rdi
leaq 0x147429(%rip), %rsi    # 0x1a87dd
callq 0x172680
movl -0x14(%rbp), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x613d6
movq -0x20(%rbp), %rdi
leaq 0x147430(%rip), %rsi    # 0x1a8801
callq 0x172680
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rdi
callq 0x172500
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
movq %rax, %rcx
leaq 0x147407(%rip), %rsi    # 0x1a8805
movb $0x0, %al
callq 0x15b0d0
movq -0x20(%rbp), %rdi
callq 0x171750
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_opt_coff_header
static void do_opt_coff_header(deark *c, lctx *d, i64 pos, i64 len)
{
	i64 sig;
	i64 coff_opt_hdr_size;

	de_dbg(c, "COFF/PE optional header at %"I64_FMT", size=%"I64_FMT, pos, len);
	de_dbg_indent(c, 1);

	sig = de_getu16le(pos);
	de_dbg(c, "signature: 0x%04x", (int)sig);

	if(sig==0x010b)
		coff_opt_hdr_size = 28;
	else
		coff_opt_hdr_size = 24;

	if(sig==0x010b) {
		d->subfmt = EXE_SUBFMT_PE32;
		de_declare_fmt(c, "PE32");
		do_opt_coff_nt_header(c, d, pos+coff_opt_hdr_size);
		do_opt_coff_data_dirs(c, d, pos+coff_opt_hdr_size+68);
	}
	else if(sig==0x020b) {
		d->subfmt = EXE_SUBFMT_PE32PLUS;
		de_declare_fmt(c, "PE32+");
		do_opt_coff_nt_header_64(c, d, pos+coff_opt_hdr_size);
		do_opt_coff_data_dirs(c, d, pos+coff_opt_hdr_size+88);
	}
	else if(sig==0x0107) {
		de_declare_fmt(c, "PE ROM image");
	}
	else {
		de_declare_fmt(c, "Unknown PE file type");
	}

	de_dbg_indent(c, -1);
}

// 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 -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x1473d7(%rip), %rsi    # 0x1a8822
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x165280
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x1473c5(%rip), %rsi    # 0x1a884b
movb $0x0, %al
callq 0x15b0d0
cmpq $0x10b, -0x28(%rbp)     # imm = 0x10B
jne 0x614a1
movq $0x1c, -0x30(%rbp)
jmp 0x614a9
movq $0x18, -0x30(%rbp)
cmpq $0x10b, -0x28(%rbp)     # imm = 0x10B
jne 0x614fe
movq -0x10(%rbp), %rax
movb $0x1, 0x1(%rax)
movq -0x8(%rbp), %rdi
leaq 0x147397(%rip), %rsi    # 0x1a885d
callq 0x15e380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq -0x30(%rbp), %rdx
callq 0x615a0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq -0x30(%rbp), %rdx
addq $0x44, %rdx
callq 0x61670
jmp 0x61580
cmpq $0x20b, -0x28(%rbp)     # imm = 0x20B
jne 0x61550
movq -0x10(%rbp), %rax
movb $0x2, 0x1(%rax)
movq -0x8(%rbp), %rdi
leaq 0x147347(%rip), %rsi    # 0x1a8862
callq 0x15e380
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq -0x30(%rbp), %rdx
callq 0x61790
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq -0x30(%rbp), %rdx
addq $0x58, %rdx
callq 0x61670
jmp 0x6157e
cmpq $0x107, -0x28(%rbp)     # imm = 0x107
jne 0x6156c
movq -0x8(%rbp), %rdi
leaq 0x147303(%rip), %rsi    # 0x1a8868
callq 0x15e380
jmp 0x6157c
movq -0x8(%rbp), %rdi
leaq 0x1472fe(%rip), %rsi    # 0x1a8875
callq 0x15e380
jmp 0x6157e
jmp 0x61580
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_opt_coff_nt_header
static void do_opt_coff_nt_header(deark *c, lctx *d, i64 pos)
{
	i64 x;
	i64 subsystem;

	de_dbg(c, "COFF/PE optional header (Windows NT) at %"I64_FMT, pos);
	de_dbg_indent(c, 1);

	x = de_getu32le(pos);
	de_dbg(c, "image base offset: 0x%08x", (UI)x);

	subsystem = de_getu16le(pos+40);
	de_dbg(c, "subsystem: %d%s", (int)subsystem, get_subsys_desc(subsystem));

	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x1472c7(%rip), %rsi    # 0x1a888a
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x165540
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %edx
leaq 0x1472b8(%rip), %rsi    # 0x1a88b6
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x28, %rsi
callq 0x165280
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rdi
callq 0x61850
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %edx
movq %rax, %rcx
leaq 0x147289(%rip), %rsi    # 0x1a88d0
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_opt_coff_data_dirs
static void do_opt_coff_data_dirs(deark *c, lctx *d, i64 pos)
{
	i64 rsrc_tbl_rva;
	i64 rsrc_tbl_size;
	i64 pe_security_pos;
	i64 pe_security_size;

	de_dbg(c, "COFF/PE optional header (data directories) at %"I64_FMT, pos);
	de_dbg_indent(c, 1);
	rsrc_tbl_rva = de_getu32le(pos+16);
	// I don't know if rsrc_tbl_rva will be needed for anything. It seems redundant.
	rsrc_tbl_size = de_getu32le(pos+20);
	de_dbg(c, "resource table RVA=0x%08x, size=%"I64_FMT, (UI)rsrc_tbl_rva,
		rsrc_tbl_size);

	pe_security_pos = de_getu32le(pos+32);
	pe_security_size = de_getu32le(pos+36);
	de_dbg(c, "security pos=0x%08x, size=%"I64_FMT, (UI)pe_security_pos,
		pe_security_size);
	if(pe_security_pos>0) {
		de_dbg_indent(c, 1);
		do_certificate(c, d, pe_security_pos, pe_security_size);
		de_dbg_indent(c, -1);
	}

	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x147267(%rip), %rsi    # 0x1a88fa
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x10, %rsi
callq 0x165540
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x14, %rsi
callq 0x165540
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %edx
movq -0x28(%rbp), %rcx
leaq 0x14723d(%rip), %rsi    # 0x1a892c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x20, %rsi
callq 0x165540
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x24, %rsi
callq 0x165540
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movl %eax, %edx
movq -0x38(%rbp), %rcx
leaq 0x147213(%rip), %rsi    # 0x1a8950
movb $0x0, %al
callq 0x15b0d0
cmpq $0x0, -0x30(%rbp)
jle 0x6177c
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x618a0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x40, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_opt_coff_nt_header_64
static void do_opt_coff_nt_header_64(deark *c, lctx *d, i64 pos)
{
	i64 base_offset;
	i64 subsystem;

	de_dbg(c, "COFF/PE32+ optional header (Windows NT) at %"I64_FMT, pos);
	de_dbg_indent(c, 1);

	base_offset = de_geti64le(pos);
	de_dbg(c, "image base offset: 0x%016" U64_FMTx "", (u64)base_offset);

	subsystem = de_getu16le(pos+44);
	de_dbg(c, "subsystem: %d%s", (int)subsystem, get_subsys_desc(subsystem));

	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x1471fa(%rip), %rsi    # 0x1a89ad
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x1657e0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x1471f0(%rip), %rsi    # 0x1a89dc
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x2c, %rsi
callq 0x165280
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rdi
callq 0x61850
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %edx
movq %rax, %rcx
leaq 0x14709b(%rip), %rsi    # 0x1a88d0
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x40, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: get_subsys_desc
static const char *get_subsys_desc(i64 subsystem)
{
	switch(subsystem) {
	case 2: return " (Windows GUI)";
	case 3: return " (console)";
	}
	return "";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
subq $0x2, %rax
je 0x61874
jmp 0x61868
movq -0x18(%rbp), %rax
subq $0x3, %rax
je 0x61881
jmp 0x6188e
leaq 0x147065(%rip), %rax    # 0x1a88e0
movq %rax, -0x8(%rbp)
jmp 0x61899
leaq 0x147067(%rip), %rax    # 0x1a88ef
movq %rax, -0x8(%rbp)
jmp 0x61899
leaq 0x16f33b(%rip), %rax    # 0x1d0bd0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_certificate
static void do_certificate(deark *c, lctx *d, i64 pos1, i64 len)
{
	i64 dlen;
	i64 revision;
	i64 certtype;

	// This is a WIN_CERTIFICATE structure.
	if(pos1<1 || len<=8 || (pos1+len > c->infile->len)) return;

	de_dbg(c, "certificate data at %"I64_FMT, pos1);
	de_dbg_indent(c, 1);
	dlen = de_getu32le(pos1);
	de_dbg(c, "length: %"I64_FMT, dlen); // Includes the 8-byte header
	revision = de_getu16le(pos1+4);
	de_dbg(c, "revision: 0x%04x", (UI)revision);
	certtype = de_getu16le(pos1+6);
	de_dbg(c, "cert type: %d", (int)certtype);
	if(dlen<=8 || dlen > len) goto done;
	if(d->extract_std_resources && c->extract_level>=2) {
		const char *ext;
		if(certtype==2) ext="p7b";
		else ext="crt";
		dbuf_create_file_from_slice(c->infile, pos1+8, dlen-8, ext, NULL, 0);
	}
done:
	de_dbg_indent(c, -1);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $0x1, -0x18(%rbp)
jl 0x618dc
cmpq $0x8, -0x20(%rbp)
jle 0x618dc
movq -0x18(%rbp), %rax
addq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jle 0x618e1
jmp 0x61a17
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x14707e(%rip), %rsi    # 0x1a896e
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x165540
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x14116e(%rip), %rsi    # 0x1a2a97
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x4, %rsi
callq 0x165280
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movl %eax, %edx
leaq 0x14702c(%rip), %rsi    # 0x1a8986
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x6, %rsi
callq 0x165280
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movl %eax, %edx
leaq 0x14700c(%rip), %rsi    # 0x1a8997
movb $0x0, %al
callq 0x15b0d0
cmpq $0x8, -0x28(%rbp)
jle 0x619a3
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jle 0x619a5
jmp 0x61a09
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
je 0x61a07
movq -0x8(%rbp), %rax
cmpl $0x2, 0x90(%rax)
jl 0x61a07
cmpq $0x2, -0x38(%rbp)
jne 0x619d3
leaq 0x146fd8(%rip), %rax    # 0x1a89a5
movq %rax, -0x40(%rbp)
jmp 0x619de
leaq 0x146fcf(%rip), %rax    # 0x1a89a9
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
movq -0x28(%rbp), %rdx
subq $0x8, %rdx
movq -0x40(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
xorl %r9d, %r9d
callq 0x166be0
jmp 0x61a09
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)