// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/arc.c
// Function: do_decompress_fork_arcmac
static void do_decompress_fork_arcmac(struct member_data *md,
	dbuf *outf, const char *fork_name)
{
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;
	deark *c = md->c;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	if(md->orig_size==0) goto done;

	de_dbg(c, "decompressing %s fork", fork_name);
	de_dbg_indent(c, 1);

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = c->infile;
	dcmpri.pos = md->cmpr_data_pos;
	dcmpri.len = md->cmpr_size;
	dcmpro.f = outf;
	dcmpro.len_known = 1;
	dcmpro.expected_len = md->orig_size;

	if(dcmpri.pos + dcmpri.len > dcmpri.f->len) {
		de_err(c, "%s: Data goes beyond end of file", ucstring_getpsz_d(md->arcmac_fn->str));
		goto done;
	}

	md->cmi->decompressor(c, md->d, md, &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->arcmac_fn->str),
			fork_name, de_dfilter_get_errmsg(c, &dres));
		goto done;
	}

	md->crc_calc = de_crcobj_getval(md->d->crco);
	de_dbg(c, "crc (calculated): 0x%04x", (unsigned int)md->crc_calc);

	if(md->crc_calc!=md->crc_reported) {
		de_err(c, "%s: CRC check failed", ucstring_getpsz_d(md->arcmac_fn->str));
	}

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 %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movq (%rdi), %rbx
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0xdebae
cmpq $0x0, 0x28(%r14)
je 0x27ded
leaq 0xdfe99(%rip), %rsi     # 0x107b57
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
leaq 0x28(%rsp), %r13
leaq 0x10(%rsp), %rbp
leaq 0x48(%rsp), %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0xee7ee
movq 0x18(%rbx), %rax
movq %rax, (%r13)
movq 0x30(%r14), %rcx
movq %rcx, 0x8(%r13)
movq 0x38(%r14), %rdx
movq %rdx, 0x10(%r13)
movq %r12, (%rbp)
movb $0x1, 0x8(%rbp)
movq 0x28(%r14), %rsi
movq %rsi, 0x10(%rbp)
addq %rcx, %rdx
cmpq 0x18(%rax), %rdx
jle 0x27d4d
movq 0xa8(%r14), %rax
movq 0x18(%rax), %rdi
callq 0xeb877
leaq 0xdfe32(%rip), %rsi     # 0x107b6d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xdf2a5
jmp 0x27ded
movq 0x8(%r14), %rsi
movq 0x18(%r14), %rax
leaq 0x28(%rsp), %rcx
leaq 0x10(%rsp), %r12
leaq 0x48(%rsp), %r13
movq %rbx, %rdi
movq %r14, %rdx
movq %r12, %r8
movq %r13, %r9
callq *0x10(%rax)
movq (%r12), %rdi
callq 0xe58e8
cmpl $0x0, (%r13)
je 0x27dbf
movq 0xa8(%r14), %rax
movq 0x18(%rax), %rdi
callq 0xeb877
movq %rax, %r14
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0xee7bc
leaq 0xdfde4(%rip), %rsi     # 0x107b8e
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0xdf2a5
jmp 0x27ded
movq 0x8(%r14), %rax
movq 0x48(%rax), %rdi
callq 0xe0e95
movl %eax, 0x44(%r14)
leaq 0xe0480(%rip), %rsi     # 0x108257
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movl 0x44(%r14), %eax
cmpl 0x40(%r14), %eax
jne 0x27e0b
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa8(%r14), %rax
movq 0x18(%rax), %rdi
callq 0xeb877
leaq 0xdfd9a(%rip), %rsi     # 0x107bbc
jmp 0x27d3b
nop