// File: /workspace/github_c_makefile_star2_O1/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 $0xea8, %rsp            # imm = 0xEA8
leaq 0x7a0(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0x6a0(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0xda0(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0xca0(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0x120(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0x20(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x3d0f0
leaq 0xba0(%rsp), %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3d0f0
movb $0x30, %bpl
movb %bpl, (%rbx)
leaq 0xaa0(%rsp), %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3d0f0
movb %bpl, (%rbx)
leaq 0x9a0(%rsp), %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3d0f0
movb %bpl, (%rbx)
leaq 0x8a0(%rsp), %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3d0f0
movb %bpl, (%rbx)
movq 0x2b654(%rip), %r13     # 0x69fd0
movq (%r13), %rdx
leaq 0x220(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
je 0x3ea10
leaq 0x220(%rsp), %rbx
movabsq $0x656d614e746e6f46, %r12 # imm = 0x656D614E746E6F46
leaq 0x16220(%rip), %r14     # 0x54bd0
leaq 0x620(%rsp), %r15
cmpb $0x23, 0x220(%rsp)
je 0x3e9fa
cmpq %r12, 0x220(%rsp)
jne 0x3e9de
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3d180
jmp 0x3e9fa
movdqa 0x220(%rsp), %xmm0
pcmpeqb 0x161d1(%rip), %xmm0    # 0x54bc0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
je 0x3ea10
movq (%r13), %rdx
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
jne 0x3e9b8
movq (%r13), %rdx
leaq 0x220(%rsp), %rbx
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
je 0x3ed50
movabsq $0x4d72616843646e45, %r12 # imm = 0x4D72616843646E45
movabsq $0x7363697274654d72, %r15 # imm = 0x7363697274654D72
leaq 0x6a0(%rsp), %r14
leaq 0x20(%rsp), %rbp
cmpb $0x23, 0x220(%rsp)
je 0x3ed36
movq 0x220(%rsp), %rax
xorq %r12, %rax
movq 0x226(%rsp), %rcx
xorq %r15, %rcx
orq %rax, %rcx
je 0x3ed50
cmpb $0x0, 0x220(%rsp)
je 0x3eb59
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x3eefa
movzwl 0x20(%rsp), %ecx
cmpl $0x43, %ecx
jne 0x3eaae
movq %rax, %rdi
movq %r14, %rsi
jmp 0x3eb48
movl 0x20(%rsp), %edx
movl $0x5857, %esi           # imm = 0x5857
xorl %esi, %edx
movzbl 0x22(%rsp), %esi
orw %dx, %si
je 0x3eae3
cmpl $0x42, %ecx
je 0x3eb0d
cmpl $0x4c, %ecx
je 0x3eaf0
cmpl $0x4e, %ecx
jne 0x3eb59
movq %rax, %rdi
leaq 0x7a0(%rsp), %rsi
jmp 0x3eb48
movq %rax, %rdi
leaq 0x120(%rsp), %rsi
jmp 0x3eb48
movq %rax, %rdi
leaq 0xda0(%rsp), %rsi
callq 0x3eefa
movq %rax, %rdi
leaq 0xca0(%rsp), %rsi
jmp 0x3eb48
movq %rax, %rdi
leaq 0xba0(%rsp), %rsi
callq 0x3eefa
movq %rax, %rdi
leaq 0xaa0(%rsp), %rsi
callq 0x3eefa
movq %rax, %rdi
leaq 0x9a0(%rsp), %rsi
callq 0x3eefa
movq %rax, %rdi
leaq 0x8a0(%rsp), %rsi
callq 0x3eefa
movq %rax, %rdi
cmpb $0x0, (%rax)
jne 0x3ea91
cmpb $0x0, 0x7a0(%rsp)
je 0x3ed36
cmpb $0x0, 0x6a0(%rsp)
je 0x3ed36
cmpb $0x0, 0x120(%rsp)
je 0x3ed36
movq %r14, %rdi
callq 0x3d190
movl %eax, 0x4(%rsp)
leaq 0x120(%rsp), %rdi
callq 0x3d190
movl %eax, %ecx
movl $0x11940, %eax          # imm = 0x11940
xorl %edx, %edx
leaq 0x2b554(%rip), %rsi     # 0x6a100
idivl (%rsi)
testl %ecx, %ecx
movslq %ecx, %rcx
movl $0x14, %esi
movq $-0x14, %rdx
cmovsq %rdx, %rsi
movq $-0x14, %r14
movl %ecx, %edi
cmovsq %rcx, %rdi
movslq %eax, %r13
movq %r13, %rax
cqto
idivq %rsi
addq %rdi, %rax
addq %rax, %rax
leaq (%rax,%rax,4), %rax
cqto
idivq %r13
movq %rax, 0x18(%rsp)
leaq 0xba0(%rsp), %rdi
callq 0x3d190
testl %eax, %eax
cltq
movl %eax, %ecx
movl $0x14, %esi
cmovsq %r14, %rsi
movq $-0x14, %r14
cmovsq %rax, %rcx
movq %r13, %rax
cqto
idivq %rsi
addq %rcx, %rax
addq %rax, %rax
leaq (%rax,%rax,4), %rax
cqto
idivq %r13
movq %rax, 0x10(%rsp)
leaq 0xaa0(%rsp), %rdi
callq 0x3d190
testl %eax, %eax
cltq
movl %eax, %ecx
movl $0x14, %esi
cmovsq %r14, %rsi
movq $-0x14, %r14
cmovsq %rax, %rcx
movq %r13, %rax
cqto
idivq %rsi
addq %rcx, %rax
addq %rax, %rax
leaq (%rax,%rax,4), %rax
cqto
idivq %r13
movq %rax, 0x8(%rsp)
leaq 0x9a0(%rsp), %rdi
callq 0x3d190
testl %eax, %eax
cltq
movl %eax, %ecx
movl $0x14, %esi
cmovsq %r14, %rsi
cmovsq %rax, %rcx
movq %r13, %rax
cqto
idivq %rsi
addq %rcx, %rax
addq %rax, %rax
leaq (%rax,%rax,4), %rax
cqto
idivq %r13
movq %r15, %r14
movq %r12, %r15
movq %rbx, %r12
movq %rax, %rbx
leaq 0x8a0(%rsp), %rdi
callq 0x3d190
testl %eax, %eax
cltq
movl %eax, %ecx
movl $0x14, %esi
movq $-0x14, %rdx
cmovsq %rdx, %rsi
cmovsq %rax, %rcx
movq %r13, %rax
cqto
idivq %rsi
addq %rcx, %rax
addq %rax, %rax
leaq (%rax,%rax,4), %rax
cqto
idivq %r13
movq 0x2b2d3(%rip), %r13     # 0x69fd0
leaq 0x7a0(%rsp), %rdi
movl 0x4(%rsp), %esi
xorl %edx, %edx
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %r9
pushq %rax
pushq %rbx
movq %r12, %rbx
movq %r15, %r12
movq %r14, %r15
leaq 0x6b0(%rsp), %r14
callq 0x3d8ec
addq $0x10, %rsp
movq (%r13), %rdx
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
jne 0x3ea53
leaq 0x620(%rsp), %rdi
callq 0x3d5cb
movq (%r13), %rdx
leaq 0x220(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
je 0x3edcf
leaq 0x220(%rsp), %rbx
movabsq $0x72654b7472617453, %r14 # imm = 0x72654B7472617453
movabsq $0x73726961506e7265, %r15 # imm = 0x73726961506E7265
cmpb $0x23, 0x220(%rsp)
je 0x3edb9
movq 0x220(%rsp), %rax
xorq %r14, %rax
movq 0x226(%rsp), %rcx
xorq %r15, %rcx
orq %rax, %rcx
je 0x3edcf
movq (%r13), %rdx
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
jne 0x3ed94
movq (%r13), %rdx
leaq 0x220(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
je 0x3eee6
leaq 0x220(%rsp), %rbx
movabsq $0x506e72654b646e45, %rbp # imm = 0x506E72654B646E45
leaq 0x15e14(%rip), %r14     # 0x54c1b
leaq 0xda0(%rsp), %r15
leaq 0xca0(%rsp), %r12
leaq 0x120(%rsp), %r13
cmpb $0x23, 0x220(%rsp)
je 0x3eec6
movq 0x220(%rsp), %rax
xorq %rbp, %rax
movl 0x228(%rsp), %ecx
xorq $0x73726961, %rcx       # imm = 0x73726961
orq %rax, %rcx
je 0x3eee6
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x3d180
cmpl $0x3, %eax
jne 0x3eec6
movq %r13, %rdi
callq 0x3d190
movl %eax, %ecx
movl $0x11940, %eax          # imm = 0x11940
xorl %edx, %edx
leaq 0x2b27e(%rip), %rsi     # 0x6a100
idivl (%rsi)
testl %ecx, %ecx
movslq %ecx, %rcx
movl $0x14, %esi
movq $-0x14, %rdx
cmovsq %rdx, %rsi
movl %ecx, %edi
cmovsq %rcx, %rdi
movslq %eax, %rcx
movq %rcx, %rax
cqto
idivq %rsi
addq %rdi, %rax
addq %rax, %rax
leaq (%rax,%rax,4), %rax
cqto
idivq %rcx
movq %r15, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x3e23f
movq 0x2b103(%rip), %rax     # 0x69fd0
movq (%rax), %rdx
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x3d130
testq %rax, %rax
jne 0x3ee1f
xorl %eax, %eax
addq $0xea8, %rsp            # imm = 0xEA8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq