// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/arj.c
// Function: extract_member_file
static void extract_member_file(deark *c, lctx *d, struct member_data *md)
{
	de_finfo *fi = NULL;
	size_t k;
	int need_to_decompress;
	u32 crc_calc;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_dfilter_results dres;

	if(md->objtype!=ARJ_OBJTYPE_MEMBERFILE) goto done;
	if(!md->name_srd) goto done;

	if(md->is_dir || (md->orig_len==0))
		need_to_decompress = 0;
	else
		need_to_decompress = 1;

	if(md->file_type==9) { // Presumably ARJZ -t9
		de_err(c, "%s: Unsupported file type",
			ucstring_getpsz_d(md->name_srd->str));
		goto done;
	}

	if((md->flags & 0x01) && need_to_decompress) {
		de_err(c, "%s: %sed files are not supported",
			ucstring_getpsz_d(md->name_srd->str),
			(d->cv->encryption_ver>=2 ? "Encrypt":"Garbl"));
		goto done;
	}

	if(need_to_decompress && (md->method>4)) {
		de_err(c, "%s: Compression method %u is not supported",
			ucstring_getpsz_d(md->name_srd->str), (UI)md->method);
		goto done;
	}

	acquire_logical_member(c, d, md);
	if(md->errflag) goto done;
	d->clm->total_cmpr_len += md->cmpr_len;
	d->clm->total_orig_len += md->orig_len;
	d->clm->fragment_count++;

	fi = de_finfo_create(c);

	de_finfo_set_name_from_ucstring(c, fi, md->name_srd->str, DE_SNFLAG_FULLPATH);
	fi->original_filename_flag = 1;

	fi->is_directory = md->is_dir;
	fi->is_volume_label = (md->file_type==ARJ_FILETYPE_VOLUMELABEL);
	if(!fi->is_directory && !fi->is_volume_label) {
		if(md->is_executable) {
			fi->mode_flags |= DE_MODEFLAG_EXE;
		}
		else if(md->is_nonexecutable) {
			fi->mode_flags |= DE_MODEFLAG_NONEXE;
		}
	}

	for(k=0; k<DE_TIMESTAMPIDX_COUNT; k++) {
		fi->timestamp[k] = md->tmstamp[k];
	}

	if(!d->clm->outf) {
		d->clm->outf = dbuf_create_output_file(c, NULL, fi, 0);
		dbuf_enable_wbuffer(d->clm->outf);
	}

	if(md->is_dir) goto done;

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

	de_crcobj_reset(d->crco);
	dbuf_set_writelistener(d->clm->outf, de_writelistener_for_crc,
		(void*)d->crco);

	if(md->orig_len==0) {
		;
	}
	else if(md->method==0) {
		fmtutil_decompress_uncompressed(c, &dcmpri, &dcmpro, &dres, 0);
	}
	else if(md->method>=1 && md->method<=3) {
		decompress_method_1(c, d, md, &dcmpri, &dcmpro, &dres);
	}
	else if(md->method==4) {
		decompress_method_4(c, d, md, &dcmpri, &dcmpro, &dres);
	}
	dbuf_flush(dcmpro.f);

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

	crc_calc = de_crcobj_getval(d->crco);
	de_dbg(c, "crc (calculated): 0x%08x", (UI)crc_calc);
	if(crc_calc != md->crc_reported) {
		de_err(c, "%s: CRC check failed", ucstring_getpsz_d(md->name_srd->str));
		goto done;
	}

done:
	if(md->errflag) {
		// Error message has already been issued, presumably
		arj_logical_member_finish_and_free(c, d, 0);
	}
	else if(d->clm && !md->cont_on_next_vol) {
		if(d->clm->fragment_count>1) {
			// FIXME? The totals will be indented as if they were associated with
			// the last fragment's compressed data, which seems wrong, but fixing
			// it would be a hack.
			de_dbg(c, "num fragments: %d", d->clm->fragment_count);
			de_dbg(c, "total cmpr size: %"I64_FMT, d->clm->total_cmpr_len);
			de_dbg(c, "total orig size: %"I64_FMT, d->clm->total_orig_len);
		}
		arj_logical_member_finish_and_free(c, d, 0);
	}

	if(fi) de_finfo_destroy(c, fi);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x65, 0x8(%rax)
je 0x49e3e
jmp 0x4a338
movq -0x18(%rbp), %rax
cmpq $0x0, 0x98(%rax)
jne 0x49e51
jmp 0x4a338
movq -0x18(%rbp), %rax
movzbl 0x1c(%rax), %eax
cmpl $0x0, %eax
jne 0x49e69
movq -0x18(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x49e72
movl $0x0, -0x2c(%rbp)
jmp 0x49e79
movl $0x1, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x13(%rax), %eax
cmpl $0x9, %eax
jne 0x49ec2
movq -0x8(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x172650
movq -0xd0(%rbp), %rdi
movq %rax, %rdx
leaq 0x15a41a(%rip), %rsi    # 0x1a42d0
movb $0x0, %al
callq 0x15bfb0
jmp 0x4a338
movq -0x18(%rbp), %rax
movzbl 0x11(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x49f35
cmpl $0x0, -0x2c(%rbp)
je 0x49f35
movq -0x8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x172650
movq -0xd8(%rbp), %rdi
movq %rax, %rdx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movzbl 0x1c(%rax), %esi
leaq 0x15a3ff(%rip), %rcx    # 0x1a4313
leaq 0x15a3f0(%rip), %rax    # 0x1a430b
cmpl $0x2, %esi
cmovgeq %rax, %rcx
leaq 0x15a3c1(%rip), %rsi    # 0x1a42ea
movb $0x0, %al
callq 0x15bfb0
jmp 0x4a338
cmpl $0x0, -0x2c(%rbp)
je 0x49f8c
movq -0x18(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x4, %eax
jle 0x49f8c
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x172650
movq -0xe0(%rbp), %rdi
movq %rax, %rdx
movq -0x18(%rbp), %rax
movzbl 0x12(%rax), %ecx
leaq 0x15a399(%rip), %rsi    # 0x1a4319
movb $0x0, %al
callq 0x15bfb0
jmp 0x4a338
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x4a410
movq -0x18(%rbp), %rax
cmpb $0x0, 0xc(%rax)
je 0x49fac
jmp 0x4a338
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
addq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
addq 0x18(%rax), %rcx
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rdi
callq 0x15d230
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rax
movq 0x18(%rax), %rdx
movl $0x1, %ecx
callq 0x15d2c0
movq -0x20(%rbp), %rax
movb $0x1, 0x8(%rax)
movq -0x18(%rbp), %rax
movb 0x1c(%rax), %cl
movq -0x20(%rbp), %rax
movb %cl, 0x9(%rax)
movq -0x18(%rbp), %rax
movzbl 0x13(%rax), %eax
cmpl $0x4, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0xa(%rax)
movq -0x20(%rbp), %rax
cmpb $0x0, 0x9(%rax)
jne 0x4a095
movq -0x20(%rbp), %rax
cmpb $0x0, 0xa(%rax)
jne 0x4a095
movq -0x18(%rbp), %rax
cmpb $0x0, 0x1d(%rax)
je 0x4a07a
movq -0x20(%rbp), %rax
movl 0x14(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x14(%rax)
jmp 0x4a093
movq -0x18(%rbp), %rax
cmpb $0x0, 0x1e(%rax)
je 0x4a091
movq -0x20(%rbp), %rax
movl 0x14(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0x14(%rax)
jmp 0x4a093
jmp 0x4a095
movq $0x0, -0x28(%rbp)
cmpq $0x5, -0x28(%rbp)
jae 0x4a0e6
movq -0x20(%rbp), %rax
addq $0x18, %rax
movq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
addq $0x48, %rcx
movq -0x28(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x4a09d
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
cmpq $0x0, (%rax)
jne 0x4a125
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
xorl %ecx, %ecx
callq 0x166c60
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rdi
callq 0x167b90
movq -0x18(%rbp), %rax
cmpb $0x0, 0x1c(%rax)
je 0x4a134
jmp 0x4a338
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x68(%rbp), %rdx
leaq -0xc8(%rbp), %rcx
callq 0x1773f0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movb $0x1, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x15f250
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x11f11b(%rip), %rsi    # 0x1692d0
callq 0x169280
movq -0x18(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x4a1ca
jmp 0x4a263
movq -0x18(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x0, %eax
jne 0x4a1f4
movq -0x8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x68(%rbp), %rdx
leaq -0xc8(%rbp), %rcx
xorl %r8d, %r8d
callq 0x1778b0
jmp 0x4a261
movq -0x18(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x1, %eax
jl 0x4a230
movq -0x18(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x3, %eax
jg 0x4a230
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x50(%rbp), %rcx
leaq -0x68(%rbp), %r8
leaq -0xc8(%rbp), %r9
callq 0x4a560
jmp 0x4a25f
movq -0x18(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x4, %eax
jne 0x4a25d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x50(%rbp), %rcx
leaq -0x68(%rbp), %r8
leaq -0xc8(%rbp), %r9
callq 0x4a650
jmp 0x4a25f
jmp 0x4a261
jmp 0x4a263
movq -0x68(%rbp), %rdi
callq 0x167c30
cmpl $0x0, -0xc8(%rbp)
je 0x4a2cc
movq -0x8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x172650
movq %rax, -0xe8(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x177360
movq -0xf0(%rbp), %rdi
movq -0xe8(%rbp), %rdx
movq %rax, %rcx
leaq 0x155d36(%rip), %rsi    # 0x19fff9
movb $0x0, %al
callq 0x15bfb0
jmp 0x4a338
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x15f340
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movl -0x30(%rbp), %edx
leaq 0x159dbd(%rip), %rsi    # 0x1a40a7
movb $0x0, %al
callq 0x15b0d0
movl -0x30(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x24(%rcx), %eax
je 0x4a336
movq -0x8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x18(%rbp), %rax
movq 0x98(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x172650
movq -0xf8(%rbp), %rdi
movq %rax, %rdx
leaq 0x1566e6(%rip), %rsi    # 0x1a0a13
movb $0x0, %al
callq 0x15bfb0
jmp 0x4a338
jmp 0x4a338
movq -0x18(%rbp), %rax
cmpb $0x0, 0xc(%rax)
je 0x4a356
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x47e00
jmp 0x4a3e7
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x4a3e5
movq -0x18(%rbp), %rax
cmpb $0x0, 0x1a(%rax)
jne 0x4a3e5
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
cmpl $0x1, 0x14(%rax)
jle 0x4a3d6
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl 0x14(%rax), %edx
leaq 0x159fb1(%rip), %rsi    # 0x1a4344
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rdx
leaq 0x159fa5(%rip), %rsi    # 0x1a4356
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x18(%rax), %rdx
leaq 0x159f9c(%rip), %rsi    # 0x1a436b
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x47e00
jmp 0x4a3e7
cmpq $0x0, -0x20(%rbp)
je 0x4a3fb
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x15d260
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)