// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/olepropset.c
// Function: do_dictionary
static void do_dictionary(deark *c, lctx *d, struct propset_struct *si,
	struct prop_info_struct *pinfo)
{
	size_t k;
	int saved_indent_level;
	i64 pos = si->tbloffset+pinfo->data_offs_rel;

	de_dbg_indent_save(c, &saved_indent_level);
	if(si->dictionary) goto done;
	si->num_dict_entries = (size_t)dbuf_getu32le_p(d->f, &pos);
	de_dbg(c, "number of dictionary entries: %u", (unsigned int)si->num_dict_entries);
	if(si->num_dict_entries > 500) {
		si->num_dict_entries = 0;
		goto done;
	}

	si->dictionary = de_mallocarray(c, (i64)si->num_dict_entries, sizeof(struct dictionary_entry));

	for(k=0; k<si->num_dict_entries; k++) {
		i64 bytes_consumed = 0;

		if(pos >= d->f->len) {
			de_warn(c, "Malformed Property Set dictionary, or unsupported dictionary format");
			break;
		}

		de_dbg(c, "entry[%u]:", (unsigned int)k);
		de_dbg_indent(c, 1);
		si->dictionary[k].prop_id = (u32)dbuf_getu32le_p(d->f, &pos);
		de_dbg(c, "prop id: 0x%08x", (unsigned int)si->dictionary[k].prop_id);
		si->dictionary[k].str = ucstring_create(c);
		do_prop_CodePageString2(c, d, si, "name", pos, 1, &bytes_consumed, si->dictionary[k].str);
		pos += bytes_consumed;
		de_dbg_indent(c, -1);
	}

done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
addq 0x8(%rcx), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x15b580
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xcab58
jmp 0xcad23
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165580
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %edx
leaq 0xee7a0(%rip), %rsi     # 0x1b9328
movb $0x0, %al
callq 0x15b0d0
movq -0x18(%rbp), %rax
cmpq $0x1f4, 0x18(%rax)      # imm = 0x1F4
jbe 0xcabae
movq -0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
jmp 0xcad23
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
movl $0x10, %edx
callq 0x15c450
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jae 0xcad21
movq $0x0, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
cmpq 0x18(%rcx), %rax
jl 0xcac19
movq -0x8(%rbp), %rdi
leaq 0xee73c(%rip), %rsi     # 0x1b9349
movb $0x0, %al
callq 0x15bc10
jmp 0xcad21
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0xee763(%rip), %rsi     # 0x1b938d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x165580
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %edx
leaq 0xee712(%rip), %rsi     # 0x1b9398
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x38(%rbp), %r8
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
leaq 0xe9310(%rip), %rcx     # 0x1b3fee
movl $0x1, %r9d
leaq -0x40(%rbp), %r10
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xcaf30
movq -0x40(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xcabd7
jmp 0xcad23
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x15b5a0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)