// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/hlp.c
// Function: do_file_PhrIndex
static void do_file_PhrIndex(deark *c, lctx *d, i64 pos1, i64 len)
{
	i64 pos = pos1;
	i64 cmprsize;
	i64 n;
	UI bits;
	UI bitcount;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	if(len<30) goto done;
	n = de_getu32le_p(&pos);
	if(n!=1) goto done;
	d->num_phrases = (UI)de_getu32le_p(&pos);
	de_dbg(c, "num phrases: %u", d->num_phrases);
	d->phrase_info = de_mallocarray(c, (i64)d->num_phrases, sizeof(struct phrase_item));

	cmprsize = de_getu32le_p(&pos);
	de_dbg(c, "index cmpr size: %"I64_FMT, cmprsize);
	d->PhrImageUncSize = de_getu32le_p(&pos);
	de_dbg(c, "PhrImage uncmpr size: %"I64_FMT, d->PhrImageUncSize);
	d->PhrImageCmprSize = de_getu32le_p(&pos);
	de_dbg(c, "PhrImage cmpr size: %"I64_FMT, d->PhrImageCmprSize);
	pos += 4;
	bits = (UI)de_getu16le_p(&pos);
	de_dbg(c, "bits: 0x%04x", bits);
	de_dbg_indent(c, 1);
	bitcount = bits & 0xf;
	de_dbg(c, "bit count: %u", bitcount);
	de_dbg_indent(c, -1);
	pos += 2;

	de_dbg(c, "avail size: %"I64_FMT, (i64)(pos1+len-pos));
	phrdecompress(c, d, pos, pos1+len-pos, bitcount);
done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq %rdx, 0x10(%rsp)
leaq 0xc(%rsp), %rsi
callq 0xe8a1c
cmpq $0x1e, %r15
jl 0x586a7
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0xeed83
cmpq $0x1, %rax
jne 0x586a7
movq 0x18(%rbx), %rdi
leaq 0x10(%rsp), %rbp
movq %rbp, %rsi
callq 0xeed83
movl %eax, 0xf8(%r14)
leaq 0xc93f7(%rip), %rsi     # 0x1218b1
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movl 0xf8(%r14), %esi
movl $0x8, %edx
movq %rbx, %rdi
callq 0xe96f7
movq %rax, 0x100(%r14)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xeed83
leaq 0xc9488(%rip), %rsi     # 0x12197c
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xeed83
movq %rax, 0xe0(%r14)
leaq 0xc9476(%rip), %rsi     # 0x121991
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xeed83
movq %rax, 0xe8(%r14)
leaq 0xc9469(%rip), %rsi     # 0x1219ab
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
addq $0x4, (%rbp)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xeebeb
movq %rax, %r13
leaq 0xc9231(%rip), %rsi     # 0x12179b
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
andl $0xf, %r13d
leaq 0xc9434(%rip), %rsi     # 0x1219c3
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq (%rbp), %rax
addq $0x2, %rax
movq %rax, (%rbp)
addq %r12, %r15
movq %r15, %rdx
subq %rax, %rdx
leaq 0xc940c(%rip), %rsi     # 0x1219d1
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq (%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x18(%rbx), %rcx
movq %rcx, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movq %r15, 0x28(%rsp)
movb $0x1, 0x38(%rsp)
movq 0x100(%r14), %rax
movl $0x0, (%rax)
cmpl $0x0, 0xf8(%r14)
je 0x58697
xorl %r12d, %r12d
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0xf1bed
movl $0x0, %ebp
testq %rax, %rax
je 0x58653
xorl %ebp, %ebp
cmpb $0x0, 0x30(%rsp)
jne 0x58697
incl %ebp
movq %r15, %rdi
movl $0x1, %esi
callq 0xf1bed
testq %rax, %rax
jne 0x58638
movl %r13d, %ecx
shll %cl, %ebp
movq %r15, %rdi
movl %r13d, %esi
callq 0xf1bed
cmpb $0x0, 0x30(%rsp)
jne 0x58697
addl %ebp, %eax
incl %eax
movq 0x100(%r14), %rcx
movl %eax, 0x4(%rcx,%r12,8)
leaq 0x1(%r12), %rdx
movl 0xf8(%r14), %esi
cmpq %rsi, %rdx
jae 0x58697
addl (%rcx,%r12,8), %eax
movl %eax, (%rcx,%rdx,8)
movq %rdx, %r12
jmp 0x5861f
cmpl $0x2, (%rbx)
jl 0x586a7
movq %rbx, %rdi
movq %r14, %rsi
callq 0x594fb
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq