// File: /workspace/github_c_makefile_star2_O1/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 0xe958c
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x28045
cmpq $0x0, 0x10(%rax)
je 0x28045
movq 0x98(%r14), %rax
testq %rax, %rax
je 0x28070
cmpq $0x0, 0xa0(%r14)
je 0x28070
leaq 0xeca82(%rip), %rsi     # 0x114ac5
jmp 0x280aa
movq 0x48(%r14), %rdi
callq 0xf7557
movzbl 0x10(%r14), %ecx
movq 0x20(%r14), %r8
leaq 0xeca34(%rip), %rsi     # 0x114a92
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9df7
jmp 0x28128
addq 0xa0(%r14), %rax
cmpq 0x28(%r14), %rax
jne 0x280a3
movq 0xa8(%r14), %rax
testq %rax, %rax
je 0x280b6
movq 0x18(%rax), %rdi
callq 0xf6c00
testl %eax, %eax
je 0x280b6
movq 0xa8(%r14), %rax
addq $0x18, %rax
jmp 0x280ba
leaq 0xeca3f(%rip), %rsi     # 0x114ae9
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0x28128
leaq 0x48(%r14), %rax
movq 0xb0(%r14), %rcx
movq 0x68(%rcx), %rdi
movq (%rax), %rsi
callq 0xf6969
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 0x597(%rip), %rcx       # 0x2868f
movq %rcx, 0x60(%rax)
leaq 0xc994e(%rip), %rcx     # 0xf1a51
movq %rcx, 0x30(%rax)
movq 0x48(%r15), %rdi
movq %rdi, 0x28(%rax)
movq %rcx, 0x58(%rax)
movq %rdi, 0x50(%rax)
callq 0xebdc3
movq 0xb0(%r14), %rdi
callq 0xfcb73
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq