// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/pcf.c
// Function: de_run_pcf
static void de_run_pcf(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos;
	i64 k;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	d = de_malloc(c, sizeof(lctx));

	pos = 0;
	de_dbg(c, "header at %d", (int)pos);
	de_dbg_indent(c, 1);

	pos += 4; // signature

	d->table_count = de_getu32le_p(&pos);
	de_dbg(c, "table count: %u", (unsigned int)d->table_count);
	if(d->table_count>256) goto done;

	// We don't necessarily want to process the tables in the order they are
	// listed in the index, so first read the tables index into memory.
	d->tables = de_mallocarray(c, d->table_count, sizeof(struct table_entry));

	for(k=0; k<d->table_count; k++) {
		de_dbg(c, "table entry[%d] at %"I64_FMT, (int)k, pos);
		de_dbg_indent(c, 1);
		if(!do_read_table_entry(c, d, &d->tables[k], pos)) goto done;
		de_dbg_indent(c, -1);
		pos += 16;
	}

	// Now process the tables in the order we choose.

	process_table_by_type(c, d, TBLTYPE_PROPERTIES);

	if(!de_strcmp(d->charset_registry, "ISO10646")) {
		d->is_unicode = 1;
	}
	else if(!de_strcmp(d->charset_registry, "ISO8859")) {
		if(!de_strcmp(d->charset_encoding, "1")) {
			d->is_unicode = 1;
		}
		else if(!de_strcmp(d->charset_encoding, "2")) {
			d->can_translate_to_unicode = 1;
			d->src_encoding = DE_ENCODING_LATIN2;
		}
	}

	if(!process_table_by_type(c, d, TBLTYPE_METRICS)) {
		de_err(c, "Missing metrics table");
		goto done;
	}

	process_table_by_type(c, d, TBLTYPE_BDF_ENCODINGS);

	if(!d->has_encodings_table) {
		d->is_unicode = 0;
		d->can_translate_to_unicode = 0;
		for(k=0; k<d->num_chars; k++) {
			d->chars[k].codepoint = (i32)k;
		}
	}

	if(!process_table_by_type(c, d, TBLTYPE_BITMAPS)) {
		de_err(c, "Missing bitmaps table");
		goto done;
	}

	do_make_font_image(c, d);

done:
	if(d) {
		de_free(c, d->tables);
		de_free(c, d->chars);
		de_free(c, d->bitmaps_data);
		de_free(c, d);
	}
	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 %rdi, %rbx
leaq 0x24(%rsp), %rsi
callq 0xe8a1c
movl $0xa8, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %r15
movq %rax, %r14
leaq 0x7a3b1(%rip), %rsi     # 0x1396ee
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq 0x10(%rsp), %rsi
movq $0x4, (%rsi)
movq 0x18(%rbx), %rdi
callq 0xeed83
movq %rax, (%r15)
leaq 0x7a728(%rip), %rsi     # 0x139a9d
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq %r15, 0x8(%rsp)
movq (%r15), %rsi
cmpq $0x100, %rsi            # imm = 0x100
jg 0xbf92c
movl $0x48, %edx
movq %rbx, %rdi
callq 0xe96f7
movq %rax, 0x8(%r14)
cmpq $0x0, (%r14)
movq 0x8(%rsp), %r15
jle 0xbf790
movl $0x40, %r12d
movq 0x10(%rsp), %rcx
leaq 0x28(%rsp), %r13
xorl %ebp, %ebp
movq %rbx, %rdi
leaq 0x7a6db(%rip), %rsi     # 0x139aad
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x8(%r14), %r15
movq 0x10(%rsp), %rax
movq %rax, 0x28(%rsp)
addq $0x10, %rax
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %rax
jg 0xbf92c
movq %r13, %rsi
callq 0xeed83
movl %eax, -0x20(%r15,%r12)
cmpl $0x1f, %eax
jg 0xbf44a
leal -0x1(%rax), %ecx
cmpl $0x7, %ecx
ja 0xbf47c
leaq 0x7a647(%rip), %rdx     # 0x139a70
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0x56659(%rip), %rcx     # 0x115a92
movq %rcx, -0x8(%r15,%r12)
leaq 0x791(%rip), %rdx       # 0xbfbd6
jmp 0xbf4d9
cmpl $0x7f, %eax
jg 0xbf465
cmpl $0x20, %eax
je 0xbf4c6
cmpl $0x40, %eax
jne 0xbf48a
leaq 0x7a732(%rip), %rcx     # 0x139b92
jmp 0xbf4e6
cmpl $0x80, %eax
je 0xbf4df
cmpl $0x100, %eax            # imm = 0x100
jne 0xbf48a
leaq 0x7a72c(%rip), %rcx     # 0x139ba6
jmp 0xbf4e6
cmpl $0x10, %eax
jne 0xbf48a
leaq 0x7a6f0(%rip), %rcx     # 0x139b78
jmp 0xbf4e6
leaq 0x6ccc0(%rip), %rcx     # 0x12c151
jmp 0xbf4e6
leaq 0x5fbc2(%rip), %rcx     # 0x11f05c
movq %rcx, -0x8(%r15,%r12)
leaq 0xe6f(%rip), %rdx       # 0xc0315
jmp 0xbf4d9
leaq 0x7a6fb(%rip), %rcx     # 0x139baa
jmp 0xbf4e6
leaq 0x7a6c4(%rip), %rcx     # 0x139b7c
movq %rcx, -0x8(%r15,%r12)
leaq 0x9fe(%rip), %rdx       # 0xbfec2
jmp 0xbf4d9
leaq 0x7a6b7(%rip), %rcx     # 0x139b84
movq %rcx, -0x8(%r15,%r12)
leaq 0x109d(%rip), %rdx      # 0xc0576
movq %rdx, (%r15,%r12)
jmp 0xbf4eb
leaq 0x7a6b4(%rip), %rcx     # 0x139b9a
movq %rcx, -0x8(%r15,%r12)
movq %rbx, %rdi
leaq 0x6e477(%rip), %rsi     # 0x12d96c
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x28(%rsp), %rsi
movq 0x18(%rbx), %rdi
callq 0xeed61
movl %eax, -0x40(%r15,%r12)
movq %rbx, %rdi
leaq 0x7a6f7(%rip), %rsi     # 0x139c12
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movl -0x40(%r15,%r12), %edx
leaq 0x7a9d7(%rip), %rcx     # 0x139f14
movl $0xffffff00, %eax       # imm = 0xFFFFFF00
andl %eax, %edx
movl %edx, -0x3c(%r15,%r12)
je 0xbf5a4
cmpl $0x100, %edx            # imm = 0x100
jne 0xbf583
movl -0x20(%r15,%r12), %eax
cmpl $0xf, %eax
jg 0xbf570
leaq 0x7a9b8(%rip), %rcx     # 0x139f1c
cmpl $0x2, %eax
je 0xbf5a4
cmpl $0x4, %eax
je 0xbf59d
jmp 0xbf583
cmpl $0x10, %eax
je 0xbf59d
leaq 0x7a9a0(%rip), %rcx     # 0x139f1c
cmpl $0x100, %eax            # imm = 0x100
je 0xbf5a4
cmpl $0x200, %edx            # imm = 0x200
leaq 0x6cbc1(%rip), %rcx     # 0x12c151
leaq 0x7a98d(%rip), %rax     # 0x139f24
cmoveq %rax, %rcx
jmp 0xbf5a4
leaq 0x7a98a(%rip), %rcx     # 0x139f2e
movq %rbx, %rdi
leaq 0x7a993(%rip), %rsi     # 0x139f41
xorl %eax, %eax
callq 0xe8617
movl -0x40(%r15,%r12), %ecx
andl $0x3, %ecx
movl %ecx, -0x38(%r15,%r12)
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x34(%r15,%r12)
movq %rbx, %rdi
leaq 0x7a983(%rip), %rsi     # 0x139f5b
movl %ecx, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
movl -0x40(%r15,%r12), %eax
andl $0x4, %eax
movl %eax, %ecx
shrl $0x2, %ecx
xorl $0x1, %ecx
testl %eax, %eax
movl %ecx, -0x30(%r15,%r12)
leaq 0x651e4(%rip), %rdx     # 0x1247e5
leaq 0x5d56d(%rip), %rax     # 0x11cb75
cmoveq %rax, %rdx
movq %rbx, %rdi
leaq 0x7a96f(%rip), %rsi     # 0x139f85
xorl %eax, %eax
callq 0xe8617
movl -0x40(%r15,%r12), %eax
andl $0x8, %eax
movl %eax, %ecx
shrl $0x3, %ecx
testl %eax, %eax
movl %ecx, -0x2c(%r15,%r12)
leaq 0x7a970(%rip), %rdx     # 0x139fa8
leaq 0x58741(%rip), %rax     # 0x117d80
cmoveq %rax, %rdx
movq %rbx, %rdi
leaq 0x7a947(%rip), %rsi     # 0x139f94
xorl %eax, %eax
callq 0xe8617
movl -0x40(%r15,%r12), %ecx
shrl $0x4, %ecx
andl $0x3, %ecx
movl %ecx, -0x28(%r15,%r12)
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x24(%r15,%r12)
movq %rbx, %rdi
leaq 0x7a932(%rip), %rsi     # 0x139fac
movl %ecx, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
addq $0x4, 0x28(%rsp)
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xeed83
movq %rax, -0x18(%r15,%r12)
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xeed83
movq %rax, -0x10(%r15,%r12)
movq -0x18(%r15,%r12), %rcx
movq %rbx, %rdi
leaq 0x7a438(%rip), %rsi     # 0x139b01
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq -0x18(%r15,%r12), %r8
movq -0x10(%r15,%r12), %rcx
leaq (%r8,%rcx), %rax
movq 0x18(%rbx), %rdx
cmpq 0x18(%rdx), %rax
jle 0xbf71f
cmpl $0x100, -0x20(%r15,%r12) # imm = 0x100
jne 0xbf709
movq %rbx, %rdi
leaq 0x7a418(%rip), %rsi     # 0x139b18
xorl %eax, %eax
callq 0xe8617
jmp 0xbf71f
movq -0x8(%r15,%r12), %rdx
movq %rbx, %rdi
leaq 0x7a420(%rip), %rsi     # 0x139b38
xorl %eax, %eax
callq 0xe8faa
movq -0x10(%r15,%r12), %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jg 0xbf92c
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x10(%rsp), %rcx
addq $0x10, %rcx
movq %rcx, 0x10(%rsp)
incq %rbp
movq (%r14), %rax
addq $0x48, %r12
cmpq %rax, %rbp
jl 0xbf3c8
testq %rax, %rax
movq 0x8(%rsp), %r15
jle 0xbf790
movq 0x8(%r14), %rdx
cmpl $0x1, 0x20(%rdx)
je 0xbf77f
addq $0x48, %rdx
decq %rax
jne 0xbf76e
jmp 0xbf790
movq 0x40(%rdx), %rax
testq %rax, %rax
je 0xbf790
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
addq $0x58, %r15
leaq 0x7a329(%rip), %rsi     # 0x139ac4
movq %r15, %rdi
callq 0x181a0
testl %eax, %eax
je 0xbf7da
leaq 0x7a31f(%rip), %rsi     # 0x139acd
movq %r15, %rdi
callq 0x181a0
testl %eax, %eax
jne 0xbf7df
movzbl 0x80(%r14), %eax
cmpl $0x32, %eax
je 0xbfb58
cmpl $0x31, %eax
jne 0xbf7df
cmpb $0x0, 0x81(%r14)
jne 0xbf7df
movb $0x1, 0x51(%r14)
movq (%r14), %rax
testq %rax, %rax
jle 0xbf7fd
movq 0x8(%r14), %rdx
movq %rax, %rcx
cmpl $0x4, 0x20(%rdx)
je 0xbf809
addq $0x48, %rdx
decq %rcx
jne 0xbf7ee
leaq 0x7a2d1(%rip), %rsi     # 0x139ad5
jmp 0xbf922
movq 0x40(%rdx), %rcx
testq %rcx, %rcx
je 0xbf81d
movq %rbx, %rdi
movq %r14, %rsi
callq *%rcx
movq (%r14), %rax
testq %rax, %rax
jle 0xbf848
movq 0x8(%r14), %rdx
cmpl $0x20, 0x20(%rdx)
je 0xbf837
addq $0x48, %rdx
decq %rax
jne 0xbf826
jmp 0xbf848
movq 0x40(%rdx), %rax
testq %rax, %rax
je 0xbf848
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
cmpb $0x0, 0x50(%r14)
jne 0xbf900
movw $0x0, 0x51(%r14)
movq 0x10(%r14), %rdx
testq %rdx, %rdx
jle 0xbf900
movq 0x18(%r14), %rax
leaq 0x1(%rdx), %rcx
andq $-0x2, %rcx
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
addq $0x1c, %rax
movdqa 0x70e44(%rip), %xmm1    # 0x1306d0
xorl %edx, %edx
movdqa 0x70e4a(%rip), %xmm2    # 0x1306e0
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x70e5a(%rip), %xmm4    # 0x130700
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %esi
notl %esi
testb $0x1, %sil
je 0xbf8db
movl %edx, -0x18(%rax)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0xbf8ef
leal 0x1(%rdx), %esi
movl %esi, (%rax)
addq $0x2, %rdx
paddq %xmm4, %xmm1
addq $0x30, %rax
cmpq %rdx, %rcx
jne 0xbf8a6
movq (%r14), %rax
testq %rax, %rax
jle 0xbf91b
movq 0x8(%r14), %rdx
cmpl $0x8, 0x20(%rdx)
je 0xbf976
addq $0x48, %rdx
decq %rax
jne 0xbf90c
leaq 0x7a1c9(%rip), %rsi     # 0x139aeb
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0xe8be2
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0xe8be2
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0xe8be2
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
movl 0x24(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x40(%rdx), %rax
testq %rax, %rax
je 0xbf987
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
cmpq $0x0, 0x18(%r14)
je 0xbf92c
cmpq $0x0, 0x28(%r14)
je 0xbf92c
movq %rbx, %rdi
callq 0xf5358
movq 0x10(%r14), %rsi
movq %rsi, 0x18(%rax)
movb $0x1, 0x10(%rax)
cmpb $0x0, 0x51(%r14)
jne 0xbf9b7
cmpb $0x0, 0x52(%r14)
je 0xbf9bd
movw $0x101, 0x11(%rax)      # imm = 0x101
movl $0x28, %edx
movq %rbx, %rdi
movq %rax, 0x18(%rsp)
callq 0xe96f7
movq 0x18(%rsp), %rcx
movq %rax, 0x20(%rcx)
movl 0x54(%r14), %esi
leaq 0x28(%rsp), %rdi
callq 0xebbf7
movq 0x18(%rsp), %rsi
movq 0x18(%rsi), %rax
testq %rax, %rax
jle 0xbfb78
movq 0x18(%r14), %rcx
addq $0x16, %rcx
xorl %r10d, %r10d
movl $0x1, %r9d
xorl %edx, %edx
cmpl $0xfffffff, -0x12(%rcx) # imm = 0xFFFFFFF
je 0xbfa3f
movswl -0x2(%rcx), %edi
addl -0xe(%rcx), %edi
movswl (%rcx), %r8d
addl %edi, %r8d
cmpl %r9d, %r8d
cmovgl %r8d, %r9d
movl -0xa(%rcx), %edi
movl -0x6(%rcx), %r8d
cmpl %r10d, %r8d
cmovgl %r8d, %r10d
subl %r8d, %edi
cmpl %edx, %edi
cmovgl %edi, %edx
addq $0x18, %rcx
decq %rax
jne 0xbfa0b
movl %r9d, (%rsi)
movl %r10d, 0x20(%rsp)
addl %r10d, %edx
cmpl $0x2, %edx
movl $0x1, %eax
cmovgel %edx, %eax
movl %eax, 0x4(%rsi)
movl $0x14, %r13d
xorl %r12d, %r12d
xorl %r15d, %r15d
movq 0x18(%r14), %rbp
movl -0x10(%rbp,%r13), %eax
cmpl $0xfffffff, %eax        # imm = 0xFFFFFFF
je 0xbfb41
movq 0x20(%rsi), %rdx
movl %eax, (%rdx,%r12)
cmpb $0x0, 0x51(%r14)
movq %rdx, 0x8(%rsp)
jne 0xbfaad
cmpb $0x0, 0x52(%r14)
je 0xbfab2
movl %eax, %edi
leaq 0x28(%rsp), %rsi
callq 0xec0ad
movq 0x8(%rsp), %rdx
movl %eax, 0x4(%rdx,%r12)
movl -0xc(%rbp,%r13), %eax
movl %eax, 0x8(%rdx,%r12)
movl -0x8(%rbp,%r13), %ecx
movl %ecx, 0xc(%rdx,%r12)
testl %eax, %eax
jns 0xbfad3
movl $0x0, 0x8(%rdx,%r12)
testl %ecx, %ecx
jns 0xbfae0
movl $0x0, 0xc(%rdx,%r12)
movl 0x20(%rsp), %ecx
subl -0x4(%rbp,%r13), %ecx
movl %ecx, 0x10(%rdx,%r12)
leal 0x7(%rax), %ecx
addl $0xe, %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
movl (%rbp,%r13), %ecx
movl %ecx, 0x14(%rdx,%r12)
sarl $0x3, %eax
movslq %eax, %rdi
movl 0x3c(%r14), %esi
callq 0xe9cb4
movq 0x8(%rsp), %rdx
movq %rax, 0x18(%rdx,%r12)
movslq -0x8(%rbp,%r13), %rcx
imulq %rax, %rcx
movl -0x14(%rbp,%r13), %eax
addq %rax, %rcx
cmpq 0x20(%r14), %rcx
movq 0x18(%rsp), %rsi
jg 0xbfb41
addq 0x28(%r14), %rax
movq %rax, 0x20(%rdx,%r12)
incq %r15
addq $0x18, %r13
addq $0x28, %r12
cmpq 0x18(%rsi), %r15
jl 0xbfa6d
jmp 0xbfb85
cmpb $0x0, 0x81(%r14)
jne 0xbf7df
movb $0x1, 0x52(%r14)
movl $0x6, 0x54(%r14)
jmp 0xbf7df
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, (%rsi)
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movq %rsi, %r15
callq 0xf576f
movq 0x20(%r15), %rsi
movq %rbx, %rdi
callq 0xe8be2
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf536d
jmp 0xbf92c