// File: /workspace/github_c_makefile_star2_O3/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 $0x28, %rsp
cmpl $0x0, 0x113a2(%rip)     # 0x20e20
je 0xfa8e
leaq 0x78b7(%rip), %rdi      # 0x1733e
xorl %eax, %eax
callq 0x714f
movq 0x1102b(%rip), %rdi     # 0x20ac0
callq 0xc87f
testq %rax, %rax
je 0xfd16
movq %rax, %rbx
movl (%rax), %eax
shll $0x2, %eax
cmpl %eax, 0x1137f(%rip)     # 0x20e30
jae 0xfad3
movl %eax, 0x11377(%rip)     # 0x20e30
movq 0x11368(%rip), %rdi     # 0x20e28
movslq %eax, %rsi
shlq $0x4, %rsi
callq 0x71e9
movq %rax, 0x11355(%rip)     # 0x20e28
movq %rbx, 0x18(%rsp)
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0xfd02
leaq 0x78ae(%rip), %r12      # 0x1739f
leaq 0x7631(%rip), %r14      # 0x17129
movq 0x10(%rsp), %rbp
movq (%rbp), %r13
movq %r13, %rdi
callq 0x63b0
movl 0x11321(%rip), %ecx     # 0x20e30
leaq 0x7853(%rip), %rdi      # 0x17369
movq %r13, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x60b0
cmpb $0x2d, (%r13)
jne 0xfb38
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x67b0
jmp 0xfb40
movq %r13, %rdi
callq 0x6a20
movq %rax, %r15
testq %rax, %rax
jne 0xfb55
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x714f
movsd 0x112e3(%rip), %xmm0    # 0x20e40
ucomisd 0x7123(%rip), %xmm0     # 0x16c88
jbe 0xfbee
movsd 0x112c5(%rip), %xmm1    # 0x20e38
subsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
ucomisd 0x7103(%rip), %xmm1     # 0x16c88
jne 0xfb89
jnp 0xfbee
movq %r15, %rdi
leaq 0x758c(%rip), %rsi      # 0x1711f
xorl %edx, %edx
leaq 0x8(%rsp), %rcx
callq 0x61c0
testl %eax, %eax
jne 0xfbee
movsd 0x20(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
leaq 0x7560(%rip), %rbx      # 0x1711f
movq %rbx, %rsi
callq 0x6160
movq %r15, %rdi
leaq 0x7553(%rip), %rsi      # 0x17124
callq 0x6160
movsd 0x8(%rsp), %xmm0
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x77b6(%rip), %r12      # 0x1739f
callq 0x6180
movq %r15, %rdi
leaq 0x74d5(%rip), %rsi      # 0x170cd
movl $0x1, %edx
callq 0x6680
xorl %edi, %edi
movq %r15, %rsi
xorl %edx, %edx
callq 0x6890
movq 0x10fb3(%rip), %rdi     # 0x20bc8
movl 0x110cd(%rip), %esi     # 0x20ce8
movq %r15, %rdx
callq 0x66f0
movq %r15, %rdi
xorl %esi, %esi
callq 0xff86
testl %eax, %eax
je 0xfc3e
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x714f
movq %r15, %rdi
movq %r14, %rsi
callq 0x6160
movq %r15, %rdi
movq %r14, %rsi
movl $0x64, %edx
callq 0x6920
movq %r15, %rdi
movl $0x1, %esi
callq 0xff86
testl %eax, %eax
je 0xfc77
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x714f
movq %r15, %rdi
leaq 0x74ae(%rip), %rbx      # 0x1712f
movq %rbx, %rsi
callq 0x6160
movq %r15, %rdi
movq %rbx, %rsi
movl $0xc8, %edx
callq 0x6920
movq %r15, %rdi
movl $0x3, %esi
callq 0xff86
testl %eax, %eax
je 0xfcb7
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x714f
movq %r15, %rdi
movq %r14, %rsi
callq 0x6160
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x6920
movq %r15, %rdi
movl $0x2, %esi
callq 0xff86
testl %eax, %eax
je 0xfced
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x714f
movq %r15, %rdi
callq 0x6060
movq 0x10(%rbp), %rbp
testq %rbp, %rbp
jne 0xfafd
movq 0x10(%rsp), %rdi
callq 0xc835
movq 0x18(%rsp), %rdi
callq 0x6380
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq