// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/pff2.c
// Function: do_code_chix
static void do_code_chix(deark *c, lctx *d, const struct pff2_sectiontype_info *si,
	i64 pos1, i64 len)
{
	i64 i;
	i64 pos;
	i64 defpos;
	i32 codepoint;
	unsigned int storage_flags;

	if(d->found_CHIX_chunk) goto done;
	d->found_CHIX_chunk = 1;

	d->font->num_chars = len/9;
	de_dbg(c, "number of characters: %d", (int)d->font->num_chars);

	d->font->char_array = de_mallocarray(c, d->font->num_chars, sizeof(struct de_bitmap_font_char));

	for(i=0; i<d->font->num_chars; i++) {
		pos = pos1 + 9*i;
		codepoint = (i32)de_getu32be(pos);
		storage_flags = (unsigned int)de_getbyte(pos+4);
		defpos = de_getu32be(pos+5);
		de_dbg2(c, "code point U+%04X, index at %d, definition at %d",
			(unsigned int)codepoint, (int)pos, (int)defpos);
		if((storage_flags&0x07)!=0) {
			de_err(c, "Compressed PFF2 format is not supported");
			goto done;
		}
		de_dbg_indent(c, 1);
		do_char(c, d, i, codepoint, defpos);
		de_dbg_indent(c, -1);
	}

	de_font_bitmap_font_to_image(c, d->font, NULL, 0);

done: ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpb $0x0, 0x8(%rsi)
je 0xb291e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r15
movq %rdi, %r13
movq %rcx, 0x10(%rsp)
movb $0x1, 0x8(%rsi)
movabsq $0x1c71c71c71c71c72, %rcx # imm = 0x1C71C71C71C71C72
movq %r8, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
addq %rax, %rdx
movq (%rsi), %rax
movq %rdx, 0x18(%rax)
leaq 0x6c540(%rip), %rsi     # 0x11ee95
xorl %eax, %eax
callq 0xe9226
movq (%r15), %rax
movq 0x18(%rax), %rsi
movl $0x28, %edx
movq %r13, %rdi
callq 0xea259
movq (%r15), %rsi
movq %rax, 0x20(%rsi)
cmpq $0x0, 0x18(%rsi)
jle 0xb2b4e
xorl %r12d, %r12d
movq %r15, %r14
leaq (%r12,%r12,8), %rbp
movq 0x10(%rsp), %r15
leaq (%r15,%rbp), %rsi
movq %rsi, 0x8(%rsp)
movq 0x18(%r13), %rdi
callq 0xef32a
movq %rax, %rbx
movq 0x18(%r13), %rdi
leaq (%r15,%rbp), %rsi
addq $0x4, %rsi
callq 0xef0d5
movb %al, 0x7(%rsp)
movq 0x18(%r13), %rdi
leaq (%r15,%rbp), %rsi
addq $0x5, %rsi
callq 0xef32a
movq %rax, %rbp
movq %r13, %rdi
leaq 0x83aa2(%rip), %rsi     # 0x13647b
movl %ebx, %edx
movq 0x8(%rsp), %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0xe93cf
testb $0x7, 0x7(%rsp)
jne 0xb2b68
movq %r13, %rdi
movl $0x1, %esi
callq 0xe9585
movq %r14, %r15
movq (%r14), %rax
movq 0x20(%rax), %r14
movq %r12, 0x8(%rsp)
leaq (%r12,%r12,4), %r12
movl %ebx, 0x4(%r14,%r12,8)
movq 0x18(%r13), %rdi
movq %rbp, %rsi
callq 0xef169
movl %eax, 0x8(%r14,%r12,8)
movq 0x18(%r13), %rdi
leaq 0x2(%rbp), %rsi
callq 0xef169
movl %eax, 0xc(%r14,%r12,8)
movl 0x8(%r14,%r12,8), %edx
movq (%r15), %rcx
cmpl (%rcx), %edx
movq %r13, %rbx
jle 0xb2a4e
movl %edx, (%rcx)
cmpl %eax, 0x4(%rcx)
jge 0xb2a56
movl %eax, 0x4(%rcx)
leaq (%r14,%r12,8), %r12
addq $0xa, %rbp
movq %rbx, %rdi
leaq 0x83a6c(%rip), %rsi     # 0x1364d4
movl %eax, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0xe93cf
movl 0x8(%r12), %eax
leal 0x7(%rax), %ecx
leal 0xe(%rax), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
sarl $0x3, %edx
movslq %edx, %rcx
movq %rcx, 0x18(%r12)
imull 0xc(%r12), %eax
leal 0x7(%rax), %ecx
addl $0xe, %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
sarl $0x3, %eax
movslq %eax, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe969b
movq %rax, %r13
movq 0x18(%rbx), %rdi
movq %rax, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0xeeee8
movslq 0xc(%r12), %rsi
imulq 0x18(%r12), %rsi
movq %rbx, %rdi
callq 0xe969b
movq %rax, 0x20(%r12)
cmpl $0x0, 0xc(%r12)
jle 0xb2b1e
xorl %r14d, %r14d
xorl %ebp, %ebp
movslq 0x8(%r12), %r8
movq %rbp, %rsi
imulq %r8, %rsi
movq 0x20(%r12), %rdx
movq 0x18(%r12), %rcx
imulq %r14, %rcx
movq %r13, %rdi
callq 0xeb7ec
incq %rbp
movslq 0xc(%r12), %rax
addq $0x8, %r14
cmpq %rax, %rbp
jl 0xb2aeb
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe9752
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq %rbx, %r13
movq 0x8(%rsp), %r12
incq %r12
movq (%r15), %rsi
cmpq 0x18(%rsi), %r12
jl 0xb2985
movq %r13, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf5c29
leaq 0x8393d(%rip), %rsi     # 0x1364ac
movq %r13, %rdi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe9df7
nop