// File: /workspace/github_c_makefile_star2_O1/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, %rbp
movq %rdi, %r14
callq 0xfca54
movq %rax, %rbx
movb $0x1, 0x79(%rax)
movl 0x14(%r15), %edx
movq 0x68(%rax), %rcx
movq %r14, %rdi
movq %rbp, %rsi
xorl %r8d, %r8d
callq 0x56888
movq 0x68(%rbx), %rdi
callq 0xf7557
leaq 0xeda2f(%rip), %rsi     # 0x143e49
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x68(%rbx), %rax
movq 0x10(%rax), %r12
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x56458
movq 0x18(%rax), %rdi
callq 0xf6c00
testl %eax, %eax
je 0x56458
movq 0x68(%rbx), %rdi
movq 0x18(%r15), %rax
movq 0x18(%rax), %rsi
callq 0xf6969
jmp 0x5646d
movq 0x68(%rbx), %rdi
leaq 0xd8211(%rip), %rsi     # 0x12e674
movl $0x5, %edx
callq 0xf6a40
movq 0x68(%rbx), %rcx
movq 0x10(%rcx), %rax
cmpq %r12, %rax
jle 0x56495
movq 0x8(%rcx), %rcx
cmpl $0x2f, (%rcx,%r12,4)
jne 0x5648d
movl $0x5f, (%rcx,%r12,4)
incq %r12
cmpq %r12, %rax
jne 0x5647e
movl $0x1, 0x70(%rbx)
movl 0x10(%r15), %eax
cmpl $0x2, %eax
je 0x564e3
cmpl $0x1, %eax
jne 0x56871
movq 0x8(%r15), %rsi
addq $0xa, %rsi
movq 0x20(%rbx), %rdx
movq %r14, %rdi
callq 0x56959
movq 0x20(%rbx), %rax
movb $0x1, %cl
movb %cl, 0x9(%rax)
movb %cl, 0x10(%rbx)
movq $0x0, 0x18(%rbx)
movq %rbx, %rdi
callq 0xfcb73
jmp 0x56871
movq 0x8(%r15), %rax
leaq 0x8(%rsp), %r12
movq %rax, (%r12)
movl $0x20, %esi
movq %r14, %rdi
callq 0xe969b
movq %rax, %r13
movq %rbp, (%rax)
movq %r15, 0x8(%rax)
movl $0x50, %esi
movq %r14, %rdi
callq 0xe969b
movq %rax, 0x10(%r13)
movl $0x50, %esi
movq %r14, %rdi
callq 0xe969b
movq %rax, 0x18(%r13)
movb $0x1, %cl
movb %cl, (%rax)
addq $0x2, (%r12)
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0xca7c7(%rip), %rsi     # 0x120d0f
movq %r14, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0xca7b4(%rip), %rsi     # 0x120d1c
movq %r14, %rdi
xorl %eax, %eax
callq 0xe9226
leaq 0x8(%rsp), %rax
movq (%rax), %r12
movq 0x18(%r14), %rdi
leaq 0x48(%rsp), %rdx
movq %r12, %rsi
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1d74
movq %rbp, 0x10(%rsp)
leaq 0x58(%rsp), %rbp
leaq 0xbe2bc(%rip), %rsi     # 0x114860
movq %r14, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe9226
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
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1d74
leaq 0x28(%rsp), %rbp
leaq 0xdd90d(%rip), %rsi     # 0x133ef3
movq %r14, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe9226
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 0xef169
movq %rax, %r12
leaq 0xbe251(%rip), %rsi     # 0x11486f
movq %r14, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
movw %r12w, 0x7e(%rbx)
movb %bpl, 0x7d(%rbx)
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
addq $0x14, (%rsi)
movq 0x18(%r14), %rdi
movq %rsi, %r12
callq 0xef193
movq 0x10(%r13), %rcx
movq %rax, 0x8(%rcx)
leaq 0xca6cc(%rip), %rsi     # 0x120d27
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef34e
movq 0x10(%r13), %rcx
movq %rax, 0x10(%rcx)
leaq 0xca6c3(%rip), %rsi     # 0x120d45
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef34e
movq 0x10(%r13), %rcx
movq %rax, 0x18(%rcx)
leaq 0xca6b6(%rip), %rsi     # 0x120d5f
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef193
movq 0x18(%r13), %rcx
movq %rax, 0x8(%rcx)
leaq 0xca6aa(%rip), %rsi     # 0x120d7a
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef34e
movq 0x18(%r13), %rcx
movq %rax, 0x10(%rcx)
leaq 0xca6a1(%rip), %rsi     # 0x120d98
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef34e
movq 0x18(%r13), %rcx
movq %rax, 0x18(%rcx)
leaq 0xca694(%rip), %rsi     # 0x120db2
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq (%r12), %rsi
movq 0x20(%rbx), %rdx
movq %r14, %rdi
callq 0x56959
addq $0x1c, (%r12)
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xef193
leaq 0xca67b(%rip), %rsi     # 0x120dcd
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq (%r12), %rsi
movq 0x10(%r13), %rdx
addq $0x20, %rdx
leaq 0xca66b(%rip), %rcx     # 0x120ddc
movq %r14, %rdi
callq 0x55ab8
movq (%r12), %rsi
addq $0xc, %rsi
movq %rsi, (%r12)
movq 0x18(%r13), %rdx
addq $0x20, %rdx
leaq 0xca652(%rip), %rcx     # 0x120de6
movq %r14, %rdi
callq 0x55ab8
addq $0xc, (%r12)
movq 0x10(%rsp), %r12
movq 0x18(%r13), %rax
cmpq $0x0, 0x10(%rax)
setg 0x1(%rax)
setle %al
movq 0x10(%r13), %rcx
cmpq $0x0, 0x10(%rcx)
setg %dl
orb %al, %dl
movb %dl, 0x1(%rcx)
cmpb %bpl, %dl
jne 0x567f0
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x569bc
movq 0x10(%r13), %rax
cmpb $0x0, 0x2(%rax)
jne 0x567f0
movq 0x10(%rax), %rax
movq %rax, 0x18(%rbx)
movb $0x1, 0x10(%rbx)
movq 0x18(%r13), %rcx
cmpb $0x0, 0x1(%rcx)
je 0x5681e
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x569bc
movq 0x18(%r13), %rax
cmpb $0x0, 0x2(%rax)
jne 0x5681e
movq 0x10(%rax), %rax
movq %rax, 0x40(%rbx)
movb $0x1, 0x38(%rbx)
movq %r13, 0x8(%rbx)
leaq 0x1ef(%rip), %rax       # 0x56a18
movq %rax, 0x60(%rbx)
movq 0x18(%r15), %rax
testq %rax, %rax
je 0x56846
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %rbx, %rdi
callq 0xfcaec
movq %rbx, %rdi
callq 0xfcb73
movq 0x10(%r13), %rsi
movq %r14, %rdi
callq 0xe9752
movq 0x18(%r13), %rsi
movq %r14, %rdi
callq 0xe9752
movq %r14, %rdi
movq %r13, %rsi
callq 0xe9752
movq %rbx, %rdi
callq 0xfca9a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq