// File: /workspace/github_c_makefile_star2_O1/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, 0x8(%rsp)
leaq 0x4(%rsp), %rsi
callq 0xe958c
cmpq $0x1e, %r15
jl 0x588c0
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0xef3a0
cmpq $0x1, %rax
jne 0x588c0
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rbp
movq %rbp, %rsi
callq 0xef3a0
movl %eax, 0xf8(%r14)
leaq 0xc90d3(%rip), %rsi     # 0x1217a5
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movl 0xf8(%r14), %esi
movl $0x8, %edx
movq %rbx, %rdi
callq 0xea259
movq %rax, 0x100(%r14)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef3a0
leaq 0xc9164(%rip), %rsi     # 0x121870
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef3a0
movq %rax, 0xe0(%r14)
leaq 0xc9152(%rip), %rsi     # 0x121885
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef3a0
movq %rax, 0xe8(%r14)
leaq 0xc9145(%rip), %rsi     # 0x12189f
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x4, (%rbp)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xef1ed
movq %rax, %r13
leaq 0xc8f0d(%rip), %rsi     # 0x12168f
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
andl $0xf, %r13d
leaq 0xc9110(%rip), %rsi     # 0x1218b7
movq %rbx, %rdi
movl %r13d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq (%rbp), %rax
addq $0x2, %rax
movq %rax, (%rbp)
addq %r12, %r15
movq %r15, %rdx
subq %rax, %rdx
leaq 0xc90e8(%rip), %rsi     # 0x1218c5
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq (%rbp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq 0x18(%rbx), %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movb $0x1, 0x30(%rsp)
movq 0x100(%r14), %rax
movl $0x0, (%rax)
cmpl $0x0, 0xf8(%r14)
je 0x588b0
xorl %r12d, %r12d
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl $0x1, %esi
callq 0xf2271
movl $0x0, %ebp
testq %rax, %rax
je 0x5886c
xorl %ebp, %ebp
cmpb $0x0, 0x28(%rsp)
jne 0x588b0
incl %ebp
movq %r15, %rdi
movl $0x1, %esi
callq 0xf2271
testq %rax, %rax
jne 0x58851
movl %r13d, %ecx
shll %cl, %ebp
movq %r15, %rdi
movl %r13d, %esi
callq 0xf2271
cmpb $0x0, 0x28(%rsp)
jne 0x588b0
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 0x588b0
addl (%rcx,%r12,8), %eax
movl %eax, (%rcx,%rdx,8)
movq %rdx, %r12
jmp 0x58838
cmpl $0x2, (%rbx)
jl 0x588c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x596fb
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq