// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x8(%rax)
je 0x10626b
jmp 0x1063e6
movq -0x10(%rbp), %rax
movb $0x1, 0x8(%rax)
movq -0x28(%rbp), %rax
movl $0x9, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rax
movl %eax, %edx
leaq 0xa4872(%rip), %rsi     # 0x1aab19
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
movl $0x28, %edx
callq 0x15c450
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x20(%rax)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
cmpq 0x18(%rcx), %rax
jge 0x1063d0
movq -0x20(%rbp), %rax
imulq $0x9, -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x165470
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0x4, %rsi
callq 0x165060
movzbl %al, %eax
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0x5, %rsi
callq 0x165470
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %edx
movq -0x38(%rbp), %rax
movl %eax, %ecx
movq -0x40(%rbp), %rax
movl %eax, %r8d
leaq 0xbbde2(%rip), %rsi     # 0x1c2147
movb $0x0, %al
callq 0x15b350
movl -0x48(%rbp), %eax
andl $0x7, %eax
cmpl $0x0, %eax
je 0x10638b
movq -0x8(%rbp), %rdi
leaq 0xbbdf6(%rip), %rsi     # 0x1c2178
movb $0x0, %al
callq 0x15bfb0
jmp 0x1063e6
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0x44(%rbp), %ecx
movq -0x40(%rbp), %r8
callq 0x1063f0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1062dd
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x16fe80
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)