// File: /workspace/github_c_makefile_star2_O2/smilingthax[P]libfontembed/embed_pdf.c
// Function: emb_pdf_fontdescr
EMB_PDF_FONTDESCR *emb_pdf_fontdescr(EMB_PARAMS *emb) // {{{ -  to be freed by user
{
  assert(emb);

  const char *subset_tag=NULL;
  // {{{ generate pdf subtag
  static unsigned int rands=0;
  if (!rands) {
    rands=time(NULL);
  }

  char subtag[7];
  subtag[6]=0;
  if (emb->plan&EMB_A_SUBSET) {
    int iA;
    for (iA=0;iA<6;iA++) {
      const int x=(int)(26.0*(rand_r(&rands)/(RAND_MAX+1.0)));
      subtag[iA]='A'+x;
    }
    subset_tag=subtag;
  }
  // }}}

  const char *fontname=NULL;
  if ( (emb->intype==EMB_FMT_TTF)||(emb->intype==EMB_FMT_OTF) ) { // TODO? use fontinfo from CFF when outtype==CFT, etc.?
    assert(emb->font->sfnt);
    fontname=emb_otf_get_fontname(emb->font->sfnt);
  } else if (emb->outtype==EMB_FMT_STDFONT) {
    return NULL;
  } else {
    fprintf(stderr,"NOT IMPLEMENTED\n");
    assert(0);
    return NULL;
  }

  EMB_PDF_FONTDESCR *ret;
  if (emb->plan&EMB_A_MULTIBYTE) { // multibyte
    ret=emb_pdf_fd_new(fontname,subset_tag,"Adobe","Identity",0); // TODO other /ROS ?
  } else {
    ret=emb_pdf_fd_new(fontname,subset_tag,NULL,NULL,-1);
  }
  if (!ret) {
    return NULL;
  }

  if ( (emb->intype==EMB_FMT_TTF)||(emb->intype==EMB_FMT_OTF) ) {
    emb_otf_get_pdf_fontdescr(emb->font->sfnt,ret);
  } else {
    assert(0);
  }
  return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x60f6
movq %rdi, %rbx
cmpl $0x0, 0x93a5(%rip)      # 0xf3b0
jne 0x601a
xorl %edi, %edi
callq 0x2120
movl %eax, 0x9396(%rip)      # 0xf3b0
movb $0x0, 0x7(%rsp)
testb $0x2, 0xc(%rbx)
jne 0x605c
xorl %r14d, %r14d
movl (%rbx), %eax
decl %eax
cmpl $0x1, %eax
ja 0x609d
movq 0x10(%rbx), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x6115
callq 0x4b9a
testb $0x1, 0xc(%rbx)
jne 0x60ac
pushq $-0x1
popq %r8
movq %rax, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
jmp 0x60c3
xorl %r12d, %r12d
leaq 0x1(%rsp), %r14
leaq 0x9345(%rip), %r15      # 0xf3b0
cmpq $0x6, %r12
je 0x6028
movq %r15, %rdi
callq 0x2150
cvtsi2sd %eax, %xmm0
mulsd 0x4f93(%rip), %xmm0     # 0xb018
mulsd 0x4f93(%rip), %xmm0     # 0xb020
cvttsd2si %xmm0, %eax
addb $0x41, %al
movb %al, 0x1(%rsp,%r12)
incq %r12
jmp 0x606b
cmpl $0x4, 0x4(%rbx)
jne 0x6134
xorl %r14d, %r14d
jmp 0x60e7
leaq 0x5051(%rip), %rdx      # 0xb104
leaq 0x5050(%rip), %rcx      # 0xb10a
movq %rax, %rdi
movq %r14, %rsi
xorl %r8d, %r8d
callq 0x618e
movq %rax, %r14
movl (%rbx), %eax
decl %eax
cmpl $0x1, %eax
ja 0x616f
movq 0x10(%rbx), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq 0x4cf7
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x41d7(%rip), %rdi      # 0xa2d4
leaq 0x4f24(%rip), %rsi      # 0xb028
leaq 0x4fc6(%rip), %rcx      # 0xb0d1
movl $0x99, %edx
callq 0x20f0
leaq 0x48b3(%rip), %rdi      # 0xa9cf
leaq 0x4f05(%rip), %rsi      # 0xb028
leaq 0x4fa7(%rip), %rcx      # 0xb0d1
movl $0xb0, %edx
callq 0x20f0
movq 0x8ea5(%rip), %rax      # 0xefe0
movq (%rax), %rcx
leaq 0x489a(%rip), %rdi      # 0xa9df
pushq $0x10
popq %rsi
pushq $0x1
popq %rdx
callq 0x2280
leaq 0x4b69(%rip), %rdi      # 0xacc0
leaq 0x4eca(%rip), %rsi      # 0xb028
leaq 0x4f6c(%rip), %rcx      # 0xb0d1
movl $0xb6, %edx
callq 0x20f0
leaq 0x4b4a(%rip), %rdi      # 0xacc0
leaq 0x4eab(%rip), %rsi      # 0xb028
leaq 0x4f4d(%rip), %rcx      # 0xb0d1
movl $0xc7, %edx
callq 0x20f0