LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/ilbm.c
// Function: decompress_delta_op74
static void decompress_delta_op74(deark *c, lctx *d, struct imgbody_info *ibi,
	struct frame_ctx *frctx, i64 pos1, i64 len)
{
	struct d74state d74s;

	de_zeromem(&d74s, sizeof(struct d74state));
	d74s.ibi = ibi;
	d74s.frctx = frctx;
	d74s.pos = pos1;
	d74s.endpos = pos1+len;

	if(!d->delta_ops_used[74]) { // If this is the first DLTA#7 chunk...
		if(ibi->width < 320) {
			// The XAnim code says this is a special case, but I haven't found any
			// sample files. (TODO)
			de_warn(c, "ANIM-J with width < 320 might not be supported correctly");
		}
	}

	while(1) {
		UI code;

		if(d74s.pos+2 >= d74s.endpos) goto done;
		code = (UI)de_getu16be_p(&d74s.pos);
		if(code==1) {
			frctx->change_flag = 1;
			d74s.op = (UI)de_getu16be_p(&d74s.pos);
			d74s.nrows = de_getu16be_p(&d74s.pos);
			d74s.nbytes = 1;
			d74s.nblocks = de_getu16be_p(&d74s.pos);
			do_delta74_blocks(c, &d74s);
		}
		else if(code==2) {
			frctx->change_flag = 1;
			d74s.op = (UI)de_getu16be_p(&d74s.pos);
			d74s.nrows = de_getu16be_p(&d74s.pos);
			d74s.nbytes = de_getu16be_p(&d74s.pos);
			d74s.nblocks = de_getu16be_p(&d74s.pos);
			do_delta74_blocks(c, &d74s);
		}
		else if(code==0) {
			break;
		}
		else {
			de_warn(c, "Bad or unsupported ANIM-J compression code: %u", code);
			goto done;
		}
	}

done:
	;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %r15
movq %rcx, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rsp)
movups %xmm0, 0x28(%rsp)
movq %rdx, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movq %r8, 0x18(%rsp)
addq %r9, %r8
movq %r8, 0x20(%rsp)
testb %sil, %sil
jne 0x7c2c9
cmpq $0x13f, (%rdx)          # imm = 0x13F
jg 0x7c2c9
leaq 0xacf46(%rip), %rsi     # 0x129205
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8faa
cmpq $0x3, %r15
jl 0x7c3aa
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %r12
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb91
cmpl $0x1, %eax
je 0x7c32e
cmpl $0x2, %eax
jne 0x7c393
movl $0x1, 0xc(%r14)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb91
movl %eax, 0x28(%rsp)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb91
movq %rax, 0x38(%rsp)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb91
jmp 0x7c35c
movl $0x1, 0xc(%r14)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb91
movl %eax, 0x28(%rsp)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb91
movq %rax, 0x38(%rsp)
movl $0x1, %eax
movq %rax, 0x40(%rsp)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb91
movq %rax, 0x30(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7cd60
movq 0x18(%rsp), %rax
addq $0x2, %rax
cmpq 0x20(%rsp), %rax
jl 0x7c2dd
jmp 0x7c3aa
testl %eax, %eax
je 0x7c3aa
leaq 0xacea0(%rip), %rsi     # 0x12923e
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8faa
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/ilbm.c
// Function: do_help_ilbm_anim
static void do_help_ilbm_anim(deark *c, int is_anim)
{
	de_msg(c, "-opt ilbm:trans=<0|1|auto> : Always remove (0) or respect (1) "
		"transparency");
	de_msg(c, "-opt ilbm:fixpal=<0|1> : Don't/Do try to fix palettes that are "
		"slightly too dark");
	de_msg(c, "-opt ilbm:allowspecial : Suppress an error on some images");
	if(is_anim) {
		de_msg(c, "-opt anim:includedups : Do not suppress duplicate frames");
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0xac6eb(%rip), %rsi     # 0x129691
xorl %eax, %eax
callq 0xe9461
leaq 0xac728(%rip), %rsi     # 0x1296dc
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9461
leaq 0xac768(%rip), %rsi     # 0x12972d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9461
testl %ebp, %ebp
je 0x7cfea
leaq 0xac78d(%rip), %rsi     # 0x129767
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe9461
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/insetpix.c
// Function: de_module_insetpix
void de_module_insetpix(deark *c, struct deark_module_info *mi)
{
	mi->id = "insetpix";
	mi->desc = "Inset PIX image";
	mi->run_fn = de_run_insetpix;
	mi->identify_fn = de_identify_insetpix;
}

// Assembly:
leaq 0xabe59(%rip), %rax     # 0x129930
movq %rax, (%rsi)
leaq 0xabe58(%rip), %rax     # 0x129939
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x7dafc
movq %rax, 0x18(%rsi)
leaq 0xf87(%rip), %rax       # 0x7ea7e
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/insetpix.c
// Function: de_identify_insetpix
static int de_identify_insetpix(deark *c)
{
	UI pix_version;
	i64 item_count;
	i64 item;
	i64 item_loc, item_len;
	u8 has_ext;
	u8 has_typical_1st_item;

	if(c->detection_data->best_confidence_so_far>20) return 0;

	pix_version = (UI)de_getu16le(0);
	// Other versions exist, but I don't know anything about them.
	if(pix_version!=3) return 0;

	has_ext = (u8)de_input_file_has_ext(c, "pix");
	has_typical_1st_item = (u8)((u32)de_getu32le(4)==(u32)0x00200000);
	if(!has_ext && !has_typical_1st_item) return 0;

	item_count = de_getu16le(2);
	// Need at least 4 items (image info, palette info, tile info, and 1 tile).
	if(item_count<4 || item_count>500) return 0;

	if(4 + 8*item_count >= c->infile->len) return 0;

	for(item=0; item<item_count && item<16; item++) {
		item_len = de_getu16le(4+8*item+2);
		item_loc = de_getu32le(4+8*item+4);
		if(item_loc < 4 + 8*item_count) return 0;
		if(item_loc+item_len > c->infile->len) return 0;
	}

	return 20;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x28(%rdi), %rcx
xorl %eax, %eax
cmpl $0x14, (%rcx)
jg 0x7eb69
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
xorl %esi, %esi
callq 0xeebc8
cmpl $0x3, %eax
jne 0x7eb67
leaq 0xabfc0(%rip), %rsi     # 0x12aa76
movq %rbx, %rdi
callq 0xea491
movl %eax, %ebp
movq 0x18(%rbx), %rdi
movl $0x4, %esi
callq 0xeed61
testb %bpl, %bpl
jne 0x7eae0
movl %eax, %eax
cmpl $0x200000, %eax         # imm = 0x200000
jne 0x7eb67
movq 0x18(%rbx), %rdi
movl $0x2, %esi
callq 0xeebc8
leaq -0x1f5(%rax), %rcx
cmpq $-0x1f1, %rcx           # imm = 0xFE0F
jb 0x7eb67
leaq 0x4(,%rax,8), %r15
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %r15
jge 0x7eb67
decq %rax
cmpq $0xf, %rax
movl $0xf, %r12d
cmovbq %rax, %r12
shll $0x3, %r12d
movq $-0x8, %r13
leaq 0xe(%r13), %rsi
callq 0xeebc8
movq %rax, %r14
movq 0x18(%rbx), %rdi
leaq 0x10(%r13), %rsi
callq 0xeed61
cmpq %r15, %rax
jl 0x7eb67
addq %r14, %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jg 0x7eb67
addq $0x8, %r13
movl $0x14, %eax
cmpq %r13, %r12
jne 0x7eb2c
jmp 0x7eb69
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/insetpix.c
// Function: insetpix_read_item
static void insetpix_read_item(deark *c, i64 pos, struct insetpix_item_data *itd)
{
	itd->id = (UI)de_getu16le_p(&pos);
	itd->len = de_getu16le_p(&pos);
	itd->loc = de_getu32le(pos);
	itd->is_special = (u8)(itd->id>=0x4000);
	itd->is_tile = (u8)(itd->id>=0x8000 && itd->id<0xffff);
	if(itd->is_tile)
		itd->tile_num = itd->id-0x8000;
	else
		itd->tile_num = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x8(%rsp), %r15
movq %rsi, (%r15)
movq 0x18(%rdi), %rdi
movq %r15, %rsi
callq 0xeebeb
movl %eax, (%rbx)
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xeebeb
movq %rax, 0x10(%rbx)
movq 0x18(%r14), %rdi
movq (%r15), %rsi
callq 0xeed61
movq %rax, 0x18(%rbx)
movl (%rbx), %eax
cmpl $0x4000, %eax           # imm = 0x4000
setae 0x8(%rbx)
addl $0xffff8000, %eax       # imm = 0xFFFF8000
xorl %ecx, %ecx
cmpl $0x7fff, %eax           # imm = 0x7FFF
setb 0x9(%rbx)
cmovbl %eax, %ecx
movl %ecx, 0x4(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/insetpix.c
// Function: insetpix_dbg_item
static void insetpix_dbg_item(deark *c, struct insetpix_item_data *itd, i64 idx)
{
	char nbuf[40];

	get_item_name(itd, nbuf, sizeof(nbuf));
	de_dbg(c, "item #%d: id=%u (%s), loc=%"I64_FMT", len=%"I64_FMT, (int)idx,
		itd->id, nbuf, itd->loc, itd->len);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpb $0x0, 0x9(%rsi)
je 0x7ec1e
movl 0x4(%r15), %ecx
leaq 0xaae90(%rip), %rdx     # 0x129a9b
leaq 0x10(%rsp), %rdi
movl $0x28, %esi
xorl %eax, %eax
callq 0xe8193
jmp 0x7ec83
movl (%r15), %eax
cmpl $0x1, %eax
jle 0x7ec40
cmpl $0x2, %eax
je 0x7ec52
cmpl $0x11, %eax
je 0x7ec5b
cmpl $0xff, %eax
jne 0x7ec6d
leaq 0x97fab(%rip), %rsi     # 0x116be9
jmp 0x7ec74
testl %eax, %eax
je 0x7ec64
cmpl $0x1, %eax
jne 0x7ec6d
leaq 0xb7864(%rip), %rsi     # 0x1364b4
jmp 0x7ec74
leaq 0xaae56(%rip), %rsi     # 0x129aaf
jmp 0x7ec74
leaq 0xaae57(%rip), %rsi     # 0x129ab9
jmp 0x7ec74
leaq 0xaae39(%rip), %rsi     # 0x129aa4
jmp 0x7ec74
leaq 0xad4dd(%rip), %rsi     # 0x12c151
leaq 0x10(%rsp), %rdi
movl $0x28, %edx
callq 0xe8219
movl (%r15), %ecx
movq 0x18(%r15), %r9
movq 0x10(%r15), %rax
movq %rax, (%rsp)
leaq 0xaaddb(%rip), %rsi     # 0x129a74
leaq 0x10(%rsp), %r8
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0xe8617
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/iptc.c
// Function: de_module_iptc
void de_module_iptc(deark *c, struct deark_module_info *mi)
{
	mi->id = "iptc";
	mi->desc = "IPTC-IIM metadata";
	mi->run_fn = de_run_iptc;
	mi->identify_fn = de_identify_iptc;
}

// Assembly:
leaq 0xcb5d3(%rip), %rax     # 0x14a472
movq %rax, (%rsi)
leaq 0xaae63(%rip), %rax     # 0x129d0c
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x7eec4
movq %rax, 0x18(%rsi)
leaq 0x2e5(%rip), %rax       # 0x7f1a4
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/iptc.c
// Function: de_identify_iptc
static int de_identify_iptc(deark *c)
{
	u8 b;

	// First byte of each dataset is 0x1c.
	if(de_getbyte(0)!=0x1c) return 0;

	// Check the record number. Record numbers 1-9 are known.
	b = de_getbyte(1);
	if(b<1 || b>15) return 0;

	// This is not meant to imply that .iptc is an official file extension for
	// IPTC data. It's just that it's sometimes used by Deark when extracting
	// IPTC data to a file.
	if(!de_input_file_has_ext(c, "iptc")) return 0;

	return 60;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0xeead3
cmpb $0x1c, %al
jne 0x7f1e9
movq 0x18(%r14), %rdi
movl $0x1, %esi
callq 0xeead3
addb $-0x10, %al
cmpb $-0xf, %al
jb 0x7f1e9
leaq 0xcb29b(%rip), %rsi     # 0x14a472
movq %r14, %rdi
callq 0xea491
testl %eax, %eax
movl $0x3c, %ebx
cmovel %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/iptc.c
// Function: handle_text
static void handle_text(deark *c, lctx *d, const struct ds_info *dsi,
	i64 pos, i64 len)
{
	de_encoding encoding;
	de_ucstring *s = NULL;

	s = ucstring_create(c);
	encoding = get_ds_encoding(c, d, dsi->recnum);
	if(encoding==DE_ENCODING_UNKNOWN)
		encoding = DE_ENCODING_ASCII;
	dbuf_read_to_ucstring(c->infile, pos, len, s, 0, encoding);
	de_dbg(c, "%s: \"%s\"", dsi->dsname, ucstring_getpsz_d(s));
	ucstring_destroy(s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r12
movq %rcx, %r13
movq %rdx, %r15
movq %rsi, %rbp
movq %rdi, %r14
callq 0xf6410
movq %rax, %rbx
movb (%r15), %al
addb $-0x2, %al
xorl %r9d, %r9d
cmpb $0x4, %al
ja 0x7f225
movl (%rbp), %r9d
cmpl $0x1, %r9d
adcl $0x0, %r9d
movq 0x18(%r14), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0xefbd7
movq 0x8(%r15), %r15
movq %rbx, %rdi
callq 0xf70f6
leaq 0xaced5(%rip), %rsi     # 0x12c12a
movq %r14, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf6753
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/iptc.c
// Function: handle_1_90
static void handle_1_90(deark *c, lctx *d, const struct ds_info *dsi,
	i64 pos, i64 len)
{
	const char *csname;

	d->charset = DE_ENCODING_UNKNOWN;

	// TODO: Fully interpret this field.

	if(len>=3 && !dbuf_memcmp(c->infile, pos, "\x1b\x25\x47", 3)) {
		d->charset = DE_ENCODING_UTF8;
	}

	if(d->charset==DE_ENCODING_UTF8)
		csname="utf-8";
	else
		csname="unknown";

	de_dbg(c, "charset: %s", csname);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x0, (%rsi)
cmpq $0x3, %r8
jl 0x7f303
movq %rcx, %rax
movq %rsi, %r14
movq 0x18(%rbx), %rdi
leaq 0xaafb8(%rip), %rdx     # 0x12a292
movl $0x3, %ecx
movq %rax, %rsi
callq 0xefc85
testl %eax, %eax
je 0x7f30c
cmpl $0x2, (%r14)
leaq 0xaafa0(%rip), %rax     # 0x12a296
leaq 0x9319f(%rip), %rdx     # 0x11249c
cmoveq %rax, %rdx
jmp 0x7f31a
leaq 0x93192(%rip), %rdx     # 0x11249c
jmp 0x7f31a
movl $0x2, (%r14)
leaq 0xaaf7c(%rip), %rdx     # 0x12a296
leaq 0xaaf7b(%rip), %rsi     # 0x12a29c
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe8617
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/iptc.c
// Function: handle_2_120
static void handle_2_120(deark *c, lctx *d, const struct ds_info *dsi,
	i64 pos, i64 len)
{
	dbuf *outf = NULL;
	de_encoding encoding;

	if(c->extract_level<2) {
		handle_text(c, d, dsi, pos, len);
		goto done;
	}

	// Note that this code for extracting captions while decoding IPTC is not
	// easily reached, because it requires the -a option, and -a usually causes
	// IPTC to be extracted instead of decoded.
	// It can be reached when reading a raw IPTC file, or when using
	// "-a -opt extractiptc=0".

	encoding = get_ds_encoding(c, d, dsi->recnum);

	outf = dbuf_create_output_file(c, "caption.txt", NULL, DE_CREATEFLAG_IS_AUX);

	dbuf_copy_slice_convert_to_utf8(c->infile, pos, len,
		DE_EXTENC_MAKE(encoding, DE_ENCSUBTYPE_HYBRID),
		outf, 0x1|0x4);

done:
	if(outf) dbuf_close(outf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %rbx
movq %rcx, %r14
movq %rdi, %r15
cmpl $0x1, 0x90(%rdi)
jg 0x7f362
movq %r15, %rdi
movq %r14, %rcx
movq %rbx, %r8
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x7f1f3
movb (%rdx), %al
addb $-0x2, %al
movl $0x300, %ebp            # imm = 0x300
cmpb $0x4, %al
ja 0x7f378
movzbl (%rsi), %ebp
orl $0x300, %ebp            # imm = 0x300
leaq 0xaaf29(%rip), %rsi     # 0x12a2a8
movq %r15, %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xefda1
movq %rax, %r12
movq 0x18(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
movq %rax, %r8
movl $0x5, %r9d
callq 0xf1883
testq %r12, %r12
je 0x7f3c0
movq %r12, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xf052b
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/iptc.c
// Function: handle_2_125
static void handle_2_125(deark *c, lctx *d, const struct ds_info *dsi,
	i64 pos, i64 len)
{
	de_bitmap *img = NULL;
	i64 rowspan;
	i64 width1, height1;

	// I can't find any examples of this field, so this may not be correct.
	// The format seems to be well-documented, though the pixels are in an
	// unusual order.

	width1 = 128; // (Will be rotated to be 460x128)
	height1 = 460;
	rowspan = width1/8;
	if(len < rowspan * height1) goto done;
	img = de_bitmap_create(c, width1, height1, 1);
	de_convert_image_bilevel(c->infile, pos, rowspan, img, DE_CVTF_WHITEISZERO);
	de_bitmap_transpose(img);
	de_bitmap_write_to_file(img, "caption", DE_CREATEFLAG_IS_AUX|DE_CREATEFLAG_FLIP_IMAGE|
		DE_CREATEFLAG_IS_BWIMG);
done:
	de_bitmap_destroy(img);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpq $0x1cc0, %r8            # imm = 0x1CC0
jge 0x7f3db
xorl %ebx, %ebx
jmp 0x7f42e
movq %rcx, %r14
movq %rdi, %r15
movl $0x80, %esi
movl $0x1cc, %edx            # imm = 0x1CC
movl $0x1, %ecx
callq 0xf266a
movq %rax, %rbx
movq 0x18(%r15), %rdi
movl $0x10, %edx
movq %r14, %rsi
movq %rax, %rcx
movl $0x1, %r8d
callq 0xf2a40
movq %rbx, %rdi
callq 0xf34d7
leaq 0xaae93(%rip), %rsi     # 0x12a2b4
movq %rbx, %rdi
movl $0xd, %edx
callq 0xf22dc
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0xf228d
nop
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jbf.c
// Function: de_module_jbf
void de_module_jbf(deark *c, struct deark_module_info *mi)
{
	mi->id = "jbf";
	mi->desc = "PaintShop Pro Browser Cache (pspbrwse.jbf)";
	mi->run_fn = de_run_jbf;
	mi->identify_fn = de_identify_jbf;
}

// Assembly:
leaq 0xab1dd(%rip), %rax     # 0x12a620
movq %rax, (%rsi)
leaq 0xab1d7(%rip), %rax     # 0x12a624
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x7f468
movq %rax, 0x18(%rsi)
leaq 0x8a0(%rip), %rax       # 0x7fd03
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jovianvi.c
// Function: de_module_jovianvi
void de_module_jovianvi(deark *c, struct deark_module_info *mi)
{
	mi->id = "jovianvi";
	mi->desc = "Jovian Logic VI";
	mi->run_fn = de_run_jovianvi;
	mi->identify_fn = de_identify_jovianvi;
}

// Assembly:
leaq 0xaab2d(%rip), %rax     # 0x12a860
movq %rax, (%rsi)
leaq 0xaab2c(%rip), %rax     # 0x12a869
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x7fd58
movq %rax, 0x18(%rsi)
leaq 0x600(%rip), %rax       # 0x80353
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jovianvi.c
// Function: de_identify_jovianvi
static int de_identify_jovianvi(deark *c)
{
	u8 t;

	if(dbuf_memcmp(c->infile, 0, "VI", 2)) return 0;
	t = de_getbyte(2);
	if((t>=0x10 && t<=0x11) ||
		(t>=0x20 && t<=0x23) ||
		(t>=0x30 && t<=0x31))
	{
		return 100;
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq 0xaa511(%rip), %rdx     # 0x12a876
xorl %ebx, %ebx
movl $0x2, %ecx
xorl %esi, %esi
callq 0xefc85
testl %eax, %eax
jne 0x803a2
movq 0x18(%r14), %rdi
movl $0x2, %esi
callq 0xeead3
movl %eax, %ecx
andb $-0x4, %cl
movl $0x64, %ebx
cmpb $0x20, %cl
je 0x803a2
addb $-0x10, %al
xorl %ecx, %ecx
testb $-0x22, %al
movl $0x64, %ebx
cmovnel %ecx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: de_module_jpeg
void de_module_jpeg(deark *c, struct deark_module_info *mi)
{
	mi->id = "jpeg";
	mi->desc = "JPEG image";
	mi->desc2 = "resources only";
	mi->run_fn = de_run_jpeg;
	mi->identify_fn = de_identify_jpeg;
}

// Assembly:
leaq 0x975bd(%rip), %rax     # 0x117970
movq %rax, (%rsi)
leaq 0xaa653(%rip), %rax     # 0x12aa10
movq %rax, 0x8(%rsi)
leaq 0x94fc9(%rip), %rax     # 0x115391
movq %rax, 0x10(%rsi)
leaq 0x10(%rip), %rax        # 0x803e3
movq %rax, 0x18(%rsi)
leaq 0x9dd(%rip), %rax       # 0x80dbb
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: de_module_syberia_syj
void de_module_syberia_syj(deark *c, struct deark_module_info *mi)
{
	mi->id = "syberia_syj";
	mi->desc = "Syberia texture";
	mi->run_fn = de_run_syberia_syj;
	mi->identify_fn = de_identify_syberia_syj;
}

// Assembly:
leaq 0xa99c2(%rip), %rax     # 0x12aa56
movq %rax, (%rsi)
leaq 0xa99c4(%rip), %rax     # 0x12aa62
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x810b9
movq %rax, 0x18(%rsi)
leaq 0x54(%rip), %rax        # 0x81108
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: de_run_syberia_syj
static void de_run_syberia_syj(deark *c, de_module_params *mparams)
{
	dbuf *outf = NULL;

	outf = dbuf_create_output_file(c, "jpg", NULL, 0);
	dbuf_write(outf, (const u8*)"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46", 10);
	dbuf_copy(c->infile, 0, c->infile->len, outf);
	dbuf_close(outf);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xb27eb(%rip), %rsi     # 0x1338b2
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xefda1
movq %rax, %r14
leaq 0xa991d(%rip), %rsi     # 0x12a9f7
movl $0xa, %edx
movq %rax, %rdi
callq 0xef547
movq 0x18(%rbx), %rdi
movq 0x18(%rdi), %rdx
xorl %esi, %esi
movq %r14, %rcx
callq 0xef481
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xf052b
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: de_identify_syberia_syj
static int de_identify_syberia_syj(deark *c)
{
	if(de_getu16be(0) != 0x0001) return 0;
	if(!de_input_file_has_ext(c, "syj")) return 0;
	if(dbuf_memcmp(c->infile, 8, (const void*)"\0\0\xff", 3)) {
		return 0;
	}
	if(de_getu16be(c->infile->len-2) != 0xffd9) return 0;
	return 80;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0xeeb67
cmpq $0x1, %rax
jne 0x81174
leaq 0xa9935(%rip), %rsi     # 0x12aa5e
movq %r14, %rdi
callq 0xea491
testl %eax, %eax
je 0x81174
movq 0x18(%r14), %rdi
leaq 0xaa9c0(%rip), %rdx     # 0x12bb00
movl $0x8, %esi
movl $0x3, %ecx
callq 0xefc85
testl %eax, %eax
jne 0x81174
movq 0x18(%r14), %rdi
movq 0x18(%rdi), %rsi
addq $-0x2, %rsi
callq 0xeeb67
xorl %ecx, %ecx
cmpq $0xffd9, %rax           # imm = 0xFFD9
movl $0x50, %ebx
cmovnel %ecx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: de_module_esm_pix
void de_module_esm_pix(deark *c, struct deark_module_info *mi)
{
	mi->id = "esm_pix";
	mi->desc = "Esm Software PIX";
	mi->run_fn = de_run_esm_pix;
	mi->identify_fn = de_identify_esm_pix;
}

// Assembly:
leaq 0xa98ed(%rip), %rax     # 0x12aa72
movq %rax, (%rsi)
leaq 0xa98eb(%rip), %rax     # 0x12aa7a
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x811aa
movq %rax, 0x18(%rsi)
leaq 0x47(%rip), %rax        # 0x811ec
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: de_identify_esm_pix
static int de_identify_esm_pix(deark *c)
{
	if(dbuf_memcmp(c->infile, 0, (const void*)"Esm ", 4)) {
		return 0;
	}
	if(dbuf_memcmp(c->infile, 13, (const void*)"PIX ", 4)) {
		return 0;
	}
	if((UI)de_getu16be(21) != 0xffd8) return 0;
	return 100;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq 0xaa8ca(%rip), %rdx     # 0x12bac8
xorl %ebx, %ebx
movl $0x4, %ecx
xorl %esi, %esi
callq 0xefc85
testl %eax, %eax
jne 0x8124b
movq 0x18(%r14), %rdi
leaq 0xaa8b2(%rip), %rdx     # 0x12bacd
movl $0xd, %esi
movl $0x4, %ecx
callq 0xefc85
testl %eax, %eax
jne 0x8124b
movq 0x18(%r14), %rdi
movl $0x15, %esi
callq 0xeeb67
xorl %ecx, %ecx
cmpl $0xffd8, %eax           # imm = 0xFFD8
movl $0x64, %ebx
cmovnel %ecx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: de_module_pegasus_pic2
void de_module_pegasus_pic2(deark *c, struct deark_module_info *mi)
{
	mi->id = "pegasus_pic2";
	mi->desc = "Pegasus PIC2";
	mi->run_fn = de_run_pegasus_pic2;
	mi->identify_fn = de_identify_pegasus_pic2;
}

// Assembly:
leaq 0xa982f(%rip), %rax     # 0x12aa8b
movq %rax, (%rsi)
leaq 0xa9832(%rip), %rax     # 0x12aa98
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x81281
movq %rax, 0x18(%rsi)
leaq 0x214(%rip), %rax       # 0x81490
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: de_run_pegasus_pic2
static void de_run_pegasus_pic2(deark *c, de_module_params *mparams)
{
	struct pic2_ctx *d = NULL;

	d = de_malloc(c, sizeof(struct pic2_ctx));
	de_declare_fmt(c, "Pegasus PIC2");
	pic2_main(c, d);
	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x1, %esi
callq 0xe8b2b
movq %rax, %r14
leaq 0xa97f2(%rip), %rsi     # 0x12aa98
movq %rbx, %rdi
callq 0xeb125
movq $0x4, 0x8(%rsp)
leaq 0x14(%rsp), %rsi
movq %rbx, %rdi
callq 0xe8a1c
movq 0x18(%rbx), %rax
cmpq $0x9, 0x18(%rax)
jl 0x81476
movl $0x4, %edx
leaq 0x8(%rsp), %r12
movq %rbx, %rdi
leaq 0xc4c06(%rip), %rsi     # 0x145eed
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeeb4b
movzbl %al, %ebp
cmpl $0x5, %ebp
jle 0x81322
cmpl $0x6, %ebp
je 0x8133c
cmpl $0x16, %ebp
jne 0x81333
leaq 0xaa7c1(%rip), %rcx     # 0x12bae1
jmp 0x81343
leaq 0xaa7ad(%rip), %rcx     # 0x12bad6
je 0x81343
testl %ebp, %ebp
je 0x8145c
leaq 0xaae17(%rip), %rcx     # 0x12c151
jmp 0x81343
leaq 0xb6482(%rip), %rcx     # 0x1377c5
movq %rbx, %rdi
leaq 0x913e5(%rip), %rsi     # 0x112732
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xeed83
movq %rax, %r15
movq 0x8(%rsp), %r13
movq %rbx, %rdi
leaq 0xc4558(%rip), %rsi     # 0x1458cc
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
leaq (%r15,%r13), %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jg 0x81476
cmpl $0x6, %ebp
je 0x813da
cmpl $0x5, %ebp
jne 0x813b6
movl $0x3, %ecx
movq %r13, %rsi
leaq 0xa97dc(%rip), %rdx     # 0x12ab85
callq 0xefc85
testl %eax, %eax
jne 0x813b6
movb $0x1, (%r14)
movq 0x18(%rbx), %rsi
movl $0x1, (%rsp)
movl $0x100, %r8d            # imm = 0x100
movq %rbx, %rdi
movq %r13, %rdx
movq %r15, %rcx
xorl %r9d, %r9d
callq 0xe8bea
jmp 0x8142e
cmpb $0x0, (%r14)
je 0x8142e
movq %rbx, %rdi
leaq 0xaa700(%rip), %rsi     # 0x12baea
movq %r13, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rcx
movq %rbx, %rdi
leaq 0x96561(%rip), %rsi     # 0x117970
leaq 0xc0111(%rip), %rdx     # 0x141527
movq %r13, %r8
movq %r15, %r9
callq 0xe9b13
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq %r15, 0x8(%rsp)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x8(%rsp), %rdx
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
addq $-0x4, %rax
cmpq %rax, %rdx
jl 0x812dd
jmp 0x81476
leaq 0x912cf(%rip), %rsi     # 0x112732
leaq 0xaa668(%rip), %rcx     # 0x12bad2
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: de_identify_pegasus_pic2
static int de_identify_pegasus_pic2(deark *c)
{
	UI n;
	u8 b;

	n = (UI)de_getu32be(0);
#define CODE_PIC2 0x50494332U
	if(n!=CODE_PIC2) return 0;
	b = de_getbyte(4); // segment type, expecting 1
	if(b!=1) return 0;
	n = (UI)de_getu32le(5); // segment len, expecting 8
	if(n<4 || n>32) return 0;
	return 87;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0xeed0d
cmpl $0x50494332, %eax       # imm = 0x50494332
jne 0x814db
movq 0x18(%r14), %rdi
movl $0x4, %esi
callq 0xeead3
cmpb $0x1, %al
jne 0x814db
movq 0x18(%r14), %rdi
movl $0x5, %esi
callq 0xeed61
addl $-0x21, %eax
xorl %ecx, %ecx
cmpl $-0x1d, %eax
movl $0x57, %ebx
cmovbl %ecx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: do_afcp_segment
static void do_afcp_segment(deark *c, lctx *d, i64 endpos)
{
	d->has_afcp = 1;
	de_dbg(c, "AFCP segment found at end of file");

	de_dbg_indent(c, 1);
	de_run_module_by_id_on_slice(c, "afcp", NULL, c->infile, 0, endpos);
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movb $0x1, 0x9(%rsi)
leaq 0xaa448(%rip), %rsi     # 0x12b942
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%r14), %rcx
leaq 0x92f3c(%rip), %rsi     # 0x114455
movq %r14, %rdi
xorl %edx, %edx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0xe9aa3
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe8a15
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: handler_dac
static void handler_dac(deark *c, lctx *d,
	const struct marker_info *mi, i64 pos1, i64 data_size)
{
	i64 ntables;
	i64 i;
	u8 b;
	u8 cs;
	u8 table_class;
	u8 table_id;

	ntables = data_size/2;
	for(i=0; i<ntables; i++) {
		b = de_getbyte(pos1+i*2);
		table_class = b>>4;
		table_id = b&0x0f;
		de_dbg(c, "table: %s%u", table_class==0?"DC":"AC",
			(unsigned int)table_id);
		cs = de_getbyte(pos1+i*2+1);
		de_dbg_indent(c, 1);
		de_dbg(c, "conditioning value: %d", (int)cs);
		de_dbg_indent(c, -1);
	}
}

// Assembly:
cmpq $0x2, %r8
jl 0x8376a
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdi, %r14
movq %r8, %r13
shrq $0x3f, %r13
addq %r8, %r13
sarq %r13
leaq 0xa762e(%rip), %r15     # 0x12ad0b
leaq 0xa7633(%rip), %r12     # 0x12ad17
movq 0x18(%r14), %rdi
movq %rbx, %rsi
callq 0xeead3
movl %eax, %ecx
andb $0xf, %cl
cmpb $0x10, %al
leaq 0xa748c(%rip), %rdx     # 0x12ab8a
leaq 0x97cde(%rip), %rax     # 0x11b3e3
cmovbq %rax, %rdx
movzbl %cl, %ecx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%r14), %rdi
leaq 0x1(%rbx), %rsi
callq 0xeead3
movl %eax, %ebp
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
movzbl %bpl, %edx
movq %r14, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq $0x2, %rbx
decq %r13
jne 0x836e4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: handler_sos
static void handler_sos(deark *c, lctx *d,
	const struct marker_info *mi, i64 pos, i64 data_size)
{
	i64 ncomp;
	i64 i;
	u8 cs;
	u8 b;
	u8 ss, se, ax;
	u8 actable, dctable;

	if(data_size<1) goto done;

	d->scan_count++;
	ncomp = (i64)de_getbyte(pos);
	de_dbg(c, "number of components in scan: %d", (int)ncomp);
	if(data_size < 4 + 2*ncomp) goto done;

	for(i=0; i<ncomp; i++) {
		cs = de_getbyte(pos+1+i*2);
		de_dbg(c, "component #%d id: %d", (int)i, (int)cs);
		de_dbg_indent(c, 1);
		b = de_getbyte(pos+1+i*2+1);
		dctable = b>>4;
		actable = b&0x0f;
		de_dbg(c, "tables to use: DC%d, AC%d", (int)dctable, (int)actable);
		de_dbg_indent(c, -1);
	}

	ss = de_getbyte(pos+1+ncomp*2);
	se = de_getbyte(pos+1+ncomp*2+1);
	ax = de_getbyte(pos+1+ncomp*2+2);
	de_dbg(c, "spectral selection start/end: %d, %d", (int)ss, (int)se);
	de_dbg(c, "successive approx. bit pos high/low: %u, %u",
		(unsigned int)(ax>>4), (unsigned int)(ax&0x0f));

done:
	;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %r8, %r8
jle 0x837bb
movq %r8, %r12
movq %rcx, %r14
movq %rdi, %rbx
incl 0x24(%rsi)
movq 0x18(%rdi), %rdi
movq %rcx, %rsi
callq 0xeead3
movzbl %al, %r15d
leaq 0xa758d(%rip), %rsi     # 0x12ad2e
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
leal (%r15,%r15), %ecx
leaq 0x4(%rcx), %rax
cmpq %r12, %rax
jbe 0x837ca
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rcx, 0x10(%rsp)
leaq 0x1(%r14), %rax
movq %rax, 0x8(%rsp)
testq %r15, %r15
je 0x8385c
addq $0x2, %r14
leaq 0xa7567(%rip), %r12     # 0x12ad4f
leaq 0xa7575(%rip), %r13     # 0x12ad64
xorl %ebp, %ebp
movq 0x18(%rbx), %rdi
leaq -0x1(%r14), %rsi
callq 0xeead3
movzbl %al, %ecx
movq %rbx, %rdi
movq %r12, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeead3
movl %eax, %ecx
shrb $0x4, %cl
andb $0xf, %al
movzbl %cl, %edx
movzbl %al, %ecx
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
incq %rbp
addq $0x2, %r14
cmpq %rbp, %r15
jne 0x837f1
movq 0x18(%rbx), %rdi
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %r12
leaq (%r12,%r15), %rsi
callq 0xeead3
movl %eax, %ebp
movq 0x18(%rbx), %rdi
leaq (%r12,%r15), %rsi
incq %rsi
callq 0xeead3
movl %eax, %r14d
movq 0x18(%rbx), %rdi
leaq (%r12,%r15), %rsi
addq $0x2, %rsi
callq 0xeead3
movl %eax, %r15d
movzbl %bpl, %edx
movzbl %r14b, %ecx
leaq 0xa74d3(%rip), %rsi     # 0x12ad7e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movzbl %r15b, %ecx
movl %ecx, %edx
shrl $0x4, %edx
andl $0xf, %ecx
leaq 0xa74db(%rip), %rsi     # 0x12ada3
movq %rbx, %rdi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe8617
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: handler_dri
static void handler_dri(deark *c, lctx *d,
	const struct marker_info *mi, i64 pos, i64 data_size)
{
	i64 ri;
	if(data_size!=2) return;
	ri = de_getu16be(pos);
	de_dbg(c, "restart interval: %d", (int)ri);
	if(ri!=0) d->has_restart_markers = 1;
}

// Assembly:
cmpq $0x2, %r8
jne 0x83b21
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rdi
movq %rcx, %rsi
callq 0xeeb67
movq %rax, %r15
leaq 0xa72fb(%rip), %rsi     # 0x12ae01
movq %r14, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
testq %r15, %r15
je 0x83b1c
movb $0x1, 0x1b(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: handler_jpg8
static void handler_jpg8(deark *c, lctx *d,
	const struct marker_info *mi, i64 seg_data_pos, i64 seg_data_size)
{
	u8 id;
	const char *name = "?";

	if(seg_data_size<1) return;
	id = de_getbyte(seg_data_pos);
	if(id==0x0d) {
		d->has_revcolorxform = 1;
		name="inverse color transform specification";
	}
	de_dbg(c, "id: 0x%02x (%s)", (unsigned int)id, name);
}

// Assembly:
testq %r8, %r8
jle 0x83b53
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
movq %rcx, %rsi
callq 0xeead3
movzbl %al, %edx
cmpb $0xd, %dl
jne 0x83b54
movb $0x1, 0x1f(%r14)
leaq 0xa72c5(%rip), %rcx     # 0x12ae16
jmp 0x83b5b
retq
leaq 0xa85f6(%rip), %rcx     # 0x12c151
leaq 0xa72da(%rip), %rsi     # 0x12ae3c
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe8617
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: handler_com
static void handler_com(deark *c, lctx *d,
	const struct marker_info *mi, i64 pos, i64 data_size)
{
	// Note that a JPEG COM-segment comment is an arbitrary sequence of bytes, so
	// there's no way to know what text encoding it uses, or even whether it is text.
	// We'll use the user's "-inenc" encoding, or DE_ENCODING_UNKNOWN by default.
	handle_comment(c, d, pos, data_size, c->input_encoding);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movq %rcx, %r12
movq %rdi, %rbx
movl 0x90(%rdi), %r13d
movl 0xfc(%rdi), %ebp
cmpl $0x1, %r13d
jle 0x83bce
testq %r15, %r15
jle 0x83c41
testl %ebp, %ebp
jne 0x83be2
movq 0x18(%rbx), %rdi
leaq 0x94981(%rip), %rcx     # 0x118533
xorl %r14d, %r14d
movq %r12, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xefd48
jmp 0x83c6c
testq %r15, %r15
jle 0x83c41
cmpl $0x0, (%rbx)
jle 0x83c41
testl %ebp, %ebp
movl $0x401, %eax            # imm = 0x401
cmovel %eax, %ebp
movq %rbx, %rdi
callq 0xf6410
movq %rax, %r14
movq 0x18(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
movl %ebp, %r9d
callq 0xefbd7
cmpl $0x2, %r13d
jl 0x83c50
leaq 0x94921(%rip), %rsi     # 0x118533
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xefda1
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
movl $0x1, %ecx
callq 0xf6da2
movq %r15, %rdi
callq 0xf052b
jmp 0x83c6c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0xf70f6
leaq 0x90c21(%rip), %rsi     # 0x114880
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf6753
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: do_jpeghdr_segment
static void do_jpeghdr_segment(deark *c, lctx *d, i64 pos1,
	i64 data_size1, int is_ext)
{
	int ret;
	i64 pos = 0;
	i64 data_size;

	// Payload should begin after the first NUL byte. Search for it.
	ret = dbuf_search_byte(c->infile, 0x00, pos1, data_size1, &pos);
	if(!ret) {
		de_warn(c, "Bad or unsupported JPEG-HDR data");
		return;
	}
	pos++;
	data_size = pos1+data_size1 - pos;

	if(is_ext) {
		de_dbg(c, "JPEG-HDR residual image continuation, pos=%d size=%d",
			(int)pos, (int)data_size);
	}
	else {
		de_dbg(c, "JPEG-HDR residual image start, pos=%d size=%d",
			(int)pos, (int)data_size);

		// Close any previous file
		if(d->hdr_residual_file) {
			dbuf_close(d->hdr_residual_file);
			d->hdr_residual_file = NULL;
		}

		// Make sure it looks like an embedded JPEG file
		if(dbuf_memcmp(c->infile, pos, "\xff\xd8", 2)) {
			de_warn(c, "Bad or unsupported JPEG-HDR format");
			return;
		}

		d->hdr_residual_file = dbuf_create_output_file(c, "residual.jpg", NULL, DE_CREATEFLAG_IS_AUX);
	}

	if(!d->hdr_residual_file) return;
	dbuf_copy(c->infile, pos, data_size, d->hdr_residual_file);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %r8
movq $0x0, (%r8)
movq 0x18(%rdi), %rdi
xorl %esi, %esi
callq 0xefa77
testl %eax, %eax
je 0x83cfd
movq (%rsp), %r15
leaq 0x1(%r15), %rdx
movq %rdx, (%rsp)
addq %r13, %r12
notq %r15
addq %r12, %r15
testl %ebp, %ebp
je 0x83d06
leaq 0xa787c(%rip), %rsi     # 0x12b551
movq %rbx, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x50(%r14), %rcx
testq %rcx, %rcx
je 0x83d5e
movq 0x18(%rbx), %rdi
movq (%rsp), %rsi
movq %r15, %rdx
callq 0xef481
jmp 0x83d5e
leaq 0xa782c(%rip), %rsi     # 0x12b530
jmp 0x83d54
leaq 0xa7879(%rip), %rsi     # 0x12b586
movq %rbx, %rdi
movl %r15d, %ecx
xorl %eax, %eax
callq 0xe8617
movq 0x50(%r14), %rdi
testq %rdi, %rdi
je 0x83d30
callq 0xf052b
movq $0x0, 0x50(%r14)
movq 0x18(%rbx), %rdi
movq (%rsp), %rsi
leaq 0xa7875(%rip), %rdx     # 0x12b5b4
movl $0x2, %ecx
callq 0xefc85
testl %eax, %eax
je 0x83d6d
leaq 0xa7863(%rip), %rsi     # 0x12b5b7
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8faa
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa7866(%rip), %rsi     # 0x12b5da
movq %rbx, %rdi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xefda1
movq %rax, %rcx
movq %rax, 0x50(%r14)
jmp 0x83ce6
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: decode_app_id
static void decode_app_id(struct app_id_decode_struct *ad)
{
	i64 k;

	if(ad->nraw_bytes<2) return;
	if(ad->raw_bytes[0]<32 || ad->raw_bytes[0]>126) return;

	// Might have an app id.
	for(k=0; k<ad->nraw_bytes; k++) {
		if(ad->raw_bytes[k]==0) {
			ad->has_app_id = 1;
			ad->app_id_orig_strlen = k;
			break;
		}
	}

	if(ad->has_app_id) {
		// We'll assume this is an app id
		de_strlcpy(ad->app_id_orig, (const char*)ad->raw_bytes, sizeof(ad->app_id_orig));
		normalize_app_id(ad->app_id_orig, ad->app_id_normalized, sizeof(ad->app_id_normalized));
	}
}

// Assembly:
movq 0x50(%rdi), %rax
cmpq $0x2, %rax
jl 0x83e5b
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movb (%rdi), %cl
addb $-0x7f, %cl
cmpb $-0x5f, %cl
jb 0x83e56
xorl %ecx, %ecx
cmpb $0x0, (%rbx,%rcx)
je 0x83dc5
incq %rcx
cmpq %rcx, %rax
jne 0x83db5
jmp 0x83dd6
movl $0x1, 0x100(%rbx)
movq %rcx, 0xf8(%rbx)
cmpl $0x0, 0x100(%rbx)
je 0x83e56
leaq 0x58(%rbx), %r15
movl $0x50, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xe8219
leaq 0xa8(%rbx), %r14
movl $0x50, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0xe8219
movq %r14, %rdi
callq 0x180e0
testq %rax, %rax
jle 0x83e56
cmpb $0x20, 0xa7(%rbx,%rax)
jne 0x83e38
movb $0x0, 0xa7(%rbx,%rax)
leaq -0x1(%rax), %rcx
cmpq $0x1, %rax
movq %rcx, %rax
jg 0x83e17
jmp 0x83e56
xorl %ecx, %ecx
movb (%r14,%rcx), %dl
leal -0x61(%rdx), %esi
cmpb $0x19, %sil
ja 0x83e4e
addb $-0x20, %dl
movb %dl, (%r14,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x83e3a
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: extract_unc_jfif_thumbnail
static void extract_unc_jfif_thumbnail(deark *c, lctx *d,
	i64 pos1, i64 len, i64 w, i64 h, int has_pal,
	const char *token)
{
	i64 i, j;
	i64 pos = pos1;
	de_bitmap *img = NULL;
	u32 clr;
	i64 rowspan;

	img = de_bitmap_create(c, w, h, 3);

	if(has_pal) {
		u32 pal[256];
		de_read_palette_rgb(c->infile, pos, 256, 3, pal, 256, 0);
		pos += 768;
		de_convert_image_paletted(c->infile, pos, 8, w, pal, img, 0);
	}
	else {
		rowspan = 3*w;
		for(j=0; j<h; j++) {
			for(i=0; i<w; i++) {
				clr = dbuf_getRGB(c->infile, pos + j*rowspan + i*3, 0);
				de_bitmap_setpixel_rgb(img, i, j, clr);
			}
		}
	}

	de_bitmap_write_to_file(img, token, DE_CREATEFLAG_IS_AUX);

	de_bitmap_destroy(img);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x438, %rsp            # imm = 0x438
movq %r9, 0x18(%rsp)
movl %r8d, %ebx
movq %rcx, %rbp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movq %rdx, %rsi
movq %rcx, %rdx
movl $0x3, %ecx
callq 0xf266a
movq %rax, %r14
testl %ebx, %ebx
je 0x83ee7
movq 0x18(%r13), %rdi
xorl %ebp, %ebp
movl %ebp, (%rsp)
leaq 0x30(%rsp), %rbx
movl $0x100, %edx            # imm = 0x100
movl $0x3, %ecx
movl $0x100, %r9d            # imm = 0x100
movq %r12, %rsi
movq %rbx, %r8
callq 0xf2c4e
addq $0x300, %r12            # imm = 0x300
movq 0x18(%r13), %rdi
movl %ebp, (%rsp)
movl $0x8, %edx
movq %r12, %rsi
movq %r15, %rcx
movq %rbx, %r8
movq %r14, %r9
callq 0xf2f79
jmp 0x83f4e
testq %rbp, %rbp
jle 0x83f4e
leaq (%r15,%r15,2), %rax
movq %rax, 0x20(%rsp)
xorl %ebx, %ebx
movq %rbp, 0x28(%rsp)
movq %r12, 0x10(%rsp)
testq %r15, %r15
jle 0x83f37
movq 0x10(%rsp), %r12
xorl %ebp, %ebp
movq 0x18(%r13), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0xef42f
movq %r14, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movl %eax, %ecx
callq 0xf24ba
incq %rbp
addq $0x3, %r12
cmpq %rbp, %r15
jne 0x83f0d
incq %rbx
movq 0x10(%rsp), %r12
addq 0x20(%rsp), %r12
movq 0x28(%rsp), %rbp
cmpq %rbp, %rbx
jne 0x83efc
movq %r14, %rdi
movq 0x18(%rsp), %rsi
movl $0x1, %edx
callq 0xf22dc
movq %r14, %rdi
callq 0xf228d
addq $0x438, %rsp            # imm = 0x438
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: destroy_fpxr_data
static void destroy_fpxr_data(deark *c, lctx *d)
{
	size_t k;
	if(!d->fpxr_data) return;

	for(k=0; k<d->fpxr_data->num_entities; k++) {
		if(d->fpxr_data->entities[k].name_srd) {
			de_destroy_stringreaderdata(c, d->fpxr_data->entities[k].name_srd);
			d->fpxr_data->entities[k].name_srd = NULL;
		}

		dbuf_close(d->fpxr_data->entities[k].stream);
		d->fpxr_data->entities[k].stream = NULL;
	}

	de_free(c, d->fpxr_data->entities);
	de_free(c, d->fpxr_data);
	d->fpxr_data = NULL;
}

// Assembly:
movq 0xa8(%rsi), %rax
testq %rax, %rax
je 0x84028
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x0, (%rax)
movq 0x8(%rax), %rsi
je 0x83ffb
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x8(%rsi,%r15), %rax
testq %rax, %rax
je 0x83fd1
movq %r14, %rdi
movq %rax, %rsi
callq 0xefaca
movq 0xa8(%rbx), %rax
movq 0x8(%rax), %rsi
movq $0x0, 0x8(%rsi,%r15)
movq 0x10(%rsi,%r15), %rdi
callq 0xf052b
movq 0xa8(%rbx), %rax
movq 0x8(%rax), %rsi
movq $0x0, 0x10(%rsi,%r15)
incq %r12
addq $0x28, %r15
cmpq (%rax), %r12
jb 0x83fa8
movq %r14, %rdi
callq 0xe8be2
movq 0xa8(%rbx), %rsi
movq %r14, %rdi
callq 0xe8be2
movq $0x0, 0xa8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/jpeg.c
// Function: do_ducky_stringblock
static void do_ducky_stringblock(deark *c, lctx *d,
	i64 pos1, i64 len, const char *name)
{
	i64 pos = pos1;
	i64 nchars;
	de_ucstring *s = NULL;

	if(len<4) goto done;
	nchars = de_getu32be_p(&pos);
	if(nchars*2 > len-4) goto done;

	s = ucstring_create(c);
	dbuf_read_to_ucstring_n(c->infile, pos, nchars*2, DE_DBG_MAX_STRLEN, s,
		0, DE_ENCODING_UTF16BE);
	de_dbg(c, "%s: \"%s\"", name, ucstring_getpsz(s));
done:
	ucstring_destroy(s);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x10(%rsp)
cmpq $0x4, %rdx
jl 0x842b7
movq %rcx, %rbx
movq %rdx, %r15
movq %rdi, %r14
movq 0x18(%rdi), %rdi
leaq 0x10(%rsp), %rsi
callq 0xeed31
movq %rax, %r12
addq %rax, %r12
addq $-0x4, %r15
cmpq %r15, %r12
jle 0x842bc
xorl %r15d, %r15d
jmp 0x84309
movq %r14, %rdi
callq 0xf6410
movq %rax, %r15
movq 0x18(%r14), %rdi
movq 0x10(%rsp), %rsi
movl $0x4, (%rsp)
movl $0x1f4, %ecx            # imm = 0x1F4
movq %r12, %rdx
movq %rax, %r8
xorl %r9d, %r9d
callq 0xefc2a
movq %r15, %rdi
callq 0xf705c
leaq 0xa7e31(%rip), %rsi     # 0x12c12a
movq %r14, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
movq %r15, %rdi
callq 0xf6753
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/lha.c
// Function: de_module_lha
void de_module_lha(deark *c, struct deark_module_info *mi)
{
	mi->id = "lha";
	mi->desc = "LHA/LZH/PMA archive";
	mi->run_fn = de_run_lha;
	mi->identify_fn = de_identify_lha;
	mi->help_fn = de_help_lha;
}

// Assembly:
leaq 0xa7947(%rip), %rax     # 0x12bc6e
movq %rax, (%rsi)
leaq 0xa78ef(%rip), %rax     # 0x12bc20
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x84357
movq %rax, 0x18(%rsi)
leaq 0x48(%rip), %rax        # 0x8438f
movq %rax, 0x20(%rsi)
leaq 0x1cc(%rip), %rax       # 0x8451e
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/lha.c
// Function: de_run_lha
static void de_run_lha(deark *c, de_module_params *mparams)
{
	lctx *d;

	d = lha_create_lctx(c);
	d->basefmt = BASEFMT_LHA;
	do_run_lha_internal(c, d, mparams);
	lha_destroy_lctx(c, d);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x38, %esi
callq 0xe8b2b
movq %rax, %r14
movl $0x0, 0xc(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x857db
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x868ce