// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/src/fmtutil-arch.c
// Function: de_arch_extract_member_file
void de_arch_extract_member_file(struct de_arch_member_data *md)
{
	deark *c = md->c;
	dbuf *outf = NULL;
	u32 crc_calc;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;

	md->extracted_ok = 0;
	ensure_name_for_msgs_is_set(md);
	if(md->orig_len>0 && !md->orig_len_known) goto done; // sanity check
	if(md->validate_crc && !md->d->crco) goto done;
	if(md->is_encrypted) {
		de_err(c, "%s: Encrypted files are not supported", ucstring_getpsz_d(md->name_for_msgs));
		goto done;
	}
	if(!de_arch_good_cmpr_data_pos(md)) {
		goto done;
	}

	if(!md->fi->file_name_internal && ucstring_isnonempty(md->filename)) {
		de_finfo_set_name_from_ucstring(c, md->fi, md->filename, md->set_name_flags);
		md->fi->original_filename_flag = 1;
	}

	outf = dbuf_create_output_file(c, NULL, md->fi, 0);
	dbuf_enable_wbuffer(outf);
	if(md->validate_crc) {
		dbuf_set_writelistener(outf, de_writelistener_for_crc, (void*)md->d->crco);
	}

	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);
	dcmpri.f = md->d->inf;
	dcmpri.pos = md->cmpr_pos;
	dcmpri.len = md->cmpr_len;
	dcmpro.f = outf;
	dcmpro.len_known = md->orig_len_known;
	dcmpro.expected_len = md->orig_len;
	md->dcmpri = &dcmpri;
	md->dcmpro = &dcmpro;
	md->dres = &dres;

	if(md->validate_crc) {
		de_crcobj_reset(md->d->crco);
	}

	if(md->orig_len_known && md->orig_len==0) {
		;
	}
	else if(md->dfn) {
		md->dfn(md);
	}
	else {
		de_dfilter_set_generic_error(c, &dres, NULL);
	}
	dbuf_flush(dcmpro.f);

	if(dres.errcode) {
		de_err(c, "%s: Decompression failed: %s", ucstring_getpsz_d(md->name_for_msgs),
			de_dfilter_get_errmsg(c, &dres));
		goto done;
	}

	if(md->orig_len_known && (outf->len != md->orig_len)) {
		de_err(c, "%s: Expected %"I64_FMT" decompressed bytes, got %"I64_FMT,
			ucstring_getpsz_d(md->name_for_msgs), md->orig_len, outf->len);
		goto done;
	}

	if(md->validate_crc) {
		crc_calc = de_crcobj_getval(md->d->crco);
		de_dbg(c, "crc (calculated): 0x%04x", (unsigned int)crc_calc);
		if(crc_calc!=md->crc_reported) {
			if(md->behavior_on_wrong_crc==1) {
				de_warn(c, "%s: CRC check not available", ucstring_getpsz_d(md->name_for_msgs));
			}
			else {
				de_err(c, "%s: CRC check failed", ucstring_getpsz_d(md->name_for_msgs));
				goto done;
			}
		}
	}

	md->extracted_ok = 1;

done:
	dbuf_close(outf);
	md->dcmpri = NULL;
	md->dcmpro = NULL;
	md->dres = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movb $0x0, 0xa3(%rax)
movq -0x8(%rbp), %rdi
callq 0x17c890
movq -0x8(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jle 0x17c970
movq -0x8(%rbp), %rax
cmpb $0x0, 0x4c(%rax)
jne 0x17c970
jmp 0x17cd11
movq -0x8(%rbp), %rax
movzbl 0xa1(%rax), %eax
cmpl $0x0, %eax
je 0x17c994
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x30(%rax)
jne 0x17c994
jmp 0x17cd11
movq -0x8(%rbp), %rax
cmpb $0x0, 0x80(%rax)
je 0x17c9d6
movq -0x10(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x172650
movq -0xc0(%rbp), %rdi
movq %rax, %rdx
leaq 0x59f9f(%rip), %rsi     # 0x1d6969
movb $0x0, %al
callq 0x15bfb0
jmp 0x17cd11
movq -0x8(%rbp), %rdi
callq 0x17c7f0
cmpl $0x0, %eax
jne 0x17c9e9
jmp 0x17cd11
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
cmpq $0x0, (%rax)
jne 0x17ca35
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x1717f0
cmpl $0x0, %eax
je 0x17ca35
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rdx
movq -0x8(%rbp), %rax
movl 0x78(%rax), %ecx
callq 0x15d2c0
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movb $0x1, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdx
xorl %eax, %eax
movl %eax, %esi
xorl %ecx, %ecx
callq 0x166c60
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x167b90
movq -0x8(%rbp), %rax
cmpb $0x0, 0xa1(%rax)
je 0x17ca82
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %rdx
leaq -0x137ad(%rip), %rsi    # 0x1692d0
callq 0x169280
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x58(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
callq 0x1773f0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movb 0x4c(%rax), %al
movb %al, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
leaq -0x40(%rbp), %rcx
movq %rcx, 0xb0(%rax)
movq -0x8(%rbp), %rax
leaq -0x58(%rbp), %rcx
movq %rcx, 0xb8(%rax)
movq -0x8(%rbp), %rax
leaq -0xb8(%rbp), %rcx
movq %rcx, 0xc0(%rax)
movq -0x8(%rbp), %rax
cmpb $0x0, 0xa1(%rax)
je 0x17cb2e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %rdi
callq 0x15f250
movq -0x8(%rbp), %rax
movzbl 0x4c(%rax), %eax
cmpl $0x0, %eax
je 0x17cb48
movq -0x8(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x17cb48
jmp 0x17cb7f
movq -0x8(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
je 0x17cb69
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq -0x8(%rbp), %rdi
callq *%rax
jmp 0x17cb7d
movq -0x10(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x177560
jmp 0x17cb7f
movq -0x58(%rbp), %rdi
callq 0x167c30
cmpl $0x0, -0xb8(%rbp)
je 0x17cbe4
movq -0x10(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x172650
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x177360
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rdx
movq %rax, %rcx
leaq 0x23421(%rip), %rsi     # 0x19fff9
movb $0x0, %al
callq 0x15bfb0
jmp 0x17cd11
movq -0x8(%rbp), %rax
movzbl 0x4c(%rax), %eax
cmpl $0x0, %eax
je 0x17cc48
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x38(%rcx), %rax
je 0x17cc48
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x172650
movq -0xd8(%rbp), %rdi
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %r8
leaq 0x46ea2(%rip), %rsi     # 0x1c3ade
movb $0x0, %al
callq 0x15bfb0
jmp 0x17cd11
movq -0x8(%rbp), %rax
cmpb $0x0, 0xa1(%rax)
je 0x17cd06
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %rdi
callq 0x15f340
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq 0x2440c(%rip), %rsi     # 0x1a1087
movb $0x0, %al
callq 0x15b0d0
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x48(%rcx), %eax
je 0x17cd04
movq -0x8(%rbp), %rax
movzbl 0xa2(%rax), %eax
cmpl $0x1, %eax
jne 0x17ccd0
movq -0x10(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x172650
movq -0xe0(%rbp), %rdi
movq %rax, %rdx
leaq 0x59cc8(%rip), %rsi     # 0x1d698f
movb $0x0, %al
callq 0x15bc10
jmp 0x17cd02
movq -0x10(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x172650
movq -0xe8(%rbp), %rdi
movq %rax, %rdx
leaq 0x23d1a(%rip), %rsi     # 0x1a0a13
movb $0x0, %al
callq 0x15bfb0
jmp 0x17cd11
jmp 0x17cd04
jmp 0x17cd06
movq -0x8(%rbp), %rax
movb $0x1, 0xa3(%rax)
movq -0x18(%rbp), %rdi
callq 0x1676a0
movq -0x8(%rbp), %rax
movq $0x0, 0xb0(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0xb8(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0xc0(%rax)
addq $0xf0, %rsp
popq %rbp
retq