// File: /workspace/github_c_makefile_star2_O2/aligrudi[P]neatmkfn/afm.c
// Function: afm_read
int afm_read(void)
{
	char ln[1024];
	char ch[TOKLEN] = "", pos[TOKLEN] = "";
	char c1[TOKLEN] = "", c2[TOKLEN] = "";
	char wid[TOKLEN] = "", field[TOKLEN] = "";
	char llx[TOKLEN] = "0", lly[TOKLEN] = "0";
	char urx[TOKLEN] = "0", ury[TOKLEN] = "0";
	char fontname[128];
	char *s;
	while (fgets(ln, sizeof(ln), stdin)) {
		if (ln[0] == '#')
			continue;
		if (!strncmp("FontName ", ln, 8)) {
			sscanf(ln, "FontName %s", fontname);
			continue;
		}
		if (!strncmp("StartCharMetrics", ln, 16))
			break;
	}
	while (fgets(ln, sizeof(ln), stdin)) {
		if (ln[0] == '#')
			continue;
		if (!strncmp("EndCharMetrics", ln, 14))
			break;
		s = ln;
		while (*s) {
			s = afm_charfield(s, field);
			if (!strcmp("C", field)) {
				s = afm_charfield(s, pos);
				continue;
			}
			if (!strcmp("WX", field)) {
				s = afm_charfield(s, wid);
				continue;
			}
			if (!strcmp("N", field)) {
				s = afm_charfield(s, ch);
				continue;
			}
			if (!strcmp("B", field)) {
				s = afm_charfield(s, llx);
				s = afm_charfield(s, lly);
				s = afm_charfield(s, urx);
				s = afm_charfield(s, ury);
				continue;
			}
			if (!strcmp("L", field)) {
				s = afm_charfield(s, c1);
				s = afm_charfield(s, c2);
				continue;
			}
			break;
		}
		if (ch[0] && pos[0] && wid[0])
			mkfn_char(ch, atoi(pos), 0, uwid(atoi(wid)),
				uwid(atoi(llx)), uwid(atoi(lly)),
				uwid(atoi(urx)), uwid(atoi(ury)));
	}
	mkfn_header(fontname);
	while (fgets(ln, sizeof(ln), stdin)) {
		if (ln[0] == '#')
			continue;
		if (!strncmp("StartKernPairs", ln, 14))
			break;
	}
	while (fgets(ln, sizeof(ln), stdin)) {
		if (ln[0] == '#')
			continue;
		if (!strncmp("EndKernPairs", ln, 12))
			break;
		if (sscanf(ln, "KPX %s %s %s", c1, c2, wid) == 3)
			mkfn_kern(c1, c2, uwid(atoi(wid)));
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe98, %rsp            # imm = 0xE98
leaq 0x190(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0x990(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0x890(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0x790(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0x10(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0x690(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0x590(%rsp), %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3d0f0
movb $0x30, %bpl
movb %bpl, (%rbx)
leaq 0x490(%rsp), %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3d0f0
movb %bpl, (%rbx)
leaq 0x390(%rsp), %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3d0f0
movb %bpl, (%rbx)
leaq 0x290(%rsp), %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3d0f0
movb %bpl, (%rbx)
movq 0x2a77c(%rip), %r12     # 0x68fd0
leaq 0xa90(%rsp), %r13
movabsq $0x656d614e746e6f46, %r15 # imm = 0x656D614E746E6F46
leaq 0x15363(%rip), %rbx     # 0x53bd0
leaq 0x110(%rsp), %r14
movq (%r12), %rdx
movq %r13, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
je 0x3e8cd
cmpb $0x23, 0xa90(%rsp)
je 0x3e875
cmpq %r15, 0xa90(%rsp)
jne 0x3e8b1
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3d190
jmp 0x3e875
movdqa 0xa90(%rsp), %xmm0
pcmpeqb 0x152fe(%rip), %xmm0    # 0x53bc0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x3e875
leaq 0x990(%rsp), %r12
leaq 0x690(%rsp), %r15
leaq 0x15318(%rip), %rbp     # 0x53bfc
pushq $0x3
popq %r14
movq 0x2a6e1(%rip), %rax     # 0x68fd0
movq (%rax), %rdx
leaq 0xa90(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
je 0x3ead7
movb 0xa90(%rsp), %bl
cmpb $0x23, %bl
je 0x3e8e8
leaq 0x152cd(%rip), %rdi     # 0x53bed
leaq 0xa90(%rsp), %r13
movq %r13, %rsi
pushq $0xe
popq %rdx
callq 0x3d1a0
testl %eax, %eax
je 0x3ead7
movq %r13, %rdi
testb %bl, %bl
je 0x3ea0d
movq %r15, %rsi
callq 0x3ebe1
movq %rax, %rbx
movzwl 0x690(%rsp), %r13d
cmpl $0x43, %r13d
jne 0x3e96b
movq %rbx, %rdi
movq %r12, %rsi
jmp 0x3e9fe
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3d1a0
testl %eax, %eax
je 0x3e99c
cmpl $0x42, %r13d
je 0x3e9c3
cmpl $0x4c, %r13d
je 0x3e9a6
cmpl $0x4e, %r13d
jne 0x3ea0d
movq %rbx, %rdi
leaq 0x190(%rsp), %rsi
jmp 0x3e9fe
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
jmp 0x3e9fe
movq %rbx, %rdi
leaq 0x890(%rsp), %rsi
callq 0x3ebe1
movq %rax, %rdi
leaq 0x790(%rsp), %rsi
jmp 0x3e9fe
movq %rbx, %rdi
leaq 0x590(%rsp), %rsi
callq 0x3ebe1
movq %rax, %rdi
leaq 0x490(%rsp), %rsi
callq 0x3ebe1
movq %rax, %rdi
leaq 0x390(%rsp), %rsi
callq 0x3ebe1
movq %rax, %rdi
leaq 0x290(%rsp), %rsi
callq 0x3ebe1
movq %rax, %rdi
movb (%rdi), %bl
jmp 0x3e93e
cmpb $0x0, 0x190(%rsp)
je 0x3e8e8
cmpb $0x0, 0x990(%rsp)
je 0x3e8e8
cmpb $0x0, 0x10(%rsp)
je 0x3e8e8
movq %r12, %rdi
callq 0x3d1b0
movl %eax, 0xc(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x3d1b0
movl %eax, %edi
callq 0x3ec48
movl %eax, 0x8(%rsp)
leaq 0x590(%rsp), %rdi
callq 0x3d1b0
movl %eax, %edi
callq 0x3ec48
movl %eax, 0x4(%rsp)
leaq 0x490(%rsp), %rdi
callq 0x3d1b0
movl %eax, %edi
callq 0x3ec48
movl %eax, %ebx
leaq 0x390(%rsp), %rdi
callq 0x3d1b0
movl %eax, %edi
callq 0x3ec48
movl %eax, %r13d
leaq 0x290(%rsp), %rdi
callq 0x3d1b0
movl %eax, %edi
callq 0x3ec48
leaq 0x190(%rsp), %rdi
movl 0xc(%rsp), %esi
xorl %edx, %edx
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %r8d
movl %ebx, %r9d
pushq %rax
pushq %r13
callq 0x3d858
popq %rax
popq %rcx
jmp 0x3e8e8
leaq 0x110(%rsp), %rdi
callq 0x3d52d
leaq 0xa90(%rsp), %rbx
leaq 0x1510c(%rip), %r14     # 0x53bff
pushq $0xe
popq %r15
movq 0x2a4d2(%rip), %r12     # 0x68fd0
movq (%r12), %rdx
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
je 0x3eb30
cmpb $0x23, 0xa90(%rsp)
je 0x3eafe
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x3d1a0
testl %eax, %eax
jne 0x3eafe
leaq 0xa90(%rsp), %rbx
leaq 0x150cf(%rip), %r14     # 0x53c0e
pushq $0xc
popq %r15
leaq 0x890(%rsp), %r13
leaq 0x790(%rsp), %rbp
leaq 0x10(%rsp), %r12
movq 0x2a471(%rip), %rax     # 0x68fd0
movq (%rax), %rdx
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
je 0x3ebcd
cmpb $0x23, 0xa90(%rsp)
je 0x3eb58
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x3d1a0
testl %eax, %eax
je 0x3ebcd
movq %rbx, %rdi
leaq 0x15081(%rip), %rsi     # 0x53c1b
movq %r13, %rdx
movq %rbp, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x3d190
cmpl $0x3, %eax
jne 0x3eb58
movq %r12, %rdi
callq 0x3d1b0
movl %eax, %edi
callq 0x3ec48
movq %r13, %rdi
movq %rbp, %rsi
movl %eax, %edx
callq 0x3e163
jmp 0x3eb58
xorl %eax, %eax
addq $0xe98, %rsp            # imm = 0xE98
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq