// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x380, %rsp            # imm = 0x380
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xb63b
jmp 0xb65a
leaq 0x29f6(%rip), %rdi      # 0xe038
leaq 0x42bc(%rip), %rsi      # 0xf905
movl $0x108, %edx            # imm = 0x108
leaq 0x43d8(%rip), %rcx      # 0xfa2d
callq 0x2100
cmpq $0x0, -0x28(%rbp)
je 0xb663
jmp 0xb682
leaq 0x33e9(%rip), %rdi      # 0xea53
leaq 0x4294(%rip), %rsi      # 0xf905
movl $0x109, %edx            # imm = 0x109
leaq 0x43b0(%rip), %rcx      # 0xfa2d
callq 0x2100
leaq -0x350(%rbp), %rdi
xorl %esi, %esi
movl $0x320, %edx            # imm = 0x320
callq 0x20e0
movq $0x43464620, -0x350(%rbp) # imm = 0x43464620
leaq 0x949(%rip), %rax       # 0xbff0
movq %rax, -0x348(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x340(%rbp)
movq $0x4f532f32, -0x300(%rbp) # imm = 0x4F532F32
movq -0x8(%rbp), %rax
movq %rax, -0x2f0(%rbp)
movq $0x636d6170, -0x2b0(%rbp) # imm = 0x636D6170
leaq 0x90f(%rip), %rax       # 0xbff0
movq %rax, -0x2a8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2a0(%rbp)
movq $0x68656164, -0x260(%rbp) # imm = 0x68656164
leaq 0x8eb(%rip), %rax       # 0xbff0
movq %rax, -0x258(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x250(%rbp)
movq $0x68686561, -0x210(%rbp) # imm = 0x68686561
leaq 0x8c7(%rip), %rax       # 0xbff0
movq %rax, -0x208(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x200(%rbp)
movq $0x686d7478, -0x1c0(%rbp) # imm = 0x686D7478
leaq 0x8a3(%rip), %rax       # 0xbff0
movq %rax, -0x1b8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq $0x6d617870, -0x170(%rbp) # imm = 0x6D617870
leaq 0x87f(%rip), %rax       # 0xbff0
movq %rax, -0x168(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x160(%rbp)
movq $0x6e616d65, -0x120(%rbp) # imm = 0x6E616D65
leaq 0x85b(%rip), %rax       # 0xbff0
movq %rax, -0x118(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x110(%rbp)
movq $0x706f7374, -0xd0(%rbp) # imm = 0x706F7374
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
cmpl $0x1, -0x14(%rbp)
jne 0xb7e1
leaq 0x826(%rip), %rax       # 0xbff0
movq %rax, -0x2f8(%rbp)
leaq 0x818(%rip), %rax       # 0xbff0
movq %rax, -0xc8(%rbp)
jmp 0xb818
movq $0x0, -0x258(%rbp)
movq $0x0, -0x208(%rbp)
movq $0x0, -0x1b8(%rbp)
movq $0x0, -0x168(%rbp)
movq $0x0, -0x118(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x350(%rbp), %rsi
callq 0xa830
movl %eax, -0x354(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x370(%rbp)
movl -0x354(%rbp), %eax
movw %ax, -0x36c(%rbp)
leaq -0x350(%rbp), %rax
movq %rax, -0x368(%rbp)
leaq -0x350(%rbp), %rdi
movl -0x354(%rbp), %esi
callq 0xbc50
movq %rax, -0x360(%rbp)
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
leaq -0x370(%rbp), %rdi
callq 0xc320
movl %eax, -0x374(%rbp)
movq -0x360(%rbp), %rdi
callq 0x21b0
movl -0x374(%rbp), %eax
addq $0x380, %rsp            # imm = 0x380
popq %rbp
retq
nopl (%rax,%rax)