// File: /workspace/github_c_makefile_star2_O2/mcaimi[P]st/x.c
// Function: xloadfonts
void
xloadfonts(char *fontstr, double fontsize)
{
  FcPattern *pattern;
  double fontval;

  if (fontstr[0] == '-')
    pattern = XftXlfdParse(fontstr, False, False);
  else
    pattern = FcNameParse((FcChar8 *)fontstr);

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

  if (fontsize > 1) {
    FcPatternDel(pattern, FC_PIXEL_SIZE);
    FcPatternDel(pattern, FC_SIZE);
    FcPatternAddDouble(pattern, FC_PIXEL_SIZE, (double)fontsize);
    usedfontsize = fontsize;
  } else {
    if (FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) ==
        FcResultMatch) {
      usedfontsize = fontval;
    } else if (FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval) ==
        FcResultMatch) {
      usedfontsize = -1;
    } else {
      /*
       * Default font size is 12, if none given. This is to
       * have a known usedfontsize value.
       */
      FcPatternAddDouble(pattern, FC_PIXEL_SIZE, 12);
      usedfontsize = 12;
    }
    defaultfontsize = usedfontsize;
  }

  if (xloadfont(&dc.font, pattern)) {
    die("can't open font %s\n", fontstr);
  }

  if (usedfontsize < 0) {
    FcPatternGetDouble(dc.font.match->pattern,
                       FC_PIXEL_SIZE, 0, &fontval);
    usedfontsize = fontval;
    if (fontsize == 0)
      defaultfontsize = fontval;
  }

  /* Setting character width and height. */
  win.cw = ceilf(dc.font.width * cwscale);
  win.ch = ceilf(dc.font.height * chscale);
  win.cyo = ceilf(dc.font.height * (chscale - 1) / 2);

  borderpx = ceilf(((float)borderperc / 100) * win.cw);

  FcPatternDel(pattern, FC_SLANT);
  if (!disableitalic)
    FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);

  if (xloadfont(&dc.ifont, pattern))
    die("can't open font %s\n", fontstr);

  FcPatternDel(pattern, FC_WEIGHT);
  if (!disablebold)
    FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
  if (xloadfont(&dc.ibfont, pattern))
    die("can't open font %s\n", fontstr);

  FcPatternDel(pattern, FC_SLANT);
  if (!disableroman)
    FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
  if (xloadfont(&dc.bfont, pattern))
    die("can't open font %s\n", fontstr);

  FcPatternDestroy(pattern);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movsd %xmm0, (%rsp)
