// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pcf.c
// Function: read_format_field
static void read_format_field(deark *c, lctx *d, struct table_entry *te,
	i64 pos, struct format_struct *fmt)
{
	const char *name;

	fmt->raw_format = (unsigned int)de_getu32le(pos);
	de_dbg(c, "format: 0x%08x", fmt->raw_format);
	de_dbg_indent(c, 1);

	fmt->gross_format = fmt->raw_format&0xffffff00U;
	if(fmt->gross_format==GFMT_DEFAULT) {
		name="DEFAULT";
	}
	else if(fmt->gross_format==0x100 && (te->type==0x02 || te->type==0x100)) {
		name="ACCEL_W_INKBOUNDS";
	}
	else if(fmt->gross_format==0x100 && (te->type==0x04 || te->type==0x10)) {
		name="COMPRESSED_METRICS";
	}
	else if(fmt->gross_format==0x200) {
		name="INKBOUNDS";
	}
	else {
		name="?";
	}
	de_dbg(c, "gross format: 0x%08x (%s)", fmt->gross_format, name);

	fmt->glyph_padding_code = fmt->raw_format&0x03;
	fmt->glyph_padding_value = 1U<<(fmt->glyph_padding_code);
	de_dbg(c, "glyph padding: %u (= to %u-byte boundary)",fmt->glyph_padding_code,
		fmt->glyph_padding_value);
	fmt->is_le = !((fmt->raw_format>>2)&0x1);
	de_dbg(c, "byte order: %s", fmt->is_le?"LE":"BE");
	fmt->msbit_first = ((fmt->raw_format>>3)&0x1)?1:0;
	de_dbg(c, "bit order: %s first", fmt->msbit_first?"msb":"lsb");

	fmt->scan_unit_code = (fmt->raw_format>>4)&0x03;
	fmt->scan_unit_value = 1U<<fmt->scan_unit_code;
	de_dbg(c, "scan unit: %u (= %u-byte units)", fmt->scan_unit_code,
		fmt->scan_unit_value);
	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x165540
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl (%rax), %edx
leaq 0xa98ec(%rip), %rsi     # 0x1c5472
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x28(%rbp), %rax
movl (%rax), %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
movq -0x28(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x11bbc8
leaq 0xa9bb5(%rip), %rax     # 0x1c5774
movq %rax, -0x30(%rbp)
jmp 0x11bc52
movq -0x28(%rbp), %rax
cmpl $0x100, 0x4(%rax)       # imm = 0x100
jne 0x11bbf9
movq -0x18(%rbp), %rax
cmpl $0x2, 0x20(%rax)
je 0x11bbec
movq -0x18(%rbp), %rax
cmpl $0x100, 0x20(%rax)      # imm = 0x100
jne 0x11bbf9
leaq 0xa9b89(%rip), %rax     # 0x1c577c
movq %rax, -0x30(%rbp)
jmp 0x11bc50
movq -0x28(%rbp), %rax
cmpl $0x100, 0x4(%rax)       # imm = 0x100
jne 0x11bc27
movq -0x18(%rbp), %rax
cmpl $0x4, 0x20(%rax)
je 0x11bc1a
movq -0x18(%rbp), %rax
cmpl $0x10, 0x20(%rax)
jne 0x11bc27
leaq 0xa9b6d(%rip), %rax     # 0x1c578e
movq %rax, -0x30(%rbp)
jmp 0x11bc4e
movq -0x28(%rbp), %rax
cmpl $0x200, 0x4(%rax)       # imm = 0x200
jne 0x11bc41
leaq 0xa9b49(%rip), %rax     # 0x1c5784
movq %rax, -0x30(%rbp)
jmp 0x11bc4c
leaq 0x9bfe5(%rip), %rax     # 0x1b7c2d
movq %rax, -0x30(%rbp)
jmp 0x11bc4e
jmp 0x11bc50
jmp 0x11bc52
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x30(%rbp), %rcx
leaq 0xa9b39(%rip), %rsi     # 0x1c57a1
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
movl (%rax), %ecx
andl $0x3, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x28(%rbp), %rax
movl 0x8(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x28(%rbp), %rax
movl 0xc(%rax), %ecx
leaq 0xa9b0c(%rip), %rsi     # 0x1c57bb
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
movl (%rax), %eax
shrl $0x2, %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x10(%rax), %ecx
leaq 0x943d1(%rip), %rdx     # 0x1b00b9
leaq 0x8ca37(%rip), %rax     # 0x1a8726
cmpl $0x0, %ecx
cmovneq %rax, %rdx
leaq 0xa9ae8(%rip), %rsi     # 0x1c57e5
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
movl (%rax), %edx
shrl $0x3, %edx
andl $0x1, %edx
xorl %ecx, %ecx
movl $0x1, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x14(%rax), %ecx
leaq 0x87d3a(%rip), %rdx     # 0x1a3a70
leaq 0xa9acb(%rip), %rax     # 0x1c5808
cmpl $0x0, %ecx
cmovneq %rax, %rdx
leaq 0xa9aa9(%rip), %rsi     # 0x1c57f4
movb $0x0, %al
callq 0x15b0d0
movq -0x28(%rbp), %rax
movl (%rax), %ecx
shrl $0x4, %ecx
andl $0x3, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x28(%rbp), %rax
movl 0x18(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x18(%rax), %edx
movq -0x28(%rbp), %rax
movl 0x1c(%rax), %ecx
leaq 0xa9a77(%rip), %rsi     # 0x1c580c
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x30, %rsp
popq %rbp
retq