// File: /workspace/github_c_makefile_star2_O0/smilingthax[P]libfontembed/sfnt.c
// Function: otf_load_more
int otf_load_more(OTF_FILE *otf) // {{{  - 0 on success   => hhea,hmtx,name,[glyf]
{
  int iA;

  int len;
  if (!is_CFF(otf)) { // not for CFF
    if (otf_load_glyf(otf)==-1) {
      return -1;
    }
  }

  // {{{ read hhea table
  char *hhea=otf_get_table(otf,OTF_TAG('h','h','e','a'),&len);
  if ( (!hhea)||
       (get_ULONG(hhea)!=0x00010000)|| // version
       (len!=36)||
       (get_SHORT(hhea+32)!=0) ) { // metric format
    fprintf(stderr,"Unsupported OTF font / hhea table\n");
    free(hhea);
    return -1;
  }
  otf->numberOfHMetrics=get_USHORT(hhea+34);
  free(hhea);
  // }}}

  // {{{ read hmtx table
  char *hmtx=otf_get_table(otf,OTF_TAG('h','m','t','x'),&len);
  if ( (!hmtx)||
       (len!=otf->numberOfHMetrics*2+otf->numGlyphs*2) ) {
    fprintf(stderr,"Unsupported OTF font / hmtx table\n");
    free(hmtx);
    return -1;
  }
  if (otf->hmtx) {
    free(otf->hmtx);
    assert(0);
  }
  otf->hmtx=hmtx;
  // }}}

  // {{{ read name table
  char *name=otf_get_table(otf,OTF_TAG('n','a','m','e'),&len);
  if ( (!name)||
       (get_USHORT(name)!=0x0000)|| // version
       (len<get_USHORT(name+2)*12+6)||
       (len<=get_USHORT(name+4)) ) {
    fprintf(stderr,"Unsupported OTF font / name table \n");
    free(name);
    return -1;
  }
  // check bounds
  int name_count=get_USHORT(name+2);
  const char *nstore=name+get_USHORT(name+4);
  for (iA=0;iA<name_count;iA++) {
    const char *nrec=name+6+12*iA;
    if (nstore-name+get_USHORT(nrec+10)+get_USHORT(nrec+8)>len) {
      fprintf(stderr,"Bad name table \n");
      free(name);
      return -1;
    }
  }
  if (otf->name) {
    free(otf->name);
    assert(0);
  }
  otf->name=name;
  // }}}

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x46c0
cmpl $0x0, %eax
jne 0x4746
movq -0x10(%rbp), %rdi
callq 0x4200
cmpl $-0x1, %eax
jne 0x4744
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4a5e
jmp 0x4746
movq -0x10(%rbp), %rdi
movl $0x68686561, %esi       # imm = 0x68686561
leaq -0x18(%rbp), %rdx
callq 0x4000
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x478c
movq -0x20(%rbp), %rdi
callq 0x3540
cmpl $0x10000, %eax          # imm = 0x10000
jne 0x478c
cmpl $0x24, -0x18(%rbp)
jne 0x478c
movq -0x20(%rbp), %rdi
addq $0x20, %rdi
callq 0x4a70
cwtl
cmpl $0x0, %eax
je 0x47b9
movq 0xe84d(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
leaq 0x9d26(%rip), %rsi      # 0xe4c3
movb $0x0, %al
callq 0x21e0
movq -0x20(%rbp), %rdi
callq 0x21b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4a5e
movq -0x20(%rbp), %rdi
addq $0x22, %rdi
callq 0x46f0
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x58(%rax)
movq -0x20(%rbp), %rdi
callq 0x21b0
movq -0x10(%rbp), %rdi
movl $0x686d7478, %esi       # imm = 0x686D7478
leaq -0x18(%rbp), %rdx
callq 0x4000
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4814
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x58(%rcx), %ecx
shll %ecx
movq -0x10(%rbp), %rdx
movzwl 0x4c(%rdx), %edx
shll %edx
addl %edx, %ecx
cmpl %ecx, %eax
je 0x4841
movq 0xe7c5(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
leaq 0x9cc1(%rip), %rsi      # 0xe4e6
movb $0x0, %al
callq 0x21e0
movq -0x28(%rbp), %rdi
callq 0x21b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4a5e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x4878
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x21b0
leaq 0xa4a0(%rip), %rdi      # 0xed00
leaq 0xa228(%rip), %rsi      # 0xea8f
movl $0x2c3, %edx            # imm = 0x2C3
leaq 0x9c96(%rip), %rcx      # 0xe509
callq 0x2100
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rdi
movl $0x6e616d65, %esi       # imm = 0x6E616D65
leaq -0x18(%rbp), %rdx
callq 0x4000
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x48f8
movq -0x30(%rbp), %rdi
callq 0x46f0
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x48f8
movl -0x18(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x30(%rbp), %rdi
addq $0x2, %rdi
callq 0x46f0
movw %ax, %cx
movl -0x4c(%rbp), %eax
movzwl %cx, %ecx
imull $0xc, %ecx, %ecx
addl $0x6, %ecx
cmpl %ecx, %eax
jl 0x48f8
movl -0x18(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
addq $0x4, %rdi
callq 0x46f0
movw %ax, %cx
movl -0x50(%rbp), %eax
movzwl %cx, %ecx
cmpl %ecx, %eax
jg 0x4925
movq 0xe6e1(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
leaq 0x9c1e(%rip), %rsi      # 0xe527
movb $0x0, %al
callq 0x21e0
movq -0x30(%rbp), %rdi
callq 0x21b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4a5e
movq -0x30(%rbp), %rdi
addq $0x2, %rdi
callq 0x46f0
movzwl %ax, %eax
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rdi
addq $0x4, %rdi
callq 0x46f0
movw %ax, %cx
movq -0x58(%rbp), %rax
movzwl %cx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x4a14
movq -0x30(%rbp), %rax
addq $0x6, %rax
imull $0xc, -0x14(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x48(%rbp), %rdi
addq $0xa, %rdi
callq 0x46f0
movw %ax, %cx
movq -0x68(%rbp), %rax
movzwl %cx, %ecx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x48(%rbp), %rdi
addq $0x8, %rdi
callq 0x46f0
movw %ax, %cx
movq -0x60(%rbp), %rax
movzwl %cx, %ecx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
cmpq %rcx, %rax
jle 0x4a04
movq 0xe5ff(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
leaq 0x9b60(%rip), %rsi      # 0xe54b
movb $0x0, %al
callq 0x21e0
movq -0x30(%rbp), %rdi
callq 0x21b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4a5e
jmp 0x4a06
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x4968
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x4a4b
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0x21b0
leaq 0xa2cd(%rip), %rdi      # 0xed00
leaq 0xa055(%rip), %rsi      # 0xea8f
movl $0x2df, %edx            # imm = 0x2DF
leaq 0x9ac3(%rip), %rcx      # 0xe509
callq 0x2100
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)