movq %rdi, %rbx
cmpb $0x2d, (%rdi)
jne 0xd141
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x67b0
jmp 0xd149
movq %rbx, %rdi
callq 0x6a20
movq %rax, %r14
testq %rax, %rax
movsd (%rsp), %xmm0
jne 0xd16c
leaq 0x8f7e(%rip), %rdi      # 0x160db
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6c0a
movsd (%rsp), %xmm0
ucomisd 0x8acc(%rip), %xmm0     # 0x15c40
jbe 0xd1b6
leaq 0x8f72(%rip), %r15      # 0x160ef
movq %r14, %rdi
movq %r15, %rsi
callq 0x6160
leaq 0x8f65(%rip), %rsi      # 0x160f4
movq %r14, %rdi
callq 0x6160
movq %r14, %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
callq 0x6180
movsd (%rsp), %xmm0
movsd %xmm0, 0x13c84(%rip)    # 0x20e38
jmp 0xd22b
leaq 0x8f32(%rip), %rsi      # 0x160ef
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x61c0
testl %eax, %eax
je 0xd20b
leaq 0x8f1d(%rip), %rsi      # 0x160f4
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x61c0
testl %eax, %eax
je 0xd213
leaq 0x8efe(%rip), %rsi      # 0x160ef
movsd 0x8a57(%rip), %xmm0     # 0x15c50
movq %r14, %rdi
callq 0x6180
movsd 0x8a47(%rip), %xmm0     # 0x15c50
jmp 0xd21b
movsd 0x10(%rsp), %xmm0
jmp 0xd21b
movsd 0x8a2d(%rip), %xmm0     # 0x15c48
movsd %xmm0, 0x13c15(%rip)    # 0x20e38
movsd %xmm0, 0x13c15(%rip)    # 0x20e40
leaq 0x138ae(%rip), %rdi     # 0x20ae0
movq %r14, %rsi
callq 0xe6e6
testl %eax, %eax
je 0xd24f
leaq 0x8e96(%rip), %rdi      # 0x160db
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6c0a
xorpd %xmm0, %xmm0
ucomisd 0x13bdd(%rip), %xmm0    # 0x20e38
jbe 0xd2a4
movq 0x1389c(%rip), %rax     # 0x20b00
movq 0x18(%rax), %rdi
leaq 0x8e80(%rip), %rsi      # 0x160ef
leaq 0x10(%rsp), %r15
xorl %edx, %edx
movq %r15, %rcx
callq 0x61c0
movsd (%r15), %xmm0
movsd %xmm0, 0x13bad(%rip)    # 0x20e38
movsd (%rsp), %xmm1
ucomisd 0x89c0(%rip), %xmm1     # 0x15c58
jne 0xd2a4
jp 0xd2a4
movsd %xmm0, 0x13b9c(%rip)    # 0x20e40
cvtsi2ssl 0x13838(%rip), %xmm0 # 0x20ae4
mulss 0x10b78(%rip), %xmm0    # 0x1de2c
callq 0x6810
movaps %xmm0, (%rsp)
cvttss2si %xmm0, %eax
cvtsi2ssl 0x13817(%rip), %xmm1 # 0x20ae0
movss %xmm1, 0x1c(%rsp)
movl %eax, 0x13a57(%rip)     # 0x20d2c
movss 0x10b53(%rip), %xmm0    # 0x1de30
movss %xmm0, 0x18(%rsp)
mulss %xmm1, %xmm0
callq 0x6810
cvttss2si %xmm0, %eax
movss 0x18(%rsp), %xmm0
addss 0x898a(%rip), %xmm0     # 0x15c88
movl %eax, 0x13a24(%rip)     # 0x20d28
mulss 0x1c(%rsp), %xmm0
mulss 0x897a(%rip), %xmm0     # 0x15c8c
callq 0x6810
cvtsi2ssl 0x10241(%rip), %xmm1 # 0x1d560
cvttss2si %xmm0, %eax
divss 0x8965(%rip), %xmm1     # 0x15c90
movl %eax, 0x139ff(%rip)     # 0x20d30
cvttps2dq (%rsp), %xmm0
cvtdq2ps %xmm0, %xmm0
mulss %xmm1, %xmm0
callq 0x6810
cvttss2si %xmm0, %eax
movl %eax, 0x13a94(%rip)     # 0x20de0
leaq 0x8da6(%rip), %rsi      # 0x160f9
movq %r14, %rdi
callq 0x6160
cmpl $0x0, 0x13722(%rip)     # 0x20a84
jne 0xd376
leaq 0x8d8e(%rip), %rsi      # 0x160f9
pushq $0x64
popq %rdx
movq %r14, %rdi
callq 0x6920
leaq 0x137d3(%rip), %rdi     # 0x20b50
movq %r14, %rsi
callq 0xe6e6
testl %eax, %eax
je 0xd39a
leaq 0x8d4b(%rip), %rdi      # 0x160db
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6c0a
leaq 0x8d5e(%rip), %rsi      # 0x160ff
movq %r14, %rdi
callq 0x6160
cmpl $0x0, 0x136d0(%rip)     # 0x20a80
jne 0xd3c6
leaq 0x8d46(%rip), %rsi      # 0x160ff
movq %r14, %rdi
movl $0xc8, %edx
callq 0x6920
leaq 0x137bb(%rip), %rdi     # 0x20b88
movq %r14, %rsi
callq 0xe6e6
testl %eax, %eax
je 0xd3ea
leaq 0x8cfb(%rip), %rdi      # 0x160db
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6c0a
leaq 0x8d08(%rip), %rsi      # 0x160f9
movq %r14, %rdi
callq 0x6160
cmpl $0x0, 0x13688(%rip)     # 0x20a88
jne 0xd413
leaq 0x8cf0(%rip), %rsi      # 0x160f9
movq %r14, %rdi
xorl %edx, %edx
callq 0x6920
leaq 0x136fe(%rip), %rdi     # 0x20b18
movq %r14, %rsi
callq 0xe6e6
testl %eax, %eax
je 0xd437
leaq 0x8cae(%rip), %rdi      # 0x160db
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6c0a
movq %r14, %rdi
callq 0x6060
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq