// File: /workspace/github_c_makefile_star2_O1/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, 0x119b0(%rip)     # 0x20e20
je 0xf480
leaq 0x7ea5(%rip), %rdi      # 0x1731e
xorl %eax, %eax
callq 0x714f
movq 0x11639(%rip), %rdi     # 0x20ac0
callq 0xc27d
testq %rax, %rax
je 0xf6fd
movq %rax, %rbx
movl (%rax), %eax
shll $0x2, %eax
cmpl %eax, 0x1198d(%rip)     # 0x20e30
jae 0xf4c5
movl %eax, 0x11985(%rip)     # 0x20e30
movq 0x11976(%rip), %rdi     # 0x20e28
movslq %eax, %rsi
shlq $0x4, %rsi
callq 0x71e9
movq %rax, 0x11963(%rip)     # 0x20e28
movq %rbx, 0x8(%rsp)
movq 0x8(%rbx), %rbp
testq %rbp, %rbp
je 0xf6df
leaq 0x7ea1(%rip), %r15      # 0x1737f
leaq 0x7c24(%rip), %r13      # 0x17109
movq (%rbp), %rbx
movq %rbx, %rdi
callq 0x63b0
movl 0x11939(%rip), %ecx     # 0x20e30
leaq 0x7e4b(%rip), %rdi      # 0x17349
movq %rbx, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x60b0
cmpb $0x2d, (%rbx)
jne 0xf51e
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x67c0
jmp 0xf526
movq %rbx, %rdi
callq 0x6a20
movq %rax, %r14
testq %rax, %rax
jne 0xf53b
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x714f
movsd 0x118fd(%rip), %xmm0    # 0x20e40
ucomisd 0x7725(%rip), %xmm0     # 0x16c70
jbe 0xf5cb
movsd 0x118e3(%rip), %xmm1    # 0x20e38
subsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
ucomisd 0x7709(%rip), %xmm1     # 0x16c70
jne 0xf56b
jnp 0xf5cb
movq %r14, %rdi
leaq 0x7b8a(%rip), %rsi      # 0x170ff
xorl %edx, %edx
movq %rsp, %rcx
callq 0x61c0
testl %eax, %eax
jne 0xf5cb
movsd 0x10(%rsp), %xmm0
addsd (%rsp), %xmm0
movsd %xmm0, (%rsp)
movq %r14, %rdi
leaq 0x7b62(%rip), %r12      # 0x170ff
movq %r12, %rsi
callq 0x6160
movq %r14, %rdi
leaq 0x7b55(%rip), %rsi      # 0x17104
callq 0x6160
movsd (%rsp), %xmm0
movq %r14, %rdi
movq %r12, %rsi
leaq 0x7db9(%rip), %r15      # 0x1737f
callq 0x6180
movq %r14, %rdi
leaq 0x7ad8(%rip), %rsi      # 0x170ad
movl $0x1, %edx
callq 0x6680
xorl %edi, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x6890
movq 0x115d6(%rip), %rdi     # 0x20bc8
movl 0x116f0(%rip), %esi     # 0x20ce8
movq %r14, %rdx
callq 0x6700
movq %r14, %rdi
xorl %esi, %esi
callq 0xf97b
testl %eax, %eax
je 0xf61b
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x714f
movq %r14, %rdi
movq %r13, %rsi
callq 0x6160
movq %r14, %rdi
movq %r13, %rsi
movl $0x64, %edx
callq 0x6920
movq %r14, %rdi
movl $0x1, %esi
callq 0xf97b
testl %eax, %eax
je 0xf654
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x714f
movq %r14, %rdi
leaq 0x7ab1(%rip), %r12      # 0x1710f
movq %r12, %rsi
callq 0x6160
movq %r14, %rdi
movq %r12, %rsi
movl $0xc8, %edx
callq 0x6920
movq %r14, %rdi
movl $0x3, %esi
callq 0xf97b
testl %eax, %eax
je 0xf694
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x714f
movq %r14, %rdi
movq %r13, %rsi
callq 0x6160
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x6920
movq %r14, %rdi
movl $0x2, %esi
callq 0xf97b
testl %eax, %eax
je 0xf6ca
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x714f
movq %r14, %rdi
callq 0x6060
movq 0x10(%rbp), %rbp
testq %rbp, %rbp
jne 0xf4e5
movq 0x8(%rsp), %rbx
movq 0x8(%rbx), %rdi
callq 0xc224
movq $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x6380
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq