LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bintext.c
// Function: de_identify_ldog_com
static int de_identify_ldog_com(deark *c)
{
	if(c->infile->len>65280) return 0;
	if(de_getbyte(0) != 0x06) return 0;

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

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

// Assembly:
leaq 0xe57cb(%rip), %rax     # 0x1170af
movq %rax, (%rsi)
leaq 0xe57c9(%rip), %rax     # 0x1170b7
movq %rax, 0x8(%rsi)
leaq 0x14(%rip), %rax        # 0x3190d
movq %rax, 0x18(%rsi)
leaq 0x2b4(%rip), %rax       # 0x31bb8
movq %rax, 0x20(%rsi)
orb $0x1, 0x30(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bintext.c
// Function: de_identify_grabber
static int de_identify_grabber(deark *c)
{
	struct grabber_id_data gi;
	u8 b0;

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

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

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

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

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

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

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

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

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

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rsi), %rcx
leaq 0xe5459(%rip), %rsi     # 0x1171cf
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x18(%r14)
movq 0x18(%rbx), %rdi
movq 0x10(%r14), %rcx
movq %rax, %rsi
movq %r15, %rdx
callq 0xeeee8
movq %rbx, %rdi
movl $0x10, %esi
callq 0xeba56
movq %rax, %r15
movq 0x10(%r14), %rdx
movq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0xebe72
movq %r15, %rdi
callq 0xebe2a
movl %eax, %ebp
movq %r15, %rdi
callq 0xebe1d
movq %rbx, %rdi
movl %ebp, %esi
callq 0xf5bf0
movl %eax, 0x20(%r14)
testl %eax, %eax
leaq 0xe5417(%rip), %rax     # 0x11720d
leaq 0xe53ff(%rip), %rcx     # 0x1171fc
cmoveq %rax, %rcx
leaq 0xe53de(%rip), %rsi     # 0x1171e6
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe9226
leaq 0xe53ff(%rip), %rsi     # 0x11721a
movq %rbx, %rdi
callq 0xea6cb
testq %rax, %rax
je 0x31e59
leaq 0xe53fc(%rip), %rsi     # 0x11722b
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xf037a
movq %rax, %r15
movq 0x10(%r14), %rdx
movq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0xefb82
movq %r15, %rdi
callq 0xf0b13
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xe9585
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bintext.c
// Function: do_generate_font
static int do_generate_font(deark *c, lctx *d)
{
	i64 i;
	struct de_encconv_state es;

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

	for(i=0; i<d->font->num_chars; i++) {
		d->font->char_array[i].codepoint_nonunicode = (i32)i;
		d->font->char_array[i].codepoint_unicode = de_char_to_unicode_ex((i32)i, &es);
		d->font->char_array[i].width = d->font->nominal_width;
		d->font->char_array[i].height = d->font->nominal_height;
		d->font->char_array[i].rowspan = 1;
		d->font->char_array[i].bitmap = &d->font_data[i*d->font_height];
	}

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq 0x28(%rsi), %rax
testq %rax, %rax
je 0x31f53
movq %rsi, %rbx
movq 0x18(%rax), %rsi
cmpq $0x100, %rsi            # imm = 0x100
jne 0x31f57
movq 0x8(%rbx), %rcx
movq %rcx, %rdx
shlq $0x8, %rdx
cmpq %rdx, 0x10(%rbx)
jne 0x31f60
movl $0x8, (%rax)
movl %ecx, 0x4(%rax)
movl $0x28, %edx
callq 0xea259
movq 0x28(%rbx), %rcx
movq %rax, 0x20(%rcx)
movq %rsp, %rdi
movl $0xd, %esi
callq 0xec207
movq 0x28(%rbx), %rax
movl $0x1, %ebp
cmpq $0x0, 0x18(%rax)
jle 0x31f70
xorl %r12d, %r12d
movq %rsp, %r14
xorl %r15d, %r15d
movq 0x20(%rax), %rax
movl %r15d, (%rax,%r12)
movl %r15d, %edi
movq %r14, %rsi
callq 0xec6fd
movq 0x28(%rbx), %rcx
movq 0x20(%rcx), %rdx
movl %eax, 0x4(%rdx,%r12)
movl (%rcx), %eax
movl %eax, 0x8(%rdx,%r12)
movl 0x4(%rcx), %eax
movl %eax, 0xc(%rdx,%r12)
movq $0x1, 0x18(%rdx,%r12)
movq 0x8(%rbx), %rax
imulq %r15, %rax
addq 0x18(%rbx), %rax
movq %rax, 0x20(%rdx,%r12)
incq %r15
movq 0x28(%rbx), %rax
addq $0x28, %r12
cmpq 0x18(%rax), %r15
jl 0x31ef7
jmp 0x31f70
xorl %ebp, %ebp
jmp 0x31f70
leaq 0xe52d6(%rip), %rsi     # 0x117234
jmp 0x31f67
leaq 0xe52f4(%rip), %rsi     # 0x11725b
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xe9df7
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bintext.c
// Function: do_extract_font
static void do_extract_font(deark *c, lctx *d)
{
	de_finfo *fi = NULL;

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

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

	de_finfo_destroy(c, fi);
}

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

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

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

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

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

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

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

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
cmpl $0xe9, %esi
je 0x32467
cmpl $0xfb, %esi
jne 0x324c5
movq 0x18(%r14), %rdi
leaq 0xe4b03(%rip), %rdx     # 0x116f50
movl $0x1, %esi
movl $0xb, %ecx
callq 0xf025e
testl %eax, %eax
jne 0x324c5
movl $0xc8, %eax
jmp 0x324bf
movq 0x18(%r14), %rdi
movl $0x1, %esi
callq 0xef257
leaq 0x3(%rax), %rsi
movq %rsi, 0x8(%rbx)
movq 0x18(%r14), %rdi
leaq 0xe4ad4(%rip), %rdx     # 0x116f5c
movl $0xc, %ecx
callq 0xf025e
testl %eax, %eax
je 0x324ba
movq 0x18(%r14), %rdi
movq 0x8(%rbx), %rsi
leaq 0xe4ac4(%rip), %rdx     # 0x116f69
movl $0xd, %ecx
callq 0xf025e
testl %eax, %eax
jne 0x324c5
movl $0x14e, %eax            # imm = 0x14E
jmp 0x324bf
movl $0x12c, %eax            # imm = 0x12C
movb $0x1, (%rbx)
movl %eax, 0x4(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmi.c
// Function: de_module_bmi
void de_module_bmi(deark *c, struct deark_module_info *mi)
{
	mi->id = "bmi";
	mi->desc = "Zoner BMI bitmap";
	mi->run_fn = de_run_bmi;
	mi->identify_fn = de_identify_bmi;
}

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

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

// Assembly:
leaq 0xee387(%rip), %rax     # 0x121052
movq %rax, (%rsi)
leaq 0xe4b43(%rip), %rax     # 0x117818
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x32cf0
movq %rax, 0x18(%rsi)
leaq 0x1759(%rip), %rax      # 0x34444
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_identify_bmp
static int de_identify_bmp(deark *c)
{
	i64 fsize;
	i64 bits_offset;
	i64 infohdrsize;
	u32 compression_field = 0;
	int bmp_ext;
	u8 buf[6];

	de_read(buf, 0, sizeof(buf));
	if(de_memcmp(buf, "BM", 2)) {
		return 0;
	}

	bmp_ext = de_input_file_has_ext(c, "bmp");
	fsize = de_getu32le_direct(&buf[2]);
	bits_offset = de_getu32le(10);
	infohdrsize = de_getu32le(14);
	if(infohdrsize>=20) {
		compression_field = (u32)de_getu32le(14+16);
		// Don't detect KQP format as BMP
		if(infohdrsize==68 && compression_field==0x4745504aU) return 0;
	}

	if(infohdrsize<12) return 0;
	if(infohdrsize>256) return 0;
	if(bits_offset>=c->infile->len) return 0;
	if(bits_offset<14+infohdrsize) return 0;
	if(fsize==c->infile->len && bmp_ext) return 100;
	if(buf[2]==0xcb) {
		// Possible VBM file.
		// Windows BMP files are highly unlikely to start with 'B' 'M' \xcb,
		// because that would imply the file is an odd number of bytes in size,
		// which is legal but silly.
		if(bmp_ext) return 90;
		return 5;
	}

	if(bmp_ext) return 100;
	if(infohdrsize==12 || infohdrsize==40 || infohdrsize==108 ||
		infohdrsize==124)
	{
		return 100;
	}
	return 90;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
leaq 0x2(%rsp), %r15
movl $0x6, %ecx
movq %r15, %rsi
xorl %edx, %edx
callq 0xeeee8
cmpw $0x4d42, (%r15)         # imm = 0x4D42
je 0x34485
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xecbc6(%rip), %rsi     # 0x121052
movq %r14, %rdi
callq 0xea936
movl %eax, %ebp
leaq 0x4(%rsp), %rdi
callq 0xef37b
movq %rax, %r12
movq 0x18(%r14), %rdi
movl $0xa, %esi
callq 0xef37e
movq %rax, %r13
movq 0x18(%r14), %rdi
movl $0xe, %esi
callq 0xef37e
movq %rax, %r15
cmpq $0x14, %rax
jl 0x34504
movq 0x18(%r14), %rdi
movl $0x1e, %esi
callq 0xef37e
movq %r15, %rcx
xorq $0x44, %rcx
movl %eax, %eax
xorq $0x4745504a, %rax       # imm = 0x4745504A
orq %rcx, %rax
sete %al
cmpq $0x100, %r15            # imm = 0x100
jg 0x34474
testb %al, %al
je 0x3450e
jmp 0x34474
cmpq $0xc, %r15
jl 0x34474
movq 0x18(%r14), %rax
movq 0x18(%rax), %rax
cmpq %rax, %r13
setge %cl
leaq 0xe(%r15), %rdx
cmpq %rdx, %r13
setl %dl
orb %cl, %dl
jne 0x34474
cmpq %rax, %r12
sete %al
testl %ebp, %ebp
setne %cl
movl $0x64, %ebx
testb %cl, %al
jne 0x34474
cmpb $-0x35, 0x4(%rsp)
jne 0x34561
testl %ebp, %ebp
movl $0x5a, %eax
movl $0x5, %ebx
cmovnel %eax, %ebx
jmp 0x34474
testl %ebp, %ebp
jne 0x34474
movabsq $0x7fffffffffffffef, %rax # imm = 0x7FFFFFFFFFFFFFEF
andq %r15, %rax
cmpq $0x6c, %rax
je 0x34474
cmpq $0xc, %r15
movl $0x64, %eax
movl $0x5a, %ebx
cmovel %eax, %ebx
cmpq $0x28, %r15
cmovel %eax, %ebx
jmp 0x34474
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_module_picjpeg
void de_module_picjpeg(deark *c, struct deark_module_info *mi)
{
	mi->id = "picjpeg";
	mi->desc = "Pegasus JPEG, and KQP";
	mi->run_fn = de_run_picjpeg;
	mi->identify_fn = de_identify_picjpeg;
	mi->id_alias[0] = "kqp";
}

// Assembly:
leaq 0xe3291(%rip), %rax     # 0x117835
movq %rax, (%rsi)
leaq 0xe328f(%rip), %rax     # 0x11783d
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x345d4
movq %rax, 0x18(%rsi)
leaq 0x7e2(%rip), %rax       # 0x34da6
movq %rax, 0x20(%rsi)
leaq 0xe3284(%rip), %rax     # 0x117853
movq %rax, 0x38(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_identify_picjpeg
static int de_identify_picjpeg(deark *c)
{
	if(dbuf_memcmp(c->infile, 0, (const void*)"BM", 2)) return 0;
	if(de_getu32le(14) != 68) return 0;
	if((UI)de_getu32le(30) != 0x4745504aU) return 0;
	return 100;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq 0xe7246(%rip), %rdx     # 0x11bffe
xorl %ebx, %ebx
movl $0x2, %ecx
xorl %esi, %esi
callq 0xf025e
testl %eax, %eax
jne 0x34dfb
movq 0x18(%r14), %rdi
movl $0xe, %esi
callq 0xef37e
cmpq $0x44, %rax
jne 0x34dfb
movq 0x18(%r14), %rdi
movl $0x1e, %esi
callq 0xef37e
xorl %ecx, %ecx
cmpl $0x4745504a, %eax       # imm = 0x4745504A
movl $0x64, %ebx
cmovnel %ecx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_module_dib
void de_module_dib(deark *c, struct deark_module_info *mi)
{
	mi->id = "dib";
	mi->desc = "DIB (raw Windows bitmap)";
	mi->run_fn = de_run_dib;
	mi->identify_fn = de_identify_dib;
}

// Assembly:
leaq 0xee423(%rip), %rax     # 0x12322f
movq %rax, (%rsi)
leaq 0xe2a41(%rip), %rax     # 0x117857
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x34e31
movq %rax, 0x18(%rsi)
leaq 0x135(%rip), %rax       # 0x34f61
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_run_dib
static void de_run_dib(deark *c, de_module_params *mparams)
{
	struct de_bmpinfo bi;
	UI createflags = 0;
	dbuf *outf = NULL;
	int implicit_size = 0;
	i64 dib_len;
	const char *ext = "bmp";
	de_finfo *fi_to_use = NULL;

	if(mparams) {
		// If flags&0x01, try to calculate the proper file size, instead of trusting
		// the length of the input file.
		if(mparams->in_params.flags & 0x01) implicit_size = 1;

		if(mparams->in_params.flags & 0x80) ext = "preview.bmp";

		fi_to_use = mparams->in_params.fi;
	}

	if(de_havemodcode(c, mparams, 'X')) {
		createflags |= DE_CREATEFLAG_IS_AUX;
	}

	if(!fmtutil_get_bmpinfo(c, c->infile, &bi, 0, c->infile->len, 0)) {
		de_err(c, "Invalid DIB, or not a DIB file");
		goto done;
	}

	if(implicit_size) {
		dib_len = bi.total_size;
		if(dib_len > c->infile->len) {
			dib_len = c->infile->len;
		}
	}
	else {
		dib_len = c->infile->len;
	}

	outf = dbuf_create_output_file(c, ext, fi_to_use, createflags);

	de_dbg(c, "writing a BMP FILEHEADER");
	fmtutil_generate_bmpfileheader(c, outf, &bi, 14+dib_len);

	de_dbg(c, "copying DIB file");
	dbuf_copy(c->infile, 0, dib_len, outf);

done:
	dbuf_close(outf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
testq %rsi, %rsi
je 0x34e6d
movl 0x8(%rsi), %eax
testb $0x1, %al
sete %r12b
testb %al, %al
leaq 0xec1f6(%rip), %rax     # 0x121052
leaq 0xe2eb8(%rip), %r14     # 0x117d1b
cmovnsq %rax, %r14
movq 0x28(%rsi), %r15
jmp 0x34e7a
leaq 0xec1de(%rip), %r14     # 0x121052
movb $0x1, %r12b
xorl %r15d, %r15d
movq %rbx, %rdi
movl $0x58, %edx
callq 0xea97e
xorl %ebp, %ebp
testl %eax, %eax
setne %r13b
movq 0x18(%rbx), %rsi
movq 0x18(%rsi), %r8
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0xf7881
testl %eax, %eax
je 0x34ebf
movb %r13b, %bpl
testb %r12b, %r12b
je 0x34ed5
movq 0x18(%rbx), %rax
movq 0x18(%rax), %r12
jmp 0x34eec
leaq 0xe2e61(%rip), %rsi     # 0x117d27
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0x34f47
movq 0x98(%rsp), %rax
movq 0x18(%rbx), %rcx
movq 0x18(%rcx), %r12
cmpq %r12, %rax
cmovlq %rax, %r12
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %ebp, %ecx
callq 0xf037a
movq %rax, %r14
leaq 0xe2e40(%rip), %rsi     # 0x117d46
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
leaq 0xe(%r12), %rcx
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf7d41
leaq 0xe2e33(%rip), %rsi     # 0x117d5f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r14, %rcx
callq 0xefabc
movq %r14, %rdi
callq 0xf0b13
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_identify_dib
static int de_identify_dib(deark *c)
{
	i64 n;

	n = de_getu32le(0); // biSize
	if(n!=40) return 0;
	n = de_getu16le(12); // biPlanes
	if(n!=1) return 0;
	n = de_getu16le(14); // biBitCount
	if(n==1 || n==4 || n==8 || n==16 || n==24 || n==32) return 15;
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0xef37e
cmpq $0x28, %rax
jne 0x34fb8
movq 0x18(%r14), %rdi
movl $0xc, %esi
callq 0xef1ca
cmpq $0x1, %rax
jne 0x34fb8
movq 0x18(%r14), %rdi
movl $0xe, %esi
callq 0xef1ca
cmpq $0x20, %rax
ja 0x34fc2
movl $0xf, %ebx
movabsq $0x101010112, %rcx      # imm = 0x101010112
btq %rax, %rcx
jae 0x34fc2
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
xorl %ebx, %ebx
jmp 0x34fb8
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_module_ddb
void de_module_ddb(deark *c, struct deark_module_info *mi)
{
	mi->id = "ddb";
	mi->desc = "Windows DDB bitmap";
	mi->run_fn = de_run_ddb;
	mi->identify_fn = NULL;
	mi->flags |= DE_MODFLAG_HIDDEN;
}

// Assembly:
leaq 0xee220(%rip), %rax     # 0x1231ed
movq %rax, (%rsi)
leaq 0xe2899(%rip), %rax     # 0x117870
movq %rax, 0x8(%rsi)
leaq 0x11(%rip), %rax        # 0x34ff3
movq %rax, 0x18(%rsi)
movq $0x0, 0x20(%rsi)
orb $0x1, 0x30(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_module_winzle
void de_module_winzle(deark *c, struct deark_module_info *mi)
{
	mi->id = "winzle";
	mi->desc = "Winzle! puzzle image";
	mi->run_fn = de_run_winzle;
	mi->identify_fn = de_identify_winzle;
}

// Assembly:
leaq 0xe238e(%rip), %rax     # 0x117883
movq %rax, (%rsi)
leaq 0xe238b(%rip), %rax     # 0x11788a
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x3551a
movq %rax, 0x18(%rsi)
leaq 0xa7(%rip), %rax        # 0x355bc
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_run_winzle
static void de_run_winzle(deark *c, de_module_params *mparams)
{
	u8 buf[256];
	i64 xorsize;
	i64 i;
	dbuf *f = NULL;

	xorsize = c->infile->len >= 256 ? 256 : c->infile->len;
	de_read(buf, 0, xorsize);
	for(i=0; i<xorsize; i++) {
		buf[i] ^= 0x0d;
	}

	f = dbuf_create_output_file(c, "bmp", NULL, 0);
	dbuf_write(f, buf, xorsize);
	if(c->infile->len > 256) {
		dbuf_copy(c->infile, 256, c->infile->len - 256, f);
	}
	dbuf_close(f);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq 0x18(%rdi), %r15
movl $0x100, %r14d           # imm = 0x100
cmpq %r14, %r15
cmovlq %r15, %r14
movq %rsp, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0xeeee8
testq %r15, %r15
jle 0x3555e
xorl %eax, %eax
xorb $0xd, (%rsp,%rax)
incq %rax
cmpq %rax, %r14
jne 0x35552
leaq 0xebaed(%rip), %rsi     # 0x121052
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r15
movq %rsp, %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0xefb82
movq 0x18(%rbx), %rdi
movq 0x18(%rdi), %rdx
cmpq $0x101, %rdx            # imm = 0x101
jl 0x355a7
addq $-0x100, %rdx
movl $0x100, %esi            # imm = 0x100
movq %r15, %rcx
callq 0xefabc
movq %r15, %rdi
callq 0xf0b13
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_identify_winzle
static int de_identify_winzle(deark *c)
{
	u8 b[18];
	de_read(b, 0, sizeof(b));

	if(b[0]==0x4f && b[1]==0x40) {
		if(b[14]==0x25 && b[15]==0x0d && b[16]==0x0d && b[17]==0x0d) {
			return 95;
		}
		return 40;
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
movq %rsp, %r14
movl $0x12, %ecx
movq %r14, %rsi
xorl %edx, %edx
callq 0xeeee8
cmpb $0x4f, (%r14)
jne 0x35615
cmpb $0x40, 0x1(%rsp)
jne 0x35615
movb 0xe(%rsp), %al
movb 0xf(%rsp), %cl
xorb $0x25, %al
xorb $0xd, %cl
orb %al, %cl
movb 0x10(%rsp), %al
xorb $0xd, %al
movb 0x11(%rsp), %dl
xorb $0xd, %dl
orb %al, %dl
orb %cl, %dl
movl $0x5f, %eax
movl $0x28, %ebx
cmovel %eax, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_module_jigsaw_wk
void de_module_jigsaw_wk(deark *c, struct deark_module_info *mi)
{
	mi->id = "jigsaw_wk";
	mi->desc = "Jigsaw .jig";
	mi->run_fn = de_run_jigsaw_wk;
	mi->identify_fn = de_identify_jigsaw_wk;
}

// Assembly:
leaq 0xe2279(%rip), %rax     # 0x11789f
movq %rax, (%rsi)
leaq 0xe2279(%rip), %rax     # 0x1178a9
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x3564b
movq %rax, 0x18(%rsi)
leaq 0x7c(%rip), %rax        # 0x356c2
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_run_jigsaw_wk
static void de_run_jigsaw_wk(deark *c, de_module_params *mparams)
{
	i64 fsize;
	dbuf *outf = NULL;

	fsize = de_getu32le(2);
	if(fsize>c->infile->len) goto done;

	outf = dbuf_create_output_file(c, "bmp", NULL, 0);
	dbuf_write(outf, (const u8*)"BM", 2);
	dbuf_copy(c->infile, 2, fsize-2, outf);

done:
	dbuf_close(outf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movl $0x2, %esi
callq 0xef37e
movq %rax, %r14
movq 0x18(%rbx), %rax
cmpq 0x18(%rax), %r14
jle 0x35673
xorl %r15d, %r15d
jmp 0x356b5
leaq 0xeb9d8(%rip), %rsi     # 0x121052
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r15
leaq 0xe696e(%rip), %rsi     # 0x11bffe
movl $0x2, %edx
movq %rax, %rdi
callq 0xefb82
movq 0x18(%rbx), %rdi
addq $-0x2, %r14
movl $0x2, %esi
movq %r14, %rdx
movq %r15, %rcx
callq 0xefabc
movq %r15, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0xf0b13
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: de_identify_jigsaw_wk
static int de_identify_jigsaw_wk(deark *c)
{
	i64 fsize;
	int ret;
	u8 buf[32];

	if(dbuf_memcmp(c->infile, 0, "JG", 2)) {
		return 0;
	}

	fsize = de_getu32le(2);
	if(fsize>c->infile->len) return 0;

	de_read(buf, 0, sizeof(buf));
	buf[0] = 'B';
	buf[1] = 'M';
	ret = looks_like_bmp_bytes(buf, sizeof(buf), 0);
	if(ret) {
		return 95;
	}

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq 0xe2735(%rip), %rdx     # 0x117e0c
xorl %ebx, %ebx
movl $0x2, %ecx
xorl %esi, %esi
callq 0xf025e
testl %eax, %eax
jne 0x3573e
movq 0x18(%r14), %rdi
movl $0x2, %esi
callq 0xef37e
movq 0x18(%r14), %rdi
cmpq 0x18(%rdi), %rax
jg 0x3573e
movq %rsp, %rbx
movl $0x20, %ecx
movq %rbx, %rsi
xorl %edx, %edx
callq 0xeeee8
movw $0x4d42, (%rbx)         # imm = 0x4D42
leaq 0xe20bd(%rip), %rsi     # 0x1177dc
movl $0x1e, %edx
movq %rbx, %rdi
movl $0x3f, %ecx
xorl %r8d, %r8d
callq 0xec00b
testl %eax, %eax
movl $0x5f, %ebx
cmovel %eax, %ebx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: do_read_bitfields
static void do_read_bitfields(deark *c, lctx *d, i64 pos, i64 len)
{
	i64 k;

	if(len>16) len=16;
	for(k=0; 4*k<len; k++) {
		d->bitfield[k].mask = (u32)de_getu32le(pos+4*k);
		de_dbg(c, "mask[%d]: 0x%08x", (int)k, (UI)d->bitfield[k].mask);
	}
	update_bitfields_info(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
testq %rcx, %rcx
jle 0x357cc
movq %rdx, %r14
movq %rdi, %r15
cmpq $0x10, %rcx
movl $0x10, %eax
cmovlq %rcx, %rax
movq (%rsp), %rcx
leaq 0x100(%rcx), %rbp
cmpq $0x5, %rax
movl $0x4, %ebx
cmovgeq %rax, %rbx
decq %rbx
shrq $0x2, %rbx
incq %rbx
leaq 0xe236d(%rip), %r12     # 0x117b05
xorl %r13d, %r13d
movq 0x18(%r15), %rdi
movq %r14, %rsi
callq 0xef37e
movl %eax, (%rbp)
movq %r15, %rdi
movq %r12, %rsi
movl %r13d, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe9226
incq %r13
addq $0x4, %r14
addq $0x10, %rbp
cmpq %r13, %rbx
jne 0x3579b
movq (%rsp), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x357e0
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: update_bitfields_info
static void update_bitfields_info(deark *c, lctx *d)
{
	i64 k;
	u32 tmpmask;

	for(k=0; k<4; k++) {
		tmpmask = d->bitfield[k].mask;
		if(tmpmask==0) continue;
		while((tmpmask & 0x1) == 0) {
			d->bitfield[k].shift++;
			tmpmask >>= 1;
		}
		d->bitfield[k].scale = 255.0 / (double)tmpmask;
	}
}

// Assembly:
addq $0x100, %rdi            # imm = 0x100
xorl %eax, %eax
movsd 0xe1ee7(%rip), %xmm0    # 0x1176d8
movq %rax, %rcx
shlq $0x4, %rcx
movl (%rdi,%rcx), %edx
testl %edx, %edx
je 0x35831
addq %rdi, %rcx
testb $0x1, %dl
jne 0x3581a
movl 0x4(%rcx), %esi
movl %edx, %r8d
incl %esi
shrl %edx
testb $0x2, %r8b
je 0x3580a
movl %esi, 0x4(%rcx)
movl %edx, %edx
xorps %xmm1, %xmm1
cvtsi2sd %rdx, %xmm1
movapd %xmm0, %xmm2
divsd %xmm1, %xmm2
movsd %xmm2, 0x8(%rcx)
incq %rax
cmpq $0x4, %rax
jne 0x357f1
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: do_image_paletted
static void do_image_paletted(deark *c, lctx *d, dbuf *bits, i64 bits_offset, u8 want_trns)
{
	int bypp;

	if(d->pal_is_grayscale) bypp = 1;
	else bypp = 3;
	if(want_trns) bypp++;

	d->img = bmp_bitmap_create(c, d, bypp);
	de_convert_image_paletted(bits, bits_offset,
		d->bitcount, d->rowspan, d->pal, d->img, 0);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
xorl %eax, %eax
cmpl $0x0, 0x88(%rsi)
sete %al
xorl %ecx, %ecx
testl %r8d, %r8d
setne %cl
leal (%rcx,%rax,2), %r8d
incl %r8d
movq 0x50(%rsi), %rsi
movq 0x58(%rbx), %rdx
movq 0x60(%rbx), %rcx
callq 0xf2ce6
movq %rax, 0x10(%rbx)
movq 0x38(%rbx), %rdx
movq 0xf8(%rbx), %rcx
addq $0x140, %rbx            # imm = 0x140
movl $0x0, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %r8
movq %rax, %r9
callq 0xf35b8
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: do_image_24bit
static void do_image_24bit(deark *c, lctx *d, dbuf *bits, i64 bits_offset, u8 want_trns)
{
	i64 i, j;
	u32 clr;
	int bypp;

	if(want_trns) bypp = 4;
	else bypp = 3;

	d->img = bmp_bitmap_create(c, d, bypp);
	for(j=0; j<d->height; j++) {
		i64 rowpos = bits_offset + j*d->rowspan;
		i64 pos_in_this_row = 0;
		u8 cbuf[3];

		for(i=0; i<d->pdwidth; i++) {
			dbuf_read(bits, cbuf, rowpos + pos_in_this_row, 3);
			if(pos_in_this_row+3 > d->rowspan) {
				// If -padpix was used, a partial pixel at the end of the row is
				// possible. Happens when width == 1 or 2 (mod 4).
				// To handle that, zero out the byte(s) that we shouldn't have read.
				cbuf[2] = 0;
				if(pos_in_this_row+2 > d->rowspan) {
					cbuf[1] = 0;
				}
			}
			clr = DE_MAKE_RGB(cbuf[2], cbuf[1], cbuf[0]);
			de_bitmap_setpixel_rgb(d->img, i, j, clr);
			pos_in_this_row += 3;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x10(%rsp)
movq %rdx, %r14
movq %rsi, %r15
cmpl $0x1, %r8d
movl $0x4, %r8d
sbbl $0x0, %r8d
movq 0x50(%rsi), %rsi
movq 0x58(%r15), %rdx
movq 0x60(%r15), %rcx
callq 0xf2ce6
movq %rax, 0x10(%r15)
cmpq $0x0, 0x60(%r15)
jle 0x3599e
xorl %r12d, %r12d
cmpq $0x0, 0x58(%r15)
jle 0x35991
movq 0xf8(%r15), %rbp
imulq %r12, %rbp
addq 0x10(%rsp), %rbp
movl $0x3, %r13d
xorl %ebx, %ebx
movl $0x3, %ecx
movq %r14, %rdi
leaq 0xd(%rsp), %rsi
movq %rbp, %rdx
callq 0xeeee8
movq 0xf8(%r15), %rax
cmpq %rax, %r13
jle 0x35952
movb $0x0, 0xf(%rsp)
leaq -0x1(%r13), %rcx
cmpq %rax, %rcx
jle 0x35952
movb $0x0, 0xe(%rsp)
movzbl 0xf(%rsp), %eax
shll $0x10, %eax
movzbl 0xe(%rsp), %edx
shll $0x8, %edx
orl %eax, %edx
movzbl 0xd(%rsp), %ecx
orl %edx, %ecx
orl $0xff000000, %ecx       # imm = 0xFF000000
movq 0x10(%r15), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0xf2afd
incq %rbx
addq $0x3, %rbp
addq $0x3, %r13
cmpq 0x58(%r15), %rbx
jl 0x3591e
incq %r12
cmpq 0x60(%r15), %r12
jl 0x358fb
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: do_image_huffman1d
static void do_image_huffman1d(deark *c, lctx *d)
{
	dbuf *unc_pixels = NULL;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;
	struct de_fax34_params fax34params;

	// Caution: These settings might be wrong. I need more information about this format.
	de_zeromem(&fax34params, sizeof(struct de_fax34_params));
	fax34params.image_width = d->width;
	fax34params.image_height = d->height;
	fax34params.out_rowspan = d->rowspan;
	fax34params.tiff_cmpr_meth = 3;
	fax34params.t4options = 0;
	fax34params.is_lsb = (u8)de_get_ext_option_bool(c, "bmp:huffmanlsb", 0);

	unc_pixels = dbuf_create_membuf(c, d->rowspan*d->height, 0x1);

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = c->infile;
	dcmpri.pos = d->bits_offset;
	dcmpri.len = get_bits_size(c, d);
	dcmpro.f = unc_pixels;
	dcmpro.len_known = 1;
	dcmpro.expected_len = d->rowspan*d->height;

	fmtutil_fax34_codectype1(c, &dcmpri, &dcmpro, &dres,
		 (void*)&fax34params);

	do_image_paletted(c, d, unc_pixels, 0, 0);

	dbuf_close(unc_pixels);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq $0x0, 0x20(%rsp)
movq 0x50(%rsi), %rax
movq %rax, (%rsp)
movq 0x60(%rsi), %rax
movq %rax, 0x8(%rsp)
movq 0xf8(%rsi), %rax
movq %rax, 0x10(%rsp)
movl $0x3, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
leaq 0xe2233(%rip), %rsi     # 0x117c3d
xorl %edx, %edx
callq 0xea727
movb %al, 0x1c(%rsp)
movq 0x60(%rbx), %rsi
imulq 0xf8(%rbx), %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0xf0faf
movq %rax, %r15
leaq 0x48(%rsp), %r12
leaq 0x30(%rsp), %rdx
leaq 0x68(%rsp), %rcx
movq %r14, %rdi
movq %r12, %rsi
callq 0xfa6e0
movq 0x18(%r14), %rcx
movq %rcx, (%r12)
movq 0x28(%rbx), %rdx
movq %rdx, 0x8(%r12)
movq 0x48(%rbx), %rax
testq %rax, %rax
jle 0x35a6f
leaq (%rax,%rdx), %rsi
cmpq 0x18(%rcx), %rsi
jle 0x35a76
movq 0x18(%rcx), %rax
subq %rdx, %rax
leaq 0x48(%rsp), %rsi
movq %rax, 0x10(%rsi)
leaq 0x30(%rsp), %rdx
movq %r15, (%rdx)
movb $0x1, 0x8(%rdx)
movq 0x60(%rbx), %rax
imulq 0xf8(%rbx), %rax
movq %rax, 0x10(%rdx)
leaq 0x68(%rsp), %rcx
movq %rsp, %r8
movq %r14, %rdi
callq 0xfe764
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3583b
movq %r15, %rdi
callq 0xf0b13
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: extract_embedded_image
static void extract_embedded_image(deark *c, lctx *d, const char *ext)
{
	i64 nbytes;

	if(d->want_returned_img) return;

	nbytes = get_bits_size(c, d);
	if(nbytes<1) return;

	dbuf_create_file_from_slice(c->infile, d->bits_offset, nbytes, ext, NULL, 0);
}

// Assembly:
cmpb $0x0, 0x4(%rsi)
je 0x35adc
retq
movq %rdx, %rcx
movq 0x48(%rsi), %rdx
testq %rdx, %rdx
jle 0x35af9
movq 0x28(%rsi), %rax
addq %rdx, %rax
movq 0x18(%rdi), %r8
cmpq 0x18(%r8), %rax
jle 0x35b05
movq 0x18(%rdi), %rax
movq 0x18(%rax), %rdx
subq 0x28(%rsi), %rdx
testq %rdx, %rdx
jle 0x35adb
movq 0x18(%rdi), %rdi
movq 0x28(%rsi), %rsi
xorl %r8d, %r8d
xorl %r9d, %r9d
jmp 0xf0321
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: rle_to_bytes_append_unit4
static void rle_to_bytes_append_unit4(deark *c, struct rle_dcmpr_ctx *rc, u8 n, u8 mflag)
{
	if(rc->num_pending_bits) { // presumably = 4
		rc->pending_bits |= n;
		rc->num_pending_bits += 4;
		rle_to_bytes_flush(c, rc);
	}
	else { // presumably num_pending_bits = 0
		rc->pending_bits = n<<4;
		rc->num_pending_bits += 4;
	}

	if(mflag && rc->mask) {
		de_bitmap_setpixel_gray(rc->mask, rc->xpos, rc->ypos, 0xff);
	}
	rc->xpos++;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rdi, %rbx
movl 0x60(%rdi), %eax
testl %eax, %eax
je 0x35b94
orb 0x64(%rbx), %sil
movb %sil, 0x64(%rbx)
addl $0x4, %eax
movl %eax, 0x60(%rbx)
je 0x35b8c
movq 0x40(%rbx), %rdi
movzbl %sil, %esi
callq 0xf11be
movb $0x0, 0x64(%rbx)
xorl %eax, %eax
jmp 0x35ba1
shlb $0x4, %sil
movb %sil, 0x64(%rbx)
movl $0x4, %eax
movl %eax, 0x60(%rbx)
testb %bpl, %bpl
je 0x35bc4
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x35bc4
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
movl $0xff, %ecx
callq 0xf2a4a
incq 0x50(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: rle_to_bytes_append_unit24
static void rle_to_bytes_append_unit24(deark *c, struct rle_dcmpr_ctx *rc,
	u8 cr, u8 cg, u8 cb, u8 mflag)
{
	dbuf_writebyte(rc->unc_pixels, cb);
	dbuf_writebyte(rc->unc_pixels, cg);
	dbuf_writebyte(rc->unc_pixels, cr);
	if(mflag && rc->mask) {
		de_bitmap_setpixel_gray(rc->mask, rc->xpos, rc->ypos, 0xff);
	}
	rc->xpos++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %ebp
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
movq 0x40(%rdi), %rdi
movl %ecx, %esi
callq 0xf11be
movq 0x40(%rbx), %rdi
movl %r14d, %esi
callq 0xf11be
movq 0x40(%rbx), %rdi
movl %r15d, %esi
callq 0xf11be
testl %ebp, %ebp
je 0x35c24
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x35c24
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
movl $0xff, %ecx
callq 0xf2a4a
incq 0x50(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: rle_to_bytes_append_unit8
static void rle_to_bytes_append_unit8(deark *c, struct rle_dcmpr_ctx *rc, u8 n, u8 mflag)
{
	dbuf_writebyte(rc->unc_pixels, n);
	if(mflag && rc->mask) {
		de_bitmap_setpixel_gray(rc->mask, rc->xpos, rc->ypos, 0xff);
	}
	rc->xpos++;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rdi, %rbx
movq 0x40(%rdi), %rdi
callq 0xf11be
testl %ebp, %ebp
je 0x35c63
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x35c63
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
movl $0xff, %ecx
callq 0xf2a4a
incq 0x50(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: do_read_linked_profile
static void do_read_linked_profile(deark *c, lctx *d)
{
	de_ucstring *fname = NULL;

	de_dbg(c, "linked profile filename at %"I64_FMT, d->profile_offset);
	fname = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, d->profile_offset,
		d->profile_size, DE_DBG_MAX_STRLEN, fname,
		DE_CONVFLAG_STOP_AT_NUL, DE_ENCODING_WINDOWS1252);
	de_dbg_indent(c, 1);
	de_dbg(c, "profile filename: \"%s\"", ucstring_getpsz(fname));
	de_dbg_indent(c, -1);
	ucstring_destroy(fname);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0xe8(%rsi), %rdx
leaq 0xe1fc1(%rip), %rsi     # 0x117c4c
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
callq 0xf6870
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq 0xe8(%r15), %rsi
movq 0xf0(%r15), %rdx
movl $0x9, (%rsp)
movl $0x1f4, %ecx            # imm = 0x1F4
movq %rax, %r8
movl $0x1, %r9d
callq 0xf0203
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq %r14, %rdi
callq 0xf74bd
leaq 0xe1f86(%rip), %rsi     # 0x117c6b
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %r14, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xf6bb0
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/bmp.c
// Function: do_read_embedded_profile
static void do_read_embedded_profile(deark *c, lctx *d)
{
	de_dbg(c, "embedded profile at %"I64_FMT", size=%"I64_FMT, d->profile_offset,
		d->profile_size);
	de_dbg_indent(c, 1);
	dbuf_create_file_from_slice(c->infile, d->profile_offset, d->profile_size, "icc",
		NULL, DE_CREATEFLAG_IS_AUX);
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0xe8(%rsi), %rdx
movq 0xf0(%rsi), %rcx
leaq 0xe1f53(%rip), %rsi     # 0x117c82
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rdi
movq 0xe8(%r14), %rsi
movq 0xf0(%r14), %rdx
leaq 0xdfd91(%rip), %rcx     # 0x115aed
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xf0321
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe9585
nop
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/arj.c
// Function: de_module_arj
void de_module_arj(deark *c, struct deark_module_info *mi)
{
	mi->id = "arj";
	mi->desc = "ARJ";
	mi->run_fn = de_run_arj;
	mi->identify_fn = de_identify_arj;
	mi->help_fn = de_help_arj;
	mi->flags |= DE_MODFLAG_MULTIPART;
}

// Assembly:
leaq 0xe2088(%rip), %rax     # 0x117e0f
movq %rax, (%rsi)
leaq 0xe2082(%rip), %rax     # 0x117e13
movq %rax, 0x8(%rsi)
leaq 0x1f(%rip), %rax        # 0x35dbb
movq %rax, 0x18(%rsi)
leaq 0x4b5(%rip), %rax       # 0x3625c
movq %rax, 0x20(%rsi)
leaq 0x512(%rip), %rax       # 0x362c4
movq %rax, 0x28(%rsi)
orb $0x40, 0x30(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/arj.c
// Function: de_identify_arj
static int de_identify_arj(deark *c)
{
	i64 basic_hdr_size;

	if(dbuf_memcmp(c->infile, 0, g_arj_hdr_id, 2)) return 0;
	basic_hdr_size = de_getu16le(2);
	if(basic_hdr_size>ARJ_MAX_BASIC_HEADER_SIZE || basic_hdr_size<ARJ_MIN_BASIC_HEADER_SIZE) return 0;
	if(de_input_file_has_ext(c, "arj")) return 100;
	return 75;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq 0xe1c1e(%rip), %rdx     # 0x117e8c
xorl %ebx, %ebx
movl $0x2, %ecx
xorl %esi, %esi
callq 0xf025e
testl %eax, %eax
jne 0x362ba
movq 0x18(%r14), %rdi
movl $0x2, %esi
callq 0xef1ca
addq $-0xa29, %rax           # imm = 0xF5D7
cmpq $-0xa0b, %rax           # imm = 0xF5F5
jb 0x362ba
leaq 0xe1b6c(%rip), %rsi     # 0x117e0f
movq %r14, %rdi
callq 0xea936
testl %eax, %eax
movl $0x4b, %eax
movl $0x64, %ebx
cmovel %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq