// File: /workspace/github_c_makefile_star2_O0/smilingthax[P]libfontembed/embed_sfnt.c
// Function: emb_otf_ps
int emb_otf_ps(OTF_FILE *otf,unsigned short *encoding,int len,unsigned short *to_unicode,OUTPUT_FN output,void *context) // {{{
{
  const int binary=0; // binary format? // TODO
  if (len>256) {
    fprintf(stderr,"Encoding too big(%d) for Type42\n",len);
    return -1;
  }
  if (len<1) {
    fprintf(stderr,"At least .notdef required in Type42\n");
    return -1;
  }
  if (!encoding) {
    to_unicode=NULL; // does not make sense
  }
  int iA,ret=0;

  DYN_STRING ds;
  if (dyn_init(&ds,1024)==-1) {
    return -1;
  }

  int rlen=0;
  char *head=otf_get_table(otf,OTF_TAG('h','e','a','d'),&rlen);
  if (!head) {
    free(ds.buf);
    return -1;
  }
  dyn_printf(&ds,"%%!PS-TrueTypeFont-%d-%d\n",
                 otf->version,get_ULONG(head+4));
  const int bbxmin=get_SHORT(head+36)*1000/otf->unitsPerEm,
            bbymin=get_SHORT(head+38)*1000/otf->unitsPerEm,
            bbxmax=get_SHORT(head+40)*1000/otf->unitsPerEm,
            bbymax=get_SHORT(head+42)*1000/otf->unitsPerEm;
  free(head);

  char *post=otf_get_table(otf,OTF_TAG('p','o','s','t'),&rlen);
  if ( (!post)&&(rlen!=-1) ) { // other error than "not found"
    free(ds.buf);
    return -1;
  }
  if (post) {
    const unsigned int minMem=get_ULONG(post+16),maxMem=get_ULONG(post+20);
    if (minMem) {
      dyn_printf(&ds,"%%VMusage: %d %d\n",minMem,maxMem);
    }
  }

  // don't forget the coordinate scaling...
  dyn_printf(&ds,"11 dict begin\n"
                 "/FontName /%s def\n"
                 "/FontType 42 def\n"
                 "/FontMatrix [1 0 0 1 0 0] def\n"
                 "/FontBBox [%f %f %f %f] def\n"
                 "/PaintType 0 def\n",
//                 "/XUID [42 16#%X 16#%X 16#%X 16#%X] def\n"  // TODO?!? (md5 of font data)  (16# means base16)
                 emb_otf_get_fontname(otf),
                 bbxmin/1000.0,bbymin/1000.0,bbxmax/1000.0,bbymax/1000.0);
  if (post) {
    dyn_printf(&ds,"/FontInfo 4 dict dup begin\n"
// TODO? [even non-post]: /version|/Notice|/Copyright|/FullName|/FamilyName|/Weight  () readonly def\n   from name table: 5 7 0 4 1 2
// using: otf_get_name(otf,3,1,0x409,?,&len) / otf_get_name(otf,1,0,0,?,&len)   + encoding
                   "  /ItalicAngle %d def\n"
                   "  /isFixedPitch %s def\n"
                   "  /UnderlinePosition %f def\n"
                   "  /UnderlineThickness %f def\n"
                   "end readonly def\n",
                   get_LONG(post+4)>>16,
                   (get_ULONG(post+12)?"true":"false"),
                   (get_SHORT(post+8)-get_SHORT(post+10)/2)/(float)otf->unitsPerEm,
                   get_SHORT(post+10)/(float)otf->unitsPerEm);
  }
  dyn_printf(&ds,"/Encoding 256 array\n"
                 "0 1 255 { 1 index exch /.notdef put } for\n");
  for (iA=0;iA<len;iA++) { // encoding data: 0...255 -> /glyphname
    const int gid=(encoding)?encoding[iA]:otf_from_unicode(otf,iA);
    if (gid!=0) {
      dyn_printf(&ds,"dup %d /%s put\n",
                     iA,get_glyphname(post,to_unicode,iA,gid));
    }
  }
  dyn_printf(&ds,"readonly def\n");

  if (binary) {
    dyn_printf(&ds,"/RD { string currentfile exch readstring pop } executeonly def\n");
  }
  dyn_printf(&ds,"/sfnts[\n");

  if (ds.len<0) {
    free(post);
    free(ds.buf);
    return -1;
  }
  (*output)(ds.buf,ds.len,context);
  ret+=ds.len;
  ds.len=0;

// TODO: only tables as in otf_subset
// TODO:  somehow communicate table boundaries:
  //   otf_action_copy  does exactly one output call (per table)
  //   only otf_action_replace might do two (padding)
  // {{{ copy tables verbatim (does not affect ds .len)
  struct _OTF_WRITE_TABLE *tablesfree=NULL;
#if 0
  struct _OTF_WRITE_TABLE *tables;
  tablesfree=tables=malloc(sizeof(struct _OTF_WRITE_TABLE)*otf->numTables);
  if (!tables) {
    fprintf(stderr,"Bad alloc: %m\n");
    free(post);
    free(ds.buf);
    return -1;
  }
  // just copy everything
  for (iA=0;iA<otf->numTables;iA++) {
    tables[iA].tag=otf->tables[iA].tag;
    tables[iA].action=otf_action_copy;
    tables[iA].copy.otf=otf;
    tables[iA].copy.table_no=iA;
  }
  const int numTables=otf->numTables;
#else
  struct _OTF_WRITE_TABLE tables[]={ // sorted
      {OTF_TAG('c','m','a','p'),otf_action_copy,.copy={otf,}},
      {OTF_TAG('c','v','t',' '),otf_action_copy,.copy={otf,}},
      {OTF_TAG('f','p','g','m'),otf_action_copy,.copy={otf,}},
      {OTF_TAG('g','l','y','f'),otf_action_copy,.copy={otf,}},
      {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,}},
      {OTF_TAG('l','o','c','a'),otf_action_copy,.copy={otf,}},
      {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','r','e','p'),otf_action_copy,.copy={otf,}},
      // vhea vmtx (never used in PDF, but possible in PS>=3011)
      {0,0,}};
  const int numTables=otf_intersect_tables(otf,tables);
#endif

  struct OUTFILTER_PS of;
  of.out=output;
  of.ctx=context;
  of.len=0;
  struct _OTF_WRITE_INFO otw={
    .version=otf->version,
    .numTables=numTables,
    .tables=tables,
    .order=otf_tagorder_win_sort(tables,numTables)
  };
  if (binary) {
    iA=otf_write_sfnt(&otw,NULL,outfilter_binary_ps,&of);
  } else {
    iA=otf_write_sfnt(&otw,NULL,outfilter_ascii_ps,&of);
  }
  free(tablesfree);
  if (iA==-1) {
    free(post);
    free(ds.buf);
    return -1;
  }
  ret+=of.len;
  // }}} done copying

  dyn_printf(&ds,"] def\n");

  dyn_printf(&ds,"/CharStrings %d dict dup begin\n"
                 "/.notdef 0 def\n",len);
  for (iA=0;iA<len;iA++) { // charstrings data: /glyphname -> gid
    const int gid=(encoding)?encoding[iA]:otf_from_unicode(otf,iA);
    if (gid) {
      dyn_printf(&ds,"/%s %d def\n",get_glyphname(post,to_unicode,iA,gid),gid);
    }
    // (respecting subsetting...)
  }
  dyn_printf(&ds,"end readonly def\n");
  dyn_printf(&ds,"FontName currentdict end definefont pop\n");
  free(post);

  if (ds.len<0) {
    free(ds.buf);
    return -1;
  }
  (*output)(ds.buf,ds.len,context);
  ret+=ds.len;
  ds.len=0;

  free(ds.buf);
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4d0, %rsp            # imm = 0x4D0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
cmpl $0x100, -0x1c(%rbp)     # imm = 0x100
jle 0x7369
movq 0xbc97(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
leaq 0x7a83(%rip), %rsi      # 0xedd9
movb $0x0, %al
callq 0x21e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7d2f
cmpl $0x1, -0x1c(%rbp)
jge 0x7393
movq 0xbc6a(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
leaq 0x7a7a(%rip), %rsi      # 0xedfa
movb $0x0, %al
callq 0x21e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7d2f
cmpq $0x0, -0x18(%rbp)
jne 0x73a2
movq $0x0, -0x28(%rbp)
movl $0x0, -0x44(%rbp)
leaq -0x58(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x9d60
cmpl $-0x1, %eax
jne 0x73c8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7d2f
movl $0x0, -0x5c(%rbp)
movq -0x10(%rbp), %rdi
movl $0x68656164, %esi       # imm = 0x68656164
leaq -0x5c(%rbp), %rdx
callq 0x4000
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x7401
movq -0x50(%rbp), %rdi
callq 0x21b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7d2f
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x4a0(%rbp)
movq -0x68(%rbp), %rdi
addq $0x4, %rdi
callq 0x6e80
movl -0x4a0(%rbp), %edx
movl %eax, %ecx
leaq -0x58(%rbp), %rdi
leaq 0x79f1(%rip), %rsi      # 0xee1f
movb $0x0, %al
callq 0xa120
movq -0x68(%rbp), %rdi
addq $0x24, %rdi
callq 0x6e60
cwtl
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movq -0x10(%rbp), %rcx
movzwl 0x48(%rcx), %ecx
cltd
idivl %ecx
movl %eax, -0x6c(%rbp)
movq -0x68(%rbp), %rdi
addq $0x26, %rdi
callq 0x6e60
cwtl
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movq -0x10(%rbp), %rcx
movzwl 0x48(%rcx), %ecx
cltd
idivl %ecx
movl %eax, -0x70(%rbp)
movq -0x68(%rbp), %rdi
addq $0x28, %rdi
callq 0x6e60
cwtl
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movq -0x10(%rbp), %rcx
movzwl 0x48(%rcx), %ecx
cltd
idivl %ecx
movl %eax, -0x74(%rbp)
movq -0x68(%rbp), %rdi
addq $0x2a, %rdi
callq 0x6e60
cwtl
imull $0x3e8, %eax, %eax      # imm = 0x3E8
movq -0x10(%rbp), %rcx
movzwl 0x48(%rcx), %ecx
cltd
idivl %ecx
movl %eax, -0x78(%rbp)
movq -0x68(%rbp), %rdi
callq 0x21b0
movq -0x10(%rbp), %rdi
movl $0x706f7374, %esi       # imm = 0x706F7374
leaq -0x5c(%rbp), %rdx
callq 0x4000
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x74fe
cmpl $-0x1, -0x5c(%rbp)
je 0x74fe
movq -0x50(%rbp), %rdi
callq 0x21b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7d2f
cmpq $0x0, -0x80(%rbp)
je 0x7554
movq -0x80(%rbp), %rdi
addq $0x10, %rdi
callq 0x6e80
movl %eax, -0x84(%rbp)
movq -0x80(%rbp), %rdi
addq $0x14, %rdi
callq 0x6e80
movl %eax, -0x88(%rbp)
cmpl $0x0, -0x84(%rbp)
je 0x7552
movl -0x84(%rbp), %edx
movl -0x88(%rbp), %ecx
leaq -0x58(%rbp), %rdi
leaq 0x78ee(%rip), %rsi      # 0xee39
movb $0x0, %al
callq 0xa120
jmp 0x7554
movq -0x10(%rbp), %rdi
callq 0x6470
movq %rax, %rdx
cvtsi2sdl -0x6c(%rbp), %xmm0
movsd 0x74f3(%rip), %xmm1     # 0xea60
divsd %xmm1, %xmm0
cvtsi2sdl -0x70(%rbp), %xmm1
movsd 0x74e2(%rip), %xmm2     # 0xea60
divsd %xmm2, %xmm1
cvtsi2sdl -0x74(%rbp), %xmm2
movsd 0x74d1(%rip), %xmm3     # 0xea60
divsd %xmm3, %xmm2
cvtsi2sdl -0x78(%rbp), %xmm3
movsd 0x74c0(%rip), %xmm4     # 0xea60
divsd %xmm4, %xmm3
leaq -0x58(%rbp), %rdi
leaq 0x789c(%rip), %rsi      # 0xee4b
movb $0x4, %al
callq 0xa120
cmpq $0x0, -0x80(%rbp)
je 0x76a4
movq -0x80(%rbp), %rdi
addq $0x4, %rdi
callq 0x6ec0
sarl $0x10, %eax
movl %eax, -0x4b4(%rbp)
movq -0x80(%rbp), %rdi
addq $0xc, %rdi
callq 0x6e80
testl %eax, %eax
leaq 0x796e(%rip), %rcx      # 0xef5b
leaq 0x796c(%rip), %rax      # 0xef60
cmovneq %rcx, %rax
movq %rax, -0x4b0(%rbp)
movq -0x80(%rbp), %rdi
addq $0x8, %rdi
callq 0x6e60
cwtl
movl %eax, -0x4b8(%rbp)
movq -0x80(%rbp), %rdi
addq $0xa, %rdi
callq 0x6e60
movw %ax, %cx
movl -0x4b8(%rbp), %eax
movswl %cx, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
addl %edx, %ecx
sarl %ecx
subl %ecx, %eax
cvtsi2ss %eax, %xmm0
movq -0x10(%rbp), %rax
movzwl 0x48(%rax), %eax
cvtsi2ss %eax, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x4a8(%rbp)
movq -0x80(%rbp), %rdi
addq $0xa, %rdi
callq 0x6e60
movl -0x4b4(%rbp), %edx
movq -0x4b0(%rbp), %rcx
movsd -0x4a8(%rbp), %xmm0
cwtl
cvtsi2ss %eax, %xmm1
movq -0x10(%rbp), %rax
movzwl 0x48(%rax), %eax
cvtsi2ss %eax, %xmm2
divss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
leaq -0x58(%rbp), %rdi
leaq 0x782b(%rip), %rsi      # 0xeec8
movb $0x2, %al
callq 0xa120
leaq -0x58(%rbp), %rdi
leaq 0x78b7(%rip), %rsi      # 0xef66
movb $0x0, %al
callq 0xa120
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x775b
cmpq $0x0, -0x18(%rbp)
je 0x76e4
movq -0x18(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0x4bc(%rbp)
jmp 0x76f9
movq -0x10(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x5280
movzwl %ax, %eax
movl %eax, -0x4bc(%rbp)
movl -0x4bc(%rbp), %eax
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x8c(%rbp)
je 0x774b
movl -0x40(%rbp), %eax
movl %eax, -0x4c0(%rbp)
movq -0x80(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x40(%rbp), %edx
movl -0x8c(%rbp), %eax
movzwl %ax, %ecx
callq 0x7d40
movl -0x4c0(%rbp), %edx
movq %rax, %rcx
leaq -0x58(%rbp), %rdi
leaq 0x7861(%rip), %rsi      # 0xefa5
movb $0x0, %al
callq 0xa120
jmp 0x774d
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x76bd
leaq -0x58(%rbp), %rdi
leaq 0x77e7(%rip), %rsi      # 0xef4d
movb $0x0, %al
callq 0xa120
leaq -0x58(%rbp), %rdi
leaq 0x783d(%rip), %rsi      # 0xefb5
movb $0x0, %al
callq 0xa120
cmpl $0x0, -0x58(%rbp)
jge 0x77a3
movq -0x80(%rbp), %rdi
callq 0x21b0
movq -0x50(%rbp), %rdi
callq 0x21b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7d2f
movq -0x30(%rbp), %rax
movq -0x50(%rbp), %rdi
movl -0x58(%rbp), %esi
movq -0x38(%rbp), %rdx
callq *%rax
movl -0x58(%rbp), %eax
addl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl $0x0, -0x58(%rbp)
movq $0x0, -0x98(%rbp)
movq $0x636d6170, -0x460(%rbp) # imm = 0x636D6170
leaq 0x480f(%rip), %rax      # 0xbff0
movq %rax, -0x458(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x450(%rbp)
movl $0x0, -0x448(%rbp)
leaq -0x460(%rbp), %rdi
addq $0x20, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
leaq -0x460(%rbp), %rdi
addq $0x50, %rdi
movq $0x63767420, -0x410(%rbp) # imm = 0x63767420
leaq 0x47bf(%rip), %rax      # 0xbff0
movq %rax, -0x408(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x400(%rbp)
movl $0x0, -0x3f8(%rbp)
addq $0x20, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
leaq -0x460(%rbp), %rdi
addq $0xa0, %rdi
movq $0x6670676d, -0x3c0(%rbp) # imm = 0x6670676D
leaq 0x4773(%rip), %rax      # 0xbff0
movq %rax, -0x3b8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x3b0(%rbp)
movl $0x0, -0x3a8(%rbp)
addq $0x20, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
leaq -0x460(%rbp), %rdi
addq $0xf0, %rdi
movq $0x676c7966, -0x370(%rbp) # imm = 0x676C7966
leaq 0x4727(%rip), %rax      # 0xbff0
movq %rax, -0x368(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x360(%rbp)
movl $0x0, -0x358(%rbp)
addq $0x20, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
leaq -0x460(%rbp), %rdi
addq $0x140, %rdi            # imm = 0x140
movq $0x68656164, -0x320(%rbp) # imm = 0x68656164
leaq 0x46db(%rip), %rax      # 0xbff0
movq %rax, -0x318(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x310(%rbp)
movl $0x0, -0x308(%rbp)
addq $0x20, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
leaq -0x460(%rbp), %rdi
addq $0x190, %rdi            # imm = 0x190
movq $0x68686561, -0x2d0(%rbp) # imm = 0x68686561
leaq 0x468f(%rip), %rax      # 0xbff0
movq %rax, -0x2c8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x2c0(%rbp)
movl $0x0, -0x2b8(%rbp)
addq $0x20, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
leaq -0x460(%rbp), %rdi
addq $0x1e0, %rdi            # imm = 0x1E0
movq $0x686d7478, -0x280(%rbp) # imm = 0x686D7478
leaq 0x4643(%rip), %rax      # 0xbff0
movq %rax, -0x278(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x270(%rbp)
movl $0x0, -0x268(%rbp)
addq $0x20, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
leaq -0x460(%rbp), %rdi
addq $0x230, %rdi            # imm = 0x230
movq $0x6c6f6361, -0x230(%rbp) # imm = 0x6C6F6361
leaq 0x45f7(%rip), %rax      # 0xbff0
movq %rax, -0x228(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x220(%rbp)
movl $0x0, -0x218(%rbp)
addq $0x20, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
leaq -0x460(%rbp), %rdi
addq $0x280, %rdi            # imm = 0x280
movq $0x6d617870, -0x1e0(%rbp) # imm = 0x6D617870
leaq 0x45ab(%rip), %rax      # 0xbff0
movq %rax, -0x1d8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movl $0x0, -0x1c8(%rbp)
addq $0x20, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
leaq -0x460(%rbp), %rdi
addq $0x2d0, %rdi            # imm = 0x2D0
movq $0x6e616d65, -0x190(%rbp) # imm = 0x6E616D65
leaq 0x455f(%rip), %rax      # 0xbff0
movq %rax, -0x188(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x180(%rbp)
movl $0x0, -0x178(%rbp)
addq $0x20, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
leaq -0x460(%rbp), %rdi
addq $0x320, %rdi            # imm = 0x320
movq $0x70726570, -0x140(%rbp) # imm = 0x70726570
leaq 0x4513(%rip), %rax      # 0xbff0
movq %rax, -0x138(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x130(%rbp)
movl $0x0, -0x128(%rbp)
addq $0x20, %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
leaq -0x460(%rbp), %rdi
addq $0x370, %rdi            # imm = 0x370
xorl %esi, %esi
movl $0x50, %edx
callq 0x20e0
movq -0x10(%rbp), %rdi
leaq -0x460(%rbp), %rsi
callq 0xa830
movl %eax, -0x464(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x480(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x478(%rbp)
movl $0x0, -0x470(%rbp)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x498(%rbp)
movl -0x464(%rbp), %eax
movw %ax, -0x494(%rbp)
leaq -0x460(%rbp), %rax
movq %rax, -0x490(%rbp)
leaq -0x460(%rbp), %rdi
movl -0x464(%rbp), %esi
callq 0xbc50
movq %rax, -0x488(%rbp)
leaq -0x498(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq 0x284(%rip), %rdx       # 0x7e30
leaq -0x480(%rbp), %rcx
callq 0xc320
movl %eax, -0x40(%rbp)
movq -0x98(%rbp), %rdi
callq 0x21b0
cmpl $-0x1, -0x40(%rbp)
jne 0x7beb
movq -0x80(%rbp), %rdi
callq 0x21b0
movq -0x50(%rbp), %rdi
callq 0x21b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7d2f
movl -0x470(%rbp), %eax
addl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
leaq -0x58(%rbp), %rdi
leaq 0x73bc(%rip), %rsi      # 0xefbe
movb $0x0, %al
callq 0xa120
movl -0x1c(%rbp), %edx
leaq -0x58(%rbp), %rdi
leaq 0x73ae(%rip), %rsi      # 0xefc5
movb $0x0, %al
callq 0xa120
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x7cba
cmpq $0x0, -0x18(%rbp)
je 0x7c4c
movq -0x18(%rbp), %rax
movslq -0x40(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0x4c4(%rbp)
jmp 0x7c61
movq -0x10(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x5280
movzwl %ax, %eax
movl %eax, -0x4c4(%rbp)
movl -0x4c4(%rbp), %eax
movl %eax, -0x49c(%rbp)
cmpl $0x0, -0x49c(%rbp)
je 0x7caa
movq -0x80(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x40(%rbp), %edx
movl -0x49c(%rbp), %eax
movzwl %ax, %ecx
callq 0x7d40
movq %rax, %rdx
movl -0x49c(%rbp), %ecx
leaq -0x58(%rbp), %rdi
leaq 0x7351(%rip), %rsi      # 0xeff4
movb $0x0, %al
callq 0xa120
jmp 0x7cac
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x7c25
leaq -0x58(%rbp), %rdi
leaq 0x7284(%rip), %rsi      # 0xef49
movb $0x0, %al
callq 0xa120
leaq -0x58(%rbp), %rdi
leaq 0x7329(%rip), %rsi      # 0xf000
movb $0x0, %al
callq 0xa120
movq -0x80(%rbp), %rdi
callq 0x21b0
cmpl $0x0, -0x58(%rbp)
jge 0x7cff
movq -0x50(%rbp), %rdi
callq 0x21b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x7d2f
movq -0x30(%rbp), %rax
movq -0x50(%rbp), %rdi
movl -0x58(%rbp), %esi
movq -0x38(%rbp), %rdx
callq *%rax
movl -0x58(%rbp), %eax
addl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl $0x0, -0x58(%rbp)
movq -0x50(%rbp), %rdi
callq 0x21b0
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x4d0, %rsp            # imm = 0x4D0
popq %rbp
retq
nopl (%rax,%rax)