// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/zip.c
// Function: ef_unicodepath
static void ef_unicodepath(deark *c, lctx *d, struct extra_item_info_struct *eii)
{
	u8 ver;
	de_ucstring *fn = NULL;
	i64 fnlen;
	u32 crc_reported, crc_calculated;

	if(eii->dlen<1) goto done;
	ver = de_getbyte(eii->dpos);
	de_dbg(c, "version: %u", (UI)ver);
	if(ver!=1) goto done;
	if(eii->dlen<6) goto done;
	crc_reported = (u32)de_getu32le(eii->dpos+1);
	de_dbg(c, "name-crc (reported): 0x%08x", (UI)crc_reported);
	fn = ucstring_create(c);
	fnlen = eii->dlen - 5;
	dbuf_read_to_ucstring(c->infile, eii->dpos+5, fnlen, fn, 0, DE_ENCODING_UTF8);
	de_dbg(c, "unicode name: \"%s\"", ucstring_getpsz_d(fn));

	// Need to go back and calculate a CRC of the main filename. This is
	// protection against the case where a ZIP editor may have changed the
	// original filename, but retained a now-orphaned Unicode Path field.
	de_crcobj_reset(d->crco);
	de_crcobj_addslice(d->crco, c->infile, eii->dd->main_fname_pos, eii->dd->main_fname_len);
	crc_calculated = de_crcobj_getval(d->crco);
	de_dbg(c, "name-crc (calculated): 0x%08x", (UI)crc_calculated);

	if(crc_calculated == crc_reported) {
		ucstring_empty(eii->dd->fname);
		ucstring_append_ucstring(eii->dd->fname, fn);
	}

done:
	ucstring_destroy(fn);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x1, 0x10(%rax)
jge 0x14c0fc
jmp 0x14c27e
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x165060
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x19(%rbp), %edx
leaq 0x76563(%rip), %rsi     # 0x1c2686
movb $0x0, %al
callq 0x15b0d0
movzbl -0x19(%rbp), %eax
cmpl $0x1, %eax
je 0x14c138
jmp 0x14c27e
movq -0x18(%rbp), %rax
cmpq $0x6, 0x10(%rax)
jge 0x14c148
jmp 0x14c27e
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x1, %rsi
callq 0x165540
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %edx
leaq 0x83d31(%rip), %rsi     # 0x1cfea3
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
subq $0x5, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0x5, %rsi
movq -0x30(%rbp), %rdx
movq -0x28(%rbp), %rcx
xorl %r8d, %r8d
movl $0x2, %r9d
callq 0x1669f0
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
callq 0x172650
movq -0x40(%rbp), %rdi
movq %rax, %rdx
leaq 0x83ce0(%rip), %rsi     # 0x1cfebf
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0xb8(%rax), %rdi
callq 0x15f250
movq -0x10(%rbp), %rax
movq 0xb8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x38(%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x40(%rax), %rcx
callq 0x15f500
movq -0x10(%rbp), %rax
movq 0xb8(%rax), %rdi
callq 0x15f340
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movl -0x38(%rbp), %edx
leaq 0x83c8b(%rip), %rsi     # 0x1cfed2
movb $0x0, %al
callq 0x15b0d0
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x14c27c
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x48(%rax), %rdi
callq 0x171210
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x48(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x171460
jmp 0x14c27e
movq -0x28(%rbp), %rdi
callq 0x171750
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)