// File: /workspace/github_c_makefile_star2_O2/mcaimi[P]st/x.c
// Function: xloadsparefonts
void
xloadsparefonts(void)
{
  FcPattern *pattern;
  double sizeshift, fontval;
  spareFontList *spl = NULL;
  struct _spareFontInfo *fontItem = NULL;
  char *fp = NULL;

  if (frclen != 0)
    die("can't embed spare fonts. cache isn't empty");

  // bail out if no spare font is specified in Xresources
  spl = loadSpareFontList(spareFonts);
  if (spl == NULL) return;

  // allocate space for font cache
  if (frccap < 4 * spl->fontCount) {
    frccap += 4 * spl->fontCount - frccap;
    frc = xrealloc(frc, frccap * sizeof(Fontcache));
  }

  fontItem = spl->fonts;
  while (fontItem != NULL) {
    fp = fontItem->fontString;
    printf("Loading extra font %s, spec %d bytes wide, frccap %d\n", fp, strlen(fp), frccap);
    if (*fp == '-')
      pattern = XftXlfdParse(fp, False, False);
    else
      pattern = FcNameParse((FcChar8 *)fp);

    if (!pattern)
      die("can't open spare font %s\n", fp);

    if (defaultfontsize > 0) {
      sizeshift = usedfontsize - defaultfontsize;
      if (sizeshift != 0 && FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) == FcResultMatch) {
        fontval += sizeshift;
        FcPatternDel(pattern, FC_PIXEL_SIZE);
        FcPatternDel(pattern, FC_SIZE);
        FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontval);
      }
    }

    FcPatternAddBool(pattern, FC_SCALABLE, 1);

    FcConfigSubstitute(NULL, pattern, FcMatchPattern);
    XftDefaultSubstitute(xw.dpy, xw.scr, pattern);

    if (xloadsparefont(pattern, FRC_NORMAL))
      die("can't open spare font %s\n", fp);

    FcPatternDel(pattern, FC_SLANT);
    FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
    if (xloadsparefont(pattern, FRC_ITALIC))
      die("can't open spare font %s\n", fp);

    FcPatternDel(pattern, FC_WEIGHT);
    FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
    if (xloadsparefont(pattern, FRC_ITALICBOLD))
      die("can't open spare font %s\n", fp);

    FcPatternDel(pattern, FC_SLANT);
    FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
    if (xloadsparefont(pattern, FRC_BOLD))
      die("can't open spare font %s\n", fp);

    FcPatternDestroy(pattern);

    // next
    fontItem = fontItem->next;
  }

  fp = NULL;
  if (spl != NULL) {
    unloadSpareFontList(spl);
    spl = NULL;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0x0, 0x12527(%rip)     # 0x20e20
je 0xe909
leaq 0x7a0c(%rip), %rdi      # 0x1630e
xorl %eax, %eax
callq 0x6c0a
movq 0x121b0(%rip), %rdi     # 0x20ac0
callq 0xb90c
testq %rax, %rax
je 0xeb69
movq %rax, %r13
movl (%rax), %eax
shll $0x2, %eax
cmpl %eax, 0x12504(%rip)     # 0x20e30
jae 0xe94e
movl %eax, 0x124fc(%rip)     # 0x20e30
movq 0x124ed(%rip), %rdi     # 0x20e28
movslq %eax, %rsi
shlq $0x4, %rsi
callq 0x6ca2
movq %rax, 0x124da(%rip)     # 0x20e28
movq %r13, 0x8(%rsp)
addq $0x8, %r13
leaq 0x7a11(%rip), %r15      # 0x1636f
leaq 0x7794(%rip), %rbx      # 0x160f9
movq (%r13), %r13
testq %r13, %r13
je 0xeb5f
movq (%r13), %rbp
movq %rbp, %rdi
callq 0x63b0
movl 0x124ac(%rip), %ecx     # 0x20e30
leaq 0x79ae(%rip), %rdi      # 0x16339
movq %rbp, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x60b0
cmpb $0x2d, (%rbp)
jne 0xe9ac
movq %rbp, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x67b0
jmp 0xe9b4
movq %rbp, %rdi
callq 0x6a20
movq %rax, %r12
testq %rax, %rax
jne 0xe9c9
movq %r15, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x6c0a
movsd 0x1246f(%rip), %xmm0    # 0x20e40
ucomisd 0x727f(%rip), %xmm0     # 0x15c58
jbe 0xea59
movsd 0x12455(%rip), %xmm1    # 0x20e38
subsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
ucomisd 0x7263(%rip), %xmm1     # 0x15c58
jne 0xe9f9
jnp 0xea59
movq %r12, %rdi
leaq 0x76ec(%rip), %rsi      # 0x160ef
xorl %edx, %edx
movq %rsp, %rcx
callq 0x61c0
testl %eax, %eax
jne 0xea59
movsd 0x10(%rsp), %xmm0
addsd (%rsp), %xmm0
movsd %xmm0, (%rsp)
movq %r12, %rdi
leaq 0x76c4(%rip), %r14      # 0x160ef
movq %r14, %rsi
callq 0x6160
movq %r12, %rdi
leaq 0x76b7(%rip), %rsi      # 0x160f4
callq 0x6160
movsd (%rsp), %xmm0
movq %r12, %rdi
movq %r14, %rsi
leaq 0x791b(%rip), %r15      # 0x1636f
callq 0x6180
movq %r12, %rdi
leaq 0x763a(%rip), %rsi      # 0x1609d
pushq $0x1
popq %rdx
callq 0x6680
xorl %edi, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x6890
movq 0x1214a(%rip), %rdi     # 0x20bc8
movl 0x12264(%rip), %esi     # 0x20ce8
movq %r12, %rdx
callq 0x66f0
movq %r12, %rdi
xorl %esi, %esi
callq 0xee0a
testl %eax, %eax
je 0xeaa7
movq %r15, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x6c0a
movq %r12, %rdi
movq %rbx, %rsi
callq 0x6160
movq %r12, %rdi
movq %rbx, %rsi
pushq $0x64
popq %rdx
callq 0x6920
movq %r12, %rdi
pushq $0x1
popq %rsi
callq 0xee0a
testl %eax, %eax
je 0xeadc
movq %r15, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x6c0a
movq %r12, %rdi
leaq 0x7619(%rip), %r14      # 0x160ff
movq %r14, %rsi
callq 0x6160
movq %r12, %rdi
movq %r14, %rsi
movl $0xc8, %edx
callq 0x6920
movq %r12, %rdi
pushq $0x3
popq %rsi
callq 0xee0a
testl %eax, %eax
je 0xeb1a
movq %r15, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x6c0a
movq %r12, %rdi
movq %rbx, %rsi
callq 0x6160
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x6920
movq %r12, %rdi
pushq $0x2
popq %rsi
callq 0xee0a
testl %eax, %eax
je 0xeb4e
movq %r15, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x6c0a
movq %r12, %rdi
callq 0x6060
addq $0x10, %r13
jmp 0xe965
movq 0x8(%rsp), %rdi
callq 0xb8f0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq