LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt.c
// Function: otf_get_glyph
int otf_get_glyph(OTF_FILE *otf,unsigned short gid) // {{{ result in >otf->gly, returns length, -1 on error
{
  assert(otf);
  assert(!is_CFF(otf)); // not for CFF

  if (gid>=otf->numGlyphs) {
    return -1;
  }

  // ensure >glyphOffsets is there
  if (!otf->glyphOffsets) {
    if (otf_load_more(otf)!=0) {
      assert(0);
      return -1;
    }
  }

  const int len=otf->glyphOffsets[gid+1]-otf->glyphOffsets[gid];
  if (len==0) {
    return 0;
  }

  assert(otf->glyfTable->length>=otf->glyphOffsets[gid+1]);
  if (otf->glyf) { // i.e. OTF_F_CACHE_GLYF
    otf->gly=otf->glyf+otf->glyphOffsets[gid];
  } else if (otf->gly) {
    if (otf->flags&OTF_F_WOFF) {
      fprintf(stderr,"OTF_F_CACHE_GLYF is needed to read glyphs from wOFF files\n");
      return -1;
    }
    if (!otf_read_raw(otf->f,otf->gly,
                  otf->glyfTable->offset+otf->glyphOffsets[gid],len)) {
      return -1;
    }
  } else {
    assert(0);
    return -1;
  }

  return len;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x4b8d
movq %rdi, %r14
testb $0x1, 0xa(%rdi)
jne 0x4bac
movl %esi, %ebp
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpw %bp, 0x4c(%r14)
jbe 0x4b7f
movq 0x50(%r14), %rax
testq %rax, %rax
jne 0x4b19
movq %r14, %rdi
callq 0x45d8
testl %eax, %eax
jne 0x4bea
movq 0x50(%r14), %rax
movzwl %bp, %ecx
movl (%rax,%rcx,4), %edx
movl 0x4(%rax,%rcx,4), %ecx
movl %ecx, %ebp
subl %edx, %ebp
je 0x4b51
movq 0x88(%r14), %rax
cmpl %ecx, 0xc(%rax)
jb 0x4bcb
movq 0x90(%r14), %rcx
testq %rcx, %rcx
je 0x4b55
addq %rdx, %rcx
movq %rcx, 0x80(%r14)
jmp 0x4b7d
xorl %ebx, %ebx
jmp 0x4b7f
movq 0x80(%r14), %rsi
testq %rsi, %rsi
je 0x4c09
testb $-0x80, 0x9(%r14)
jne 0x4b86
movq (%r14), %rdi
addl 0x8(%rax), %edx
movl %ebp, %ecx
callq 0x39e3
testl %eax, %eax
je 0x4b7f
movl %ebp, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x28eb
jmp 0x4b7f
leaq 0x54a4(%rip), %rdi      # 0xa038
leaq 0x5eb4(%rip), %rsi      # 0xaa4f
leaq 0x5a77(%rip), %rcx      # 0xa619
movl $0x359, %edx            # imm = 0x359
callq 0x20e0
leaq 0x586e(%rip), %rdi      # 0xa421
leaq 0x5e95(%rip), %rsi      # 0xaa4f
leaq 0x5a58(%rip), %rcx      # 0xa619
movl $0x35a, %edx            # imm = 0x35A
callq 0x20e0
leaq 0x5a75(%rip), %rdi      # 0xa647
leaq 0x5e76(%rip), %rsi      # 0xaa4f
leaq 0x5a39(%rip), %rcx      # 0xa619
movl $0x36d, %edx            # imm = 0x36D
callq 0x20e0
leaq 0x60cf(%rip), %rdi      # 0xacc0
leaq 0x5e57(%rip), %rsi      # 0xaa4f
leaq 0x5a1a(%rip), %rcx      # 0xa619
movl $0x363, %edx            # imm = 0x363
callq 0x20e0
leaq 0x60b0(%rip), %rdi      # 0xacc0
leaq 0x5e38(%rip), %rsi      # 0xaa4f
leaq 0x59fb(%rip), %rcx      # 0xa619
movl $0x37a, %edx            # imm = 0x37A
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/embed.c
// Function: emb_close
void emb_close(EMB_PARAMS *emb) // {{{
{
  if (emb) {
    free(emb->subset);
    if (emb->plan&EMB_A_CLOSE_FONTFILE) {
      fontfile_close(emb->font);
    }
    free(emb);
  }
}

// Assembly:
testq %rdi, %rdi
je 0x5022
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
callq 0x21a0
testb $-0x80, 0xd(%rbx)
je 0x5019
movq 0x10(%rbx), %rdi
callq 0x7d18
movq %rbx, %rdi
popq %rbx
jmp 0x21a0
retq
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/embed_sfnt.c
// Function: emb_otf_get_rights
EMB_RIGHT_TYPE emb_otf_get_rights(OTF_FILE *otf) // {{{
{
  EMB_RIGHT_TYPE ret=EMB_RIGHT_FULL;

  int len;
  char *os2=otf_get_table(otf,OTF_TAG('O','S','/','2'),&len);
  if (os2) {
    const unsigned short os2_version=get_USHORT(os2);
    // check len
    assert( (os2_version!=0x0000)||(len==78) );
    assert( (os2_version!=0x0001)||(len==86) );
    assert( (os2_version<0x0002)||(os2_version>0x0004)||(len==96) );
    if (os2_version<=0x0004) {
      // get rights
      unsigned short fsType=get_USHORT(os2+8);
      // from Adobe's Fontpolicies_v9.pdf, pg 13:
      if (fsType==0x0002) {
        ret=EMB_RIGHT_NONE;
      } else {
        ret=fsType&0x0300; // EMB_RIGHT_BITMAPONLY, EMB_RIGHT_NO_SUBSET
        if ((fsType&0x000c)==0x0004) {
          ret|=EMB_RIGHT_READONLY;
        }
      }
    }
    free(os2);
  }
  return ret;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0xc(%rsp), %rdx
movl $0x4f532f32, %esi       # imm = 0x4F532F32
callq 0x423c
testq %rax, %rax
je 0x5451
movzwl (%rax), %ecx
rolw $0x8, %cx
testw %cx, %cx
setne %sil
movl 0xc(%rsp), %edx
cmpl $0x4e, %edx
sete %dil
orb %sil, %dil
je 0x545b
cmpw $0x1, %cx
setne %sil
cmpl $0x56, %edx
sete %dil
orb %sil, %dil
je 0x547a
leal -0x5(%rcx), %esi
cmpw $-0x3, %si
setb %sil
cmpl $0x60, %edx
sete %dl
orb %sil, %dl
je 0x5499
xorl %ebx, %ebx
cmpw $0x4, %cx
ja 0x5447
movzwl 0x8(%rax), %ecx
rolw $0x8, %cx
movl $0x2, %ebx
cmpw $0x2, %cx
je 0x5447
movzwl %cx, %ecx
movl %ecx, %edx
andl $0x300, %edx            # imm = 0x300
andl $0xc, %ecx
leal 0x4(%rdx), %ebx
cmpl $0x4, %ecx
cmovnel %edx, %ebx
movq %rax, %rdi
callq 0x21a0
jmp 0x5453
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
leaq 0x55c6(%rip), %rdi      # 0xaa28
leaq 0x55e0(%rip), %rsi      # 0xaa49
leaq 0x55e6(%rip), %rcx      # 0xaa56
movl $0x14, %edx
callq 0x20e0
leaq 0x5603(%rip), %rdi      # 0xaa84
leaq 0x55c1(%rip), %rsi      # 0xaa49
leaq 0x55c7(%rip), %rcx      # 0xaa56
movl $0x15, %edx
callq 0x20e0
leaq 0x5605(%rip), %rdi      # 0xaaa5
leaq 0x55a2(%rip), %rsi      # 0xaa49
leaq 0x55a8(%rip), %rcx      # 0xaa56
movl $0x16, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x4(%rsp), %r9
movl $0x3, %esi
movl $0x1, %edx
movl $0x409, %ecx            # imm = 0x409
movl $0x6, %r8d
callq 0x4974
testq %rax, %rax
je 0x5565
movslq 0x4(%rsp), %r12
xorl %r15d, %r15d
testq %r12, %r12
jle 0x55f1
movq %rax, %rbx
xorl %ebp, %ebp
xorl %r13d, %r13d
cmpb $0x0, (%rbx,%r13)
jne 0x5542
movb 0x1(%rbx,%r13), %r14b
leal -0x7f(%r14), %eax
cmpb $-0x5e, %al
jb 0x5542
movzbl %r14b, %esi
movl $0xb, %edx
leaq 0x55b4(%rip), %rdi      # 0xaadb
callq 0x2170
testq %rax, %rax
jne 0x5542
movslq %r15d, %rax
incl %r15d
leaq 0x9c22(%rip), %rcx      # 0xf160
movb %r14b, (%rax,%rcx)
cmpq $0x3d, %rbp
ja 0x55ee
addq $0x2, %r13
leaq 0x2(,%rbp,2), %rax
incq %rbp
cmpq %r12, %rax
jb 0x5503
jmp 0x55ee
leaq 0x4(%rsp), %r9
movq %r14, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x6, %r8d
callq 0x4974
testq %rax, %rax
je 0x561c
movq %rax, %rbx
movl 0x4(%rsp), %eax
xorl %r15d, %r15d
testl %eax, %eax
jle 0x55f1
decl %eax
cmpl $0x3e, %eax
movl $0x3e, %r12d
cmovbl %eax, %r12d
incl %r12d
leaq 0x552a(%rip), %r14      # 0xaadb
xorl %ebp, %ebp
movb (%rbx,%rbp), %r13b
leal -0x7f(%r13), %eax
cmpb $-0x5e, %al
jb 0x55e6
movzbl %r13b, %esi
movl $0xb, %edx
movq %r14, %rdi
callq 0x2170
testq %rax, %rax
jne 0x55e6
movslq %r15d, %rax
incl %r15d
leaq 0x9b7e(%rip), %rcx      # 0xf160
movb %r13b, (%rax,%rcx)
incq %rbp
cmpq %rbp, %r12
jne 0x55b3
movslq %r15d, %r15
leaq 0x9b68(%rip), %rax      # 0xf160
movb $0x0, (%r15,%rax)
cmpb $0x0, 0x9b5c(%rip)      # 0xf160
je 0x5623
leaq 0x9b53(%rip), %rax      # 0xf160
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x0, 0x9b3d(%rip)      # 0xf160
callq 0x2ab4
jmp 0x5606
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/embed_sfnt.c
// Function: emb_otf_get_pdf_cidwidths
EMB_PDF_FONTWIDTHS *emb_otf_get_pdf_cidwidths(OTF_FILE *otf,const BITSET glyphs) // {{{ // glyphs==NULL -> output all
{
  assert(otf);

  // ensure hmtx is there
  if (!otf->hmtx) {
    if (otf_load_more(otf)!=0) {
      assert(0);
      return NULL;
    }
  }
//  int dw=emb_otf_pdf_glyphwidth(otf,0); // e.g.
  int dw=-1; // let them estimate

  return emb_pdf_fw_cidwidths(glyphs,otf->numGlyphs,dw,emb_otf_pdf_glyphwidth,otf);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5de5
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x60(%rdi)
jne 0x5dc3
movq %rbx, %rdi
callq 0x45d8
testl %eax, %eax
jne 0x5e04
movzwl 0x4c(%rbx), %esi
leaq 0x55(%rip), %rcx        # 0x5e23
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rbx, %r8
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6ca0
leaq 0x424c(%rip), %rdi      # 0xa038
leaq 0x4c56(%rip), %rsi      # 0xaa49
leaq 0x4f57(%rip), %rcx      # 0xad51
movl $0x129, %edx            # imm = 0x129
callq 0x20e0
leaq 0x4eb5(%rip), %rdi      # 0xacc0
leaq 0x4c37(%rip), %rsi      # 0xaa49
leaq 0x4f38(%rip), %rcx      # 0xad51
movl $0x12e, %edx            # imm = 0x12E
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/./sfnt_int.h
// Function: emb_otf_pdf_glyphwidth
static inline int get_width_fast(OTF_FILE *otf,int gid) // {{{
{
  if (gid>=otf->numberOfHMetrics) {
    return get_USHORT(otf->hmtx+(otf->numberOfHMetrics-1)*4);
  } else {
    return get_USHORT(otf->hmtx+gid*4);
  }
}

// Assembly:
movzwl 0x58(%rdi), %eax
movq 0x60(%rdi), %rcx
leal (,%rsi,4), %edx
movslq %edx, %rdx
leaq (%rcx,%rdx), %r8
cmpl %esi, %eax
leaq 0x1(%rcx,%rdx), %rdx
leaq -0x4(%rcx,%rax,4), %rsi
leaq -0x3(%rcx,%rax,4), %rax
cmovgq %rdx, %rax
cmovgq %r8, %rsi
movzbl (%rsi), %ecx
movzbl (%rax), %eax
shll $0x8, %ecx
orl %eax, %ecx
imull $0x3e8, %ecx, %eax      # imm = 0x3E8
movzwl 0x48(%rdi), %ecx
xorl %edx, %edx
divl %ecx
retq
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/embed_sfnt.c
// Function: get_glyphname
static const char *get_glyphname(const char *post,unsigned short *to_unicode,int charcode,unsigned short gid) // {{{ if charcode==0 -> force gid to be used
{
  if (gid==0) {
    return ".notdef";
  }
  const char *postName=emb_otf_get_post_name(post,gid);
  if (postName) {
    return postName;
  }
  static char ret[255];
  if (charcode) {
    if (to_unicode) { // i.e. encoding was there
      charcode=to_unicode[charcode];
      // TODO!? to_unicode should be able to represent more than one unicode character?
      // TODO for additional credit: for ligatures, etc  create /f_f /uni12341234  or the like
    }
    const char *aglname=aglfn13(charcode); // TODO? special case ZapfDingbats?
    if (aglname) {
      return aglname;
    }
    snprintf(ret,250,"uni%04X",charcode); // allows extraction
  } else {
    snprintf(ret,250,"c%d",gid);  // last resort: only by gid
  }
  return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
testq %rdi, %rdi
je 0x66d4
movl (%rdi), %eax
bswapl %eax
cmpl $0x20000, %eax          # imm = 0x20000
jne 0x66d4
movzwl 0x20(%rdi), %edx
rolw $0x8, %dx
cmpw %cx, %dx
jbe 0x66d4
movzwl %cx, %eax
movzbl 0x23(%rdi,%rax,2), %r8d
movzbl 0x22(%rdi,%rax,2), %r9d
shll $0x8, %r9d
movl %r9d, %eax
orl %r8d, %eax
movzwl %ax, %r8d
cmpl $0x102, %r8d            # imm = 0x102
setb %r8b
testw %r9w, %r9w
sets %r9b
orb %r8b, %r9b
jne 0x66d4
movzwl %dx, %ecx
addq $0x22, %rdi
leaq (%rdi,%rcx,2), %rsi
addw $0xfefe, %ax            # imm = 0xFEFE
je 0x66b5
movzbl (%rsi), %ecx
addq %rcx, %rsi
incq %rsi
decw %ax
jne 0x66a7
movzbl (%rsi), %ebx
incq %rsi
leaq 0x8bde(%rip), %r14      # 0xf2a0
movq %r14, %rdi
movq %rbx, %rdx
callq 0x2100
movb $0x0, (%rbx,%r14)
jmp 0x672b
testl %ebx, %ebx
je 0x670e
testq %rsi, %rsi
je 0x66e4
movslq %ebx, %rax
movzwl (%rsi,%rax,2), %ebx
movzwl %bx, %edi
callq 0x7d3c
movq %rax, %r14
testq %rax, %rax
jne 0x672b
leaq 0x8aa5(%rip), %r14      # 0xf1a0
leaq 0x48e7(%rip), %rdx      # 0xafe9
movl $0xfa, %esi
movq %r14, %rdi
movl %ebx, %ecx
jmp 0x6724
leaq 0x8a8b(%rip), %r14      # 0xf1a0
leaq 0x48d5(%rip), %rdx      # 0xaff1
movl $0xfa, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2210
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/embed_sfnt.c
// Function: outfilter_ascii_ps
static void outfilter_ascii_ps(const char *buf,int len,void *context)  // {{{
{
  struct OUTFILTER_PS *of=context;
  OUTPUT_FN out=of->out;
  int iA;

  (*out)("<",1,of->ctx);
  of->len++;

  const char *last=buf;
  char tmp[256];
  while (len>0) {
    for (iA=0;(iA<76)&&(len>0);iA+=2,len--) {
      const unsigned char ch=buf[iA>>1];
      tmp[iA]="0123456789abcdef"[ch>>4];
      tmp[iA+1]="0123456789abcdef"[ch&0x0f];
    }
    buf+=iA>>1;
    if (buf<last+64000) {
      if (len>0) {
        tmp[iA++]='\n';
      }
      (*out)(tmp,iA,of->ctx);
    } else {
      last=buf;
      strcpy(tmp+iA,"00>\n<");
      iA+=5;
      (*out)(tmp,iA,of->ctx);
    }
    of->len+=iA;
  }

  (*out)("00>\n",4,of->ctx);
  of->len+=4;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
movq (%rdx), %rax
movq 0x8(%rdx), %rdx
leaq 0x48ac(%rip), %rdi      # 0xb00a
movl $0x1, %esi
movq %rax, (%rsp)
callq *%rax
incl 0x10(%rbx)
testl %r14d, %r14d
jle 0x6820
leaq 0x4879(%rip), %r12      # 0xaff5
movq %r15, 0x8(%rsp)
movl %r14d, %r14d
leaq -0x1(%r14), %rcx
xorl %eax, %eax
xorl %r13d, %r13d
movq %r13, %rsi
movq %rax, %rdx
movzbl (%r15,%rax), %eax
movl %eax, %edi
shrl $0x4, %edi
movb (%rdi,%r12), %dil
movb %dil, 0x10(%rsp,%rdx,2)
andl $0xf, %eax
movb (%rax,%r12), %al
movb %al, 0x11(%rsp,%rdx,2)
addq $0x2, %r13
leaq 0x1(%rdx), %rax
cmpq $0x49, %rsi
ja 0x67c3
cmpl %edx, %ecx
jne 0x678d
addq %rax, %r15
movq 0x8(%rsp), %rsi
addq $0xfa00, %rsi           # imm = 0xFA00
cmpq %rsi, %r15
jae 0x67e5
cmpl %edx, %ecx
je 0x67fd
incl %r13d
movb $0xa, 0x10(%rsp,%rax,2)
jmp 0x67fd
movw $0x3c, 0x14(%rsp,%rax,2)
movl $0xa3e3030, 0x10(%rsp,%rax,2) # imm = 0xA3E3030
addl $0x5, %r13d
movq %r15, 0x8(%rsp)
subq %rax, %r14
leaq 0x1(%r14), %rbp
movq 0x8(%rbx), %rdx
leaq 0x10(%rsp), %rdi
movl %r13d, %esi
callq *(%rsp)
addl %r13d, 0x10(%rbx)
cmpl $0x1, %ebp
jg 0x6781
movq 0x8(%rbx), %rdx
leaq 0x47e1(%rip), %rdi      # 0xb00c
movl $0x4, %esi
callq *(%rsp)
addl $0x4, 0x10(%rbx)
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/embed_pdf.c
// Function: emb_pdf_fontdescr
EMB_PDF_FONTDESCR *emb_pdf_fontdescr(EMB_PARAMS *emb) // {{{ -  to be freed by user
{
  assert(emb);

  const char *subset_tag=NULL;
  // {{{ generate pdf subtag
  static unsigned int rands=0;
  if (!rands) {
    rands=time(NULL);
  }

  char subtag[7];
  subtag[6]=0;
  if (emb->plan&EMB_A_SUBSET) {
    int iA;
    for (iA=0;iA<6;iA++) {
      const int x=(int)(26.0*(rand_r(&rands)/(RAND_MAX+1.0)));
      subtag[iA]='A'+x;
    }
    subset_tag=subtag;
  }
  // }}}

  const char *fontname=NULL;
  if ( (emb->intype==EMB_FMT_TTF)||(emb->intype==EMB_FMT_OTF) ) { // TODO? use fontinfo from CFF when outtype==CFT, etc.?
    assert(emb->font->sfnt);
    fontname=emb_otf_get_fontname(emb->font->sfnt);
  } else if (emb->outtype==EMB_FMT_STDFONT) {
    return NULL;
  } else {
    fprintf(stderr,"NOT IMPLEMENTED\n");
    assert(0);
    return NULL;
  }

  EMB_PDF_FONTDESCR *ret;
  if (emb->plan&EMB_A_MULTIBYTE) { // multibyte
    ret=emb_pdf_fd_new(fontname,subset_tag,"Adobe","Identity",0); // TODO other /ROS ?
  } else {
    ret=emb_pdf_fd_new(fontname,subset_tag,NULL,NULL,-1);
  }
  if (!ret) {
    return NULL;
  }

  if ( (emb->intype==EMB_FMT_TTF)||(emb->intype==EMB_FMT_OTF) ) {
    emb_otf_get_pdf_fontdescr(emb->font->sfnt,ret);
  } else {
    assert(0);
  }
  return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x6a09
movq %rdi, %rbx
cmpl $0x0, 0x8a83(%rip)      # 0xf3a0
jne 0x692c
xorl %edi, %edi
callq 0x2110
movl %eax, 0x8a74(%rip)      # 0xf3a0
movb $0x0, 0x7(%rsp)
testb $0x2, 0xc(%rbx)
jne 0x693c
xorl %r14d, %r14d
jmp 0x697e
xorl %r12d, %r12d
leaq 0x8a5a(%rip), %r15      # 0xf3a0
leaq 0x1(%rsp), %r14
movq %r15, %rdi
callq 0x2140
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x46b6(%rip), %xmm0     # 0xb018
mulsd 0x46b6(%rip), %xmm0     # 0xb020
cvttsd2si %xmm0, %eax
addb $0x41, %al
movb %al, 0x1(%rsp,%r12)
incq %r12
cmpq $0x6, %r12
jne 0x694b
movl (%rbx), %eax
decl %eax
cmpl $0x1, %eax
ja 0x69b4
movq 0x10(%rbx), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x6a28
callq 0x54b8
testb $0x1, 0xc(%rbx)
jne 0x69c3
movq %rax, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
jmp 0x69da
cmpl $0x4, 0x4(%rbx)
jne 0x6a47
xorl %r14d, %r14d
jmp 0x69fa
leaq 0x473a(%rip), %rdx      # 0xb104
leaq 0x4739(%rip), %rcx      # 0xb10a
movq %rax, %rdi
movq %r14, %rsi
xorl %r8d, %r8d
callq 0x6a6b
movq %rax, %r14
movl (%rbx), %eax
decl %eax
cmpl $0x1, %eax
ja 0x6a4c
movq 0x10(%rbx), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq 0x562a
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x38c4(%rip), %rdi      # 0xa2d4
leaq 0x4611(%rip), %rsi      # 0xb028
leaq 0x46b3(%rip), %rcx      # 0xb0d1
movl $0x99, %edx
callq 0x20e0
leaq 0x3fa0(%rip), %rdi      # 0xa9cf
leaq 0x45f2(%rip), %rsi      # 0xb028
leaq 0x4694(%rip), %rcx      # 0xb0d1
movl $0xb0, %edx
callq 0x20e0
callq 0x2bcd
leaq 0x426d(%rip), %rdi      # 0xacc0
leaq 0x45ce(%rip), %rsi      # 0xb028
leaq 0x4670(%rip), %rcx      # 0xb0d1
movl $0xc7, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/embed_pdf.c
// Function: emb_pdf_fw_new
EMB_PDF_FONTWIDTHS *emb_pdf_fw_new(int datasize) // {{{
{
  assert(datasize>=0);
  EMB_PDF_FONTWIDTHS *ret=calloc(1,sizeof(EMB_PDF_FONTWIDTHS)+datasize*sizeof(int));
  if (!ret) {
    fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
    assert(0);
    return NULL;
  }
  return ret;
}

// Assembly:
pushq %rax
testl %edi, %edi
js 0x6c7c
movl %edi, %eax
leaq 0x20(,%rax,4), %rsi
movl $0x1, %edi
callq 0x20f0
testq %rax, %rax
je 0x6c9b
popq %rcx
retq
leaq 0x4490(%rip), %rdi      # 0xb113
leaq 0x439e(%rip), %rsi      # 0xb028
leaq 0x448e(%rip), %rcx      # 0xb11f
movl $0xcf, %edx
callq 0x20e0
callq 0x2c51
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/embed_pdf.c
// Function: emb_pdf_fontwidths
EMB_PDF_FONTWIDTHS *emb_pdf_fontwidths(EMB_PARAMS *emb) // {{{
{
  assert(emb);

  if ( (emb->intype==EMB_FMT_TTF)||(emb->intype==EMB_FMT_OTF) ) {
    assert(emb->font->sfnt);
    if (emb->plan&EMB_A_MULTIBYTE) {
      return emb_otf_get_pdf_cidwidths(emb->font->sfnt,emb->subset);
    } else {
      return emb_otf_get_pdf_widths(emb->font->sfnt,/*encoding*/NULL,emb->font->sfnt->numGlyphs,emb->subset); // TODO: encoding
    }
  } else {
    fprintf(stderr,"NOT IMPLEMENTED\n");
    assert(0);
    return NULL;
  }
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x6fdb
movl (%rdi), %eax
decl %eax
cmpl $0x1, %eax
ja 0x6ffa
movq 0x10(%rdi), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x6fff
testb $0x1, 0xc(%rdi)
jne 0x6fce
movzwl 0x4c(%rax), %edx
movq 0x20(%rdi), %rcx
movq %rax, %rdi
xorl %esi, %esi
popq %rax
jmp 0x5bac
movq 0x20(%rdi), %rsi
movq %rax, %rdi
popq %rax
jmp 0x5da1
leaq 0x32f2(%rip), %rdi      # 0xa2d4
leaq 0x403f(%rip), %rsi      # 0xb028
leaq 0x41d4(%rip), %rcx      # 0xb1c4
movl $0x151, %edx            # imm = 0x151
callq 0x20e0
callq 0x2c9b
leaq 0x39c9(%rip), %rdi      # 0xa9cf
leaq 0x401b(%rip), %rsi      # 0xb028
leaq 0x41b0(%rip), %rcx      # 0xb1c4
movl $0x154, %edx            # imm = 0x154
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/embed_pdf.c
// Function: emb_pdf_escape_name
static const char *emb_pdf_escape_name(const char *name,int len) // {{{ // - statically allocated buffer
{
  assert(name);
  if (len==-1) {
    len=strlen(name);
  }
  assert(len<=127); // pdf implementation limit

  static char buf[128*3];
  int iA,iB;
  const char hex[]="0123456789abcdef";

  for (iA=0,iB=0;iA<len;iA++,iB++) {
    if ( ((unsigned char)name[iA]<33)||((unsigned char)name[iA]>126)||
         (strchr("#()<>[]{}/%",name[iA])) ) {
      buf[iB]='#';
      buf[++iB]=hex[(name[iA]>>4)&0x0f];
      buf[++iB]=hex[name[iA]&0xf];
    } else {
      buf[iB]=name[iA];
    }
  }
  buf[iB]=0;
  return buf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x748c
movq %rdi, %rbx
callq 0x2090
movq %rax, %r14
cmpl $0x7f, %r14d
jg 0x74ab
xorl %r12d, %r12d
testl %r14d, %r14d
jle 0x7471
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
leaq 0x7fab(%rip), %r13      # 0xf3b0
xorl %r15d, %r15d
movb (%rbx,%r15), %bpl
leal -0x7f(%rbp), %eax
cmpb $-0x5e, %al
jb 0x742d
movzbl %bpl, %esi
movl $0xc, %edx
leaq 0x42d1(%rip), %rdi      # 0xb6f4
callq 0x2170
testq %rax, %rax
je 0x745c
movslq %r12d, %r12
movb $0x23, (%r12,%r13)
movzbl (%rbx,%r15), %eax
shrl $0x4, %eax
leaq 0x42bc(%rip), %rcx      # 0xb700
movb (%rax,%rcx), %al
movb %al, 0x1(%r12,%r13)
movzbl (%rbx,%r15), %eax
andl $0xf, %eax
movb (%rax,%rcx), %bpl
addl $0x2, %r12d
movslq %r12d, %r12
movb %bpl, (%r12,%r13)
incq %r15
incl %r12d
cmpq %r15, %r14
jne 0x7408
movslq %r12d, %r12
leaq 0x7f38(%rip), %rax      # 0xf3b0
movb $0x0, (%r12,%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x40fa(%rip), %rdi      # 0xb58d
leaq 0x3b8e(%rip), %rsi      # 0xb028
leaq 0x4217(%rip), %rcx      # 0xb6b8
movl $0x29, %edx
callq 0x20e0
leaq 0x4239(%rip), %rdi      # 0xb6eb
leaq 0x3b6f(%rip), %rsi      # 0xb028
leaq 0x41f8(%rip), %rcx      # 0xb6b8
movl $0x2d, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/embed_pdf.c
// Function: emb_pdf_simple_cidfont
char *emb_pdf_simple_cidfont(EMB_PARAMS *emb,const char *fontname,int descendant_obj_ref) // {{{ - to be freed by user
{
  assert(emb);
  assert(fontname);

  char *ret=NULL,*pos;
  int len,size;

  size=250;
  pos=ret=malloc(size);
  if (!ret) {
    fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
    return NULL;
  }
     // for CFF: one of:
     // UniGB-UCS2-H, UniCNS-UCS2-H, UniJIS-UCS2-H, UniKS-UCS2-H
  const char *encoding="Identity-H",*addenc="-";
  if (emb->outtype==EMB_FMT_TTF) { // !=CidType0
    addenc="";
  }

  len=snprintf(pos,size,
               "<</Type /Font\n"
               "  /Subtype /Type0\n"
               "  /BaseFont /%s%s%s\n"
               "  /Encoding /%s\n"
               "  /DescendantFonts [%d 0 R]\n",
//               "  /ToUnicode ?\n" // TODO
               emb_pdf_escape_name(fontname,-1),
               addenc,((addenc[0])?encoding:""),
               encoding,
               descendant_obj_ref);
  NEXT;

  len=snprintf(pos,size,">>\n");
  NEXT;

  return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x78aa
movq %rsi, %r15
testq %rsi, %rsi
je 0x78c9
movl %edx, %r14d
movq %rdi, %r12
movl $0xfa, %edi
callq 0x21c0
movq %rax, %rbx
testq %rax, %rax
je 0x78a3
cmpl $0x1, 0x4(%r12)
leaq 0x2d2d(%rip), %r12      # 0xa547
leaq 0x3cd0(%rip), %r13      # 0xb4f1
cmoveq %r12, %r13
movq %r15, %rdi
callq 0x73c6
cmpb $0x0, (%r13)
leaq 0x3cad(%rip), %r10      # 0xb4e6
cmovneq %r10, %r12
leaq 0x3caf(%rip), %rdx      # 0xb4f3
leaq 0x7b65(%rip), %rcx      # 0xf3b0
movl $0xfa, %esi
movq %rbx, %rdi
movq %r13, %r8
movq %r12, %r9
xorl %eax, %eax
pushq %r14
pushq %r10
callq 0x2210
addq $0x10, %rsp
cmpl $0xfa, %eax
jae 0x78e8
movl %eax, %ecx
movq %rbx, %rdi
addq %rcx, %rdi
movl $0xfa, %r14d
subl %eax, %r14d
leaq 0x3a9f(%rip), %rdx      # 0xb326
movq %r14, %rsi
xorl %eax, %eax
callq 0x2210
cmpl %r14d, %eax
jae 0x7907
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x2d03
jmp 0x7896
leaq 0x2a23(%rip), %rdi      # 0xa2d4
leaq 0x3770(%rip), %rsi      # 0xb028
leaq 0x3be0(%rip), %rcx      # 0xb49f
movl $0x212, %edx            # imm = 0x212
callq 0x20e0
leaq 0x3c0d(%rip), %rdi      # 0xb4dd
leaq 0x3751(%rip), %rsi      # 0xb028
leaq 0x3bc1(%rip), %rcx      # 0xb49f
movl $0x213, %edx            # imm = 0x213
callq 0x20e0
leaq 0x33d1(%rip), %rdi      # 0xacc0
leaq 0x3732(%rip), %rsi      # 0xb028
leaq 0x3ba2(%rip), %rcx      # 0xb49f
movl $0x230, %edx            # imm = 0x230
callq 0x20e0
leaq 0x33b2(%rip), %rdi      # 0xacc0
leaq 0x3713(%rip), %rsi      # 0xb028
leaq 0x3b83(%rip), %rcx      # 0xb49f
movl $0x233, %edx            # imm = 0x233
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/embed_pdf.c
// Function: emb_pdf_simple_stdfont
char *emb_pdf_simple_stdfont(EMB_PARAMS *emb) // {{{ - to be freed by user
{
  assert(emb);
  assert(emb->font->stdname);

  char *ret=NULL,*pos;
  int len,size;

  size=300;
  pos=ret=malloc(size);
  if (!ret) {
    fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
    return NULL;
  }

  len=snprintf(pos,size,
               "<</Type/Font\n"
               "  /Subtype /Type1\n"
               "  /BaseFont /%s\n"
               ">>\n",
//               emb_pdf_get_font_subtype(emb),
               emb->font->stdname);
  NEXT;

  return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7980
movq 0x10(%rdi), %rax
movq 0x8(%rax), %r14
testq %r14, %r14
je 0x799f
movl $0x12c, %edi            # imm = 0x12C
callq 0x21c0
movq %rax, %rbx
testq %rax, %rax
je 0x7979
leaq 0x3c3d(%rip), %rdx      # 0xb592
movl $0x12c, %esi            # imm = 0x12C
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2210
cmpl $0x12c, %eax            # imm = 0x12C
jae 0x79be
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x2d2f
jmp 0x796e
leaq 0x294d(%rip), %rdi      # 0xa2d4
leaq 0x369a(%rip), %rsi      # 0xb028
leaq 0x3bbf(%rip), %rcx      # 0xb554
movl $0x23b, %edx            # imm = 0x23B
callq 0x20e0
leaq 0x3bd9(%rip), %rdi      # 0xb57f
leaq 0x367b(%rip), %rsi      # 0xb028
leaq 0x3ba0(%rip), %rcx      # 0xb554
movl $0x23c, %edx            # imm = 0x23C
callq 0x20e0
leaq 0x32fb(%rip), %rdi      # 0xacc0
leaq 0x365c(%rip), %rsi      # 0xb028
leaq 0x3b81(%rip), %rcx      # 0xb554
movl $0x24f, %edx            # imm = 0x24F
callq 0x20e0
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/dynstring.c
// Function: dyn_init
int dyn_init(DYN_STRING *ds,int reserve_size) // {{{
{
  assert(ds);
  assert(reserve_size>0);

  ds->len=0;
  ds->alloc=reserve_size;
  ds->buf=malloc(ds->alloc+1);
  if (!ds->buf) {
    fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
    assert(0);
    ds->len=-1;
    return -1;
  }
  return 0;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x7a0d
testl %esi, %esi
jle 0x7a2c
movq %rdi, %rbx
movl $0x0, (%rdi)
movl %esi, 0x4(%rdi)
incl %esi
movq %rsi, %rdi
callq 0x21c0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x7a4b
xorl %eax, %eax
popq %rbx
retq
leaq 0x3cfd(%rip), %rdi      # 0xb711
leaq 0x3cf9(%rip), %rsi      # 0xb714
leaq 0x3cfe(%rip), %rcx      # 0xb720
movl $0xb, %edx
callq 0x20e0
leaq 0x3d0d(%rip), %rdi      # 0xb740
leaq 0x3cda(%rip), %rsi      # 0xb714
leaq 0x3cdf(%rip), %rcx      # 0xb720
movl $0xc, %edx
callq 0x20e0
callq 0x2d5b
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/dynstring.c
// Function: dyn_free
void dyn_free(DYN_STRING *ds) // {{{
{
  assert(ds);

  ds->len=-1;
  ds->alloc=0;
  free(ds->buf);
  ds->buf=NULL;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x7a74
movq %rdi, %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, (%rdi)
movq 0x8(%rdi), %rdi
callq 0x21a0
movq $0x0, 0x8(%rbx)
popq %rbx
retq
leaq 0x3c96(%rip), %rdi      # 0xb711
leaq 0x3c92(%rip), %rsi      # 0xb714
leaq 0x3cc6(%rip), %rcx      # 0xb74f
movl $0x1d, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/dynstring.c
// Function: dyn_ensure
int dyn_ensure(DYN_STRING *ds,int free_space) // {{{
{
  assert(ds);
  assert(free_space);

  if (ds->len<0) {
    return -1;
  }
  if (ds->alloc - ds->len >= free_space) {
    return 0; // done
  }
  ds->alloc+=free_space;
  char *tmp=realloc(ds->buf,ds->alloc+1);
  if (!tmp) {
    ds->len=-1;
    fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
    assert(0);
    return -1;
  }
  ds->buf=tmp;
  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7ae4
testl %esi, %esi
je 0x7b03
movq %rdi, %rbx
movl (%rdi), %ecx
testl %ecx, %ecx
js 0x7ad6
movl 0x4(%rbx), %eax
movl %eax, %edx
subl %ecx, %edx
xorl %ebp, %ebp
cmpl %esi, %edx
jge 0x7adb
leal (%rax,%rsi), %ecx
movl %ecx, 0x4(%rbx)
movq 0x8(%rbx), %rdi
addl %esi, %eax
incl %eax
movslq %eax, %rsi
callq 0x2230
testq %rax, %rax
je 0x7b22
movq %rax, 0x8(%rbx)
jmp 0x7adb
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x3c26(%rip), %rdi      # 0xb711
leaq 0x3c22(%rip), %rsi      # 0xb714
leaq 0x3c72(%rip), %rcx      # 0xb76b
movl $0x28, %edx
callq 0x20e0
leaq 0x3c83(%rip), %rdi      # 0xb78d
leaq 0x3c03(%rip), %rsi      # 0xb714
leaq 0x3c53(%rip), %rcx      # 0xb76b
movl $0x29, %edx
callq 0x20e0
movq %rbx, %rdi
callq 0x2da3
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/dynstring.c
// Function: dyn_vprintf
int dyn_vprintf(DYN_STRING *ds,const char *fmt,va_list ap) // {{{
{
  assert(ds);

  int need,len=strlen(fmt)+100;
  va_list va;

  if (dyn_ensure(ds,len)==-1) {
    return -1;
  }

  while (1) {
    va_copy(va,ap);
    need=vsnprintf(ds->buf+ds->len,ds->alloc-ds->len+1,fmt,va);
    va_end(va);
    if (need==-1) {
      len+=100;
    } else if (need>=len) {
      len=need;
    } else {
      ds->len+=need;
      break;
    }
    if (dyn_ensure(ds,len)==-1) {
      return -1;
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x7be2
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x2090
movq %rax, %r13
addl $0x64, %r13d
movq %r14, %rdi
movl %r13d, %esi
callq 0x7a93
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x7bd1
movq %rsp, %r12
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
movups (%rbx), %xmm0
movaps %xmm0, (%rsp)
movslq (%r14), %rdi
movl 0x4(%r14), %eax
subl %edi, %eax
addq 0x8(%r14), %rdi
incl %eax
movslq %eax, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x20d0
cmpl $-0x1, %eax
je 0x7bac
movl %eax, %ebp
cmpl %r13d, %eax
jge 0x7bb3
jmp 0x7bcc
addl $0x64, %r13d
movl %r13d, %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x7a93
movl %ebp, %r13d
cmpl $-0x1, %eax
jne 0x7b71
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x7bd1
addl %ebp, (%r14)
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3b28(%rip), %rdi      # 0xb711
leaq 0x3b24(%rip), %rsi      # 0xb714
leaq 0x3ba1(%rip), %rcx      # 0xb798
movl $0x40, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/fontfile.c
// Function: fontfile_open_sfnt
FONTFILE *fontfile_open_sfnt(OTF_FILE *otf) // {{{
{
  if (!otf) {
    assert(0);
    return NULL;
  }
  FONTFILE *ret=calloc(1,sizeof(FONTFILE));

  ret->sfnt=otf;

  return ret;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x7ca5
movq %rdi, %rbx
movl $0x1, %edi
movl $0x18, %esi
callq 0x20f0
movq %rbx, (%rax)
popq %rbx
retq
leaq 0x3014(%rip), %rdi      # 0xacc0
leaq 0x3b29(%rip), %rsi      # 0xb7dc
leaq 0x3b2d(%rip), %rcx      # 0xb7e7
movl $0x13, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/fontfile.c
// Function: fontfile_open_std
FONTFILE *fontfile_open_std(const char *name) // {{{
{
  assert(name);
  FONTFILE *ret=calloc(1,sizeof(FONTFILE));

  ret->stdname=strdup(name);

  return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7cf9
movq %rdi, %rbx
movl $0x1, %edi
movl $0x18, %esi
callq 0x20f0
movq %rax, %r14
movq %rbx, %rdi
callq 0x2240
movq %rax, 0x8(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x388d(%rip), %rdi      # 0xb58d
leaq 0x3ad5(%rip), %rsi      # 0xb7dc
leaq 0x3b02(%rip), %rcx      # 0xb810
movl $0x20, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/fontfile.c
// Function: fontfile_close
void fontfile_close(FONTFILE *ff) // {{{
{
  if (ff) {
    otf_close(ff->sfnt);
    // ??? cff_close(ff->cff);
    free(ff->stdname);
    free(ff);
  }
}

// Assembly:
testq %rdi, %rdi
je 0x7d3b
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x4034
movq 0x8(%rbx), %rdi
callq 0x21a0
movq %rbx, %rdi
popq %rbx
jmp 0x21a0
retq
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/frequent.c
// Function: frequent_new
FREQUENT *frequent_new(int size) // {{{ - just free() it
{
  assert(size>0);
  FREQUENT *ret=malloc(sizeof(ret[0])+sizeof(ret->pair[0])*size);
  if (!ret) {
    return NULL;
  }
  ret->size=size;
  ret->czero=0;
  ret->sorted=1;
  int iA;
  for (iA=0;iA<size;iA++) {
    ret->pair[iA].key=INTPTR_MIN;
    ret->pair[iA].count=0;
    ret->pair[iA].zero=0;
  }

  return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testl %edi, %edi
jle 0x7d97
movl %edi, %ebx
movl %edi, %r14d
shlq $0x4, %r14
leaq 0x10(%r14), %rdi
callq 0x21c0
testq %rax, %rax
je 0x7d8f
movl %ebx, (%rax)
movl $0x0, 0x4(%rax)
movb $0x1, 0x8(%rax)
xorl %ecx, %ecx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
movq %rdx, 0x10(%rax,%rcx)
movq $0x0, 0x18(%rax,%rcx)
addq $0x10, %rcx
cmpq %rcx, %r14
jne 0x7d78
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x39aa(%rip), %rdi      # 0xb748
leaq 0x3a95(%rip), %rsi      # 0xb83a
leaq 0x3a99(%rip), %rcx      # 0xb845
movl $0x11, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/frequent.c
// Function: frequent_add
void frequent_add(FREQUENT *freq,intptr_t key) // {{{
{
  assert(freq);
  int iA,zero=-1;
  for (iA=freq->size-1;iA>=0;iA--) {
    if (freq->pair[iA].key==key) {
      freq->pair[iA].count++;
      freq->sorted=0;
      return;
    } else if (freq->pair[iA].count==freq->czero) {
      zero=iA;
    }
  }
  if (zero>=0) { // insert into set
    freq->pair[zero].key=key;
    freq->pair[zero].count++; // i.e. czero+1
    freq->pair[zero].zero=freq->czero;
    // if it was sorted, the free entries are at the end. zero points to the first free entry, because of the loop direction
  } else { // out-of-set count
    freq->czero++;
  }
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x7e2c
movslq (%rdi), %rdx
testq %rdx, %rdx
jle 0x7e1b
movq %rdx, %rax
shlq $0x4, %rax
leaq (%rax,%rdi), %rcx
addq $0x8, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl (%rcx), %r8d
cmpq %rsi, -0x8(%rcx)
je 0x7e20
leaq -0x1(%rdx), %r9
decl %edx
cmpl 0x4(%rdi), %r8d
cmovel %edx, %eax
leaq 0x1(%r9), %r8
addq $-0x10, %rcx
movq %r9, %rdx
cmpq $0x1, %r8
ja 0x7dd8
testl %eax, %eax
js 0x7e1b
movl %eax, %eax
shlq $0x4, %rax
movq %rsi, 0x10(%rdi,%rax)
incl 0x18(%rdi,%rax)
movl 0x4(%rdi), %ecx
movl %ecx, 0x1c(%rdi,%rax)
jmp 0x7e2a
incl 0x4(%rdi)
jmp 0x7e2a
incl %r8d
movl %r8d, (%rcx)
movb $0x0, 0x8(%rdi)
popq %rax
retq
leaq 0x3a2e(%rip), %rdi      # 0xb861
leaq 0x3a00(%rip), %rsi      # 0xb83a
leaq 0x3a25(%rip), %rcx      # 0xb866
movl $0x26, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/frequent.c
// Function: frequent_get
intptr_t frequent_get(FREQUENT *freq,int pos) // {{{
{
  assert(freq);
  if (!freq->sorted) {
    // sort by (count-zero)
    qsort(freq->pair,freq->size,sizeof(freq->pair[0]),frequent_cmp);
    freq->sorted=1;
  }
  if ( (pos<0)||(pos>=freq->size) ) {
    return INTPTR_MIN;
  }
  return freq->pair[pos].key;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7e9e
movl %esi, %ebp
movq %rdi, %rbx
cmpb $0x0, 0x8(%rdi)
jne 0x7e7a
leaq 0x10(%rbx), %rdi
movslq (%rbx), %rsi
leaq 0x51(%rip), %rcx        # 0x7ebd
movl $0x10, %edx
callq 0x2250
movb $0x1, 0x8(%rbx)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
testl %ebp, %ebp
js 0x7e97
cmpl %ebp, (%rbx)
jle 0x7e97
movl %ebp, %eax
shlq $0x4, %rax
movq 0x10(%rbx,%rax), %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x39bc(%rip), %rdi      # 0xb861
leaq 0x398e(%rip), %rsi      # 0xb83a
leaq 0x39db(%rip), %rcx      # 0xb88e
movl $0x47, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt_subset.c
// Function: otf_copy_sfnt
int otf_copy_sfnt(OTF_FILE *otf,struct _OTF_WRITE_WOFF *woff,OUTPUT_FN output,void *context) // {{{
{
  assert(otf);
  assert(output);
  int iA;

  struct _OTF_WRITE_INFO otw={
    .version=otf->version,
    .numTables=otf->numTables
  };
  otw.tables=malloc(sizeof(struct _OTF_WRITE_TABLE)*otf->numTables);
  if (!otw.tables) {
    fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
    return -1;
  }

  // just copy everything
  for (iA=0;iA<otf->numTables;iA++) {
    otw.tables[iA].tag=otf->tables[iA].tag;
    otw.tables[iA].action=otf_action_copy;
    otw.tables[iA].copy.otf=otf;
    otw.tables[iA].copy.table_no=iA;
  }
  otw.order=otf_tagorder_offset_sort(otf);

  const int ret=otf_write_sfnt(&otw,woff,output,context);

  free(otw.order);
  free(otw.tables);
  return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
testq %rdi, %rdi
je 0x7fbb
movq %rdx, %r14
testq %rdx, %rdx
je 0x7fda
movq %rcx, %rbx
movq %rsi, %r15
movq %rdi, %r12
movq $0x0, 0x8(%rsp)
movl 0x14(%rdi), %eax
movl %eax, 0x8(%rsp)
movzwl 0x38(%rdi), %r13d
movw %r13w, 0xc(%rsp)
movl %r13d, %eax
shll $0x4, %eax
leaq (%rax,%rax,4), %rdi
callq 0x21c0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x7faf
testq %r13, %r13
je 0x7f66
movq 0x40(%r12), %rcx
xorl %edx, %edx
leaq 0xfd7(%rip), %rsi       # 0x8f19
xorl %edi, %edi
movl (%rcx,%rdx), %r8d
movq %r8, (%rax,%rdx,4)
movq %rsi, 0x8(%rax,%rdx,4)
movq %r12, 0x10(%rax,%rdx,4)
movl %edi, 0x18(%rax,%rdx,4)
incq %rdi
addq $0x14, %rdx
cmpq %r13, %rdi
jb 0x7f44
movq %r12, %rdi
callq 0x8e4f
leaq 0x8(%rsp), %r12
movq %rax, 0x10(%r12)
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x909a
movl %eax, %ebx
movq 0x10(%r12), %rdi
callq 0x21a0
movq 0x8(%r12), %rdi
callq 0x21a0
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x2dee
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x7f9f
leaq 0x2076(%rip), %rdi      # 0xa038
leaq 0x38ec(%rip), %rsi      # 0xb8b5
leaq 0x38f3(%rip), %rcx      # 0xb8c3
movl $0xc, %edx
callq 0x20e0
leaq 0x2a38(%rip), %rdi      # 0xaa19
leaq 0x38cd(%rip), %rsi      # 0xb8b5
leaq 0x38d4(%rip), %rcx      # 0xb8c3
movl $0xd, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt_subset.c
// Function: otf_intersect_tables
int otf_intersect_tables(OTF_FILE *otf,struct _OTF_WRITE_TABLE *tables) // {{{
{
  int iA,iB,numTables=0;
  for (iA=0,iB=0;(iA<otf->numTables)&&(tables[iB].tag);) {
    if (otf->tables[iA].tag==tables[iB].tag) {
      if (tables[iB].action) {
        if (tables[iB].action==otf_action_copy) {
          tables[iB].copy.table_no=iA; // original table location found.
        }
        if (iB!=numTables) { // >, actually
          memmove(tables+numTables,tables+iB,sizeof(struct _OTF_WRITE_TABLE));
        }
        numTables++;
      } // else skip
      iA++;
      iB++;
    } else if (otf->tables[iA].tag<tables[iB].tag) {
      iA++;
    } else { // not in otf->tables
      if ( (tables[iB].action)&&(tables[iB].action!=otf_action_copy) ) { // keep
        if (iB!=numTables) { // >, actually
          memmove(tables+numTables,tables+iB,sizeof(struct _OTF_WRITE_TABLE));
        }
        numTables++;
      } // else delete
      iB++;
    }
  }
  return numTables;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpw $0x0, 0x38(%rdi)
je 0x8100
movq %rsi, %r14
movq %rdi, %r15
xorl %ebx, %ebx
leaq 0xec8(%rip), %r12       # 0x8f19
xorl %ebp, %ebp
xorl %r13d, %r13d
movslq %ebp, %rax
leaq (%rax,%rax,4), %rsi
shlq $0x4, %rsi
movq (%r14,%rsi), %rax
testq %rax, %rax
je 0x8102
addq %r14, %rsi
movq 0x40(%r15), %rcx
movslq %r13d, %rdx
leaq (%rdx,%rdx,4), %rdx
movl (%rcx,%rdx,4), %ecx
cmpq %rcx, %rax
jne 0x80bb
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x80b4
cmpq %r12, %rax
jne 0x8096
movl %r13d, 0x18(%rsi)
cmpl %ebx, %ebp
je 0x80b2
movslq %ebx, %rax
leaq (%rax,%rax,4), %rdi
shlq $0x4, %rdi
addq %r14, %rdi
movl $0x50, %edx
callq 0x2220
incl %ebx
incl %r13d
incl %ebp
jmp 0x80c0
jbe 0x80cc
incl %r13d
movzwl 0x38(%r15), %eax
cmpl %eax, %r13d
jl 0x8056
jmp 0x8102
movq 0x8(%rsi), %rax
testq %rax, %rax
sete %cl
cmpq %r12, %rax
sete %al
orb %cl, %al
jne 0x80b7
cmpl %ebx, %ebp
je 0x80fc
movslq %ebx, %rax
leaq (%rax,%rax,4), %rdi
shlq $0x4, %rdi
addq %r14, %rdi
movl $0x50, %edx
callq 0x2220
incl %ebx
jmp 0x80b7
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt_subset.c
// Function: otf_subset_glyf
static int otf_subset_glyf(OTF_FILE *otf,int curgid,int donegid,BITSET glyphs) // {{{
{
  int ret=0;
  if (get_SHORT(otf->gly)>=0) { // not composite
    return ret; // done
  }

  char *cur=otf->gly+10;

  unsigned short flags;
  do {
    flags=get_USHORT(cur);
    const unsigned short sub_gid=get_USHORT(cur+2);
    assert(sub_gid<otf->numGlyphs);
    if (!bit_check(glyphs,sub_gid)) {
      // bad: temporarily load sub glyph
      const int len=otf_get_glyph(otf,sub_gid);
      assert(len>0);
      bit_set(glyphs,sub_gid);
      if (sub_gid<donegid) {
        ret+=len;
        ret+=otf_subset_glyf(otf,sub_gid,donegid,glyphs); // composite of composites?, e.g. in DejaVu
      }
      const int res=otf_get_glyph(otf,curgid); // reload current glyph
      assert(res);
    }

    // skip parameters
    cur+=6;
    if (flags&0x01) {
      cur+=2;
    }
    if (flags&0x08) {
      cur+=2;
    } else if (flags&0x40) {
      cur+=4;
    } else if (flags&0x80) {
      cur+=8;
    }
  } while (flags&0x20); // more components

  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, 0x14(%rsp)
movq 0x80(%rdi), %rbp
movl $0x0, 0xc(%rsp)
cmpb $0x0, (%rbp)
jns 0x892e
movq %rcx, %r8
addq $0xa, %rbp
movl $0x0, 0xc(%rsp)
movzwl %si, %eax
movl %eax, 0x10(%rsp)
movq %rcx, 0x20(%rsp)
movq %rdi, 0x18(%rsp)
movzwl 0x2(%rbp), %eax
rolw $0x8, %ax
cmpw 0x4c(%rdi), %ax
jae 0x8941
movzbl 0x1(%rbp), %r15d
movzwl %ax, %r13d
movl %r13d, %ebx
shrl $0x5, %ebx
movl (%r8,%rbx,4), %eax
movl $0x1, %r14d
movl %r13d, %ecx
shll %cl, %r14d
btl %r13d, %eax
jb 0x88f5
movl %r13d, %esi
callq 0x4ad0
testl %eax, %eax
jle 0x897f
movq 0x20(%rsp), %rcx
orl %r14d, (%rcx,%rbx,4)
movl 0x14(%rsp), %edx
cmpl %edx, %r13d
jge 0x88d8
movl %eax, %r12d
addl 0xc(%rsp), %r12d
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x8813
addl %r12d, %eax
movl %eax, 0xc(%rsp)
jmp 0x88dd
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movl 0x10(%rsp), %esi
callq 0x4ad0
testl %eax, %eax
movq 0x20(%rsp), %r8
movq %rbx, %rdi
je 0x8960
movl $0x2, %eax
testb $0x8, %r15b
jne 0x8916
movl $0x4, %eax
testb $0x40, %r15b
jne 0x8916
movl %r15d, %eax
shrb $0x4, %al
andb $0x8, %al
movzbl %al, %eax
movl %r15d, %ecx
andl $0x1, %ecx
leaq 0x6(%rbp,%rcx,2), %rbp
addq %rax, %rbp
testb $0x20, %r15b
jne 0x885e
movl 0xc(%rsp), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3131(%rip), %rdi      # 0xba79
leaq 0x2f66(%rip), %rsi      # 0xb8b5
leaq 0x313a(%rip), %rcx      # 0xba90
movl $0x65, %edx
callq 0x20e0
leaq 0x17c9(%rip), %rdi      # 0xa130
leaq 0x2f47(%rip), %rsi      # 0xb8b5
leaq 0x311b(%rip), %rcx      # 0xba90
movl $0x70, %edx
callq 0x20e0
leaq 0x313c(%rip), %rdi      # 0xbac2
leaq 0x2f28(%rip), %rsi      # 0xb8b5
leaq 0x30fc(%rip), %rcx      # 0xba90
movl $0x69, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt_subset.c
// Function: otf_cff_extract
int otf_cff_extract(OTF_FILE *otf,OUTPUT_FN output,void *context) // {{{ - returns number of bytes written
{
  assert(otf);
  assert(output);

  if (otf->flags&OTF_F_WOFF) {
    int len;
    char *data=otf_get_table(otf,OTF_TAG('C','F','F',' '),&len);
    if (!data) {
      return -1;
    }
    (*output)(data,len,context);
    return len;
  }

  int idx=otf_find_table(otf,OTF_TAG('C','F','F',' '));
  if (idx==-1) {
    return -1;
  }
  const OTF_DIRENT *table=otf->tables+idx;

  return copy_block(otf->f,table->offset,table->length,output,context);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movq %rdx, 0x8(%rsp)
testq %rdi, %rdi
je 0x8d0a
movq %rsi, %rbx
testq %rsi, %rsi
je 0x8d29
movq %rdi, %r12
testb $-0x80, 0x9(%rdi)
jne 0x8cc3
movq %r12, %rdi
movl $0x43464620, %esi       # imm = 0x43464620
callq 0x41db
cmpl $-0x1, %eax
je 0x8cf3
movq (%r12), %r15
testq %r15, %r15
je 0x8d48
movq 0x40(%r12), %rcx
cltq
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,4), %rax
movl 0xc(%rax), %r14d
movl 0x8(%rax), %esi
xorl %ebp, %ebp
movq %r15, %rdi
xorl %edx, %edx
callq 0x2160
cmpl $-0x1, %eax
je 0x8cee
cmpl $0x1001, %r14d          # imm = 0x1001
jl 0x8c88
xorl %ebp, %ebp
leaq 0x10(%rsp), %r12
movl $0x1, %esi
movl $0x1000, %edx           # imm = 0x1000
movq %r12, %rdi
movq %r15, %rcx
callq 0x21e0
movq %rax, %r13
cmpl $0x1000, %r13d          # imm = 0x1000
jl 0x8cf3
movq %r12, %rdi
movl %r13d, %esi
movq 0x8(%rsp), %rdx
callq *%rbx
addl %r13d, %ebp
subl %r13d, %r14d
cmpl $0x1000, %r14d          # imm = 0x1000
jg 0x8c47
movslq %r14d, %r12
leaq 0x10(%rsp), %rdi
movl $0x1, %esi
movq %r12, %rdx
movq %r15, %rcx
callq 0x21e0
movq %rax, %r15
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r15d, %r12d
jg 0x8cf8
leaq 0x10(%rsp), %rdi
movl %r15d, %esi
movq 0x8(%rsp), %rdx
callq *%rbx
addl %r15d, %ebp
movl %ebp, %eax
jmp 0x8cf8
leaq 0x10(%rsp), %rdx
movq %r12, %rdi
movl $0x43464620, %esi       # imm = 0x43464620
callq 0x423c
testq %rax, %rax
je 0x8cf3
movl 0x10(%rsp), %esi
movq %rax, %rdi
movq 0x8(%rsp), %rdx
callq *%rbx
movl 0x10(%rsp), %eax
jmp 0x8cf8
callq 0x2e64
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1327(%rip), %rdi      # 0xa038
leaq 0x2b9d(%rip), %rsi      # 0xb8b5
leaq 0x2d27(%rip), %rcx      # 0xba46
movl $0x166, %edx            # imm = 0x166
callq 0x20e0
leaq 0x1ce9(%rip), %rdi      # 0xaa19
leaq 0x2b7e(%rip), %rsi      # 0xb8b5
leaq 0x2d08(%rip), %rcx      # 0xba46
movl $0x167, %edx            # imm = 0x167
callq 0x20e0
leaq 0x1316(%rip), %rdi      # 0xa065
leaq 0x2b5f(%rip), %rsi      # 0xb8b5
leaq 0x2d6b(%rip), %rcx      # 0xbac8
movl $0x144, %edx            # imm = 0x144
callq 0x20e0
nop