// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/arc.c
// Function: do_extract_member_file_arcmac
static void do_extract_member_file_arcmac(deark *c, lctx *d, struct member_data *md,
	de_finfo *fi)
{
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);

	if(!md->cmi || !md->cmi->decompressor) {
		de_err(c, "%s: Compression type 0x%02x (%s) is not supported.",
			ucstring_getpsz_d(md->fn), (unsigned int)md->cmpr_meth, md->cmpr_meth_name);
		goto done;
	}

	if(md->arcmac_dforklen && md->arcmac_rforklen) {
		// This seems to be allowed, but I need sample files.
		de_err(c, "Can't handle multi-fork ArcMac file");
		goto done;
	}
	if(md->arcmac_dforklen + md->arcmac_rforklen != md->orig_size) {
		de_err(c, "Inconsistent ArcMac fork size");
		goto done;
	}

	if(md->arcmac_fn && ucstring_isnonempty(md->arcmac_fn->str)) {
		ucstring_append_ucstring(md->arcmac_advf->filename, md->arcmac_fn->str);
	}
	else {
		ucstring_append_ucstring(md->arcmac_advf->filename, md->fn);
	}
	md->arcmac_advf->original_filename_flag = 1;

	md->arcmac_advf->mainfork.fi->timestamp[DE_TIMESTAMPIDX_MODIFY] =
		fi->timestamp[DE_TIMESTAMPIDX_MODIFY];

	md->arcmac_advf->userdata = (void*)md;
	md->arcmac_advf->writefork_cbfn = my_advfile_cbfn;

	md->arcmac_advf->mainfork.writelistener_cb = de_writelistener_for_crc;
	md->arcmac_advf->mainfork.userdata_for_writelistener = (void*)d->crco;
	md->arcmac_advf->rsrcfork.writelistener_cb = de_writelistener_for_crc;
	md->arcmac_advf->rsrcfork.userdata_for_writelistener = (void*)d->crco;
	de_crcobj_reset(d->crco);

	de_advfile_run(md->arcmac_advf);

done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x4(%rsp), %rsi
callq 0xe8a1c
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x28008
cmpq $0x0, 0x10(%rax)
je 0x28008
movq 0x98(%r14), %rax
movq 0xa0(%r14), %rcx
testq %rax, %rax
je 0x28035
testq %rcx, %rcx
je 0x28033
leaq 0xecb9a(%rip), %rsi     # 0x114ba0
jmp 0x2806b
movq 0x48(%r14), %rdi
callq 0xf70f6
movzbl 0x10(%r14), %ecx
movq 0x20(%r14), %r8
leaq 0xecb4c(%rip), %rsi     # 0x114b6d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9295
jmp 0x280e9
xorl %ecx, %ecx
addq %rax, %rcx
cmpq 0x28(%r14), %rcx
jne 0x28064
movq 0xa8(%r14), %rax
testq %rax, %rax
je 0x28077
movq 0x18(%rax), %rdi
callq 0xf67a3
testl %eax, %eax
je 0x28077
movq 0xa8(%r14), %rax
addq $0x18, %rax
jmp 0x2807b
leaq 0xecb59(%rip), %rsi     # 0x114bc4
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0x280e9
leaq 0x48(%r14), %rax
movq 0xb0(%r14), %rcx
movq 0x68(%rcx), %rdi
movq (%rax), %rsi
callq 0xf6509
movq 0xb0(%r14), %rax
movb $0x1, 0x79(%rax)
movq 0x20(%rax), %rax
movups 0x18(%r12), %xmm0
movups %xmm0, 0x18(%rax)
movq 0xb0(%r14), %rax
movq %r14, 0x8(%rax)
leaq 0x59e(%rip), %rcx       # 0x28657
movq %rcx, 0x60(%rax)
leaq 0xc938d(%rip), %rcx     # 0xf1451
movq %rcx, 0x30(%rax)
movq 0x48(%r15), %rdi
movq %rdi, 0x28(%rax)
movq %rcx, 0x58(%rax)
movq %rdi, 0x50(%rax)
callq 0xeb7fe
movq 0xb0(%r14), %rdi
callq 0xfc5b7
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq