// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/olepropset.c
// Function: do_prop_CodePageString2
static void do_prop_CodePageString2(deark *c, lctx *d, struct propset_struct *si,
	const char *name, i64 dpos, int is_dict_name, i64 *bytes_consumed,
	de_ucstring *s)
{
	i64 n_raw;
	int is_utf16 = (si->code_page==1200);
	de_encoding encoding = si->encoding;

	if(is_utf16 && is_dict_name && d->asciipropnames) {
		// A hack that the user can enable. Some dictionaries use an 8-bit
		// encoding even though they have CodePage=1200, and I don't know
		// how to detect this.
		is_utf16 = 0;
		encoding = DE_ENCODING_ASCII;
	}

	n_raw = dbuf_getu32le(d->f, dpos);

	if(is_utf16) {
		i64 n;

		if(is_dict_name) {
			n = n_raw*2;
		}
		else {
			n = n_raw;
		}
		dbuf_read_to_ucstring_n(d->f, dpos+4, n, DE_DBG_MAX_STRLEN*2, s,
			0, encoding);
		ucstring_truncate_at_NUL(s);
		if(is_dict_name) {
			*bytes_consumed = 4 + de_pad_to_4(n_raw*2);
		}
		else {
			*bytes_consumed = 4 + de_pad_to_4(n_raw);
		}
	}
	else {
		dbuf_read_to_ucstring_n(d->f, dpos+4, n_raw, DE_DBG_MAX_STRLEN, s,
			DE_CONVFLAG_STOP_AT_NUL, encoding);
		*bytes_consumed = 4 + n_raw;
	}
	de_dbg(c, "%s: \"%s\"", name, ucstring_getpsz(s));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x4b0, 0xc(%rax)       # imm = 0x4B0
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0xcaf9c
cmpl $0x0, -0x2c(%rbp)
je 0xcaf9c
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0xcaf9c
movl $0x0, -0x3c(%rbp)
movl $0x1, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x165540
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0xcb043
cmpl $0x0, -0x2c(%rbp)
je 0xcafcd
movq -0x38(%rbp), %rax
shlq %rax
movq %rax, -0x48(%rbp)
jmp 0xcafd5
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
addq $0x4, %rsi
movq -0x48(%rbp), %rdx
movq 0x18(%rbp), %r8
movl -0x40(%rbp), %eax
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %r9d, %r9d
movl %eax, (%rsp)
callq 0x166a40
movq 0x18(%rbp), %rdi
callq 0x1712b0
cmpl $0x0, -0x2c(%rbp)
je 0xcb02a
movq -0x38(%rbp), %rdi
shlq %rdi
callq 0x15ce30
movq %rax, %rcx
addq $0x4, %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0xcb041
movq -0x38(%rbp), %rdi
callq 0x15ce30
movq %rax, %rcx
addq $0x4, %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0xcb07f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
addq $0x4, %rsi
movq -0x38(%rbp), %rdx
movq 0x18(%rbp), %r8
movl -0x40(%rbp), %eax
movl $0x1f4, %ecx            # imm = 0x1F4
movl $0x1, %r9d
movl %eax, (%rsp)
callq 0x166a40
movq -0x38(%rbp), %rcx
addq $0x4, %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movq 0x18(%rbp), %rdi
callq 0x172500
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rdx
movq %rax, %rcx
leaq 0xecb5c(%rip), %rsi     # 0x1b7c06
movb $0x0, %al
callq 0x15b0d0
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)