// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/stuffit.c
// Function: do_v5_member
static int do_v5_member(deark *c, lctx *d, i64 member_idx,
	i64 pos1, i64 *pnext_member_pos)
{
	struct member_data *md = NULL;
	int saved_indent_level;
	int retval = 0;

	de_dbg_indent_save(c, &saved_indent_level);

	if(pos1==0) goto done;

	if(!de_inthashtable_add_item(c, d->v5_offsets_seen, pos1, NULL)) {
		de_err(c, "Loop detected");
		goto done;
	}

	md = de_malloc(c, sizeof(struct member_data));
	md->rfork.is_rsrc_fork = 1;
	md->dfork.forkname = "data";
	md->rfork.forkname = "resource";

	de_dbg(c, "member[%d] at %"I64_FMT, (int)member_idx, pos1);
	de_dbg_indent(c, 1);

	if(pos1<0 || pos1>=c->infile->len) {
		de_err(c, "Bad file offset");
		goto done;
	}

	md->advf = de_advfile_create(c);
	md->advf->enable_wbuffer = 1;

	if(!do_v5_member_header(c, d, md, pos1)) goto done;
	*pnext_member_pos = md->v5_next_member_pos;

	if(!md->full_fname) {
		md->full_fname = ucstring_create(c);
		de_strarray_make_path(d->curpath, md->full_fname, DE_MPFLAG_NOTRAILINGSLASH);
	}
	de_dbg(c, "full name: \"%s\"", ucstring_getpsz_d(md->full_fname));

	if(md->is_folder) {
		do_extract_folder(c, d, md);

		if(d->subdir_level >= MAX_NESTING_LEVEL) {
			de_err(c, "Directories nested too deeply");
			retval = 0;
			goto done;
		}
		de_dbg(c, "[folder contents]");
		de_dbg_indent(c, 1);
		d->subdir_level++;
		do_v5_list_of_members(c, d, md->v5_first_entry_pos, md->v5_num_files_in_folder);
		d->subdir_level--;
		de_dbg_indent(c, -1);
	}
	else {
		do_extract_member_file(c, d, md);
	}

	retval = 1;

done:
	if(md) {
		if(md->v5_need_strarray_pop) {
			de_strarray_pop(d->curpath);
		}
		de_destroy_stringreaderdata(c, md->fname);
		ucstring_destroy(md->full_fname);
		de_advfile_destroy(md->advf);
		de_free(c, md);
	}
	de_dbg_indent_restore(c, saved_indent_level);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0x15b580
cmpq $0x0, -0x20(%rbp)
jne 0x141744
jmp 0x141993
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rsi
movq -0x20(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x15e810
cmpl $0x0, %eax
jne 0x141779
movq -0x8(%rbp), %rdi
leaq 0x8c96f(%rip), %rsi     # 0x1ce0dc
movb $0x0, %al
callq 0x15bfb0
jmp 0x141993
movq -0x8(%rbp), %rdi
movl $0x140, %esi            # imm = 0x140
callq 0x15b780
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x1, 0xa0(%rax)
movq -0x30(%rbp), %rax
leaq 0x843d8(%rip), %rcx     # 0x1c5b79
movq %rcx, 0x108(%rax)
movq -0x30(%rbp), %rax
leaq 0x7ac4d(%rip), %rcx     # 0x1bc400
movq %rcx, 0xc8(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movq -0x20(%rbp), %rcx
leaq 0x8c91b(%rip), %rsi     # 0x1ce0ea
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
cmpq $0x0, -0x20(%rbp)
jl 0x1417fd
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jl 0x141814
movq -0x8(%rbp), %rdi
leaq 0x8c8f4(%rip), %rsi     # 0x1ce0fc
movb $0x0, %al
callq 0x15bfb0
jmp 0x141993
movq -0x8(%rbp), %rdi
callq 0x17aa20
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x1, 0x78(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x141a10
cmpl $0x0, %eax
jne 0x141853
jmp 0x141993
movq -0x30(%rbp), %rax
movq 0x120(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x14189e
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rsi
movl $0x1, %edx
callq 0x1729c0
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x172650
movq -0x40(%rbp), %rdi
movq %rax, %rdx
leaq 0x7ca3e(%rip), %rsi     # 0x1be2ff
movb $0x0, %al
callq 0x15b0d0
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax)
je 0x14197b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x140080
movq -0x10(%rbp), %rax
cmpl $0x20, 0xc(%rax)
jl 0x14190e
movq -0x8(%rbp), %rdi
leaq 0x5e62d(%rip), %rsi     # 0x19ff28
movb $0x0, %al
callq 0x15bfb0
movl $0x0, -0x38(%rbp)
jmp 0x141993
movq -0x8(%rbp), %rdi
leaq 0x8c7f3(%rip), %rsi     # 0x1ce10c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x128(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x130(%rax), %rcx
callq 0x141670
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
jmp 0x14198c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x140160
movl $0x1, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1419ec
movq -0x30(%rbp), %rax
cmpb $0x0, 0x138(%rax)
je 0x1419b4
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x172850
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x166830
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x171750
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x17aaa0
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x15b820
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x15b5a0
movl -0x38(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)