// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/gemfont.c
// Function: do_header
static int do_header(deark *c, lctx *d)
{
	unsigned int font_flags;
	i64 max_char_width;
	i64 n;

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

	n = de_getu16le(0);
	de_dbg(c, "face ID: %d", (int)n);

	d->face_size = de_getu16le(2);
	de_dbg(c, "point size: %d", (int)d->face_size);

	do_face_name(c, d); // Offset 4-35

	d->first_index = de_getu16le(36);
	d->last_index = de_getu16le(38);
	de_dbg(c, "first char: %d, last char: %d", (int)d->first_index, (int)d->last_index);
	d->font->num_chars = d->last_index - d->first_index + 1;

	max_char_width = de_getu16le(50);
	d->max_char_cell_width = de_getu16le(52);
	de_dbg(c, "max char width: %d, max char cell width: %d", (int)max_char_width,
		(int)d->max_char_cell_width);

	n = de_getu16le(54);
	de_dbg(c, "left offset: %d", (int)n);
	n = de_getu16le(56);
	de_dbg(c, "right offset: %d", (int)n);

	n = de_getu16le(62);
	de_dbg(c, "lightening mask: 0x%04x", (unsigned int)n);

	font_flags = (unsigned int)de_getu16le(66);
	de_dbg(c, "flags: 0x%04x", (UI)font_flags);
	de_dbg_indent(c, 1);
	d->byte_swap_flag = (font_flags & 0x04) ? 1 : 0;
	de_dbg(c, "byte swap flag: %d", (int)d->byte_swap_flag);
	de_dbg_indent(c, -1);

	n = de_getu32le(68);
	de_dbg(c, "horiz. offset table offset: %u", (unsigned int)n);

	d->char_offset_table_pos = de_getu32le(72);
	d->font_data_pos = de_getu32le(76);
	de_dbg(c, "char. offset table offset: %d", (int)d->char_offset_table_pos);
	de_dbg(c, "font data offset: %d", (int)d->font_data_pos);

	d->form_width_bytes = de_getu16le(80);
	d->form_height_pixels = de_getu16le(82);
	de_dbg(c, "form width: %d bytes", (int)d->form_width_bytes);
	de_dbg(c, "form height: %d pixels", (int)d->form_height_pixels);

	de_dbg_indent(c, -1);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x155323(%rip), %rsi    # 0x1c4f8e
xorl %edx, %edx
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x165280
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x13af50(%rip), %rsi    # 0x1aabf8
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x2, %esi
callq 0x165280
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %edx
leaq 0x13af23(%rip), %rsi    # 0x1aac04
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x70370
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x24, %esi
callq 0x165280
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x26, %esi
callq 0x165280
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %ecx
leaq 0x13aec5(%rip), %rsi    # 0x1aac13
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
subq 0x10(%rax), %rcx
addq $0x1, %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x32, %esi
callq 0x165280
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x34, %esi
callq 0x165280
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl %eax, %ecx
leaq 0x13ae6f(%rip), %rsi    # 0x1aac31
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x36, %esi
callq 0x165280
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x13ae6d(%rip), %rsi    # 0x1aac5d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x38, %esi
callq 0x165280
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x13ae4f(%rip), %rsi    # 0x1aac6d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x3e, %esi
callq 0x165280
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x13ae32(%rip), %rsi    # 0x1aac7e
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x42, %esi
callq 0x165280
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %edx
leaq 0x144de5(%rip), %rsi    # 0x1b4c5b
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movl -0x14(%rbp), %edx
andl $0x4, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x48(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movzbl 0x48(%rax), %edx
leaq 0x13addc(%rip), %rsi    # 0x1aac96
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x44, %esi
callq 0x165540
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0x13adb3(%rip), %rsi    # 0x1aaca9
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x48, %esi
callq 0x165540
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x4c, %esi
callq 0x165540
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl %eax, %edx
leaq 0x13ad7c(%rip), %rsi    # 0x1aacc8
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, %edx
leaq 0x13ad7e(%rip), %rsi    # 0x1aace6
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x50, %esi
callq 0x165280
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movl $0x52, %esi
callq 0x165280
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movl %eax, %edx
leaq 0x13ad3d(%rip), %rsi    # 0x1aacfb
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movl %eax, %edx
leaq 0x13ad36(%rip), %rsi    # 0x1aad10
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movl $0x1, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)