// File: /workspace/github_c_makefile_star2_O1/smilingthax[P]libfontembed/sfnt_subset.c
// Function: otf_subset_cff2
int otf_subset_cff2(OTF_FILE *otf,BITSET glyphs,SUBSET_DESTINATION dest,struct _OTF_WRITE_WOFF *woff,OUTPUT_FN output,void *context) // {{{ - returns number of bytes written
{
  assert(otf);
  assert(output);

// TODO char *new_cff=cff_subset(...);

  // determine new tables.
  struct _OTF_WRITE_TABLE tables[]={
      {OTF_TAG('C','F','F',' '),otf_action_copy,.copy={otf,}}, // 0
//      {OTF_TAG('C','F','F',' '),otf_action_replace,.replace={new_glyf,glyfSize}},
// also needed for (e.g.) chrome:
      {OTF_TAG('O','S','/','2'),NULL,.copy={otf,}},
      {OTF_TAG('c','m','a','p'),otf_action_copy,.copy={otf,}},

      // not actually needed in pdf:
      {OTF_TAG('h','e','a','d'),otf_action_copy,.copy={otf,}},
      {OTF_TAG('h','h','e','a'),otf_action_copy,.copy={otf,}},
      {OTF_TAG('h','m','t','x'),otf_action_copy,.copy={otf,}}, // 5
      {OTF_TAG('m','a','x','p'),otf_action_copy,.copy={otf,}},
      {OTF_TAG('n','a','m','e'),otf_action_copy,.copy={otf,}},

      {OTF_TAG('p','o','s','t'),NULL,.copy={otf,}},
      {0,0,}};
  if (dest==SUBSET_DST_BROWSER) {
    // e.g. chrome:
    tables[1].action=otf_action_copy; // OS/2
    tables[8].action=otf_action_copy; // post
  } else {
    tables[3].action=NULL; // head
    tables[4].action=NULL;
    tables[5].action=NULL;
    tables[6].action=NULL;
    tables[7].action=NULL; // name
  }

  // and write them
  const int numTables=otf_intersect_tables(otf,tables);
  struct _OTF_WRITE_INFO otw={
    .version=otf->version,
    .numTables=numTables,
    .tables=tables,
    .order=otf_tagorder_win_sort(tables,numTables)
  };
  const int ret=otf_write_sfnt(&otw,woff,output,context);

  free(otw.order);
//  free(new_cff);
  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x348, %rsp            # imm = 0x348
testq %rdi, %rdi
je 0x8c0d
movq %r8, %r14
testq %r8, %r8
je 0x8c2c
movq %r9, %rbx
movq %rcx, %r15
movl %edx, %ebp
movq %rdi, %r12
leaq 0x20(%rsp), %r13
movl $0x320, %edx            # imm = 0x320
movq %r13, %rdi
xorl %esi, %esi
callq 0x20c0
movq $0x43464620, (%r13)     # imm = 0x43464620
leaq 0x519(%rip), %rax       # 0x8fc8
movq %rax, 0x8(%r13)
movq %r12, 0x10(%r13)
movq $0x4f532f32, 0x50(%r13) # imm = 0x4F532F32
movq %r12, 0x60(%r13)
movq $0x636d6170, 0xa0(%r13) # imm = 0x636D6170
movq %rax, 0xa8(%r13)
movq %r12, 0xb0(%r13)
movq $0x68656164, 0xf0(%r13) # imm = 0x68656164
movq %rax, 0xf8(%r13)
movq %r12, 0x100(%r13)
movq $0x68686561, 0x140(%r13) # imm = 0x68686561
movq %rax, 0x148(%r13)
movq %r12, 0x150(%r13)
movq $0x686d7478, 0x190(%r13) # imm = 0x686D7478
movq %rax, 0x198(%r13)
movq %r12, 0x1a0(%r13)
movq $0x6d617870, 0x1e0(%r13) # imm = 0x6D617870
movq %rax, 0x1e8(%r13)
movq %r12, 0x1f0(%r13)
movq $0x6e616d65, 0x230(%r13) # imm = 0x6E616D65
movq %rax, 0x238(%r13)
movq %r12, 0x240(%r13)
movq $0x706f7374, 0x280(%r13) # imm = 0x706F7374
movq %r12, 0x290(%r13)
cmpl $0x1, %ebp
jne 0x8b7f
movq %rax, 0x78(%rsp)
movq %rax, 0x2a8(%rsp)
jmp 0x8ba9
xorl %eax, %eax
movq %rax, 0x118(%rsp)
movq %rax, 0x168(%rsp)
movq %rax, 0x1b8(%rsp)
movq %rax, 0x208(%rsp)
movq %rax, 0x258(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x80e2
movl 0x14(%r12), %ecx
leaq 0x8(%rsp), %r12
movl %ecx, (%r12)
movw %ax, 0x4(%r12)
movq %r13, 0x8(%r12)
movq %r13, %rdi
movl %eax, %esi
callq 0x8e10
movq %rax, 0x10(%r12)
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x914d
movl %eax, %ebx
movq 0x10(%r12), %rdi
callq 0x21a0
movl %ebx, %eax
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1424(%rip), %rdi      # 0xa038
leaq 0x2c9a(%rip), %rsi      # 0xb8b5
leaq 0x2dbb(%rip), %rcx      # 0xb9dd
movl $0x108, %edx            # imm = 0x108
callq 0x20e0
leaq 0x1de6(%rip), %rdi      # 0xaa19
leaq 0x2c7b(%rip), %rsi      # 0xb8b5
leaq 0x2d9c(%rip), %rcx      # 0xb9dd
movl $0x109, %edx            # imm = 0x109
callq 0x20e0