// File: /workspace/github_c_makefile_star2_O0/smilingthax[P]libfontembed/embed_sfnt.c
// Function: emb_otf_get_fontname
const char *emb_otf_get_fontname(OTF_FILE *otf) // {{{
{
  static char fontname[64];

  int len;
  const char *fname=otf_get_name(otf,3,1,0x409,6,&len); // microsoft
  if (fname) {
    int iA,iB=0;
    for (iA=0;(iA<63)&&(iA*2<len);iA++) {
      if ( (fname[2*iA]==0)&&
           (fname[2*iA+1]>=33)&&(fname[2*iA+1]<=126)&&
           (!strchr("[](){}<>/%",fname[iA*2+1])) ) {
        fontname[iB++]=fname[iA*2+1];
      }
    }
    fontname[iB]=0;
  } else if ((fname=otf_get_name(otf,1,0,0,6,&len))) { // mac
    int iA,iB=0;
    for (iA=0;(iA<63)&&(iA<len);iA++) {
      if ( (fname[iA]>=33)&&(fname[iA]<=126)&&
           (!strchr("[](){}<>/%",fname[iA])) ) {
        fontname[iB++]=fname[iA];
      }
    }
    fontname[iB]=0;
  } else {
    fontname[0]=0;
  }
  if (!*fontname) {
    // TODO construct a fontname, eg from */*/*/4
    fprintf(stderr,"WARNING: no fontName\n");
  }
  return fontname;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movl $0x3, %esi
movl $0x1, %edx
movl $0x409, %ecx            # imm = 0x409
movl $0x6, %r8d
leaq -0xc(%rbp), %r9
callq 0x4df0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x6598
movl $0x0, -0x20(%rbp)
movl $0x0, -0x1c(%rbp)
xorl %eax, %eax
cmpl $0x3f, -0x1c(%rbp)
movb %al, -0x29(%rbp)
jge 0x64d4
movl -0x1c(%rbp), %eax
shll %eax
cmpl -0xc(%rbp), %eax
setl %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x64e0
jmp 0x6584
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x6574
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x21, %eax
jl 0x6574
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x7e, %eax
jg 0x6574
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %esi
leaq 0x85dc(%rip), %rdi      # 0xeb1b
callq 0x2080
cmpq $0x0, %rax
jne 0x6574
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %dl
movl -0x20(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x20(%rbp)
movslq %eax, %rcx
leaq 0xccbf(%rip), %rax      # 0x13230
movb %dl, (%rax,%rcx)
jmp 0x6576
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x64bb
movslq -0x20(%rbp), %rcx
leaq 0xcca1(%rip), %rax      # 0x13230
movb $0x0, (%rax,%rcx)
jmp 0x667d
movq -0x8(%rbp), %rdi
movl $0x1, %esi
xorl %ecx, %ecx
movl $0x6, %r8d
leaq -0xc(%rbp), %r9
movl %ecx, %edx
callq 0x4df0
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x6674
movl $0x0, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
xorl %eax, %eax
cmpl $0x3f, -0x24(%rbp)
movb %al, -0x2a(%rbp)
jge 0x65e7
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
setl %al
movb %al, -0x2a(%rbp)
movb -0x2a(%rbp), %al
testb $0x1, %al
jne 0x65f0
jmp 0x6663
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x21, %eax
jl 0x6653
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x7e, %eax
jg 0x6653
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %esi
leaq 0x84f6(%rip), %rdi      # 0xeb1b
callq 0x2080
cmpq $0x0, %rax
jne 0x6653
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb (%rax,%rcx), %dl
movl -0x28(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x28(%rbp)
movslq %eax, %rcx
leaq 0xcbe0(%rip), %rax      # 0x13230
movb %dl, (%rax,%rcx)
jmp 0x6655
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x65d0
movslq -0x28(%rbp), %rcx
leaq 0xcbc2(%rip), %rax      # 0x13230
movb $0x0, (%rax,%rcx)
jmp 0x667b
movb $0x0, 0xcbb5(%rip)      # 0x13230
jmp 0x667d
cmpb $0x0, 0xcbac(%rip)      # 0x13230
jne 0x669e
movq 0xc953(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
leaq 0x848f(%rip), %rsi      # 0xeb26
movb $0x0, %al
callq 0x21e0
leaq 0xcb8b(%rip), %rax      # 0x13230
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)