// File: /workspace/github_c_makefile_star2_O3/uobikiemukot[P]yaft/tools/bdf.h
// Function: read_header
int read_header(char *buf, struct bdf_header_t *bdf_header)
{
	char *cp;

	if (pre_match(buf, "FONTBOUNDINGBOX "))
		sscanf(buf + strlen("FONTBOUNDINGBOX "), "%d %d %d %d",
			&bdf_header->bbw, &bdf_header->bbh, &bdf_header->bbx, &bdf_header->bby);
	else if (pre_match(buf, "FONT_ASCENT "))
		bdf_header->ascent = atoi(buf + strlen("FONT_ASCENT "));
	else if (pre_match(buf, "FONT_DESCENT "))
		bdf_header->descent = atoi(buf + strlen("FONT_DESCENT "));
	else if (pre_match(buf, "DEFAULT_CHAR "))
		bdf_header->default_char = atoi(buf + strlen("DEFAULT_CHAR "));
	else if (pre_match(buf, "PIXEL_SIZE "))
		bdf_header->pixel_size = atoi(buf + strlen("PIXEL_SIZE "));
	else if (pre_match(buf, "CHARSET_REGISTRY ")) {
		strncpy(bdf_header->charset, buf + strlen("CHARSET_REGISTRY "), BUFSIZE - 1);
		logging(DEBUG, "%s\n", bdf_header->charset);

		for (cp = bdf_header->charset; *cp != '\0'; cp++)
			*cp = (char) toupper((int) *cp);

		if (strstr(bdf_header->charset, "X68000") != NULL
			|| strstr(bdf_header->charset, "x68000") != NULL)
			load_table("./table/X68000", X68000);
		else if (strstr(bdf_header->charset, "JISX0201") != NULL
			|| strstr(bdf_header->charset, "jisx0201") != NULL)
			load_table("./table/JISX0201", JISX0201);
		else if (strstr(bdf_header->charset, "JISX0208") != NULL
			|| strstr(bdf_header->charset, "jisx0208") != NULL)
			load_table("./table/JISX0208", JISX0208);
		else if (strstr(bdf_header->charset, "ISO8859") != NULL
			|| strstr(bdf_header->charset, "iso8859") != NULL)
			load_table("./table/ISO8859", ISO8859);
		else /* assume "ISO10646" */
			load_table("./table/ISO10646", ISO10646);
	}
	else if (pre_match(buf, "CHARS ")) {
		bdf_header->chars =  atoi(buf + strlen("CHARS "));
		return BDF_CHAR;
	}

	return BDF_HEADER;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1a2b(%rip), %rsi      # 0x3102
movl $0x10, %edx
callq 0x1060
testl %eax, %eax
je 0x1751
leaq 0x1a33(%rip), %rsi      # 0x311f
movl $0xc, %edx
movq %r14, %rdi
callq 0x1060
testl %eax, %eax
je 0x1779
leaq 0x1a28(%rip), %rsi      # 0x312c
movl $0xd, %edx
movq %r14, %rdi
callq 0x1060
testl %eax, %eax
je 0x178a
leaq 0x1a1e(%rip), %rsi      # 0x313a
movl $0xd, %edx
movq %r14, %rdi
callq 0x1060
testl %eax, %eax
je 0x179b
leaq 0x1a14(%rip), %rsi      # 0x3148
movq %r14, %rdi
callq 0x147b
testl %eax, %eax
je 0x17b9
addq $0xb, %r14
movq %r14, %rdi
callq 0x1160
movl %eax, 0x20(%rbx)
jmp 0x17aa
addq $0x10, %r14
leaq 0x4(%rbx), %rcx
leaq 0x8(%rbx), %r8
leaq 0xc(%rbx), %r9
leaq 0x19ab(%rip), %rsi      # 0x3113
xorl %ebp, %ebp
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1110
jmp 0x17ac
addq $0xc, %r14
movq %r14, %rdi
callq 0x1160
movl %eax, 0x10(%rbx)
jmp 0x17aa
addq $0xd, %r14
movq %r14, %rdi
callq 0x1160
movl %eax, 0x14(%rbx)
jmp 0x17aa
addq $0xd, %r14
movq %r14, %rdi
callq 0x1160
movl %eax, 0x18(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1994(%rip), %rsi      # 0x3154
movq %r14, %rdi
callq 0x147b
testl %eax, %eax
je 0x1840
leaq 0x24(%rbx), %r15
addq $0x11, %r14
movl $0x3ff, %edx            # imm = 0x3FF
movq %r15, %rdi
movq %r14, %rsi
callq 0x1050
movb 0x24(%rbx), %al
testb %al, %al
je 0x1803
addq $0x25, %rbx
movsbl %al, %edi
callq 0x1070
movb %al, -0x1(%rbx)
movb (%rbx), %al
incq %rbx
testb %al, %al
jne 0x17ef
leaq 0x196b(%rip), %rsi      # 0x3175
movq %r15, %rdi
callq 0x1190
testq %rax, %rax
jne 0x182b
leaq 0x1948(%rip), %rsi      # 0x3166
movq %r15, %rdi
callq 0x1190
testq %rax, %rax
je 0x1870
leaq 0x193b(%rip), %rdi      # 0x316d
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x15cf
jmp 0x17ac
leaq 0x1992(%rip), %rsi      # 0x31d9
movq %r14, %rdi
callq 0x147b
testl %eax, %eax
je 0x17aa
addq $0x6, %r14
movq %r14, %rdi
callq 0x1160
movl %eax, 0x1c(%rbx)
movl $0x1, %ebp
jmp 0x17ac
leaq 0x1916(%rip), %rsi      # 0x318d
movq %r15, %rdi
callq 0x1190
testq %rax, %rax
jne 0x1898
leaq 0x18f1(%rip), %rsi      # 0x317c
movq %r15, %rdi
callq 0x1190
testq %rax, %rax
je 0x18ae
leaq 0x18e6(%rip), %rdi      # 0x3185
movl $0x2, %esi
callq 0x15cf
jmp 0x17aa
leaq 0x18f2(%rip), %rsi      # 0x31a7
movq %r15, %rdi
callq 0x1190
testq %rax, %rax
jne 0x18d6
leaq 0x18cd(%rip), %rsi      # 0x3196
movq %r15, %rdi
callq 0x1190
testq %rax, %rax
je 0x18e4
leaq 0x18c2(%rip), %rdi      # 0x319f
movl $0x1, %esi
jmp 0x18a4
leaq 0x18d5(%rip), %rsi      # 0x31c0
movq %r15, %rdi
callq 0x1190
testq %rax, %rax
jne 0x190c
leaq 0x18b1(%rip), %rsi      # 0x31b0
movq %r15, %rdi
callq 0x1190
testq %rax, %rax
je 0x191a
leaq 0x18a5(%rip), %rdi      # 0x31b8
movl $0x3, %esi
jmp 0x18a4
leaq 0x18a7(%rip), %rdi      # 0x31c8
movl $0x4, %esi
jmp 0x18a4