// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x83b5
jmp 0x83d4
leaq 0x5f18(%rip), %rdi      # 0xe2d4
leaq 0x6cad(%rip), %rsi      # 0xf070
movl $0x99, %edx
leaq 0x6d4a(%rip), %rcx      # 0xf119
callq 0x2100
movq $0x0, -0x18(%rbp)
cmpl $0x0, 0xb09d(%rip)      # 0x13480
jne 0x83f4
xorl %eax, %eax
movl %eax, %edi
callq 0x2130
movl %eax, 0xb08c(%rip)      # 0x13480
movb $0x0, -0x19(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x8466
movl $0x0, -0x24(%rbp)
cmpl $0x6, -0x24(%rbp)
jge 0x845e
leaq 0xb065(%rip), %rdi      # 0x13480
callq 0x2160
cvtsi2sd %eax, %xmm1
movsd 0x6c3c(%rip), %xmm0     # 0xf068
divsd %xmm0, %xmm1
movsd 0x6c28(%rip), %xmm0     # 0xf060
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl $0x41, %eax
movb %al, %cl
movslq -0x24(%rbp), %rax
movb %cl, -0x1f(%rbp,%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x840e
leaq -0x1f(%rbp), %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
je 0x8480
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x84c5
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, (%rax)
je 0x8490
jmp 0x84af
leaq 0x6572(%rip), %rdi      # 0xea09
leaq 0x6bd2(%rip), %rsi      # 0xf070
movl $0xb0, %edx
leaq 0x6c6f(%rip), %rcx      # 0xf119
callq 0x2100
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
callq 0x6470
movq %rax, -0x30(%rbp)
jmp 0x8513
movq -0x10(%rbp), %rax
cmpl $0x4, 0x4(%rax)
jne 0x84dc
movq $0x0, -0x8(%rbp)
jmp 0x85c4
movq 0xaafd(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
leaq 0x652c(%rip), %rsi      # 0xea19
movb $0x0, %al
callq 0x21e0
leaq 0x6805(%rip), %rdi      # 0xed00
leaq 0x6b6e(%rip), %rsi      # 0xf070
movl $0xb6, %edx
leaq 0x6c0b(%rip), %rcx      # 0xf119
callq 0x2100
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x8546
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x6c1b(%rip), %rdx      # 0xf14c
leaq 0x6c1a(%rip), %rcx      # 0xf152
xorl %r8d, %r8d
callq 0x85d0
movq %rax, -0x38(%rbp)
jmp 0x8564
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq %rcx, %rdx
callq 0x85d0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x8575
movq $0x0, -0x8(%rbp)
jmp 0x85c4
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
je 0x8587
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x859d
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x66b0
jmp 0x85bc
leaq 0x675c(%rip), %rdi      # 0xed00
leaq 0x6ac5(%rip), %rsi      # 0xf070
movl $0xc7, %edx
leaq 0x6b62(%rip), %rcx      # 0xf119
callq 0x2100
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop