LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/stuffit.c
// Function: do_main_decompress_fork
static void do_main_decompress_fork(deark *c, lctx *d, struct member_data *md,
	struct fork_data *frk, dbuf *outf)
{
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	if(!frk || !frk->cmi || !frk->cmi->decompressor) {
		goto done;
	}

	de_dbg(c, "decompressing %s fork", frk->forkname);
	de_dbg_indent(c, 1);

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = c->infile;
	dcmpri.pos = frk->cmpr_pos;
	dcmpri.len = frk->cmpr_len;
	dcmpro.f = outf;
	dcmpro.len_known = 1;
	dcmpro.expected_len = frk->unc_len;
	frk->cmi->decompressor(c, &dcmpri, &dcmpro, &dres);
	dbuf_flush(dcmpro.f);
	if(dres.errcode) {
		de_err(c, "Decompression failed for file %s[%s fork]: %s", ucstring_getpsz_d(md->full_fname),
			frk->forkname, de_dfilter_get_errmsg(c, &dres));
		goto done;
	}
	frk->decompress_succeeded = 1;

done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xc(%rsp), %rsi
callq 0xe958c
testq %r14, %r14
je 0xd856a
movq 0x30(%r14), %rax
testq %rax, %rax
je 0xd856a
cmpq $0x0, 0x10(%rax)
je 0xd856a
movq 0x28(%r14), %rdx
leaq 0x3c662(%rip), %rsi     # 0x114b07
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0x88(%rsp), %r13
leaq 0x70(%rsp), %rbp
leaq 0x10(%rsp), %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0xfa6e0
movq 0x18(%rbx), %rax
movq %rax, (%r13)
movq 0x18(%r14), %rax
movq %rax, 0x8(%r13)
movq 0x20(%r14), %rax
movq %rax, 0x10(%r13)
movq %r12, (%rbp)
movb $0x1, 0x8(%rbp)
movq 0x10(%r14), %rax
movq %rax, 0x10(%rbp)
movq 0x30(%r14), %rax
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
leaq 0x10(%rsp), %rcx
callq *0x10(%rax)
movq (%rbp), %rdi
callq 0xf0ea4
leaq 0x10(%rsp), %rax
cmpl $0x0, (%rax)
je 0xd8565
movq 0x18(%r15), %rdi
callq 0xf7557
movq %rax, %r15
movq 0x28(%r14), %r14
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xfa6a8
leaq 0x3c5ee(%rip), %rsi     # 0x114b3e
movq %rbx, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xe9df7
jmp 0xd856a
movb $0x1, 0x38(%r14)
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/sis.c
// Function: de_module_sis
void de_module_sis(deark *c, struct deark_module_info *mi)
{
	mi->id = "sis";
	mi->desc = "SIS (EPOC/Symbian installation archive)";
	mi->run_fn = de_run_sis;
	mi->identify_fn = de_identify_sis;
}

// Assembly:
leaq 0x4b0a1(%rip), %rax     # 0x124170
movq %rax, (%rsi)
leaq 0x691be(%rip), %rax     # 0x142297
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xd90f4
movq %rax, 0x18(%rsi)
leaq 0xfe0(%rip), %rax       # 0xda0cf
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/sis.c
// Function: de_identify_sis
static int de_identify_sis(deark *c)
{
	if(!dbuf_memcmp(c->infile, 8, "\x19\x04\x00\x10", 4)) {
		if(!dbuf_memcmp(c->infile, 4, "\x6d\x00\x00\x10", 4))
			return 100;
		if(!dbuf_memcmp(c->infile, 4, "\x12\x3a\x00\x10", 4))
			return 100;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
leaq 0x68728(%rip), %rdx     # 0x142808
movl $0x8, %esi
movl $0x4, %ecx
callq 0xf025e
testl %eax, %eax
je 0xda0fe
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq 0x18(%rbx), %rdi
leaq 0x68704(%rip), %rdx     # 0x14280d
movl $0x4, %esi
movl $0x4, %ecx
callq 0xf025e
movl $0x64, %ebp
testl %eax, %eax
je 0xda0f5
movq 0x18(%rbx), %rdi
leaq 0x686e6(%rip), %rdx     # 0x142812
movl $0x4, %esi
movl $0x4, %ecx
callq 0xf025e
testl %eax, %eax
jne 0xda0f3
jmp 0xda0f5
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/sis.c
// Function: read_sis_string
static void read_sis_string(deark *c, lctx *d, de_ucstring *s,
	i64 pos, i64 len)
{
	if(d->options & 0x0001) {
		dbuf_read_to_ucstring_n(c->infile, pos, len, 512*2, s, 0, DE_ENCODING_UTF16LE);
	}
	else {
		dbuf_read_to_ucstring_n(c->infile, pos, len, 512, s, 0, DE_ENCODING_WINDOWS1252);
	}
}

// Assembly:
pushq %rax
movq %r8, %rax
movq %rcx, %r9
movq %rdx, %r8
testb $0x1, 0x8(%rsi)
movq 0x18(%rdi), %rdi
jne 0xda163
movl $0x9, (%rsp)
movl $0x200, %ecx            # imm = 0x200
jmp 0xda16f
movl $0x3, (%rsp)
movl $0x400, %ecx            # imm = 0x400
movq %r9, %rsi
movq %rax, %rdx
xorl %r9d, %r9d
callq 0xf0203
popq %rax
retq
nop
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/sauce.c
// Function: de_module_sauce
void de_module_sauce(deark *c, struct deark_module_info *mi)
{
	mi->id = "sauce";
	mi->desc = "SAUCE metadata";
	mi->run_fn = de_run_sauce;
	mi->identify_fn = de_identify_sauce;
	mi->flags |= DE_MODFLAG_HIDDEN | DE_MODFLAG_SHAREDDETECTION;
}

// Assembly:
leaq 0x6870d(%rip), %rax     # 0x142894
movq %rax, (%rsi)
leaq 0x68709(%rip), %rax     # 0x14289a
movq %rax, 0x8(%rsi)
leaq 0x14(%rip), %rax        # 0xda1b0
movq %rax, 0x18(%rsi)
leaq 0x118(%rip), %rax       # 0xda2bf
movq %rax, 0x20(%rsi)
orb $0x11, 0x30(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/sauce.c
// Function: de_run_sauce
static void de_run_sauce(deark *c, de_module_params *mparams)
{
	if(c->module_disposition==DE_MODDISP_INTERNAL) {
		run_sauce_as_submodule(c, mparams);
	}
	else {
		run_sauce_direct(c, mparams);
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x3, 0x24(%rdi)
jne 0xda1df
testq %rsi, %rsi
je 0xda25f
movq 0x68(%rsi), %rdx
testq %rdx, %rdx
je 0xda25f
xorl %r14d, %r14d
jmp 0xda26d
movq 0x18(%rbx), %rsi
leaq 0xd(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rdx
movl $0x1, %ecx
callq 0xf840d
cmpb $0x0, (%r14)
je 0xda28c
movq %rbx, %rdi
callq 0xf84f4
movq %rax, %r14
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xda2e4
movl %eax, %ebp
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
testl %ebp, %ebp
je 0xda2ab
cmpl $0x1, 0x24(%rbx)
jne 0xda2ab
movzbl 0x38(%r14), %edx
movzbl 0x39(%r14), %ecx
leaq 0x68859(%rip), %rsi     # 0x142aac
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0xda2ab
movq %rbx, %rdi
callq 0xf84f4
movq %rax, %r14
movq %rax, %rdx
movq 0x18(%rbx), %rsi
movq %rbx, %rdi
callq 0xda2e4
movq %rbx, %rdi
movq %r14, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0xf84fe
cmpl $0x2, 0x24(%rbx)
jne 0xda2a8
leaq 0x687fd(%rip), %rsi     # 0x142a96
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0xda2ab
xorl %r14d, %r14d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf84fe
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: de_module_base16
void de_module_base16(deark *c, struct deark_module_info *mi)
{
	mi->id = "base16";
	mi->id_alias[0] = "hex";
	mi->desc = "Base16";
	mi->run_fn = de_run_base16;
}

// Assembly:
leaq 0x67e1d(%rip), %rax     # 0x142b24
movq %rax, (%rsi)
leaq 0x6a633(%rip), %rax     # 0x145344
movq %rax, 0x38(%rsi)
leaq 0x67e0f(%rip), %rax     # 0x142b2b
movq %rax, 0x8(%rsi)
leaq 0x5(%rip), %rax         # 0xdad2c
movq %rax, 0x18(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: de_run_base64
static void de_run_base64(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	dbuf *f = NULL;

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

	f = dbuf_create_output_file(c, "bin", NULL, 0);
	do_base64_internal(c, d, 0, f);

	dbuf_close(f);
	de_free(c, d);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x38, %esi
callq 0xe969b
movq %rax, %r14
leaq 0x5a687(%rip), %rsi     # 0x135431
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0xdb558
movq %r15, %rdi
callq 0xf0b13
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xe9752
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: de_module_uuencode
void de_module_uuencode(deark *c, struct deark_module_info *mi)
{
	mi->id = "uuencode";
	mi->desc = "UUEncode";
	mi->run_fn = de_run_uuencode;
	mi->identify_fn = de_identify_uuencode;
}

// Assembly:
leaq 0x67d58(%rip), %rax     # 0x142b40
movq %rax, (%rsi)
leaq 0x67d57(%rip), %rax     # 0x142b49
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xdae0d
movq %rax, 0x18(%rsi)
leaq 0x11a(%rip), %rax       # 0xdaf22
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: de_run_uuencode
static void de_run_uuencode(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	dbuf *f = NULL;
	struct uu_hdr_parser *uuhp = NULL;
	int ret;

	uuhp = de_malloc(c, sizeof(struct uu_hdr_parser));
	d = de_malloc(c, sizeof(lctx));

	d->fi = de_finfo_create(c);
	ret = uuencode_read_header(c, uuhp, d->fi, 0);
	if(!ret) goto done;

	if(uuhp->hdr_line_type==HDR_UUENCODE_BASE64) {
		de_declare_fmt(c, "Base64 with uuencode wrapper");
		d->data_fmt = FMT_BASE64;
		f = dbuf_create_output_file(c, NULL, d->fi, 0);
		do_base64_internal(c, d, uuhp->data_startpos, f);
	}
	else {
		de_declare_fmt(c, "Uuencoded");
		d->data_fmt = FMT_UUENCODE;
		f = dbuf_create_output_file(c, NULL, d->fi, 0);
		do_uudecode_internal(c, d, uuhp, f);
	}

done:
	dbuf_close(f);
	if(uuhp) {
		de_free(c, uuhp);
	}
	if(d) {
		de_finfo_destroy(c, d->fi);
		de_free(c, d);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x20, %esi
callq 0xe969b
movq %rax, %r15
movl $0x38, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r14
movq %rbx, %rdi
callq 0xea9a9
movq %rax, 0x30(%r14)
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq 0xdb763
testl %eax, %eax
je 0xdaed7
cmpl $0xc, (%r15)
jne 0xdae9c
leaq 0x67d57(%rip), %rsi     # 0x142bbc
movq %rbx, %rdi
callq 0xeb6d6
movl $0x1, 0xc(%r14)
movq 0x30(%r14), %rdx
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r12
movq 0x18(%r15), %rdx
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rcx
callq 0xdb558
jmp 0xdaed7
leaq 0x67d36(%rip), %rsi     # 0x142bd9
movq %rbx, %rdi
callq 0xeb6d6
movl $0x2, 0xc(%r14)
movq 0x30(%r14), %rdx
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r12
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rax, %rcx
callq 0xdb8da
movq %r12, %rdi
callq 0xf0b13
testq %r15, %r15
je 0xdaeef
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9752
testq %r14, %r14
je 0xdaf16
movq 0x30(%r14), %rsi
movq %rbx, %rdi
callq 0xea9b3
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe9752
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: de_identify_uuencode
static int de_identify_uuencode(deark *c)
{
	u8 b[17];
	i64 pos;
	int retval = 0;
	struct uu_hdr_parser *uuhp;

	pos = bom_length(c);
	de_read(b, pos, sizeof(b));

	if(!de_memcmp(b, "begin-base64 ", 13)) {
		return 100;
	}
	if(!de_memcmp(b, "begin ", 6)) {
		if(b[9]==' ' && de_is_digit_string(&b[6], 3)) {
			// This needs to be lower than XXEncode.
			return 85;
		}
	}

	if(!de_input_file_has_ext(c, "uue") &&
		!de_input_file_has_ext(c, "uu"))
	{
		return 0;
	}

	// For some extensions, do detection the slow way.
	uuhp = de_malloc(c, sizeof(struct uu_hdr_parser));
	uuencode_read_header(c, uuhp, NULL, 1);
	if(uuhp->hdr_line_type==HDR_UUENCODE_OR_XXENCODE) {
		retval = 19;
	}
	else if(uuhp->hdr_line_type==HDR_UUENCODE_BASE64) {
		retval = 19;
	}
	de_free(c, uuhp);

	return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
xorl %esi, %esi
callq 0xf1d1c
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
leaq (%rcx,%rcx,2), %rdx
movq 0x18(%rbx), %rdi
movq %rsp, %r14
movl $0x11, %ecx
movq %r14, %rsi
callq 0xeeee8
movabsq $0x61622d6e69676562, %rax # imm = 0x61622D6E69676562
xorq (%r14), %rax
movabsq $0x203436657361622d, %rcx # imm = 0x203436657361622D
xorq 0x5(%r14), %rcx
orq %rax, %rcx
je 0xdb02a
movl $0x69676562, %eax       # imm = 0x69676562
xorl (%rsp), %eax
movzwl 0x4(%rsp), %ecx
xorl $0x206e, %ecx           # imm = 0x206E
orl %eax, %ecx
jne 0xdafc0
cmpb $0x20, 0x9(%rsp)
jne 0xdafc0
xorl %eax, %eax
movb 0x6(%rsp,%rax), %cl
addb $-0x3a, %cl
cmpb $-0xa, %cl
jb 0xdafb6
leaq 0x1(%rax), %rdx
cmpq $0x2, %rax
movq %rdx, %rax
jne 0xdaf9d
movl $0x55, %ebp
cmpb $-0xb, %cl
ja 0xdb02f
leaq 0x67cb9(%rip), %rsi     # 0x142c80
movq %rbx, %rdi
callq 0xea936
testl %eax, %eax
jne 0xdafe6
leaq 0x67caa(%rip), %rsi     # 0x142c84
movq %rbx, %rdi
callq 0xea936
testl %eax, %eax
je 0xdb03c
movl $0x20, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r14
xorl %r15d, %r15d
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xdb763
movl (%r14), %eax
addl $-0xb, %eax
cmpl $0x2, %eax
movl $0x13, %ebp
cmovael %r15d, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
jmp 0xdb02f
movl $0x64, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0xdb02f
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: de_module_xxencode
void de_module_xxencode(deark *c, struct deark_module_info *mi)
{
	mi->id = "xxencode";
	mi->desc = "XXEncode";
	mi->run_fn = de_run_xxencode;
	mi->identify_fn = de_identify_xxencode;
}

// Assembly:
leaq 0x67b0b(%rip), %rax     # 0x142b52
movq %rax, (%rsi)
leaq 0x67b0a(%rip), %rax     # 0x142b5b
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xdb06c
movq %rax, 0x18(%rsi)
leaq 0xe1(%rip), %rax        # 0xdb148
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: de_run_xxencode
static void de_run_xxencode(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	dbuf *f = NULL;
	struct uu_hdr_parser *uuhp = NULL;
	int ret;

	uuhp = de_malloc(c, sizeof(struct uu_hdr_parser));
	d = de_malloc(c, sizeof(lctx));

	d->fi = de_finfo_create(c);
	ret = uuencode_read_header(c, uuhp, d->fi, 0);
	if(!ret) goto done;
	if(uuhp->hdr_line_type!=HDR_UUENCODE_OR_XXENCODE) goto done;

	de_declare_fmt(c, "XXEncoded");
	f = dbuf_create_output_file(c, NULL, d->fi, 0);
	d->data_fmt = FMT_XXENCODE;
	do_uudecode_internal(c, d, uuhp, f);

done:
	dbuf_close(f);
	if(uuhp) {
		de_free(c, uuhp);
	}
	if(d) {
		de_finfo_destroy(c, d->fi);
		de_free(c, d);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x20, %esi
callq 0xe969b
movq %rax, %r15
movl $0x38, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r14
movq %rbx, %rdi
callq 0xea9a9
movq %rax, 0x30(%r14)
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq 0xdb763
testl %eax, %eax
je 0xdb0fd
cmpl $0xb, (%r15)
jne 0xdb0fa
leaq 0x67bc3(%rip), %rsi     # 0x142c87
movq %rbx, %rdi
callq 0xeb6d6
movq 0x30(%r14), %rdx
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r12
movl $0x3, 0xc(%r14)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %rax, %rcx
callq 0xdb8da
jmp 0xdb0fd
xorl %r12d, %r12d
movq %r12, %rdi
callq 0xf0b13
testq %r15, %r15
je 0xdb115
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9752
testq %r14, %r14
je 0xdb13c
movq 0x30(%r14), %rsi
movq %rbx, %rdi
callq 0xea9b3
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xe9752
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: de_identify_xxencode
static int de_identify_xxencode(deark *c)
{
	int retval = 0;
	struct uu_hdr_parser *uuhp;

	// XXEncode is hard to distinguish from UUEncode, so we rely on the
	// filename.
	if(!de_input_file_has_ext(c, "xxe") &&
		!de_input_file_has_ext(c, "xx"))
	{
		return 0;
	}

	uuhp = de_malloc(c, sizeof(struct uu_hdr_parser));
	uuencode_read_header(c, uuhp, NULL, 1);
	if(uuhp->hdr_line_type==HDR_UUENCODE_OR_XXENCODE) {
		retval = (uuhp->hdr_line_startpos<=3) ? 90 : 20;
	}
	de_free(c, uuhp);

	return retval;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x67b3a(%rip), %rsi     # 0x142c91
callq 0xea936
testl %eax, %eax
jne 0xdb173
leaq 0x67b2e(%rip), %rsi     # 0x142c95
movq %rbx, %rdi
callq 0xea936
testl %eax, %eax
je 0xdb1c6
movl $0x20, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r15
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xdb763
cmpl $0xb, (%r15)
jne 0xdb1b2
cmpq $0x4, 0x8(%r15)
movl $0x5a, %eax
movl $0x14, %r14d
cmovll %eax, %r14d
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9752
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
xorl %r14d, %r14d
jmp 0xdb1bd
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: de_module_ascii85
void de_module_ascii85(deark *c, struct deark_module_info *mi)
{
	mi->id = "ascii85";
	mi->desc = "Ascii85";
	mi->run_fn = de_run_ascii85;
	mi->identify_fn = de_identify_ascii85;
}

// Assembly:
leaq 0x67992(%rip), %rax     # 0x142b64
movq %rax, (%rsi)
leaq 0x67990(%rip), %rax     # 0x142b6c
movq %rax, 0x8(%rsi)
leaq 0x10(%rip), %rax        # 0xdb1f7
movq %rax, 0x18(%rsi)
leaq 0x346(%rip), %rax       # 0xdb538
movq %rax, 0x20(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: do_base64_internal
static void do_base64_internal(deark *c, lctx *d, i64 pos, dbuf *outf)
{
	u8 b;
	int found_terminator = 0;
	int bad_warned = 0;

	d->cbuf_count = 0;
	while(pos<c->infile->len) {
		b = de_getbyte(pos++);
		if(b>='A' && b<='Z') {
			d->cbuf[d->cbuf_count++] = b-65;
		}
		else if(b>='a' && b<='z') {
			d->cbuf[d->cbuf_count++] = b-71;
		}
		else if(b>='0' && b<='9') {
			d->cbuf[d->cbuf_count++] = b+4;
		}
		else if(b=='+') {
			d->cbuf[d->cbuf_count++] = 62;
		}
		else if(b=='/') {
			d->cbuf[d->cbuf_count++] = 63;
		}
		else if(b=='=') {
			found_terminator = 1;
			break;
		}
		else if(b==9 || b==10 || b==13 || b==32) {
			; // ignore whitespace
		}
		else {
			if(!bad_warned) {
				de_warn(c, "Bad Base64 character(s) found (offset %d)", (int)pos);
				bad_warned = 1;
			}
		}

		if(d->cbuf_count>=4) {
			do_base64_flush(c, d, outf, 3);
		}
	}

	if(d->cbuf_count>0) {
		if(!found_terminator || d->cbuf_count==1) {
			de_warn(c, "Unexpected end of Base64 data");
		}
		do_base64_flush(c, d, outf, 3);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x0, (%rsi)
movq 0x18(%rdi), %rdi
cmpq %rdx, 0x18(%rdi)
setle %bpl
jg 0xdb5c8
movl (%r14), %eax
testl %eax, %eax
je 0xdb6b2
cmpl $0x1, %eax
setne %al
notb %bpl
testb %al, %bpl
jne 0xdb5aa
leaq 0x675fe(%rip), %rsi     # 0x142b9e
movq %r15, %rdi
xorl %eax, %eax
callq 0xe9b27
movl $0x3, %edx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdb6c1
movq %rdx, %r12
xorl %r13d, %r13d
movq %r12, %rsi
callq 0xef0d5
leal -0x41(%rax), %ecx
cmpb $0x19, %cl
ja 0xdb5ee
movl (%r14), %eax
leal 0x1(%rax), %edx
movl %edx, (%r14)
movb %cl, 0x4(%r14,%rax)
jmp 0xdb612
leal -0x61(%rax), %ecx
cmpb $0x19, %cl
ja 0xdb5fa
addb $-0x47, %al
jmp 0xdb604
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0xdb63e
addb $0x4, %al
movl (%r14), %ecx
leal 0x1(%rcx), %edx
movl %edx, (%r14)
movb %al, 0x4(%r14,%rcx)
cmpl $0x4, (%r14)
jb 0xdb628
movl $0x3, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xdb6c1
incq %r12
movq 0x18(%r15), %rdi
cmpq 0x18(%rdi), %r12
setge %bpl
jl 0xdb5ce
jmp 0xdb580
cmpb $0x2b, %al
je 0xdb69e
movzbl %al, %ecx
cmpl $0x2f, %ecx
je 0xdb68a
cmpl $0x3d, %ecx
je 0xdb580
testl %r13d, %r13d
jne 0xdb612
cmpb $0x20, %al
ja 0xdb66c
movabsq $0x100002600, %rax      # imm = 0x100002600
btq %rcx, %rax
jb 0xdb612
leal 0x1(%r12), %edx
movq %r15, %rdi
leaq 0x674f9(%rip), %rsi     # 0x142b74
xorl %eax, %eax
callq 0xe9b27
movl $0x1, %r13d
jmp 0xdb612
movl (%r14), %eax
leal 0x1(%rax), %ecx
movl %ecx, (%r14)
movb $0x3f, 0x4(%r14,%rax)
jmp 0xdb612
movl (%r14), %eax
leal 0x1(%rax), %ecx
movl %ecx, (%r14)
movb $0x3e, 0x4(%r14,%rax)
jmp 0xdb612
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: do_base64_flush
static i64 do_base64_flush(deark *c, lctx *d, dbuf *f, i64 max_to_write)
{
	i64 bytes_written = 0;

	if(d->cbuf_count>=2 && bytes_written<max_to_write) {
		dbuf_writebyte(f, (u8)((d->cbuf[0]<<2)|(d->cbuf[1]>>4)));
		bytes_written++;
	}
	if(d->cbuf_count>=3 && bytes_written<max_to_write) {
		dbuf_writebyte(f, (u8)((d->cbuf[1]<<4)|(d->cbuf[2]>>2)));
		bytes_written++;
	}
	if(d->cbuf_count>=4 && bytes_written<max_to_write) {
		dbuf_writebyte(f, (u8)((d->cbuf[2]<<6)|d->cbuf[3]));
		bytes_written++;
	}
	d->cbuf_count=0;
	return bytes_written;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
xorl %r15d, %r15d
testq %rdx, %rdx
jle 0xdb6fe
cmpl $0x2, (%rbx)
jb 0xdb6fe
movb 0x4(%rbx), %al
movb 0x5(%rbx), %cl
shlb $0x2, %al
shrb $0x4, %cl
orb %al, %cl
movzbl %cl, %esi
movq %r14, %rdi
callq 0xf11be
movl $0x1, %r15d
cmpq %r12, %r15
jge 0xdb724
cmpl $0x3, (%rbx)
jb 0xdb724
movb 0x5(%rbx), %al
movb 0x6(%rbx), %cl
shlb $0x4, %al
shrb $0x2, %cl
orb %al, %cl
movzbl %cl, %esi
movq %r14, %rdi
callq 0xf11be
incq %r15
cmpl $0x4, (%rbx)
setae %al
cmpq %r12, %r15
setl %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xdb74e
movb 0x6(%rbx), %al
shlb $0x6, %al
orb 0x7(%rbx), %al
movzbl %al, %esi
movq %r14, %rdi
callq 0xf11be
incq %r15
movl $0x0, (%rbx)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: parse_begin_line
static void parse_begin_line(deark *c,
	struct uu_hdr_parser *uuhp, de_finfo *fi, const u8 *buf, i64 buf_len)
{
	i64 beginsize;
	de_ucstring *fn = NULL;
	i64 mode;
	size_t nbytes_to_copy;
	char tmpbuf[32];

	if(!fi) goto done;

	if(uuhp->hdr_line_type==HDR_UUENCODE_OR_XXENCODE) {
		beginsize = 5; // "begin" has 5 letters
	}
	else if(uuhp->hdr_line_type==HDR_UUENCODE_BASE64) {
		beginsize = 12; // "begin-base64"
	}
	else {
		goto done;
	}

	if(buf_len<beginsize+6 || buf[beginsize]!=' ' || buf[beginsize+4]!=' ') {
		goto done;
	}

	// Make a NUL-terminated copy of the file permissions mode.
	nbytes_to_copy = (size_t)(buf_len - (beginsize+1));
	if(nbytes_to_copy>sizeof(tmpbuf)) nbytes_to_copy = sizeof(tmpbuf);
	de_strlcpy(tmpbuf, (const char*)&buf[beginsize+1], nbytes_to_copy);
	mode = de_strtoll(tmpbuf, NULL, 8);
	de_dbg(c, "mode: %03o", (unsigned int)mode);
	if((mode & 0111)!=0) {
		fi->mode_flags |= DE_MODEFLAG_EXE;
	}
	else {
		fi->mode_flags |= DE_MODEFLAG_NONEXE;
	}

	fn = ucstring_create(c);
	ucstring_append_bytes(fn, &buf[beginsize+5], buf_len-(beginsize+5), 0, DE_ENCODING_ASCII);
	de_dbg(c, "filename: \"%s\"", ucstring_getpsz_d(fn));
	de_finfo_set_name_from_ucstring(c, fi, fn, 0);
	fi->original_filename_flag = 1;

done:
	ucstring_destroy(fn);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %rbx
movq %rdi, %r14
movl (%rsi), %eax
cmpl $0xb, %eax
je 0xdbae3
cmpl $0xc, %eax
jne 0xdbbcd
movl $0xc, %ebp
jmp 0xdbae8
movl $0x5, %ebp
leaq 0x6(%rbp), %rax
cmpq %r15, %rax
jg 0xdbbcd
cmpb $0x20, (%r12,%rbp)
jne 0xdbbcd
cmpb $0x20, 0x4(%r12,%rbp)
jne 0xdbbcd
leaq 0x1(%rbp), %rax
movq %r15, %rcx
subq %rax, %rcx
cmpq $0x20, %rcx
movl $0x20, %edx
cmovbq %rcx, %rdx
leaq (%r12,%rbp), %rsi
incq %rsi
movq %rsp, %r13
movq %r13, %rdi
callq 0xe8ded
movq %r13, %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x109895
movq %rax, %r13
leaq 0x670c3(%rip), %rsi     # 0x142c11
movq %r14, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe9226
andl $0x49, %r13d
cmpq $0x1, %r13
movl $0x2, %eax
sbbl $0x0, %eax
orl %eax, 0x14(%rbx)
movq %r14, %rdi
callq 0xf6870
movq %rax, %r13
leaq (%r12,%rbp), %rsi
addq $0x5, %rsi
addq $0x5, %rbp
subq %rbp, %r15
movq %rax, %rdi
movq %r15, %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xf7131
movq %r13, %rdi
callq 0xf7557
leaq 0x5fe2a(%rip), %rsi     # 0x13b9d4
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0xea9e4
movb $0x1, 0x8(%rbx)
jmp 0xdbbd0
xorl %r13d, %r13d
movq %r13, %rdi
callq 0xf6bb0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: get_uu_byte_value
static int get_uu_byte_value(deark *c, lctx *d, u8 b, u8 *val)
{
	if(d->data_fmt==FMT_XXENCODE) {
		if(b>='0' && b<='9') *val = b-46;
		else if(b>='A' && b<='Z') *val = b-53;
		else if(b>='a' && b<='z') *val = b-59;
		else if(b=='+') *val = 0;
		else if(b=='-') *val = 1;
		else {
			*val = 0;
			return 0;
		}
		return 1;
	}

	// Standard UUEncoding
	if(b>=32 && b<=96) {
		*val = (b-32)%64;
		return 1;
	}
	*val = 0;
	return 0;
}

// Assembly:
cmpl $0x3, 0xc(%rdi)
jne 0xdbbfa
leal -0x30(%rsi), %eax
cmpb $0x9, %al
ja 0xdbc14
addb $-0x2e, %sil
jmp 0xdbc2c
leal -0x20(%rsi), %edi
xorl %ecx, %ecx
movl $0x0, %eax
cmpb $0x40, %dil
ja 0xdbc33
andb $0x3f, %sil
xorb $0x20, %sil
jmp 0xdbc2c
leal -0x41(%rsi), %eax
cmpb $0x19, %al
ja 0xdbc21
addb $-0x35, %sil
jmp 0xdbc2c
leal -0x61(%rsi), %eax
cmpb $0x19, %al
ja 0xdbc36
addb $-0x3b, %sil
movl $0x1, %eax
movl %esi, %ecx
movb %cl, (%rdx)
retq
movl $0x1, %eax
cmpb $0x2b, %sil
je 0xdbc4e
movzbl %sil, %ecx
cmpl $0x2d, %ecx
jne 0xdbc52
movb $0x1, %cl
jmp 0xdbc33
xorl %ecx, %ecx
jmp 0xdbc33
xorl %ecx, %ecx
xorl %eax, %eax
jmp 0xdbc33
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: ascii85_detect_fmt
static int ascii85_detect_fmt(deark *c)
{
	u8 buf[11];

	de_read(buf, 0, 11);

	if(!de_memcmp(buf, "xbtoa Begin", 11)) {
		return ASCII85_FMT_BTOA_OLD;
	}
	else if(!dbuf_memcmp(c->infile, 0, "xbtoa5 ", 7)) {
		return ASCII85_FMT_BTOA_NEW;
	}
	else if(!dbuf_memcmp(c->infile, 0, "<~", 2)) {
		return ASCII85_FMT_STANDARD;
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
leaq 0xd(%rsp), %r14
movl $0xb, %ecx
movq %r14, %rsi
xorl %edx, %edx
callq 0xeeee8
movabsq $0x654220616f746278, %rax # imm = 0x654220616F746278
xorq (%r14), %rax
movabsq $0x6e6967654220616f, %rcx # imm = 0x6E6967654220616F
xorq 0x3(%r14), %rcx
orq %rax, %rcx
je 0xdbcdc
movq 0x18(%rbx), %rdi
leaq 0x67016(%rip), %rdx     # 0x142cbb
xorl %r14d, %r14d
movl $0x7, %ecx
xorl %esi, %esi
callq 0xf025e
testl %eax, %eax
je 0xdbce3
movq 0x18(%rbx), %rdi
leaq 0x67000(%rip), %rdx     # 0x142cc3
movl $0x2, %ecx
xorl %esi, %esi
callq 0xf025e
testl %eax, %eax
movl $0x17, %eax
cmovnel %r14d, %eax
jmp 0xdbce8
movl $0x15, %eax
jmp 0xdbce8
movl $0x16, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: do_ascii85_flush
static void do_ascii85_flush(deark *c, lctx *d, dbuf *f)
{
	i64 i;
	u32 code;

	if(d->cbuf_count<1) return;

	code = (u32)d->cbuf[0];
	for(i=1; i<5; i++) {
		if(i<d->cbuf_count)
			code = code*85 + (u32)d->cbuf[i];
		else
			code = code*85 + 84; // (This shouldn't happen with btoa format)
	}

	// TODO: Simplify this code
	if(d->cbuf_count>=2) {
		dbuf_writebyte(f, (u8)((code>>24)&0xff));
		d->bytes_written++;
		if(d->output_filesize_known && d->bytes_written>=d->output_filesize) goto done;
	}
	if(d->cbuf_count>=3) {
		dbuf_writebyte(f, (u8)((code>>16)&0xff));
		d->bytes_written++;
		if(d->output_filesize_known && d->bytes_written>=d->output_filesize) goto done;
	}
	if(d->cbuf_count>=4) {
		dbuf_writebyte(f, (u8)((code>>8)&0xff));
		d->bytes_written++;
		if(d->output_filesize_known && d->bytes_written>=d->output_filesize) goto done;
	}
	if(d->cbuf_count>=5) {
		dbuf_writebyte(f, (u8)(code&0xff));
		d->bytes_written++;
		if(d->output_filesize_known && d->bytes_written>=d->output_filesize) goto done;
	}

done:
	d->cbuf_count = 0;
}

// Assembly:
movl (%rdi), %eax
testq %rax, %rax
je 0xdbdd4
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movzbl 0x4(%rdi), %ebx
movl $0x5, %ecx
leaq -0x4(%rcx), %rsi
movl $0x54, %edx
cmpq %rax, %rsi
jae 0xdbd22
movzbl (%r15,%rcx), %edx
imull $0x55, %ebx, %ebx
addl %edx, %ebx
incq %rcx
cmpq $0x9, %rcx
jne 0xdbd0f
cmpl $0x1, %eax
je 0xdbd5c
movl %ebx, %eax
shrl $0x18, %eax
movq %r14, %rdi
movl %eax, %esi
callq 0xf11be
movq 0x18(%r15), %rax
incq %rax
movq %rax, 0x18(%r15)
cmpl $0x0, 0x28(%r15)
je 0xdbd5c
cmpq 0x20(%r15), %rax
jge 0xdbdc8
cmpl $0x3, (%r15)
jb 0xdbd8a
movl %ebx, %eax
shrl $0x10, %eax
movzbl %al, %esi
movq %r14, %rdi
callq 0xf11be
movq 0x18(%r15), %rax
incq %rax
movq %rax, 0x18(%r15)
cmpl $0x0, 0x28(%r15)
je 0xdbd8a
cmpq 0x20(%r15), %rax
jge 0xdbdc8
cmpl $0x4, (%r15)
jb 0xdbdb3
movzbl %bh, %esi
movq %r14, %rdi
callq 0xf11be
movq 0x18(%r15), %rax
incq %rax
movq %rax, 0x18(%r15)
cmpl $0x0, 0x28(%r15)
je 0xdbdb3
cmpq 0x20(%r15), %rax
jge 0xdbdc8
cmpl $0x5, (%r15)
jb 0xdbdc8
movzbl %bl, %esi
movq %r14, %rdi
callq 0xf11be
incq 0x18(%r15)
movl $0x0, (%r15)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/xfer.c
// Function: do_ascii85_data_char_raw
static void do_ascii85_data_char_raw(deark *c, lctx *d, dbuf *f, i64 linenum,
	 const u8 x)
{
	i64 k;

	if(x>='!' && x<='u') {
		do_ascii85_data_char_processed(c, d, f, linenum, x-33);
	}
	else if(x=='z') {
		// 'z' represents four 0x00 bytes, which encodes to five 0 values
		// (not including the +33 bias).
		for(k=0; k<5; k++)
			do_ascii85_data_char_processed(c, d, f, linenum, 0);
	}
	else if(x=='y' && d->ascii85_fmt==ASCII85_FMT_BTOA_NEW) {
		// This is what four spaces encodes to (not including the +33 bias).
		do_ascii85_data_char_processed(c, d, f, linenum, 0x0a);
		do_ascii85_data_char_processed(c, d, f, linenum, 0x1b);
		do_ascii85_data_char_processed(c, d, f, linenum, 0x35);
		do_ascii85_data_char_processed(c, d, f, linenum, 0x43);
		do_ascii85_data_char_processed(c, d, f, linenum, 0x2b);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leal -0x21(%rdx), %ebp
cmpb $0x54, %bpl
ja 0xdbe16
cmpl $0x5, (%rbx)
jb 0xdbdfb
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdbcf0
movl (%rbx), %eax
cmpl $0x5, %eax
jae 0xdbf04
movl %eax, %ecx
movb %bpl, 0x4(%rbx,%rcx)
incl %eax
movl %eax, (%rbx)
jmp 0xdbf04
cmpb $0x79, %dl
je 0xdbe58
movzbl %dl, %eax
cmpl $0x7a, %eax
jne 0xdbf04
movl $0x5, %r15d
cmpl $0x5, (%rbx)
jb 0xdbe3d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdbcf0
movl (%rbx), %eax
cmpq $0x4, %rax
ja 0xdbe4e
movb $0x0, 0x4(%rbx,%rax)
incl %eax
movl %eax, (%rbx)
decq %r15
jne 0xdbe2d
jmp 0xdbf04
cmpl $0x16, 0x10(%rbx)
jne 0xdbf04
cmpl $0x5, (%rbx)
jb 0xdbe72
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdbcf0
movl (%rbx), %eax
cmpq $0x4, %rax
ja 0xdbe83
movb $0xa, 0x4(%rbx,%rax)
incl %eax
movl %eax, (%rbx)
cmpl $0x5, (%rbx)
jb 0xdbe93
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdbcf0
movl (%rbx), %eax
cmpq $0x4, %rax
ja 0xdbea4
movb $0x1b, 0x4(%rbx,%rax)
incl %eax
movl %eax, (%rbx)
cmpl $0x5, (%rbx)
jb 0xdbeb4
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdbcf0
movl (%rbx), %eax
cmpq $0x4, %rax
ja 0xdbec5
movb $0x35, 0x4(%rbx,%rax)
incl %eax
movl %eax, (%rbx)
cmpl $0x5, (%rbx)
jb 0xdbed5
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdbcf0
movl (%rbx), %eax
cmpq $0x4, %rax
ja 0xdbee6
movb $0x43, 0x4(%rbx,%rax)
incl %eax
movl %eax, (%rbx)
cmpl $0x5, (%rbx)
jb 0xdbef6
movq %rbx, %rdi
movq %r14, %rsi
callq 0xdbcf0
movl (%rbx), %eax
movb $0x2b, %bpl
cmpl $0x4, %eax
jbe 0xdbe06
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: de_module_zip
void de_module_zip(deark *c, struct deark_module_info *mi)
{
	mi->id = "zip";
	mi->desc = "ZIP archive";
	mi->run_fn = de_run_zip;
	mi->identify_fn = de_identify_zip;
	mi->help_fn = de_help_zip;
	mi->flags |= DE_MODFLAG_MULTIPART;
}

// Assembly:
leaq 0x6cab8(%rip), %rax     # 0x1489cf
movq %rax, (%rsi)
leaq 0x66fac(%rip), %rax     # 0x142ecd
movq %rax, 0x8(%rsi)
leaq 0x1f(%rip), %rax        # 0xdbf4b
movq %rax, 0x18(%rsi)
leaq 0x6cf(%rip), %rax       # 0xdc606
movq %rax, 0x20(%rsi)
leaq 0x7b7(%rip), %rax       # 0xdc6f9
movq %rax, 0x28(%rsi)
orb $0x40, 0x30(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: de_identify_zip
static int de_identify_zip(deark *c)
{
	u32 bof_sig;
	int has_zip_ext;
	int has_mz_sig = 0;
	i64 eocd_pos;

	has_zip_ext = de_input_file_has_ext(c, "zip");

	// Fast tests:

	bof_sig = (u32)de_getu32be(0);
	if(bof_sig==CODE_PK34 || bof_sig==CODE_PK00) {
		return has_zip_ext ? 100 : 90;
	}
	if((bof_sig>>16)==0x4d5a || (bof_sig>>16)==0x5a4d) {
		has_mz_sig = 1;
	}

	// First try "fast" mode. Note that we won't update c->detection_data
	// if this fails, because a later full search might succeed.
	if(fmtutil_find_zip_eocd(c, c->infile, 0x1, &eocd_pos)) {
		c->detection_data->zip_eocd_looked_for = 1;
		c->detection_data->zip_eocd_found = 1;
		c->detection_data->zip_eocd_pos = eocd_pos;
		return has_zip_ext ? 100 : 19;
	}

	// Things to consider:
	// * We want de_fmtutil_find_zip_eocd() to be called no more than once, and
	// only on files that for some reason we suspect could be ZIP files.
	// * If the user disables exe format detection (e.g. with "-onlydetect zip"),
	// we want self-extracting-ZIP .exe files to be detected as ZIP instead.
	// * And we want the above to work even if the file has a ZIP file comment,
	// making it expensive to detect as ZIP.

	// Tests below can't return a confidence higher than this.
	if(c->detection_data->best_confidence_so_far >= 19) return 0;

	// Slow tests:

	if(has_mz_sig || has_zip_ext) {
		c->detection_data->zip_eocd_looked_for = 1;
		if(fmtutil_find_zip_eocd(c, c->infile, 0, &eocd_pos)) {
			c->detection_data->zip_eocd_found = 1;
			c->detection_data->zip_eocd_pos = eocd_pos;
			return 19;
		}
	}

	if(has_zip_ext && bof_sig==CODE_PK78) {
		return 10; // First segment of a mult-segment archive
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
leaq 0x6c3b6(%rip), %rsi     # 0x1489cf
callq 0xea936
movl %eax, %ebx
movq 0x18(%r14), %rdi
xorl %esi, %esi
callq 0xef32a
movq %rax, %r15
cmpl $0x504b3030, %r15d      # imm = 0x504B3030
je 0xdc640
cmpl $0x504b0304, %r15d      # imm = 0x504B0304
jne 0xdc649
testl %ebx, %ebx
movl $0x5a, %ecx
jmp 0xdc67d
movq 0x18(%r14), %rsi
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
movl $0x1, %edx
callq 0xf93ef
movq 0x28(%r14), %rcx
testl %eax, %eax
je 0xdc68f
movw $0x101, 0x6(%rcx)       # imm = 0x101
movq 0x8(%rsp), %rax
movq %rax, 0x8(%rcx)
testl %ebx, %ebx
movl $0x13, %ecx
movl $0x64, %eax
cmovel %ecx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
xorl %eax, %eax
cmpl $0x12, (%rcx)
jg 0xdc685
testl %ebx, %ebx
je 0xdc6cd
movb $0x1, 0x6(%rcx)
movq 0x18(%r14), %rsi
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0xf93ef
testl %eax, %eax
je 0xdc6e1
movq 0x28(%r14), %rax
movb $0x1, 0x7(%rax)
movq 0x8(%rsp), %rcx
movq %rcx, 0x8(%rax)
movl $0x13, %eax
jmp 0xdc685
movl %r15d, %eax
shrl $0x10, %eax
cmpl $0x5a4d, %eax           # imm = 0x5A4D
je 0xdc69a
cmpl $0x4d5a, %eax           # imm = 0x4D5A
je 0xdc69a
xorl %ecx, %ecx
cmpl $0x504b0708, %r15d      # imm = 0x504B0708
movl $0xa, %eax
cmovnel %ecx, %eax
testl %ebx, %ebx
cmovel %ebx, %eax
jmp 0xdc685
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: de_help_zip
static void de_help_zip(deark *c)
{
	de_msg(c, "-opt zip:scanmode : Do not use the \"central directory\"");
	de_msg(c, "-opt zip:implodebug : Behave like PKZIP 1.01/1.02");
	de_msg(c, "-opt zip:reloc[=<new_offset>] : Instead of decoding, "
		"copy/optimize the file");
	de_msg(c, "-mp -opt zip:combine : Instead of decoding, "
		"combine a multi-segment archive into one file");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x67dc4(%rip), %rsi     # 0x1444c8
xorl %eax, %eax
callq 0xe9fc3
leaq 0x67ded(%rip), %rsi     # 0x1444ff
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9fc3
leaq 0x67e0e(%rip), %rsi     # 0x144531
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9fc3
leaq 0x67e49(%rip), %rsi     # 0x14457d
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
jmp 0xe9fc3
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: simple_read_eocd
static void simple_read_eocd(deark *c, dbuf *f, i64 pos1,
	struct eocd_struct *eocd)
{
	i64 pos = pos1+4;

	eocd->this_seg_num = dbuf_getu16le_p(f, &pos);
	eocd->cdir_starting_seg_num = dbuf_getu16le_p(f, &pos);
	eocd->cdir_num_entries_this_seg = dbuf_getu16le_p(f, &pos);
	eocd->cdir_num_entries_total = dbuf_getu16le_p(f, &pos);
	eocd->cdir_byte_size = dbuf_getu32le_p(f, &pos);
	eocd->cdir_offset = dbuf_getu32le_p(f, &pos);
	eocd->archive_comment_len = dbuf_getu16le_p(f, &pos);

	if((UI)dbuf_getu32be(f, pos1-20) == CODE_PK67) {
		eocd->is_likely_zip64 = 1;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x4(%rsi), %rax
movq %rsp, %r12
movq %rax, (%r12)
movq %r12, %rsi
callq 0xef1ed
movq %rax, (%rbx)
movq %r15, %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0x8(%rbx)
movq %r15, %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0x10(%rbx)
movq %r15, %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0x18(%rbx)
movq %r15, %rdi
movq %r12, %rsi
callq 0xef3a0
movq %rax, 0x20(%rbx)
movq %r15, %rdi
movq %r12, %rsi
callq 0xef3a0
movq %rax, 0x28(%rbx)
movq %r15, %rdi
movq %r12, %rsi
callq 0xef1ed
movq %rax, 0x30(%rbx)
addq $-0x14, %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xef32a
cmpl $0x504b0607, %eax       # imm = 0x504B0607
jne 0xdd459
movb $0x1, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: simple_dbg_eocd
static void simple_dbg_eocd(deark *c, struct eocd_struct *eocd)
{
	de_dbg(c, "this segment num: %"I64_FMT, eocd->this_seg_num);
	de_dbg(c, "central dir num entries on this segment: %"I64_FMT,
		eocd->cdir_num_entries_this_seg);
	de_dbg(c, "central dir num entries: %"I64_FMT, eocd->cdir_num_entries_total);
	de_dbg(c, "central dir size: %"I64_FMT, eocd->cdir_byte_size);
	de_dbg(c, "central dir offset: %"I64_FMT", segment %"I64_FMT, eocd->cdir_offset,
		eocd->cdir_starting_seg_num);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rdx
leaq 0x65a60(%rip), %rsi     # 0x142ed9
xorl %eax, %eax
callq 0xe9226
movq 0x10(%r14), %rdx
leaq 0x65a64(%rip), %rsi     # 0x142eef
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdx
leaq 0x65a7c(%rip), %rsi     # 0x142f1c
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x20(%r14), %rdx
leaq 0x65a84(%rip), %rsi     # 0x142f39
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x8(%r14), %rcx
movq 0x28(%r14), %rdx
leaq 0x65a81(%rip), %rsi     # 0x142f4f
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xe9226
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: zc_relpos_to_abspos
static void zc_relpos_to_abspos(struct zipcombine_ctx *d, struct zc_advpos *advpos)
{
	if(advpos->rel_seg_id<0 || advpos->rel_seg_id>=d->num_segments) {
		d->errflag = 1;
		advpos->abs_pos = d->f->len;
		return;
	}
	advpos->abs_pos = d->segments[advpos->rel_seg_id].starting_offset + advpos->rel_pos;
	if(advpos->rel_seg_id==0) {
		advpos->abs_pos -= d->seg0_prefix_len;
	}
}

// Assembly:
movslq (%rsi), %rax
testq %rax, %rax
js 0xdd50c
cmpl 0x4(%rdi), %eax
jge 0xdd50c
movq 0x88(%rdi), %rdx
movq %rax, %r8
shlq $0x4, %r8
movq 0x8(%rsi), %rcx
addq 0x8(%rdx,%r8), %rcx
movq %rcx, 0x10(%rsi)
testl %eax, %eax
je 0xdd51c
retq
movb $0x1, (%rdi)
movq 0x78(%rdi), %rax
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsi)
retq
subq 0x80(%rdi), %rcx
movq %rcx, 0x10(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: zc_modify_eocd
static void zc_modify_eocd(deark *c, struct zipcombine_ctx *d)
{
	de_dbg(c, "[adjusting eocd]");

	// this segment id -> 0
	zc_writeu16le_at(d, d->eocd_pos.abs_pos + 4, 0);

	// cdir segment num -> 0
	zc_writeu16le_at(d, d->eocd_pos.abs_pos + 6, 0);

	// cdir num entries this segment
	zc_writeu16le_at(d, d->eocd_pos.abs_pos + 8, d->eocd.cdir_num_entries_total);

	// cdir offset
	zc_writeu32le_at(d, d->eocd_pos.abs_pos + 16, d->cdir_pos.abs_pos);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
leaq 0x65b17(%rip), %rsi     # 0x143052
xorl %eax, %eax
callq 0xe9226
movq 0x58(%rbx), %r14
addq $0x4, %r14
leaq 0x6(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0xf158c
movq 0x78(%rbx), %rdi
movl $0x2, %ecx
movq %r14, %rsi
movq %r15, %rdx
callq 0xf11f9
movq 0x58(%rbx), %r14
addq $0x6, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0xf158c
movq 0x78(%rbx), %rdi
movl $0x2, %ecx
movq %r14, %rsi
movq %r15, %rdx
callq 0xf11f9
movq 0x20(%rbx), %rsi
movq 0x58(%rbx), %r14
addq $0x8, %r14
leaq 0xa(%rsp), %r15
movq %r15, %rdi
callq 0xf158c
movq 0x78(%rbx), %rdi
movl $0x2, %ecx
movq %r14, %rsi
movq %r15, %rdx
callq 0xf11f9
movq 0x58(%rbx), %r14
movq 0x70(%rbx), %rsi
addq $0x10, %r14
leaq 0xc(%rsp), %r15
movq %r15, %rdi
callq 0xf1642
movq 0x78(%rbx), %rdi
movl $0x4, %ecx
movq %r14, %rsi
movq %r15, %rdx
callq 0xf11f9
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: zc_modify_cdir
static void zc_modify_cdir(deark *c, struct zipcombine_ctx *d)
{
	struct zip_wcd_ctx *wcdctx = NULL;

	de_dbg(c, "[adjusting cdir entries]");
	de_dbg_indent(c, 1);
	wcdctx = de_malloc(c, sizeof(struct zip_wcd_ctx));
	wcdctx->userdata = (void*)d;
	wcdctx->cbfn = wcd_callback_for_fixcdir;
	wcdctx->inf = d->f;
	wcdctx->max_entries = d->eocd.cdir_num_entries_total;
	wcdctx->inf_startpos = d->cdir_pos.abs_pos;
	wcdctx->inf_endpos = d->f->len;
	zip_wcd_run(c, wcdctx);
	d->errflag = wcdctx->errflag;
	d->need_errmsg = wcdctx->need_errmsg;
	if(d->errflag) {
		goto done;
	}

done:
	de_free(c, wcdctx);
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x65a55(%rip), %rsi     # 0x143063
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movl $0x78, %esi
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r15
movq %r14, 0x8(%rax)
leaq 0x1f8(%rip), %rax       # 0xdd835
movq %rax, (%r15)
movq 0x78(%r14), %rax
movq %rax, 0x18(%r15)
movq 0x20(%r14), %rcx
movq %rcx, 0x30(%r15)
movq 0x70(%r14), %rcx
movq %rcx, 0x20(%r15)
movq 0x18(%rax), %rax
movq %rax, 0x28(%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdd6b9
movb 0x39(%r15), %al
movb %al, (%r14)
movb 0x3a(%r15), %al
movb %al, 0x1(%r14)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xe9752
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %r15
jmp 0xe9585
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: wcd_callback_for_cdpadding
static void wcd_callback_for_cdpadding(deark *c, struct zip_wcd_ctx *wcdctx)
{
	if(c->debug_level<2) return;
	de_dbg2(c, "peek at cdir entry #%u: segment %d, pos %"I64_FMT", len %"I64_FMT,
		(UI)wcdctx->num_entries_completed,
		wcdctx->userdata_seg_id, wcdctx->entry_pos, wcdctx->entry_size);
}

// Assembly:
cmpl $0x2, (%rdi)
jge 0xdd69d
retq
movl 0x10(%rsi), %ecx
movl 0x40(%rsi), %edx
movq 0x50(%rsi), %r8
movq 0x58(%rsi), %r9
leaq 0x658fd(%rip), %rsi     # 0x142faf
xorl %eax, %eax
jmp 0xe93cf
// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/zip.c
// Function: wcd_callback_for_fixcdir
static void wcd_callback_for_fixcdir(deark *c, struct zip_wcd_ctx *wcdctx)
{
	struct zipcombine_ctx *d = (struct zipcombine_ctx*)wcdctx->userdata;
	struct zc_advpos ldir_pos;
	u32 sig;

	de_dbg(c, "adjusting cdir entry #%u: pos %"I64_FMT", len %"I64_FMT,
		(UI)wcdctx->num_entries_completed,
		wcdctx->entry_pos, wcdctx->entry_size);

	de_zeromem(&ldir_pos, sizeof(struct zc_advpos));
	ldir_pos.rel_seg_id = (int)dbuf_getu16le(d->f, wcdctx->entry_pos+34);
	ldir_pos.rel_pos = dbuf_getu32le(d->f, wcdctx->entry_pos+42);

	zc_relpos_to_abspos(d, &ldir_pos);

	zc_format_advpos(d, &ldir_pos);
	de_dbg_indent(c, 1);
	de_dbg(c, "ldir pos: %s", d->tmpsz);
	de_dbg_indent(c, -1);

	// If this is the right place, there should be a signature there.
	sig = (u32)dbuf_getu32be(d->f, ldir_pos.abs_pos);
	if(sig != CODE_PK34) {
		wcdctx->errflag = 1;
		wcdctx->need_errmsg = 1;
		goto done;
	}

	// segment number -> 0
	zc_writeu16le_at(d, wcdctx->entry_pos+34, 0);
	// old offset -> new offset
	zc_writeu32le_at(d, wcdctx->entry_pos+42, ldir_pos.abs_pos);

done:
	;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %rbp
movl 0x40(%rsi), %edx
movq 0x50(%rsi), %rcx
movq 0x58(%rsi), %r8
leaq 0x65820(%rip), %rsi     # 0x14307c
xorl %eax, %eax
callq 0xe9226
movq 0x78(%rbp), %rdi
movq 0x50(%rbx), %rsi
addq $0x22, %rsi
callq 0xef1ca
movq %rax, %r12
movq 0x78(%rbp), %rdi
movq 0x50(%rbx), %rsi
addq $0x2a, %rsi
callq 0xef37e
testl %r12d, %r12d
js 0xdd8bd
cmpl %r12d, 0x4(%rbp)
jle 0xdd8bd
movq 0x88(%rbp), %rcx
movl %r12d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
shlq $0x4, %rdx
movq 0x8(%rcx,%rdx), %r15
addq %rax, %r15
testl %r12d, %r12d
jne 0xdd8c9
subq 0x80(%rbp), %r15
jmp 0xdd8c9
movb $0x1, (%rbp)
movq 0x78(%rbp), %rcx
movq 0x18(%rcx), %r15
leaq 0x90(%rbp), %r13
leaq 0x65761(%rip), %rdx     # 0x143038
movl $0x50, %esi
movq %r13, %rdi
movl %r12d, %ecx
movq %rax, %r8
movq %r15, %r9
xorl %eax, %eax
callq 0xe8d67
movq %r14, %rdi
movl $0x1, %esi
callq 0xe9585
leaq 0x657a4(%rip), %rsi     # 0x1430a7
movq %r14, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0xe9226
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq 0x78(%rbp), %rdi
movq %r15, %rsi
callq 0xef32a
cmpl $0x504b0304, %eax       # imm = 0x504B0304
jne 0xdd989
movq 0x50(%rbx), %r14
addq $0x22, %r14
leaq 0x2(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0xf158c
movq 0x78(%rbp), %rdi
movl $0x2, %ecx
movq %r14, %rsi
movq %r12, %rdx
callq 0xf11f9
movq 0x50(%rbx), %rbx
addq $0x2a, %rbx
leaq 0x4(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0xf1642
movq 0x78(%rbp), %rdi
movl $0x4, %ecx
movq %rbx, %rsi
movq %r14, %rdx
callq 0xf11f9
jmp 0xdd98f
movw $0x101, 0x39(%rbx)      # imm = 0x101
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq