// File: /workspace/github_c_makefile_star2_O2/jsummers[P]deark/modules/hfs.c
// Function: do_leaf_node_record_extract_item
static void do_leaf_node_record_extract_item(deark *c, lctx *d, struct nodedata *nd,
	struct recorddata *rd)
{
	struct de_advfile *advf = NULL;
	i64 oldlen;

	advf = de_advfile_create(c);
	advf->original_filename_flag = 1;

	// TODO: This is not very efficient. Maybe we should at least cache the
	// previous file's path, since it's usually the same.
	get_full_path_from_dirid(c, d, rd->ParID, advf->filename, 0);

	de_dbg(c, "path: \"%s\"", ucstring_getpsz_d(advf->filename));
	oldlen = advf->filename->len;
	if(rd->name_srd && ucstring_isnonempty(rd->name_srd->str)) {
		ucstring_append_ucstring(advf->filename, rd->name_srd->str);
	}
	else {
		ucstring_append_sz(advf->filename, "_", DE_ENCODING_LATIN1);
	}

	squash_slashes(advf->filename, oldlen);

	advf->snflags = DE_SNFLAG_FULLPATH;

	if(rd->cdrType==CDRTYPE_DIR) {
		do_extract_dir(c, d, nd, rd, advf);
	}
	else if(rd->cdrType==CDRTYPE_FILE) {
		do_extract_file(c, d, nd, rd, advf);
	}

