LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_identify_tinystuff
static int de_identify_tinystuff(deark *c)
{
	// TODO: Can we identify these files?
	if(de_getbyte(0)>0x05) return 0;
	if(de_input_file_has_ext(c, "tny") ||
		de_input_file_has_ext(c, "tn1") ||
		de_input_file_has_ext(c, "tn2") ||
		de_input_file_has_ext(c, "tn3") ||
		de_input_file_has_ext(c, "tn4"))
	{
		return 8;
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0xe3eb4
cmpb $0x5, %al
ja 0x22572
leaq 0xe4533(%rip), %rsi     # 0x106a44
movq %r14, %rdi
callq 0xdfcd5
pushq $0x8
popq %rbx
testl %eax, %eax
jne 0x22572
leaq 0xe4521(%rip), %rsi     # 0x106a48
movq %r14, %rdi
callq 0xdfcd5
testl %eax, %eax
jne 0x22572
leaq 0xe4512(%rip), %rsi     # 0x106a4c
movq %r14, %rdi
callq 0xdfcd5
testl %eax, %eax
jne 0x22572
leaq 0xe4503(%rip), %rsi     # 0x106a50
movq %r14, %rdi
callq 0xdfcd5
testl %eax, %eax
jne 0x22572
leaq 0xe44f4(%rip), %rsi     # 0x106a54
movq %r14, %rdi
callq 0xdfcd5
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
shll $0x3, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_module_doodle
void de_module_doodle(deark *c, struct deark_module_info *mi)
{
	mi->id = "doodle";
	mi->desc = "Atari Doodle";
	mi->run_fn = de_run_doodle;
	mi->identify_fn = de_identify_doodle;
}

// Assembly:
leaq 0xe3f0c(%rip), %rax     # 0x1064a1
movq %rax, (%rsi)
leaq 0xe3f09(%rip), %rax     # 0x1064a8
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x225ba
movq %rax, 0x18(%rsi)
leaq 0xcd(%rip), %rax        # 0x22682
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_run_doodle
static void de_run_doodle(deark *c, de_module_params *mparams)
{
	struct atari_img_decode_data *adata = NULL;
	de_finfo *fi = NULL;
	u32 pal[2];

	adata = de_malloc(c, sizeof(struct atari_img_decode_data));
	adata->pal = pal;
	adata->bpp = 1;

	adata->w = 640;
	adata->h = 400;
	adata->ncolors = 2;
	adata->pal[0] = DE_STOCKCOLOR_WHITE;
	adata->pal[1] = DE_STOCKCOLOR_BLACK;

	adata->unc_pixels = c->infile;
	adata->img = de_bitmap_create(c, adata->w, adata->h, 1);
	fi = de_finfo_create(c);
	fmtutil_atari_set_standard_density(c, adata, fi);
	fmtutil_atari_decode_image(c, adata);
	de_bitmap_write_to_file_finfo(adata->img, fi, 0);

	if(adata) {
		de_bitmap_destroy(adata->img);
		de_free(c, adata);
	}
	de_finfo_destroy(c, fi);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
pushq $0x40
popq %rsi
callq 0xdecaf
movq %rax, %r14
leaq 0x8(%rsp), %rax
movq %rax, 0x30(%r14)
movq $0x1, (%r14)
movq $0x280, 0x10(%r14)      # imm = 0x280
movq $0x190, 0x18(%r14)      # imm = 0x190
movq $0x2, 0x8(%r14)
movabsq $-0xffffff00000001, %rcx # imm = 0xFF000000FFFFFFFF
movq %rcx, (%rax)
movq 0x18(%rbx), %rax
movq %rax, 0x20(%r14)
pushq $0x1
popq %rcx
movl $0x280, %esi            # imm = 0x280
movl $0x190, %edx            # imm = 0x190
movq %rbx, %rdi
callq 0xe7437
movq %rax, 0x38(%r14)
movq %rbx, %rdi
callq 0xdfd1a
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0xed4e6
movq %rbx, %rdi
movq %r14, %rsi
callq 0xed22a
movq 0x38(%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xe70ab
movq 0x38(%r14), %rdi
callq 0xe7084
movq %rbx, %rdi
movq %r14, %rsi
callq 0xded32
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdfd24
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_module_neochrome
void de_module_neochrome(deark *c, struct deark_module_info *mi)
{
	mi->id = "neochrome";
	mi->desc = "Atari NEOchrome image";
	mi->run_fn = de_run_neochrome;
	mi->identify_fn = de_identify_neochrome;
	mi->help_fn = de_help_neochrome;
}

// Assembly:
leaq 0xe3e00(%rip), %rax     # 0x1064b5
movq %rax, (%rsi)
leaq 0xe3e00(%rip), %rax     # 0x1064bf
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x226e5
movq %rax, 0x18(%rsi)
leaq 0x184(%rip), %rax       # 0x22859
movq %rax, 0x20(%rsi)
leaq 0x1aa(%rip), %rax       # 0x2288a
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_identify_neochrome
static int de_identify_neochrome(deark *c)
{
	if(de_input_file_has_ext(c, "neo")) {
		if(c->infile->len == 32128) {
			return 100;
		}
		else if(c->infile->len > 32128) {
			return 10;
		}
	}
	return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xe422f(%rip), %rsi     # 0x106a93
callq 0xdfcd5
testl %eax, %eax
je 0x22886
movq 0x18(%rbx), %rax
cmpq $0x7d80, 0x18(%rax)     # imm = 0x7D80
jne 0x2287f
pushq $0x64
jmp 0x22883
jle 0x22886
pushq $0xa
popq %rax
jmp 0x22888
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_module_neochrome_ani
void de_module_neochrome_ani(deark *c, struct deark_module_info *mi)
{
	mi->id = "neochrome_ani";
	mi->desc = "NEOchrome Animation";
	mi->run_fn = de_run_neochrome_ani;
	mi->identify_fn = de_identify_neochrome_ani;
	mi->flags |= DE_MODFLAG_NONWORKING;
}

// Assembly:
leaq 0xe3c3f(%rip), %rax     # 0x1064d5
movq %rax, (%rsi)
leaq 0xe3c43(%rip), %rax     # 0x1064e3
movq %rax, 0x8(%rsi)
leaq 0x14(%rip), %rax        # 0x228bf
movq %rax, 0x18(%rsi)
leaq 0x1c3(%rip), %rax       # 0x22a79
movq %rax, 0x20(%rsi)
orb $0x2, 0x30(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_module_animatic
void de_module_animatic(deark *c, struct deark_module_info *mi)
{
	mi->id = "animatic";
	mi->desc = "Animatic Film";
	mi->run_fn = de_run_animatic;
	mi->identify_fn = de_identify_animatic;
	mi->help_fn = de_help_animatic;
}

// Assembly:
leaq 0xe3a55(%rip), %rax     # 0x1064f7
movq %rax, (%rsi)
leaq 0xe3a54(%rip), %rax     # 0x106500
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x22ad2
movq %rax, 0x18(%rsi)
leaq 0x1d0(%rip), %rax       # 0x22c92
movq %rax, 0x20(%rsi)
leaq 0x1e8(%rip), %rax       # 0x22cb5
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_module_fpaint_pi4
void de_module_fpaint_pi4(deark *c, struct deark_module_info *mi)
{
	mi->id = "fpaint_pi4";
	mi->desc = "Atari Falcon PI4 image";
	mi->run_fn = de_run_fpaint_pi4;
	mi->identify_fn = de_identify_fpaint_pi4;
}

// Assembly:
leaq 0xe384d(%rip), %rax     # 0x10650e
movq %rax, (%rsi)
leaq 0xe384e(%rip), %rax     # 0x106519
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x22ce6
movq %rax, 0x18(%rsi)
leaq 0x14(%rip), %rax        # 0x22cf5
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_identify_fpaint_pi4
static int de_identify_fpaint_pi4(deark *c)
{
	if(c->infile->len==77824) {
		if(de_input_file_has_ext(c, "pi4") ||
			de_input_file_has_ext(c, "pi9"))
		{
			return 50; // Must be lower than fpaint_pi9
		}
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x18(%rdi), %rax
cmpq $0x13000, 0x18(%rax)    # imm = 0x13000
jne 0x22d30
movq %rdi, %r14
leaq 0xe3804(%rip), %rsi     # 0x106515
callq 0xdfcd5
pushq $0x32
popq %rbx
testl %eax, %eax
jne 0x22d32
leaq 0xe3813(%rip), %rsi     # 0x106537
movq %r14, %rdi
callq 0xdfcd5
testl %eax, %eax
jne 0x22d32
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_module_fpaint_pi9
void de_module_fpaint_pi9(deark *c, struct deark_module_info *mi)
{
	mi->id = "fpaint_pi9";
	mi->desc = "Atari Falcon PI9 image";
	mi->run_fn = de_run_fpaint_pi9;
	mi->identify_fn = de_identify_fpaint_pi9;
}

// Assembly:
leaq 0xe37ed(%rip), %rax     # 0x106530
movq %rax, (%rsi)
leaq 0xe37ee(%rip), %rax     # 0x10653b
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x22d68
movq %rax, 0x18(%rsi)
leaq 0x14(%rip), %rax        # 0x22d77
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_identify_fpaint_pi9
static int de_identify_fpaint_pi9(deark *c)
{
	int pi4_ext, pi9_ext;

	if(c->infile->len!=77824 && c->infile->len!=65024) return 0;

	pi4_ext = de_input_file_has_ext(c, "pi4");
	pi9_ext = de_input_file_has_ext(c, "pi9");
	if(!pi4_ext && !pi9_ext) return 0;

	if(c->infile->len==65024) return 60;

	// If file size is 77824, we need to distinguish between PI4 (320x240) and
	// PI9 (320x200) format.
	// Best guess is that if the last 12800 bytes are all 0, we should assume PI9.
	if(!dbuf_is_all_zeroes(c->infile, 65024, 12800)) {
		return 0; // Will be identified elsewhere as PI4.
	}

	return 60; // PI9. Must be higher than the value PI4 uses.
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rax
movq 0x18(%rax), %rax
xorl %ebx, %ebx
cmpq $0x13000, %rax          # imm = 0x13000
je 0x22d98
cmpq $0xfe00, %rax           # imm = 0xFE00
jne 0x22de6
leaq 0xe3776(%rip), %rsi     # 0x106515
movq %r14, %rdi
callq 0xdfcd5
movl %eax, %ebp
leaq 0xe3787(%rip), %rsi     # 0x106537
movq %r14, %rdi
callq 0xdfcd5
orl %ebp, %eax
je 0x22de6
movq 0x18(%r14), %rdi
cmpq $0xfe00, 0x18(%rdi)     # imm = 0xFE00
jne 0x22dcf
pushq $0x3c
popq %rbx
jmp 0x22de6
movl $0xfe00, %esi           # imm = 0xFE00
movl $0x3200, %edx           # imm = 0x3200
callq 0xe66d2
testl %eax, %eax
pushq $0x3c
popq %rbx
cmovel %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_module_atari_pi7
void de_module_atari_pi7(deark *c, struct deark_module_info *mi)
{
	mi->id = "atari_pi7";
	mi->desc = "Atari PI7 image";
	mi->run_fn = de_run_atari_pi7;
	mi->identify_fn = de_identify_atari_pi7;
}

// Assembly:
leaq 0xe375e(%rip), %rax     # 0x106552
movq %rax, (%rsi)
leaq 0xe375e(%rip), %rax     # 0x10655c
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x22e19
movq %rax, 0x18(%rsi)
leaq 0x14(%rip), %rax        # 0x22e28
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_module_falcon_xga
void de_module_falcon_xga(deark *c, struct deark_module_info *mi)
{
	mi->id = "falcon_xga";
	mi->desc = "Atari Falcon XGA image";
	mi->run_fn = de_run_falcon_xga;
	mi->identify_fn = de_identify_falcon_xga;
}

// Assembly:
leaq 0xe3712(%rip), %rax     # 0x10656c
movq %rax, (%rsi)
leaq 0xe3713(%rip), %rax     # 0x106577
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x22e7f
movq %rax, 0x18(%rsi)
leaq 0xeb(%rip), %rax        # 0x22f65
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_run_falcon_xga
static void de_run_falcon_xga(deark *c, de_module_params *mparams)
{
	struct atari_img_decode_data *adata = NULL;
	de_finfo *fi = NULL;

	adata = de_malloc(c, sizeof(struct atari_img_decode_data));
	if(c->infile->len==153600) {
		adata->bpp = 16;
		adata->w = 320;
		adata->h = 240;
	}
	else {
		adata->bpp = 16;
		adata->w = 384;
		adata->h = 480;
	}
	de_dbg_dimensions(c, adata->w, adata->h);
	adata->unc_pixels = c->infile;
	adata->img = de_bitmap_create(c, adata->w, adata->h, 3);
	fi = de_finfo_create(c);
	if(adata->w==384 && adata->h == 480) {
		fi->density.code = DE_DENSITY_UNK_UNITS;
		fi->density.xdens = 384;
		fi->density.ydens = 640;
	}
	fmtutil_atari_decode_image(c, adata);
	de_bitmap_write_to_file_finfo(adata->img, fi, 0);
	de_bitmap_destroy(adata->img);
	de_finfo_destroy(c, fi);
	de_free(c, adata);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
pushq $0x40
popq %rsi
callq 0xdecaf
movq %rax, %r14
movq 0x18(%rbx), %rax
xorl %esi, %esi
cmpq $0x25800, 0x18(%rax)    # imm = 0x25800
setne %sil
movl $0xf0, %eax
movl $0x1e0, %edx            # imm = 0x1E0
cmoveq %rax, %rdx
shll $0x6, %esi
addq $0x140, %rsi            # imm = 0x140
movq $0x10, (%r14)
movq %rsi, 0x10(%r14)
movq %rdx, 0x18(%r14)
movq %rbx, %rdi
callq 0xdf038
movq 0x18(%rbx), %rax
movq %rax, 0x20(%r14)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
pushq $0x3
popq %rcx
movq %rbx, %rdi
callq 0xe7437
movq %rax, 0x38(%r14)
movq %rbx, %rdi
callq 0xdfd1a
movq %rax, %r15
cmpq $0x180, 0x10(%r14)      # imm = 0x180
jne 0x22f28
cmpq $0x1e0, 0x18(%r14)      # imm = 0x1E0
jne 0x22f28
movl $0x1, 0x78(%r15)
movaps 0xe3350(%rip), %xmm0    # 0x106270
movups %xmm0, 0x80(%r15)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xed22a
movq 0x38(%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xe70ab
movq 0x38(%r14), %rdi
callq 0xe7084
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdfd24
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xded32
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_module_coke
void de_module_coke(deark *c, struct deark_module_info *mi)
{
	mi->id = "coke";
	mi->desc = "Atari Falcon COKE image (.TG1)";
	mi->run_fn = de_run_coke;
	mi->identify_fn = de_identify_coke;
}

// Assembly:
leaq 0xe35ed(%rip), %rax     # 0x10658e
movq %rax, (%rsi)
leaq 0xe35e8(%rip), %rax     # 0x106593
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x22fc6
movq %rax, 0x18(%rsi)
leaq 0x105(%rip), %rax       # 0x230c6
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_run_coke
static void de_run_coke(deark *c, de_module_params *mparams)
{
	i64 imgdatapos;
	struct atari_img_decode_data *adata = NULL;
	de_finfo *fi = NULL;

	adata = de_malloc(c, sizeof(struct atari_img_decode_data));
	adata->bpp = 16;
	adata->w = de_getu16be(12);
	adata->h = de_getu16be(14);
	de_dbg_dimensions(c, adata->w, adata->h);
	imgdatapos = de_getu16be(16);
	de_dbg(c, "image data pos: %d", (int)imgdatapos);

	adata->unc_pixels = dbuf_open_input_subfile(c->infile,
		imgdatapos, c->infile->len-imgdatapos);
	adata->img = de_bitmap_create(c, adata->w, adata->h, 3);

	fi = de_finfo_create(c);
	fi->density.code = DE_DENSITY_UNK_UNITS;
	fi->density.xdens = 288;
	fi->density.ydens = 240;

	fmtutil_atari_decode_image(c, adata);
	de_bitmap_write_to_file_finfo(adata->img, fi, 0);

	if(adata) {
		dbuf_close(adata->unc_pixels);
		de_bitmap_destroy(adata->img);
		de_free(c, adata);
	}
	de_finfo_destroy(c, fi);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
pushq $0x40
popq %rsi
callq 0xdecaf
movq %rax, %r14
movq $0x10, (%rax)
movq 0x18(%rbx), %rdi
pushq $0xc
popq %rsi
callq 0xe3f46
movq %rax, 0x10(%r14)
movq 0x18(%rbx), %rdi
pushq $0xe
popq %rsi
callq 0xe3f46
movq %rax, 0x18(%r14)
movq 0x10(%r14), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0xdf038
movq 0x18(%rbx), %rdi
pushq $0x10
popq %rsi
callq 0xe3f46
movq %rax, %r15
leaq 0xe3af0(%rip), %rsi     # 0x106b15
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq 0x18(%rdi), %rdx
subq %r15, %rdx
movq %r15, %rsi
callq 0xe6248
movq %rax, 0x20(%r14)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
pushq $0x3
popq %rcx
movq %rbx, %rdi
callq 0xe7437
movq %rax, 0x38(%r14)
movq %rbx, %rdi
callq 0xdfd1a
movq %rax, %r15
movl $0x1, 0x78(%rax)
movaps 0xe31e7(%rip), %xmm0    # 0x106260
movups %xmm0, 0x80(%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xed22a
movq 0x38(%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xe70ab
movq 0x20(%r14), %rdi
callq 0xe5591
movq 0x38(%r14), %rdi
callq 0xe7084
movq %rbx, %rdi
movq %r14, %rsi
callq 0xded32
movq %rbx, %rdi
movq %r15, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xdfd24
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: de_module_videomaster
void de_module_videomaster(deark *c, struct deark_module_info *mi)
{
	mi->id = "videomaster";
	mi->desc = "Video Master (.flm/.vid/.vsq)";
	mi->run_fn = de_run_videomaster;
	mi->identify_fn = de_identify_videomaster;
}

// Assembly:
leaq 0xe34c3(%rip), %rax     # 0x1065b2
movq %rax, (%rsi)
leaq 0xe34c5(%rip), %rax     # 0x1065be
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x23114
movq %rax, 0x18(%rsi)
leaq 0x20a(%rip), %rax       # 0x23319
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: fix_dark_pal
static void fix_dark_pal(deark *c, struct atari_img_decode_data *adata)
{
	u32 ap[2];

	if(adata->bpp!=1) return;

	ap[0] = adata->pal[0]&0xffffff;
	ap[1] = adata->pal[1]&0xffffff;

	// Always respect white/black and black/white palettes.
	if(ap[0]==0xffffff && ap[1]==0x000000) return; // The usual palette
	if(ap[0]==0x000000 && ap[1]==0xffffff) return;

	// Otherwise assume white/black, unless the user told us not to.
	if(de_get_ext_option(c, "atari:respectpal")) return;

	adata->pal[0] = DE_STOCKCOLOR_WHITE;
	adata->pal[1] = DE_STOCKCOLOR_BLACK;
}

// Assembly:
cmpq $0x1, (%rsi)
jne 0x23389
pushq %rbx
movq %rsi, %rbx
movq 0x30(%rsi), %rdx
movl $0xffffff, %eax         # imm = 0xFFFFFF
movl (%rdx), %ecx
andl %eax, %ecx
movl %ecx, %esi
xorl %eax, %esi
andl 0x4(%rdx), %eax
orl %eax, %esi
je 0x23388
xorl $0xffffff, %eax         # imm = 0xFFFFFF
orl %eax, %ecx
je 0x23388
leaq 0xe3356(%rip), %rsi     # 0x1066c3
callq 0xdfa87
testq %rax, %rax
jne 0x23388
movq 0x30(%rbx), %rax
movabsq $-0xffffff00000001, %rcx # imm = 0xFF000000FFFFFFFF
movq %rcx, (%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/atari-img.c
// Function: tiny_setword
static void tiny_setword(deark *c, tinyctx *d, struct atari_img_decode_data *adata, const u8 *wordbuf)
{
	i64 dstpos;

	// As each word is emitted from the decompressor, we store it in the unc_pixels buffer
	// in a particular location. The location is chosen so as to make the pixel data more
	// contiguous, but (for 2bpp and 4bpp images) more work will still have to be done when
	// the image is generated.

	if(d->stopflag) return;
	d->dcmpr_word_count++;
	dstpos = d->stripe * 8 + d->column*2 + (d->ypos * d->numscans + d->scan)*d->dst_rowspan;
	dbuf_write_at(adata->unc_pixels, dstpos, wordbuf, 2);
	d->ypos++;
	if(d->ypos >= 200) {
		d->ypos = 0;
		d->stripe++;
		if(d->stripe >= d->numstripes) {
			d->stripe = 0;
			d->scan++;
			if(d->scan >= d->numscans) {
				d->scan = 0;
				d->column++;
				if(d->column >= 4) {
					d->stopflag = 1;
					return;
				}
			}
		}
	}
}

// Assembly:
cmpl $0x0, 0x78(%rdi)
je 0x2339f
retq
pushq %rbx
movq %rdi, %rbx
incq 0xa0(%rdi)
movq 0x68(%rdi), %rax
movq 0x88(%rdi), %rcx
shlq $0x3, %rcx
movq 0x98(%rdi), %rdi
leaq (%rcx,%rdi,2), %rcx
imulq 0x80(%rbx), %rax
addq 0x90(%rbx), %rax
imulq 0x70(%rbx), %rax
addq %rcx, %rax
movq 0x20(%rsi), %rdi
pushq $0x2
popq %rcx
movq %rax, %rsi
callq 0xe5bfe
movq 0x80(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x80(%rbx)
cmpq $0xc7, %rax
jl 0x23469
andq $0x0, 0x80(%rbx)
movq 0x88(%rbx), %rax
incq %rax
movq %rax, 0x88(%rbx)
cmpq 0x60(%rbx), %rax
jl 0x23469
andq $0x0, 0x88(%rbx)
movq 0x90(%rbx), %rax
incq %rax
movq %rax, 0x90(%rbx)
cmpq 0x68(%rbx), %rax
jl 0x23469
andq $0x0, 0x90(%rbx)
movq 0x98(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x98(%rbx)
cmpq $0x3, %rax
jl 0x23469
movl $0x1, 0x78(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/autocad.c
// Function: de_module_autocad_slb
void de_module_autocad_slb(deark *c, struct deark_module_info *mi)
{
	mi->id = "autocad_slb";
	mi->desc = "AutoCAD Slide Library";
	mi->run_fn = de_run_autocad_slb;
	mi->identify_fn = de_identify_autocad_slb;
}

// Assembly:
leaq 0xe34d6(%rip), %rax     # 0x106b75
movq %rax, (%rsi)
leaq 0xe34d8(%rip), %rax     # 0x106b81
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x236c4
movq %rax, 0x18(%rsi)
leaq 0x238(%rip), %rax       # 0x238f7
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/awbm.c
// Function: de_module_awbm
void de_module_awbm(deark *c, struct deark_module_info *mi)
{
	mi->id = "awbm";
	mi->desc = "Award BIOS logo";
	mi->run_fn = de_run_awbm;
	mi->identify_fn = de_identify_awbm;
	mi->help_fn = de_help_awbm;
}

// Assembly:
leaq 0xe333d(%rip), %rax     # 0x106c60
movq %rax, (%rsi)
leaq 0xe3338(%rip), %rax     # 0x106c65
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x23953
movq %rax, 0x18(%rsi)
leaq 0x2be(%rip), %rax       # 0x23c01
movq %rax, 0x20(%rsi)
leaq 0x33b(%rip), %rax       # 0x23c89
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/awbm.c
// Function: de_identify_awbm
static int de_identify_awbm(deark *c)
{
	u8 buf[4];
	i64 nblocks;
	int epa_ext;

	de_read(buf, 0, 4);
	if(!de_memcmp(buf, "AWBM", 4)) return 100;

	nblocks = (i64)buf[0] * (i64)buf[1];
	if(nblocks<1 || nblocks>256) return 0;
	if(c->infile->len == 2 + nblocks*15 + 70) {
		epa_ext = de_input_file_has_ext(c, "epa");
		if(epa_ext) return 100;
		return 20;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
leaq 0xc(%rsp), %r15
pushq $0x4
popq %rcx
movq %r15, %rsi
xorl %edx, %edx
callq 0xe3cb7
cmpl $0x4d425741, (%r15)     # imm = 0x4D425741
je 0x23c7a
movzbl 0xc(%rsp), %ecx
movzbl 0xd(%rsp), %eax
imulq %rcx, %rax
leaq -0x101(%rax), %rcx
cmpq $-0x100, %rcx
jb 0x23c7d
movq 0x18(%r14), %rcx
imulq $0xf, %rax, %rax
addq $0x48, %rax
cmpq %rax, 0x18(%rcx)
jne 0x23c7d
leaq 0xe3082(%rip), %rsi     # 0x106ce7
movq %r14, %rdi
callq 0xdfcd5
testl %eax, %eax
pushq $0x14
popq %rax
pushq $0x64
popq %rbx
cmovel %eax, %ebx
jmp 0x23c7d
pushq $0x64
popq %rbx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/basic-c64.c
// Function: de_module_basic_c64
void de_module_basic_c64(deark *c, struct deark_module_info *mi)
{
	mi->id = "basic_c64";
	mi->desc = "Detokenize C64 BASIC";
	mi->run_fn = de_run_basic_c64;
	mi->identify_fn = de_identify_basic_c64;
}

// Assembly:
leaq 0xe2de8(%rip), %rax     # 0x106d3f
movq %rax, (%rsi)
leaq 0xe2de8(%rip), %rax     # 0x106d49
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x23f7c
movq %rax, 0x18(%rsi)
leaq 0x19f(%rip), %rax       # 0x24116
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/basic-c64.c
// Function: de_run_basic_c64
static void de_run_basic_c64(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 file_pos;
	i64 mem_start;
	i64 mem_pos;
	i64 next_line_ptr;
	i64 line_size;

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

	d->outf = dbuf_create_output_file(c, "c64.bas", NULL, 0);

	// TODO: What if the first two bytes are not 0x01 0x08?
	mem_start = 0x0801;

	file_pos = 2;

	while(file_pos < c->infile->len) {
		mem_pos = file_pos - 2 + mem_start;

		next_line_ptr = de_getu16le(file_pos);
		if(next_line_ptr==0x0000) {
			break;
		}

		line_size = next_line_ptr - mem_pos - 2;
		if(line_size<1) {
			break;
		}
		process_line(c, d, file_pos+2, mem_pos+2, line_size);
		file_pos += 2 + line_size;
	}

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
pushq $0x8
popq %rsi
callq 0xdecaf
movq %rax, %r14
leaq 0xe2dbf(%rip), %rsi     # 0x106d5e
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, (%r14)
pushq $0x2
popq %r12
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %r12
jge 0x240f5
movq %r12, %rsi
callq 0xe3fa3
testq %rax, %rax
je 0x240f5
movq %rax, %rbp
movq %rax, %r15
subq %r12, %r15
addq $-0x7ff, %r15           # imm = 0xF801
cmpq $0x3, %r15
jl 0x240f5
leaq 0x2(%r12), %rsi
movq %rsi, 0x10(%rsp)
movq 0x18(%rbx), %rdi
callq 0xe3fa3
movq %rax, 0x8(%rsp)
leal 0x801(%r12), %r8d
addl $-0x2, %r15d
xorl %r13d, %r13d
movq %rbx, %rdi
leaq 0xe2d4a(%rip), %rsi     # 0x106d66
movl %eax, %edx
movq 0x10(%rsp), %rcx
movl %r15d, %r9d
xorl %eax, %eax
callq 0xde896
movq %r12, %r15
addq $0x4, %r15
movq (%r14), %rdi
leaq 0xe2d4b(%rip), %rsi     # 0x106d89
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0xe5905
movq %rbp, %r12
addq $-0x7ff, %r12           # imm = 0xF801
cmpq %r12, %r15
jge 0x240e1
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe3eb4
movl %eax, %ebp
movzbl %al, %esi
testl %r13d, %r13d
je 0x24087
cmpb $0x22, %bpl
je 0x24087
movq (%r14), %rdi
callq 0xe5bc5
pushq $0x1
popq %r13
jmp 0x240d9
testb %bpl, %bpl
js 0x240a9
je 0x240e1
movq (%r14), %rdi
callq 0xe5bc5
cmpb $0x22, %bpl
jne 0x240d9
xorl %eax, %eax
testl %r13d, %r13d
sete %al
movl %eax, %r13d
jmp 0x240d9
cmpb $-0x35, %bpl
ja 0x240ca
andb $0x7f, %bpl
movzbl %bpl, %eax
leaq 0xe2dda(%rip), %rcx     # 0x106e98
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movq (%r14), %rdi
jmp 0x240d4
movq (%r14), %rdi
leaq 0xe2cb9(%rip), %rsi     # 0x106d8d
callq 0xe5fe4
incq %r15
jmp 0x24054
movq (%r14), %rdi
leaq 0xdf09c(%rip), %rsi     # 0x103187
callq 0xe5fe4
jmp 0x23fb2
movq (%r14), %rdi
callq 0xe5591
movq %rbx, %rdi
movq %r14, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xded32
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/basic-c64.c
// Function: de_identify_basic_c64
static int de_identify_basic_c64(deark *c)
{
	u8 buf[8];

	if(de_input_file_has_ext(c, "prg")) {
		de_read(buf, 0, 2);
		if(!de_memcmp(buf, "\x01\x08", 2)) return 20;
	}
	return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x10a6d5(%rip), %rsi    # 0x12e7fa
callq 0xdfcd5
testl %eax, %eax
je 0x2414b
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rbx
pushq $0x2
popq %rcx
movq %rbx, %rsi
xorl %edx, %edx
callq 0xe3cb7
cmpw $0x801, (%rbx)          # imm = 0x801
je 0x2414f
xorl %eax, %eax
jmp 0x24152
pushq $0x14
popq %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arcfs.c
// Function: de_module_arcfs
void de_module_arcfs(deark *c, struct deark_module_info *mi)
{
	mi->id = "arcfs";
	mi->desc = "ArcFS (RISC OS archive)";
	mi->run_fn = de_run_arcfs;
	mi->identify_fn = de_identify_arcfs;
}

// Assembly:
leaq 0xe2e92(%rip), %rax     # 0x106ff1
movq %rax, (%rsi)
leaq 0xe2e8e(%rip), %rax     # 0x106ff7
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x24184
movq %rax, 0x18(%rsi)
leaq 0x9b3(%rip), %rax       # 0x24b32
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arcfs.c
// Function: de_module_squash
void de_module_squash(deark *c, struct deark_module_info *mi)
{
	mi->id = "squash";
	mi->desc = "Squash (RISC OS compressed file)";
	mi->run_fn = de_run_squash;
	mi->identify_fn = de_identify_squash;
}

// Assembly:
leaq 0xe24b4(%rip), %rax     # 0x10700f
movq %rax, (%rsi)
leaq 0xe24b1(%rip), %rax     # 0x107016
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x24b80
movq %rax, 0x18(%rsi)
leaq 0x272(%rip), %rax       # 0x24ded
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arcfs.c
// Function: de_run_squash
static void de_run_squash(deark *c, de_module_params *mparams)
{
	sqctx *d = NULL;

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

	do_squash_header(c, d, 0);
	do_squash_main(c, d);

	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
pushq $0x38
popq %rsi
callq 0xdecaf
movq %rax, %r14
leaq 0x107848(%rip), %rsi    # 0x12c3ee
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0xdeba7
leaq 0x68(%rsp), %r15
movq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe40bf
movq %rax, (%r14)
leaq 0xe2529(%rip), %rsi     # 0x10710a
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rsi
leaq 0x8(%r14), %r13
movq (%r15), %rcx
movq %rbx, %rdi
movq %r13, %rdx
callq 0xed922
addq $0x8, (%r15)
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0xdebae
leaq 0x30(%rsp), %r15
leaq 0x18(%rsp), %rdx
leaq 0x68(%rsp), %rcx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xee7ee
movq 0x18(%rbx), %rax
movq %rax, (%r15)
movq $0x14, 0x8(%r15)
movq 0x18(%rax), %rax
addq $-0x14, %rax
movq %rax, 0x10(%r15)
leaq 0x1002e4(%rip), %rsi    # 0x124f40
pushq $0x14
popq %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movl %ebp, %esi
callq 0xdeba7
movq %rbx, %rdi
callq 0xdfd1a
movq %rax, %r15
movq %rbx, %rdi
callq 0xeac74
movq %rax, %r12
movb $0x1, 0x10(%r15)
movl 0x14(%r14), %eax
movl %eax, 0xa0(%r15)
movq 0xc(%r14), %rax
movq %rax, 0xa4(%r15)
leaq 0x103832(%rip), %rsi    # 0x1284dd
pushq $0x5
popq %rdx
movq %r12, %rdi
callq 0xeae42
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movl %ebp, %r9d
callq 0xeda93
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0xdfd55
cmpb $0x0, 0x28(%r14)
je 0x24cf0
leaq 0x28(%r14), %rax
movups (%rax), %xmm0
movups %xmm0, 0x18(%r15)
movq %r14, 0x10(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %r13
movq %rax, %rdi
callq 0xe589c
leaq 0x54(%rsp), %r8
andq $0x0, 0x8(%r8)
leaq 0x18(%rsp), %rbp
andl $0x0, 0x10(%r8)
movq %r13, (%rbp)
movb $0x0, 0x8(%rbp)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, (%r8)
leaq 0x30(%rsp), %rsi
leaq 0x68(%rsp), %r14
movq %rbx, %rdi
movq %rbp, %rdx
movq %r14, %rcx
callq 0xf644c
movq (%rbp), %rdi
callq 0xe58e8
cmpl $0x0, (%r14)
je 0x24d87
leaq 0x68(%rsp), %rsi
movq %rbx, %rdi
callq 0xee7bc
leaq 0xe2f8c(%rip), %rsi     # 0x107cff
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xdf2a5
movq 0x10(%rsp), %r14
jmp 0x24da9
movq 0x18(%r13), %rcx
movq 0x10(%rsp), %r14
movq (%r14), %rdx
cmpq %rdx, %rcx
je 0x24da9
leaq 0xe24b1(%rip), %rsi     # 0x107250
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
movq %r13, %rdi
callq 0xe5591
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdfd24
movq %r12, %rdi
callq 0xeaf3c
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
movq %rbx, %rdi
movq %r14, %rsi
callq 0xded32
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/apm.c
// Function: de_module_apm
void de_module_apm(deark *c, struct deark_module_info *mi)
{
	mi->id = "apm";
	mi->desc = "Apple Partition Map";
	mi->run_fn = de_run_apm;
	mi->identify_fn = de_identify_apm;
}

// Assembly:
leaq 0xe246f(%rip), %rax     # 0x107286
movq %rax, (%rsi)
leaq 0xe2469(%rip), %rax     # 0x10728a
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x24e3c
movq %rax, 0x18(%rsi)
leaq 0x64(%rip), %rax        # 0x24e9b
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/apm.c
// Function: de_run_apm
static void de_run_apm(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 i;
	int ret;

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

	d->secsize = 512;

	// Read the first map entry (should set d->npartitions)
	ret = do_entry_at_sector(c, d, 1);
	if(!ret) goto done;

	// Read the rest of the entries
	for(i=1; i<d->npartitions; i++) {
		ret = do_entry_at_sector(c, d, 1+i);
		if(!ret) goto done;
	}

done:
	de_free(c, d);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
pushq $0x10
popq %rsi
callq 0xdecaf
movq %rax, %r14
movq $0x200, (%rax)          # imm = 0x200
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x24eee
testl %eax, %eax
je 0x24e8b
pushq $0x2
popq %r15
leaq -0x1(%r15), %rax
cmpq 0x8(%r14), %rax
jge 0x24e8b
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x24eee
incq %r15
testl %eax, %eax
jne 0x24e6c
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xded32
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/afcp.c
// Function: de_module_afcp
void de_module_afcp(deark *c, struct deark_module_info *mi)
{
	mi->id = "afcp";
	mi->desc = "AXS File Concatenation Protocol";
	mi->run_fn = de_run_afcp;
	mi->flags |= DE_MODFLAG_HIDDEN;
}

// Assembly:
leaq 0xe214e(%rip), %rax     # 0x1073f5
movq %rax, (%rsi)
leaq 0xe2149(%rip), %rax     # 0x1073fa
movq %rax, 0x8(%rsi)
leaq 0x9(%rip), %rax         # 0x252c5
movq %rax, 0x18(%rsi)
orb $0x1, 0x30(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: de_module_arc
void de_module_arc(deark *c, struct deark_module_info *mi)
{
	mi->id = "arc";
	mi->desc = "ARC compressed archive";
	mi->run_fn = de_run_arc;
	mi->identify_fn = de_identify_arc;
	mi->help_fn = de_help_arc;
}

// Assembly:
leaq 0xecc87(%rip), %rax     # 0x112492
movq %rax, (%rsi)
leaq 0xe1d7c(%rip), %rax     # 0x107591
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x2583b
movq %rax, 0x18(%rsi)
leaq 0x11a(%rip), %rax       # 0x25945
movq %rax, 0x20(%rsi)
leaq 0x3f0(%rip), %rax       # 0x25c26
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: de_run_arc
static void de_run_arc(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	const char *s;

	d = de_malloc(c, sizeof(lctx));
	d->fmt = FMT_ARC;
	d->fmtname = "ARC";
	// TODO: Make 'recurse' configurable. Would require us to make the embedded
	// archives end with the correct marker.
	d->recurse_subdirs = 1;
	d->input_encoding_for_filenames = de_get_input_encoding(c, NULL, DE_ENCODING_CP437);
	d->input_encoding_for_comments = DE_EXTENC_MAKE(d->input_encoding_for_filenames,
		DE_ENCSUBTYPE_HYBRID);

	// TODO: It would probably be worth it to have a separate module for PAK, so we
	// can take the .PAK file extension into account when guessing what method #10
	// is. It's complicated, though, and not very useful until we support Crushed
	// decompression.

	s = de_get_ext_option(c, "arc:method10");
	if(s) {
		if(!de_strcmp(s, "trimmed")) {
			d->method10 = 1;
		}
		else if(!de_strcmp(s, "crushed")) {
			d->method10 = 2;
		}
	}

	if(de_havemodcode(c, mparams, '6')) {
		do_convert_pak16sfx(c, d);
		goto done;
	}

	do_run_arc_spark_internal(c, d);

done:
	destroy_lctx(c, d);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x68
popq %rsi
callq 0xdecaf
movq %rax, %r14
pushq $0x1
popq %rax
movl %eax, (%r14)
leaq 0xf1d05(%rip), %rcx     # 0x117566
movq %rcx, 0x8(%r14)
movl %eax, 0x20(%r14)
pushq $0xd
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, 0x10(%r14)
movzbl %al, %eax
orl $0x300, %eax            # imm = 0x300
movl %eax, 0x14(%r14)
leaq 0xe1d50(%rip), %rsi     # 0x1075dd
movq %rbx, %rdi
callq 0xdfa87
testq %rax, %rax
je 0x258cd
movq %rax, %r12
leaq 0xe1d46(%rip), %rsi     # 0x1075ea
movq %rax, %rdi
callq 0x181a0
testl %eax, %eax
je 0x258c7
leaq 0xe210e(%rip), %rsi     # 0x1079c5
movq %r12, %rdi
callq 0x181a0
testl %eax, %eax
jne 0x258cd
movb $0x2, %al
jmp 0x258c9
movb $0x1, %al
movb %al, 0x1c(%r14)
pushq $0x36
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdfcf4
testl %eax, %eax
je 0x25924
movl $0x4, (%r14)
andl $0x0, 0x20(%r14)
movb $0x1a, 0x24(%r14)
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rcx
leaq 0xfe2(%rip), %r9        # 0x268e1
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %r8d, %r8d
callq 0x266d1
movq 0x60(%r14), %rdi
testq %rdi, %rdi
je 0x2592f
movl $0xfe00, %esi           # imm = 0xFE00
callq 0xe5f1e
jmp 0x2592f
movq %rbx, %rdi
movq %r14, %rsi
callq 0x25e9d
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x26644
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: de_module_spark
void de_module_spark(deark *c, struct deark_module_info *mi)
{
	mi->id = "spark";
	mi->desc = "Spark archive";
	mi->run_fn = de_run_spark;
	mi->identify_fn = de_identify_spark;
	mi->help_fn = de_help_spark;
}

// Assembly:
leaq 0xe196d(%rip), %rax     # 0x1075a8
movq %rax, (%rsi)
leaq 0xe1969(%rip), %rax     # 0x1075ae
movq %rax, 0x8(%rsi)
leaq 0x1b(%rip), %rax        # 0x25c6b
movq %rax, 0x18(%rsi)
leaq 0x83(%rip), %rax        # 0x25cde
movq %rax, 0x20(%rsi)
leaq 0x129(%rip), %rax       # 0x25d8f
movq %rax, 0x28(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: de_run_spark
static void de_run_spark(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));
	d->fmt = FMT_SPARK;
	d->fmtname = "Spark";
	d->input_encoding_for_filenames = de_get_input_encoding(c, NULL, DE_ENCODING_RISCOS);
	d->input_encoding_for_comments = DE_EXTENC_MAKE(d->input_encoding_for_filenames,
		DE_ENCSUBTYPE_HYBRID);
	d->recurse_subdirs = de_get_ext_option_bool(c, "spark:recurse", 1);

	do_run_arc_spark_internal(c, d);
	destroy_lctx(c, d);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x68
popq %rsi
callq 0xdecaf
movq %rax, %r14
movl $0x2, (%rax)
leaq 0xe1fa2(%rip), %rax     # 0x107c2c
movq %rax, 0x8(%r14)
pushq $0x14
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, 0x10(%r14)
movzbl %al, %eax
orl $0x300, %eax            # imm = 0x300
movl %eax, 0x14(%r14)
leaq 0xe1f80(%rip), %rsi     # 0x107c32
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0xdfae5
movl %eax, 0x20(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x25e9d
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x26644
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: de_identify_spark
static int de_identify_spark(deark *c)
{
	u8 b;
	u32 load_addr;
	int ldaddrcheck = 0;
	int has_trailer = 0;

	if(de_getbyte(0) != 0x1a) return 0;
	b = de_getbyte(1); // compression method
	if(b==0x82 || b==0x83 || b==0x88 || b==0x89 || b==0xff) {
		;
	}
	else if(b==0x81 || b==0x84 || b==0x85 || b==0x86) {
		; // TODO: Verify that these are possible in Spark.
	}
	else {
		return 0;
	}

	load_addr = (u32)de_getu32le(29);
	if((load_addr & 0xfff00000) == 0xfff00000) {
		ldaddrcheck = 1;
	}

	if(de_getu16be(c->infile->len-2) == 0x1a80) {
		has_trailer = 1;
	}

	if(has_trailer && ldaddrcheck) return 85;
	if(ldaddrcheck) return 30;
	if(has_trailer) return 10;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
xorl %r14d, %r14d
xorl %esi, %esi
callq 0xe3eb4
cmpb $0x1a, %al
jne 0x25d7d
movq 0x18(%rbx), %rdi
pushq $0x1
popq %rsi
callq 0xe3eb4
movzbl %al, %eax
leal -0x81(%rax), %ecx
cmpl $0x8, %ecx
ja 0x25d86
cmpl $0x6, %ecx
je 0x25d86
movq 0x18(%rbx), %rdi
pushq $0x1d
popq %rsi
callq 0xe409f
movq %rax, %r14
andl $0xfff00000, %r14d      # imm = 0xFFF00000
movl $0xfff00000, %r15d      # imm = 0xFFF00000
xorq %r14, %r15
movq 0x18(%rbx), %rdi
movq 0x18(%rdi), %rsi
addq $-0x2, %rsi
callq 0xe3f46
movq %rax, %rcx
xorq $0x1a80, %rcx           # imm = 0x1A80
orq %r15, %rcx
jne 0x25d60
pushq $0x55
popq %r14
jmp 0x25d7d
xorl %ecx, %ecx
cmpq $0x1a80, %rax           # imm = 0x1A80
pushq $0xa
popq %rax
cmovnel %ecx, %eax
cmpl $0xfff00000, %r14d      # imm = 0xFFF00000
pushq $0x1e
popq %r14
cmovnel %eax, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
cmpl $0xff, %eax
je 0x25d1b
jmp 0x25d7d
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: de_module_arcmac
void de_module_arcmac(deark *c, struct deark_module_info *mi)
{
	mi->id = "arcmac";
	mi->desc = "ArcMac compressed archive";
	mi->run_fn = de_run_arcmac;
	mi->identify_fn = de_identify_arcmac;
}

// Assembly:
leaq 0xe1818(%rip), %rax     # 0x1075bc
movq %rax, (%rsi)
leaq 0xe1815(%rip), %rax     # 0x1075c3
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0x25dc9
movq %rax, 0x18(%rsi)
leaq 0x6c(%rip), %rax        # 0x25e30
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: de_run_arcmac
static void de_run_arcmac(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

	d = de_malloc(c, sizeof(lctx));
	d->fmt = FMT_ARCMAC;
	d->fmtname = "ArcMac";
	d->recurse_subdirs = 1;
	d->input_encoding_for_arcmac_fn = de_get_input_encoding(c, NULL, DE_ENCODING_MACROMAN);
	d->input_encoding_for_filenames = DE_ENCODING_CP437;
	d->input_encoding_for_comments = DE_EXTENC_MAKE(d->input_encoding_for_filenames,
		DE_ENCSUBTYPE_HYBRID);

	do_run_arc_spark_internal(c, d);
	destroy_lctx(c, d);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x68
popq %rsi
callq 0xdecaf
movq %rax, %r14
movl $0x3, (%rax)
leaq 0xe1e8e(%rip), %rax     # 0x107c76
movq %rax, 0x8(%r14)
movl $0x1, 0x20(%r14)
pushq $0x11
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, 0x18(%r14)
movabsq $0x30d0000000d, %rax    # imm = 0x30D0000000D
movq %rax, 0x10(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x25e9d
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x26644
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: de_identify_arcmac
static int de_identify_arcmac(deark *c)
{
	u8 buf1[2];
	u8 buf2[2];

	de_read(buf1, 0, 2);
	if(buf1[0]!=0x1b) return 0;
	if(!(buf1[1]>=1 && buf1[1]<=9)) return 0;
	de_read(buf2, 59, 2);
	if(buf2[0]!=0x1a) return 0;
	if(buf2[1]!=buf1[1]) return 0;
	return 80;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movq 0x18(%rdi), %rdi
xorl %ebx, %ebx
leaq 0xc(%rsp), %r15
pushq $0x2
popq %rcx
movq %r15, %rsi
xorl %edx, %edx
callq 0xe3cb7
cmpb $0x1b, (%r15)
jne 0x25e91
movb 0xd(%rsp), %al
decb %al
cmpb $0x8, %al
ja 0x25e91
movq 0x18(%r14), %rdi
leaq 0xe(%rsp), %r14
pushq $0x3b
popq %rdx
pushq $0x2
popq %rcx
movq %r14, %rsi
callq 0xe3cb7
cmpb $0x1a, (%r14)
jne 0x25e91
movb 0xf(%rsp), %al
xorl %ecx, %ecx
cmpb 0xd(%rsp), %al
pushq $0x50
popq %rbx
cmovnel %ecx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: destroy_lctx
static void destroy_lctx(deark *c, lctx *d)
{
	if(!d) return;
	de_crcobj_destroy(d->crco);
	de_strarray_destroy(d->curpath);
	if(d->pak16sfx_outf) {
		dbuf_close(d->pak16sfx_outf);
	}
	if(d->persistent_md) {
		i64 i;

		for(i=0; i<d->num_top_level_members; i++) {
			ucstring_destroy(d->persistent_md[i].comment);
			ucstring_destroy(d->persistent_md[i].path);
		}
		de_free(c, d->persistent_md);
	}
	de_free(c, d);
}

// Assembly:
testq %rsi, %rsi
je 0x266d0
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x48(%rsi), %rdi
callq 0xe0e8d
movq 0x50(%rbx), %rdi
callq 0xeb97e
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x2667b
callq 0xe5591
cmpq $0x0, 0x58(%rbx)
je 0x266ba
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x58(%rbx), %rsi
cmpq 0x38(%rbx), %r12
jge 0x266b2
movq (%rsi,%r15), %rdi
callq 0xeaf3c
movq 0x58(%rbx), %rax
movq 0x8(%rax,%r15), %rdi
callq 0xeaf3c
incq %r12
addq $0x10, %r15
jmp 0x26688
movq %r14, %rdi
callq 0xded32
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xded32
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: member_cb_for_pak16sfx
static void member_cb_for_pak16sfx(deark *c, lctx *d, struct member_parser_data *mpd)
{
	de_dbg2(c, "pak16sfx member at %"I64_FMT", type=0x%02x", mpd->member_pos,
		(UI)mpd->magic);
	de_dbg_indent(c, 1);

	// This is not perfect. We throw away the extended info, instead of converting
	// it to extended records.
	if(mpd->magic==0x1a) {
		if(!d->pak16sfx_outf) {
			d->pak16sfx_outf = dbuf_create_output_file(c, "pak", NULL, 0);
		}
		dbuf_copy(c->infile, mpd->member_pos, mpd->member_len, d->pak16sfx_outf);
	}
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x10(%rdx), %rdx
movzbl 0x8(%r14), %ecx
leaq 0xe0cf3(%rip), %rsi     # 0x1075f2
xorl %eax, %eax
callq 0xde9f1
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
cmpb $0x1a, 0x8(%r14)
jne 0x2694c
movq 0x60(%r15), %rcx
testq %rcx, %rcx
jne 0x2693b
leaq 0xe0cee(%rip), %rsi     # 0x107616
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %rcx
movq %rax, 0x60(%r15)
movq 0x18(%rbx), %rdi
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
callq 0xe45f4
pushq $-0x1
popq %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0xdeba7
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: find_arc_marker
static int find_arc_marker(deark *c, const u8 *buf, size_t buflen, i64 *ppos)
{
	size_t i;

	for(i=0; i<buflen; i++) {
		if(buf[i]==0x1a) {
			*ppos = (i64)i;
			return 1;
		}
	}
	return 0;
}

// Assembly:
xorl %eax, %eax
xorl %ecx, %ecx
cmpq %rcx, %rsi
je 0x26976
cmpb $0x1a, (%rdi,%rcx)
je 0x26970
incq %rcx
jmp 0x26960
movq %rcx, (%rdx)
pushq $0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: do_sequence_of_members
static void do_sequence_of_members(deark *c, lctx *d, i64 pos1, i64 len, int nesting_level)
{
	if(nesting_level >= MAX_NESTING_LEVEL) {
		de_err(c, "Max subdir nesting level exceeded");
		return;
	}

	de_dbg(c, "archive at %"I64_FMT, pos1);
	de_dbg_indent(c, 1);
	parse_member_sequence(c, d, pos1, len, nesting_level, member_cb_main);
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpl $0x18, %r8d
jl 0x269a1
leaq 0xe0e30(%rip), %rsi     # 0x1077bf
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xdf2a5
movl %r8d, %ebp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
leaq 0xe0e2d(%rip), %rsi     # 0x1077e1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
leaq 0x135(%rip), %r9        # 0x26b05
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
movl %ebp, %r8d
callq 0x266d1
pushq $-0x1
popq %rsi
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xdeba7
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: member_cb_for_prescan
static void member_cb_for_prescan(deark *c, lctx *d, struct member_parser_data *mpd)
{
	if(mpd->magic!=d->sig_byte) return;
	if(mpd->cmpr_meth_masked==0x00) { // end of archive
		d->prescan_found_eoa = 1;
		d->prescan_pos_after_eoa = mpd->member_pos + mpd->member_len;
		de_dbg2(c, "end of member sequence at %"I64_FMT, d->prescan_pos_after_eoa);
		return;
	}
	if(mpd->cmpr_meth==20 || mpd->cmpr_meth==21 || mpd->cmpr_meth==30) {
		// Features we're pretty sure aren't used by PAK.
		d->has_arc_extensions = 1;
	}
	d->num_top_level_members++;
	de_dbg2(c, "member at %"I64_FMT, mpd->member_pos);
}

// Assembly:
movb 0x8(%rdx), %al
cmpb 0x24(%rsi), %al
jne 0x26a2d
cmpb $0x0, 0xa(%rdx)
je 0x26a2e
movzbl 0x9(%rdx), %eax
cmpl $0x1e, %eax
ja 0x26a1c
movl $0x40300000, %ecx       # imm = 0x40300000
btl %eax, %ecx
jae 0x26a1c
movb $0x1, 0x28(%rsi)
incq 0x38(%rsi)
movq 0x10(%rdx), %rdx
leaq 0x107e42(%rip), %rsi    # 0x12e86d
jmp 0x26a48
retq
movb $0x1, 0x25(%rsi)
movq 0x18(%rdx), %rax
addq 0x10(%rdx), %rax
movq %rax, 0x30(%rsi)
leaq 0xe0c7e(%rip), %rsi     # 0x1076c3
movq %rax, %rdx
xorl %eax, %eax
jmp 0xde9f1
// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: is_pkcomment_sig_at
static int is_pkcomment_sig_at(deark *c, lctx *d, i64 pos)
{
	i64 comments_descr_pos;

	if(!d->prescan_found_eoa) return 0;
	if(pos < d->prescan_pos_after_eoa) return 0;
	if(pos > c->infile->len-8) return 0;
	if((UI)de_getu32be(pos) != 0x504baa55U) {
		return 0;
	}
	comments_descr_pos = de_getu32le(pos+4);
	if((comments_descr_pos < d->prescan_pos_after_eoa) ||
		(comments_descr_pos > pos-4))
	{
		return 0;
	}
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebp, %ebp
cmpb $0x0, 0x25(%rsi)
je 0x26ab0
movq %rdx, %rbx
movq %rsi, %r14
cmpq %rdx, 0x30(%rsi)
jg 0x26ab0
movq %rdi, %r15
movq 0x18(%rdi), %rdi
movq 0x18(%rdi), %rax
addq $-0x8, %rax
cmpq %rbx, %rax
jl 0x26ab0
movq %rbx, %rsi
callq 0xe404f
cmpl $0x504baa55, %eax       # imm = 0x504BAA55
jne 0x26ab0
movq 0x18(%r15), %rdi
leaq 0x4(%rbx), %rsi
callq 0xe409f
cmpq 0x30(%r14), %rax
setge %cl
addq $-0x4, %rbx
cmpq %rbx, %rax
setle %al
andb %cl, %al
movzbl %al, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq