// File: /workspace/github_c_makefile_star2_O2/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 0x83d3
movq %r8, %r14
testq %r8, %r8
je 0x83f2
movq %r9, %rbx
movq %rcx, %r15
movl %edx, %ebp
movq %rdi, %r12
leaq 0x30(%rsp), %r13
movl $0x310, %edx            # imm = 0x310
movq %r13, %rdi
xorl %esi, %esi
callq 0x20d0
movq $0x43464620, -0x10(%r13) # imm = 0x43464620
leaq 0x560(%rip), %rax       # 0x87cd
movq %rax, -0x8(%r13)
movq %r12, (%r13)
movq $0x4f532f32, 0x40(%r13) # imm = 0x4F532F32
movq %r12, 0x50(%r13)
movq $0x636d6170, 0x90(%r13) # imm = 0x636D6170
movq %rax, 0x98(%r13)
movq %r12, 0xa0(%r13)
movq $0x68656164, 0xe0(%r13) # imm = 0x68656164
movq %rax, 0xe8(%r13)
movq %r12, 0xf0(%r13)
movq $0x68686561, 0x130(%r13) # imm = 0x68686561
movq %rax, 0x138(%r13)
movq %r12, 0x140(%r13)
movq $0x686d7478, 0x180(%r13) # imm = 0x686D7478
movq %rax, 0x188(%r13)
movq %r12, 0x190(%r13)
movq $0x6d617870, 0x1d0(%r13) # imm = 0x6D617870
movq %rax, 0x1d8(%r13)
movq %r12, 0x1e0(%r13)
movq $0x6e616d65, 0x220(%r13) # imm = 0x6E616D65
movq %rax, 0x228(%r13)
movq %r12, 0x230(%r13)
movq $0x706f7374, 0x270(%r13) # imm = 0x706F7374
movq %r12, 0x280(%r13)
cmpl $0x1, %ebp
jne 0x833d
movq %rax, 0x78(%rsp)
movq %rax, 0x2a8(%rsp)
jmp 0x836a
andq $0x0, 0x118(%rsp)
andq $0x0, 0x168(%rsp)
andq $0x0, 0x1b8(%rsp)
andq $0x0, 0x208(%rsp)
andq $0x0, 0x258(%rsp)
leaq 0x20(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x7860
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 0x85e8
movq %rax, 0x10(%r12)
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x894c
movl %eax, %ebx
movq 0x10(%r12), %rdi
callq 0x21b0
movl %ebx, %eax
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c5e(%rip), %rdi      # 0xa038
leaq 0x34d4(%rip), %rsi      # 0xb8b5
leaq 0x35f5(%rip), %rcx      # 0xb9dd
movl $0x108, %edx            # imm = 0x108
callq 0x20f0
leaq 0x2620(%rip), %rdi      # 0xaa19
leaq 0x34b5(%rip), %rsi      # 0xb8b5
leaq 0x35d6(%rip), %rcx      # 0xb9dd
movl $0x109, %edx            # imm = 0x109
callq 0x20f0