	de_advfile_destroy(advf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r14
callq 0xf07cc
movq %rax, %rbx
movb $0x1, 0x79(%rax)
movl 0x14(%r15), %edx
movq 0x68(%rax), %rcx
movq %r14, %rdi
movq %r13, %rsi
xorl %r8d, %r8d
callq 0x53ac1
movq 0x68(%rbx), %rdi
callq 0xeb877
leaq 0xe387e(%rip), %rsi     # 0x136ed9
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x68(%rbx), %rdi
movq 0x10(%rdi), %r12
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x53699
movq 0x18(%rax), %rdi
callq 0xeaf8a
movq 0x68(%rbx), %rdi
testl %eax, %eax
je 0x53699
movq 0x18(%r15), %rax
movq 0x18(%rax), %rsi
callq 0xead71
jmp 0x536a8
leaq 0xce05c(%rip), %rsi     # 0x1216fc
pushq $0x5
popq %rdx
callq 0xeae42
movq 0x68(%rbx), %rdi
movq %r12, %rsi
callq 0x53aa1
movl $0x1, 0x70(%rbx)
movl 0x10(%r15), %eax
cmpl $0x2, %eax
je 0x536ff
cmpl $0x1, %eax
jne 0x53a8a
movq 0x8(%r15), %rsi
addq $0xa, %rsi
movq 0x20(%rbx), %rdx
movq %r14, %rdi
callq 0x53b8e
movq 0x20(%rbx), %rax
movb $0x1, %cl
movb %cl, 0x9(%rax)
movb %cl, 0x10(%rbx)
andq $0x0, 0x18(%rbx)
movq %rbx, %rdi
callq 0xf08e8
jmp 0x53a8a
movq %r13, %r12
movq 0x8(%r15), %rbp
pushq $0x20
popq %rsi
movq %r14, %rdi
callq 0xdecaf
movq %rax, %r13
movq %r12, 0x8(%rsp)
movq %r12, (%rax)
movq %r15, 0x8(%rax)
pushq $0x50
popq %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0xdecaf
movq %rax, 0x10(%r13)
movq %r14, %rdi
movq %r12, %rsi
callq 0xdecaf
movq %rax, 0x18(%r13)
movb $0x1, %cl
movb %cl, (%rax)
addq $0x2, %rbp
leaq 0x10(%rsp), %r12
movq %rbp, (%r12)
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0xc05de(%rip), %rsi     # 0x113d47
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0xc05cb(%rip), %rsi     # 0x113d54
movq %r14, %rdi
xorl %eax, %eax
callq 0xde896
movq (%r12), %r12
movq 0x18(%r14), %rdi
leaq 0x48(%rsp), %rdx
pushq $0x4
popq %rcx
movq %r12, %rsi
xorl %r8d, %r8d
callq 0xe657c
leaq 0x58(%rsp), %rbp
leaq 0xb40f6(%rip), %rsi     # 0x1078b0
movq %r14, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xde896
movl -0x10(%rbp), %eax
movl %eax, 0x90(%rbx)
movb $0x1, %al
movb %al, 0x7b(%rbx)
leaq 0x4(%r12), %rsi
movq 0x18(%r14), %rdi
leaq 0x18(%rsp), %rdx
pushq $0x4
popq %rcx
xorl %r8d, %r8d
callq 0xe657c
leaq 0x28(%rsp), %rbp
leaq 0xd3819(%rip), %rsi     # 0x127013
movq %r14, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xde896
movl -0x10(%rbp), %eax
movl %eax, 0x94(%rbx)
movb $0x1, %al
movb %al, 0x7c(%rbx)
movb $0x1, %bpl
addq $0x8, %r12
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe3f46
movq %rax, %r12
leaq 0xb408d(%rip), %rsi     # 0x1078bf
movq %r14, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xde896
movw %r12w, 0x7e(%rbx)
movb %bpl, 0x7d(%rbx)
leaq 0x10(%rsp), %rsi
addq $0x14, (%rsi)
movq 0x18(%r14), %rdi
movq %rsi, %r12
callq 0xe3f6e
movq 0x10(%r13), %rcx
movq %rax, 0x8(%rcx)
leaq 0xc04f3(%rip), %rsi     # 0x113d5f
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe4071
movq 0x10(%r13), %rcx
movq %rax, 0x10(%rcx)
leaq 0xc04ea(%rip), %rsi     # 0x113d7d
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe4071
movq 0x10(%r13), %rcx
movq %rax, 0x18(%rcx)
leaq 0xc04dd(%rip), %rsi     # 0x113d97
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe3f6e
movq 0x18(%r13), %rcx
movq %rax, 0x8(%rcx)
leaq 0xc04d1(%rip), %rsi     # 0x113db2
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe4071
movq 0x18(%r13), %rcx
movq %rax, 0x10(%rcx)
leaq 0xc04c8(%rip), %rsi     # 0x113dd0
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe4071
movq 0x18(%r13), %rcx
movq %rax, 0x18(%rcx)
leaq 0xc04bb(%rip), %rsi     # 0x113dea
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq (%r12), %rsi
movq 0x20(%rbx), %rdx
movq %r14, %rdi
callq 0x53b8e
addq $0x1c, (%r12)
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xe3f6e
leaq 0xc04a2(%rip), %rsi     # 0x113e05
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq (%r12), %rsi
movq 0x10(%r13), %rdx
addq $0x20, %rdx
leaq 0xc0492(%rip), %rcx     # 0x113e14
movq %r14, %rdi
callq 0x52d43
movq (%r12), %rsi
addq $0xc, %rsi
movq %rsi, (%r12)
movq 0x18(%r13), %rdx
addq $0x20, %rdx
leaq 0xc0479(%rip), %rcx     # 0x113e1e
movq %r14, %rdi
callq 0x52d43
addq $0xc, (%r12)
movq 0x18(%r13), %rcx
movq 0x10(%rcx), %rax
testq %rax, %rax
setg 0x1(%rcx)
movq 0x10(%r13), %rcx
cmpq $0x0, 0x10(%rcx)
jle 0x539fb
movb $0x1, 0x1(%rcx)
movq 0x8(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x53bf1
movq 0x10(%r13), %rax
cmpb $0x0, 0x2(%rax)
jne 0x53a09
movq 0x10(%rax), %rax
movq %rax, 0x18(%rbx)
movb $0x1, 0x10(%rbx)
jmp 0x53a09
testq %rax, %rax
setle 0x1(%rcx)
movq 0x8(%rsp), %r12
jle 0x539d5
movq 0x18(%r13), %rcx
cmpb $0x0, 0x1(%rcx)
je 0x53a37
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x53bf1
movq 0x18(%r13), %rax
cmpb $0x0, 0x2(%rax)
jne 0x53a37
movq 0x10(%rax), %rax
movq %rax, 0x40(%rbx)
movb $0x1, 0x38(%rbx)
movq %r13, 0x8(%rbx)
leaq 0x20b(%rip), %rax       # 0x53c4d
movq %rax, 0x60(%rbx)
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x53a5f
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %rbx, %rdi
callq 0xf0864
movq %rbx, %rdi
callq 0xf08e8
movq 0x10(%r13), %rsi
movq %r14, %rdi
callq 0xded32
movq 0x18(%r13), %rsi
movq %r14, %rdi
callq 0xded32
movq %r14, %rdi
movq %r13, %rsi
callq 0xded32
movq %rbx, %rdi
callq 0xf0812
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq