// File: /workspace/github_c_makefile_star2_O0/smilingthax[P]libfontembed/sfnt.c
// Function: otf_get_name
const char *otf_get_name(OTF_FILE *otf,int platformID,int encodingID,int languageID,int nameID,int *ret_len) // {{{
{
  assert(otf);
  assert(ret_len);

  // ensure name is there
  if (!otf->name) {
    if (otf_load_more(otf)!=0) {
      *ret_len=-1;
      assert(0);
      return NULL;
    }
  }

  char key[8];
  set_USHORT(key,platformID);
  set_USHORT(key+2,encodingID);
  set_USHORT(key+4,languageID);
  set_USHORT(key+6,nameID);

  char *res=bsearch(key,otf->name+6,get_USHORT(otf->name+2),12,otf_name_compare);
  if (res) {
    *ret_len=get_USHORT(res+8);
    int npos=get_USHORT(res+10);
    const char *nstore=otf->name+get_USHORT(otf->name+4);
    return nstore+npos;
  }
  *ret_len=0;
  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq %r9, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x4e16
jmp 0x4e35
leaq 0x921b(%rip), %rdi      # 0xe038
leaq 0x9c6b(%rip), %rsi      # 0xea8f
movl $0x339, %edx            # imm = 0x339
leaq 0x97ac(%rip), %rcx      # 0xe5dc
callq 0x2100
cmpq $0x0, -0x28(%rbp)
je 0x4e3e
jmp 0x4e5d
leaq 0x95ba(%rip), %rdi      # 0xe3ff
leaq 0x9c43(%rip), %rsi      # 0xea8f
movl $0x33a, %edx            # imm = 0x33A
leaq 0x9784(%rip), %rcx      # 0xe5dc
callq 0x2100
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
jne 0x4ea1
movq -0x10(%rbp), %rdi
callq 0x4710
cmpl $0x0, %eax
je 0x4e9f
movq -0x28(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
leaq 0x9e79(%rip), %rdi      # 0xed00
leaq 0x9c01(%rip), %rsi      # 0xea8f
movl $0x340, %edx            # imm = 0x340
leaq 0x9742(%rip), %rcx      # 0xe5dc
callq 0x2100
jmp 0x4ea1
leaq -0x30(%rbp), %rdi
movl -0x14(%rbp), %eax
movzwl %ax, %esi
callq 0x4fd0
leaq -0x30(%rbp), %rdi
addq $0x2, %rdi
movl -0x18(%rbp), %eax
movzwl %ax, %esi
callq 0x4fd0
leaq -0x30(%rbp), %rdi
addq $0x4, %rdi
movl -0x1c(%rbp), %eax
movzwl %ax, %esi
callq 0x4fd0
leaq -0x30(%rbp), %rdi
addq $0x6, %rdi
movl -0x20(%rbp), %eax
movzwl %ax, %esi
callq 0x4fd0
leaq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
addq $0x6, %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdi
addq $0x2, %rdi
callq 0x46f0
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movzwl %ax, %eax
movl %eax, %edx
movl $0xc, %ecx
leaq 0xe5(%rip), %r8         # 0x5010
callq 0x21c0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x4fa6
movq -0x38(%rbp), %rdi
addq $0x8, %rdi
callq 0x46f0
movzwl %ax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x38(%rbp), %rdi
addq $0xa, %rdi
callq 0x46f0
movzwl %ax, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdi
addq $0x4, %rdi
callq 0x46f0
movw %ax, %cx
movq -0x60(%rbp), %rax
movzwl %cx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movslq -0x3c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x4fb8
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)