// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x18ab(%rip), %rsi      # 0x30d6
callq 0x14d0
cmpl $0x0, %eax
je 0x186c
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rcx
addq $0x4, %rcx
movq -0x18(%rbp), %r8
addq $0x8, %r8
movq -0x18(%rbp), %r9
addq $0xc, %r9
leaq 0x1887(%rip), %rsi      # 0x30e7
movb $0x0, %al
callq 0x1100
jmp 0x1b29
movq -0x10(%rbp), %rdi
leaq 0x187c(%rip), %rsi      # 0x30f3
callq 0x14d0
cmpl $0x0, %eax
je 0x189c
movq -0x10(%rbp), %rdi
addq $0xc, %rdi
callq 0x1150
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x1b27
movq -0x10(%rbp), %rdi
leaq 0x1859(%rip), %rsi      # 0x3100
callq 0x14d0
cmpl $0x0, %eax
je 0x18cc
movq -0x10(%rbp), %rdi
addq $0xd, %rdi
callq 0x1150
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
jmp 0x1b25
movq -0x10(%rbp), %rdi
leaq 0x1837(%rip), %rsi      # 0x310e
callq 0x14d0
cmpl $0x0, %eax
je 0x18fc
movq -0x10(%rbp), %rdi
addq $0xd, %rdi
callq 0x1150
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
jmp 0x1b23
movq -0x10(%rbp), %rdi
leaq 0x1815(%rip), %rsi      # 0x311c
callq 0x14d0
cmpl $0x0, %eax
je 0x192c
movq -0x10(%rbp), %rdi
addq $0xb, %rdi
callq 0x1150
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
jmp 0x1b21
movq -0x10(%rbp), %rdi
leaq 0x17f1(%rip), %rsi      # 0x3128
callq 0x14d0
cmpl $0x0, %eax
je 0x1ae9
movq -0x18(%rbp), %rdi
addq $0x24, %rdi
movq -0x10(%rbp), %rsi
addq $0x11, %rsi
movl $0x3ff, %edx            # imm = 0x3FF
callq 0x1050
movq -0x18(%rbp), %rdx
addq $0x24, %rdx
xorl %edi, %edi
leaq 0x1707(%rip), %rsi      # 0x3077
movb $0x0, %al
callq 0x1280
movq -0x18(%rbp), %rax
addq $0x24, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x19b1
movq -0x20(%rbp), %rax
movsbl (%rax), %edi
callq 0x1070
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, (%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1983
movq -0x18(%rbp), %rdi
addq $0x24, %rdi
leaq 0x1789(%rip), %rsi      # 0x3149
callq 0x1170
cmpq $0x0, %rax
jne 0x19e5
movq -0x18(%rbp), %rdi
addq $0x24, %rdi
leaq 0x1760(%rip), %rsi      # 0x313a
callq 0x1170
cmpq $0x0, %rax
je 0x19f8
leaq 0x1755(%rip), %rdi      # 0x3141
xorl %esi, %esi
callq 0x16e0
jmp 0x1ae7
movq -0x18(%rbp), %rdi
addq $0x24, %rdi
leaq 0x175a(%rip), %rsi      # 0x3161
callq 0x1170
cmpq $0x0, %rax
jne 0x1a2c
movq -0x18(%rbp), %rdi
addq $0x24, %rdi
leaq 0x172f(%rip), %rsi      # 0x3150
callq 0x1170
cmpq $0x0, %rax
je 0x1a42
leaq 0x1726(%rip), %rdi      # 0x3159
movl $0x2, %esi
callq 0x16e0
jmp 0x1ae5
movq -0x18(%rbp), %rdi
addq $0x24, %rdi
leaq 0x172a(%rip), %rsi      # 0x317b
callq 0x1170
cmpq $0x0, %rax
jne 0x1a76
movq -0x18(%rbp), %rdi
addq $0x24, %rdi
leaq 0x16ff(%rip), %rsi      # 0x316a
callq 0x1170
cmpq $0x0, %rax
je 0x1a89
leaq 0x16f6(%rip), %rdi      # 0x3173
movl $0x1, %esi
callq 0x16e0
jmp 0x1ae3
movq -0x18(%rbp), %rdi
addq $0x24, %rdi
leaq 0x16fc(%rip), %rsi      # 0x3194
callq 0x1170
cmpq $0x0, %rax
jne 0x1abd
movq -0x18(%rbp), %rdi
addq $0x24, %rdi
leaq 0x16d2(%rip), %rsi      # 0x3184
callq 0x1170
cmpq $0x0, %rax
je 0x1ad0
leaq 0x16c8(%rip), %rdi      # 0x318c
movl $0x3, %esi
callq 0x16e0
jmp 0x1ae1
leaq 0x16c5(%rip), %rdi      # 0x319c
movl $0x4, %esi
callq 0x16e0
jmp 0x1ae3
jmp 0x1ae5
jmp 0x1ae7
jmp 0x1b1f
movq -0x10(%rbp), %rdi
leaq 0x16b9(%rip), %rsi      # 0x31ad
callq 0x14d0
cmpl $0x0, %eax
je 0x1b1d
movq -0x10(%rbp), %rdi
addq $0x6, %rdi
callq 0x1150
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x1b30
jmp 0x1b1f
jmp 0x1b21
jmp 0x1b23
jmp 0x1b25
jmp 0x1b27
jmp 0x1b29
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)