// File: /workspace/github_c_makefile_star2_O3/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 0xe222
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x67b0
jmp 0xe22a
movq %rbx, %rdi
callq 0x6a20
movq %rax, %r14
testq %rax, %rax
movsd (%rsp), %xmm0
jne 0xe24d
leaq 0x8ecd(%rip), %rdi      # 0x1710b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x714f
movsd (%rsp), %xmm0
ucomisd 0x8a1b(%rip), %xmm0     # 0x16c70
jbe 0xe297
leaq 0x8ec1(%rip), %r15      # 0x1711f
movq %r14, %rdi
movq %r15, %rsi
callq 0x6160
leaq 0x8eb4(%rip), %rsi      # 0x17124
movq %r14, %rdi
callq 0x6160
movq %r14, %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
callq 0x6180
movsd (%rsp), %xmm0
movsd %xmm0, 0x12ba3(%rip)    # 0x20e38
jmp 0xe30c
leaq 0x8e81(%rip), %rsi      # 0x1711f
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x61c0
testl %eax, %eax
je 0xe2ec
leaq 0x8e6c(%rip), %rsi      # 0x17124
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x61c0
testl %eax, %eax
je 0xe2f4
leaq 0x8e4d(%rip), %rsi      # 0x1711f
movsd 0x89a6(%rip), %xmm0     # 0x16c80
movq %r14, %rdi
callq 0x6180
movsd 0x8996(%rip), %xmm0     # 0x16c80
jmp 0xe2fc
movsd 0x10(%rsp), %xmm0
jmp 0xe2fc
movsd 0x897c(%rip), %xmm0     # 0x16c78
movsd %xmm0, 0x12b34(%rip)    # 0x20e38
movsd %xmm0, 0x12b34(%rip)    # 0x20e40
leaq 0x127cd(%rip), %rdi     # 0x20ae0
movq %r14, %rsi
callq 0xf88f
testl %eax, %eax
je 0xe330
leaq 0x8de5(%rip), %rdi      # 0x1710b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x714f
xorpd %xmm0, %xmm0
ucomisd 0x12afc(%rip), %xmm0    # 0x20e38
jbe 0xe385
movq 0x127bb(%rip), %rax     # 0x20b00
movq 0x18(%rax), %rdi
leaq 0x8dcf(%rip), %rsi      # 0x1711f
leaq 0x10(%rsp), %r15
xorl %edx, %edx
movq %r15, %rcx
callq 0x61c0
movsd (%r15), %xmm0
movsd %xmm0, 0x12acc(%rip)    # 0x20e38
movsd (%rsp), %xmm1
ucomisd 0x890f(%rip), %xmm1     # 0x16c88
jne 0xe385
jp 0xe385
movsd %xmm0, 0x12abb(%rip)    # 0x20e40
xorps %xmm0, %xmm0
cvtsi2ssl 0x12754(%rip), %xmm0 # 0x20ae4
mulss 0xfa94(%rip), %xmm0     # 0x1de2c
callq 0x6810
movaps %xmm0, (%rsp)
cvttss2si %xmm0, %eax
xorps %xmm1, %xmm1
cvtsi2ssl 0x12730(%rip), %xmm1 # 0x20ae0
movss %xmm1, 0x1c(%rsp)
movl %eax, 0x12970(%rip)     # 0x20d2c
movss 0xfa6c(%rip), %xmm0     # 0x1de30
movss %xmm0, 0x18(%rsp)
mulss %xmm1, %xmm0
callq 0x6810
cvttss2si %xmm0, %eax
movss 0x18(%rsp), %xmm0
addss 0x88d3(%rip), %xmm0     # 0x16cb8
movl %eax, 0x1293d(%rip)     # 0x20d28
mulss 0x1c(%rsp), %xmm0
mulss 0x88c3(%rip), %xmm0     # 0x16cbc
callq 0x6810
xorps %xmm1, %xmm1
cvtsi2ssl 0xf157(%rip), %xmm1 # 0x1d560
cvttss2si %xmm0, %eax
divss 0x88ab(%rip), %xmm1     # 0x16cc0
movl %eax, 0x12915(%rip)     # 0x20d30
cvttps2dq (%rsp), %xmm0
cvtdq2ps %xmm0, %xmm0
mulss %xmm1, %xmm0
callq 0x6810
cvttss2si %xmm0, %eax
movl %eax, 0x129aa(%rip)     # 0x20de0
leaq 0x8cec(%rip), %rsi      # 0x17129
movq %r14, %rdi
callq 0x6160
cmpl $0x0, 0x12638(%rip)     # 0x20a84
jne 0xe462
leaq 0x8cd4(%rip), %rsi      # 0x17129
movq %r14, %rdi
movl $0x64, %edx
callq 0x6920
leaq 0x126e7(%rip), %rdi     # 0x20b50
movq %r14, %rsi
callq 0xf88f
testl %eax, %eax
je 0xe486
leaq 0x8c8f(%rip), %rdi      # 0x1710b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x714f
leaq 0x8ca2(%rip), %rsi      # 0x1712f
movq %r14, %rdi
callq 0x6160
cmpl $0x0, 0x125e4(%rip)     # 0x20a80
jne 0xe4b2
leaq 0x8c8a(%rip), %rsi      # 0x1712f
movq %r14, %rdi
movl $0xc8, %edx
callq 0x6920
leaq 0x126cf(%rip), %rdi     # 0x20b88
movq %r14, %rsi
callq 0xf88f
testl %eax, %eax
je 0xe4d6
leaq 0x8c3f(%rip), %rdi      # 0x1710b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x714f
leaq 0x8c4c(%rip), %rsi      # 0x17129
movq %r14, %rdi
callq 0x6160
cmpl $0x0, 0x1259c(%rip)     # 0x20a88
jne 0xe4ff
leaq 0x8c34(%rip), %rsi      # 0x17129
movq %r14, %rdi
xorl %edx, %edx
callq 0x6920
leaq 0x12612(%rip), %rdi     # 0x20b18
movq %r14, %rsi
callq 0xf88f
testl %eax, %eax
je 0xe523
leaq 0x8bf2(%rip), %rdi      # 0x1710b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x714f
movq %r14, %rdi
callq 0x6060
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq