// File: /workspace/github_c_makefile_star2_O0/smilingthax[P]libfontembed/embed_pdf.c
// Function: emb_pdf_simple_fontdescr
char *emb_pdf_simple_fontdescr(EMB_PARAMS *emb,EMB_PDF_FONTDESCR *fdes,int fontfile_obj_ref) // {{{ - to be freed by user
{
  assert(emb);
  assert(fdes);

  char *ret=NULL,*pos;
  int len,size;

  size=300;
  pos=ret=malloc(size);
  if (!ret) {
    fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
    return NULL;
  }

  len=snprintf(pos,size,
               "<</Type /FontDescriptor\n"
               "  /FontName /%s\n" // TODO? handle quoting in struct?
               "  /Flags %d\n"
               "  /ItalicAngle %d\n",
               emb_pdf_escape_name(fdes->fontname,-1),
               fdes->flags,
               fdes->italicAngle);
  NEXT;

  if (1) { // TODO type!=EMB_PDF_TYPE3
    len=snprintf(pos,size,
                 "  /FontBBox [%d %d %d %d]\n"
                 "  /Ascent %d\n"
                 "  /Descent %d\n"
                 "  /CapHeight %d\n" // if font has Latin chars
                 "  /StemV %d\n",
                 fdes->bbxmin,fdes->bbymin,fdes->bbxmax,fdes->bbymax,
                 fdes->ascent,
                 fdes->descent,
                 fdes->capHeight,
                 fdes->stemV);
    NEXT;
  }
  if (fdes->xHeight) {
    len=snprintf(pos,size,"  /XHeight %d\n",fdes->xHeight);
    NEXT;
  }
  if (fdes->avgWidth) {
    len=snprintf(pos,size,"  /AvgWidth %d\n",fdes->avgWidth);
    NEXT;
  }
  if (fdes->panose) {
    int iA;
    len=snprintf(pos,size,"  /Style << /Panose <");
    NEXT;
    if (size<30) {
      assert(0);
      free(ret);
      return NULL;
    }
    for (iA=0;iA<12;iA++) {
      snprintf(pos+iA*2,size-iA*2,"%02x",fdes->panose[iA]);
    }
    size-=24;
    pos+=24;
    len=snprintf(pos,size,"> >>\n");
    NEXT;
  }
  // TODO (for Type0)? CIDSet  -> simply our glyphs BITSET  (ok. endianess?)
  len=snprintf(pos,size,
               "  /%s %d 0 R\n"
               ">>\n",
               emb_pdf_get_fontfile_key(emb),
               fontfile_obj_ref);
  NEXT;

  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movl %edx, -0x2c(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x8f72
jmp 0x8f91
leaq 0x535b(%rip), %rdi      # 0xe2d4
leaq 0x60f0(%rip), %rsi      # 0xf070
movl $0x171, %edx            # imm = 0x171
leaq 0x62b5(%rip), %rcx      # 0xf241
callq 0x2100
cmpq $0x0, -0x28(%rbp)
je 0x8f9a
jmp 0x8fb9
leaq 0x513a(%rip), %rdi      # 0xe0db
leaq 0x60c8(%rip), %rsi      # 0xf070
movl $0x172, %edx            # imm = 0x172
leaq 0x628d(%rip), %rcx      # 0xf241
callq 0x2100
movq $0x0, -0x38(%rbp)
movl $0x12c, -0x48(%rbp)     # imm = 0x12C
movslq -0x48(%rbp), %rdi
callq 0x21d0
movq %rax, -0x38(%rbp)
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x901c
movq 0x9ff9(%rip), %rax      # 0x12fe0
movq (%rax), %rax
movq %rax, -0x58(%rbp)
callq 0x2040
movl (%rax), %edi
callq 0x2070
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq 0x5354(%rip), %rsi      # 0xe35c
movb $0x0, %al
callq 0x21e0
movq $0x0, -0x18(%rbp)
jmp 0x9435
movq -0x40(%rbp), %rax
movq %rax, -0x68(%rbp)
movslq -0x48(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x9450
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq %rax, %rcx
movq -0x28(%rbp), %rax
movl 0x8(%rax), %r8d
movq -0x28(%rbp), %rax
movl 0x1c(%rax), %r9d
leaq 0x6229(%rip), %rdx      # 0xf288
movb $0x0, %al
callq 0x2220
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x9077
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jl 0x9096
leaq 0x5c82(%rip), %rdi      # 0xed00
leaq 0x5feb(%rip), %rsi      # 0xf070
movl $0x186, %edx            # imm = 0x186
leaq 0x61b0(%rip), %rcx      # 0xf241
callq 0x2100
movl -0x44(%rbp), %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0x44(%rbp), %ecx
movl -0x48(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movslq -0x48(%rbp), %rsi
movq -0x28(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x28(%rbp), %rax
movl 0x10(%rax), %r8d
movq -0x28(%rbp), %rax
movl 0x14(%rax), %r9d
movq -0x28(%rbp), %rax
movl 0x18(%rax), %r14d
movq -0x28(%rbp), %rax
movl 0x20(%rax), %ebx
movq -0x28(%rbp), %rax
movl 0x24(%rax), %r11d
movq -0x28(%rbp), %rax
movl 0x28(%rax), %r10d
movq -0x28(%rbp), %rax
movl 0x2c(%rax), %eax
leaq 0x61d1(%rip), %rdx      # 0xf2cf
movl %r14d, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x0, %al
callq 0x2220
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x912c
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jl 0x914b
leaq 0x5bcd(%rip), %rdi      # 0xed00
leaq 0x5f36(%rip), %rsi      # 0xf070
movl $0x194, %edx            # imm = 0x194
leaq 0x60fb(%rip), %rcx      # 0xf241
callq 0x2100
movl -0x44(%rbp), %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0x44(%rbp), %ecx
movl -0x48(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x48(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x30(%rax)
je 0x91da
movq -0x40(%rbp), %rdi
movslq -0x48(%rbp), %rsi
movq -0x28(%rbp), %rax
movl 0x30(%rax), %ecx
leaq 0x619a(%rip), %rdx      # 0xf321
movb $0x0, %al
callq 0x2220
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x919f
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jl 0x91be
leaq 0x5b5a(%rip), %rdi      # 0xed00
leaq 0x5ec3(%rip), %rsi      # 0xf070
movl $0x198, %edx            # imm = 0x198
leaq 0x6088(%rip), %rcx      # 0xf241
callq 0x2100
movl -0x44(%rbp), %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0x44(%rbp), %ecx
movl -0x48(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x48(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x34(%rax)
je 0x924d
movq -0x40(%rbp), %rdi
movslq -0x48(%rbp), %rsi
movq -0x28(%rbp), %rax
movl 0x34(%rax), %ecx
leaq 0x6136(%rip), %rdx      # 0xf330
movb $0x0, %al
callq 0x2220
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x9212
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jl 0x9231
leaq 0x5ae7(%rip), %rdi      # 0xed00
leaq 0x5e50(%rip), %rsi      # 0xf070
movl $0x19c, %edx            # imm = 0x19C
leaq 0x6015(%rip), %rcx      # 0xf241
callq 0x2100
movl -0x44(%rbp), %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0x44(%rbp), %ecx
movl -0x48(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x48(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x93ab
movq -0x40(%rbp), %rdi
movslq -0x48(%rbp), %rsi
leaq 0x60d5(%rip), %rdx      # 0xf340
movb $0x0, %al
callq 0x2220
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x9283
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jl 0x92a2
leaq 0x5a76(%rip), %rdi      # 0xed00
leaq 0x5ddf(%rip), %rsi      # 0xf070
movl $0x1a1, %edx            # imm = 0x1A1
leaq 0x5fa4(%rip), %rcx      # 0xf241
callq 0x2100
movl -0x44(%rbp), %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0x44(%rbp), %ecx
movl -0x48(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x48(%rbp)
cmpl $0x1e, -0x48(%rbp)
jge 0x92e3
leaq 0x5a35(%rip), %rdi      # 0xed00
leaq 0x5d9e(%rip), %rsi      # 0xf070
movl $0x1a3, %edx            # imm = 0x1A3
leaq 0x5f63(%rip), %rcx      # 0xf241
callq 0x2100
movl $0x0, -0x4c(%rbp)
cmpl $0xc, -0x4c(%rbp)
jge 0x9334
movq -0x40(%rbp), %rdi
movl -0x4c(%rbp), %eax
shll %eax
cltq
addq %rax, %rdi
movl -0x48(%rbp), %eax
movl -0x4c(%rbp), %ecx
shll %ecx
subl %ecx, %eax
movslq %eax, %rsi
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x4c(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
leaq 0x6034(%rip), %rdx      # 0xf356
movb $0x0, %al
callq 0x2220
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x92ea
movl -0x48(%rbp), %eax
subl $0x18, %eax
movl %eax, -0x48(%rbp)
movq -0x40(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movslq -0x48(%rbp), %rsi
leaq 0x6003(%rip), %rdx      # 0xf35b
movb $0x0, %al
callq 0x2220
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x9370
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jl 0x938f
leaq 0x5989(%rip), %rdi      # 0xed00
leaq 0x5cf2(%rip), %rsi      # 0xf070
movl $0x1ad, %edx            # imm = 0x1AD
leaq 0x5eb7(%rip), %rcx      # 0xf241
callq 0x2100
movl -0x44(%rbp), %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0x44(%rbp), %ecx
movl -0x48(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x78(%rbp)
movslq -0x48(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rdi
callq 0x82e0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq %rax, %rcx
movl -0x2c(%rbp), %r8d
leaq 0x5f87(%rip), %rdx      # 0xf361
movb $0x0, %al
callq 0x2220
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x93f2
movl -0x44(%rbp), %eax
cmpl -0x48(%rbp), %eax
jl 0x9411
leaq 0x5907(%rip), %rdi      # 0xed00
leaq 0x5c70(%rip), %rsi      # 0xf070
movl $0x1b5, %edx            # imm = 0x1B5
leaq 0x5e35(%rip), %rcx      # 0xf241
callq 0x2100
movl -0x44(%rbp), %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0x44(%rbp), %ecx
movl -0x48(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)