// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/fnt.c
// Function: do_postprocess_char_table
static int do_postprocess_char_table(deark *c, lctx *d)
{
	i64 k;
	int retval = 0;

	d->detected_max_width = 0;

	for(k=0; k<d->num_chars_stored; k++) {
		int codepoint;

		if(d->has_abs_space_char && (k==d->num_chars_stored-1)) {
			d->char_table[k].is_abs_space = 1;
		}

		// TODO: Maybe codepoint should be a field in char_table_entry.
		if(d->char_table[k].is_abs_space) {
			codepoint = 256;
		}
		else {
			codepoint = (int)((int)d->first_char + (int)k);
		}

		if(d->fnt_version==0x100) {
			de_dbg2(c, "char[%d] codepoint=%d pixoffset=%d width=%d", (int)k, codepoint,
				(int)d->char_table[k].v1_pixel_offset, d->char_table[k].pixel_width);
		}
		else {
			de_dbg2(c, "char[%d] codepoint=%d bitmappos=%d width=%d", (int)k, codepoint,
				(int)d->char_table[k].v23_data_pos, d->char_table[k].pixel_width);
		}

		if(d->char_table[k].pixel_width > d->detected_max_width) {
			d->detected_max_width = d->char_table[k].pixel_width;
		}
	}

	de_dbg(c, "detected max width: %d", d->detected_max_width);

	if(d->detected_max_width<1) goto done;
	d->nominal_char_width = d->detected_max_width;

	retval = 1;
done:
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, 0x68(%rax)
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jge 0x6f5e1
movq -0x10(%rbp), %rax
cmpl $0x0, 0x80(%rax)
je 0x6f4d2
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x48(%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x6f4d2
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
imulq $0x18, -0x18(%rbp), %rcx
addq %rcx, %rax
movb $0x1, 0x4(%rax)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
imulq $0x18, -0x18(%rbp), %rcx
addq %rcx, %rax
cmpb $0x0, 0x4(%rax)
je 0x6f4f1
movl $0x100, -0x20(%rbp)     # imm = 0x100
jmp 0x6f502
movq -0x10(%rbp), %rax
movzbl 0x40(%rax), %eax
movq -0x18(%rbp), %rcx
addl %ecx, %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x100, (%rax)          # imm = 0x100
jne 0x6f555
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
imulq $0x18, -0x18(%rbp), %rsi
addq %rsi, %rax
movq 0x8(%rax), %rax
movl %eax, %r8d
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
imulq $0x18, -0x18(%rbp), %rsi
addq %rsi, %rax
movl (%rax), %r9d
leaq 0x13b615(%rip), %rsi    # 0x1aab61
movb $0x0, %al
callq 0x15b350
jmp 0x6f59a
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
imulq $0x18, -0x18(%rbp), %rsi
addq %rsi, %rax
movq 0x10(%rax), %rax
movl %eax, %r8d
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
imulq $0x18, -0x18(%rbp), %rsi
addq %rsi, %rax
movl (%rax), %r9d
leaq 0x13b5fa(%rip), %rsi    # 0x1aab8d
movb $0x0, %al
callq 0x15b350
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
imulq $0x18, -0x18(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x68(%rcx), %eax
jle 0x6f5ce
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
imulq $0x18, -0x18(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x68(%rax)
jmp 0x6f5d0
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x6f48a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x68(%rax), %edx
leaq 0x13b5c6(%rip), %rsi    # 0x1aabb9
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
cmpl $0x1, 0x68(%rax)
jge 0x6f606
jmp 0x6f61b
movq -0x10(%rbp), %rax
movl 0x68(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)