// File: /workspace/github_c_makefile_star2_O0/aligrudi[P]neatmkfn/otf.c
// Function: otf_cff
static void otf_cff(struct otf *otf, void *cff)
{
	void *nameidx;		/* name index */
	void *topidx;		/* top dict index */
	void *stridx;		/* string idx */
	void *chridx;		/* charstrings index */
	void *charset;		/* charset offset */
	int badcff;		/* invalid CFF SIDs */
	int i, j;
	if (U8(cff, 0) != 1)
		return;
	nameidx = cff + U8(cff, 2);
	topidx = cffidx_end(nameidx);
	if (cffidx_cnt(nameidx) < 1)
		return;
	stridx = cffidx_end(topidx);
	chridx = cff + cffdict_get(cffidx_get(topidx, 0),
			cffidx_len(topidx, 0), 17, NULL);
	charset = cff + cffdict_get(cffidx_get(topidx, 0),
			cffidx_len(topidx, 0), 15, NULL);
	glyph_n = cffidx_cnt(chridx);
	badcff = cffidx_cnt(chridx) - 391 > cffidx_cnt(stridx);
	strcpy(glyph_name[0], ".notdef");
	/* read font name from name index */
	if (cffidx_cnt(nameidx) > 0) {
		char name[256] = "";
		memcpy(name, cffidx_get(nameidx, 0), cffidx_len(nameidx, 0));
		if (name[0] && !otf->name[0])
			snprintf(otf->name, sizeof(otf->name), "%s", name);
	}
	/* read charset: glyph to character name */
	if (!badcff && U8(charset, 0) == 0) {
		for (i = 0; i < glyph_n; i++)
			cff_char(stridx, U16(charset, 1 + i * 2),
				glyph_name[i + 1]);
	}
	if (!badcff && (U8(charset, 0) == 1 || U8(charset, 0) == 2)) {
		int g = 1;
		int sz = U8(charset, 0) == 1 ? 3 : 4;
		for (i = 0; g < glyph_n; i++) {
			int sid = U16(charset, 1 + i * sz);
			int cnt = cff_int(charset, 1 + i * sz + 2, sz - 2);
			for (j = 0; j <= cnt && g < glyph_n; j++) {
				cff_char(stridx, sid + j, glyph_name[g]);
				g++;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x40834
jmp 0x40bca
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x41220
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x41250
cmpl $0x1, %eax
jge 0x4086a
jmp 0x40bca
movq -0x20(%rbp), %rdi
callq 0x41220
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x41350
movq %rax, -0x188(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x413d0
movq -0x188(%rbp), %rdi
movl %eax, %esi
movl $0x11, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x41280
movl %eax, %ecx
movq -0x180(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x41350
movq %rax, -0x178(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x413d0
movq -0x178(%rbp), %rdi
movl %eax, %esi
movl $0xf, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x41280
movl %eax, %ecx
movq -0x170(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x41250
movl %eax, 0x35efa(%rip)     # 0x76824
movq -0x30(%rbp), %rdi
callq 0x41250
subl $0x187, %eax            # imm = 0x187
movl %eax, -0x164(%rbp)
movq -0x28(%rbp), %rdi
callq 0x41250
movl %eax, %ecx
movl -0x164(%rbp), %eax
cmpl %ecx, %eax
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
leaq 0x35ecd(%rip), %rdi     # 0x76830
leaq 0x17189(%rip), %rsi     # 0x57af3
callq 0x3d050
movq -0x18(%rbp), %rdi
callq 0x41250
cmpl $0x0, %eax
jle 0x40a0f
leaq -0x150(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x3d0f0
leaq -0x150(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x41350
movq %rax, -0x190(%rbp)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x413d0
movq -0x198(%rbp), %rdi
movq -0x190(%rbp), %rsi
movslq %eax, %rdx
callq 0x3d140
movsbl -0x150(%rbp), %eax
cmpl $0x0, %eax
je 0x40a0d
movq -0x8(%rbp), %rax
cmpb $0x0, 0x10(%rax)
jne 0x40a0d
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
leaq -0x150(%rbp), %rcx
movl $0x80, %esi
leaq 0x17224(%rip), %rdx     # 0x57c2a
movb $0x0, %al
callq 0x3d0c0
jmp 0x40a0f
cmpl $0x0, -0x3c(%rbp)
jne 0x40a88
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x40a88
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl 0x35df3(%rip), %eax     # 0x76824
jge 0x40a86
movq -0x28(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x38(%rbp), %rax
movl -0x40(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx), %edi
callq 0x3d090
movq -0x1a0(%rbp), %rdi
movzwl %ax, %esi
movl -0x40(%rbp), %eax
addl $0x1, %eax
cltq
leaq 0x35dc1(%rip), %rdx     # 0x76830
shlq $0x6, %rax
addq %rax, %rdx
callq 0x41410
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x40a28
jmp 0x40a88
cmpl $0x0, -0x3c(%rbp)
jne 0x40bca
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x40aae
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x2, %eax
jne 0x40bca
movl $0x1, -0x154(%rbp)
movq -0x38(%rbp), %rax
movzbl (%rax), %edx
movl $0x4, %eax
movl $0x3, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x158(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x154(%rbp), %eax
cmpl 0x35d3c(%rip), %eax     # 0x76824
jge 0x40bc8
movq -0x38(%rbp), %rax
movl -0x40(%rbp), %ecx
imull -0x158(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx), %edi
callq 0x3d090
movzwl %ax, %eax
movl %eax, -0x15c(%rbp)
movq -0x38(%rbp), %rdi
movl -0x40(%rbp), %esi
imull -0x158(%rbp), %esi
addl $0x1, %esi
addl $0x2, %esi
movl -0x158(%rbp), %edx
subl $0x2, %edx
callq 0x414d0
movl %eax, -0x160(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %ecx
xorl %eax, %eax
cmpl -0x160(%rbp), %ecx
movb %al, -0x1a1(%rbp)
jg 0x40b6b
movl -0x154(%rbp), %eax
cmpl 0x35cc2(%rip), %eax     # 0x76824
setl %al
movb %al, -0x1a1(%rbp)
movb -0x1a1(%rbp), %al
testb $0x1, %al
jne 0x40b77
jmp 0x40bb8
movq -0x28(%rbp), %rdi
movl -0x15c(%rbp), %esi
addl -0x44(%rbp), %esi
movslq -0x154(%rbp), %rax
leaq 0x35c9e(%rip), %rdx     # 0x76830
shlq $0x6, %rax
addq %rax, %rdx
callq 0x41410
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x40b43
jmp 0x40bba
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x40adc
jmp 0x40bca
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
nopw %cs:(%rax,%rax)