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

	if (fontstr[0] == '-')
		pattern = XftXlfdParse(fontstr, False, False);
	else
		pattern = FcNameParse((const 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);

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

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

	FcPatternDel(pattern, FC_SLANT);
	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 $0x10, %rsp
movsd %xmm0, (%rsp)
movq %rdi, %rbx
cmpb $0x2d, (%rdi)
jne 0xf6dc
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6740
jmp 0xf6e4
movq %rbx, %rdi
callq 0x6970
movq %rax, %r14
testq %rax, %rax
movsd (%rsp), %xmm0
jne 0xf707
leaq 0x3af6(%rip), %rdi      # 0x131ee
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6f9f
movsd (%rsp), %xmm0
ucomisd 0x35a9(%rip), %xmm0     # 0x12cb8
jbe 0xf751
leaq 0x3aea(%rip), %r15      # 0x13202
movq %r14, %rdi
movq %r15, %rsi
callq 0x6140
leaq 0x3add(%rip), %rsi      # 0x13207
movq %r14, %rdi
callq 0x6140
movq %r14, %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
callq 0x6160
movsd (%rsp), %xmm0
movsd %xmm0, 0xe571(%rip)     # 0x1dcc0
jmp 0xf7c6
leaq 0x3aaa(%rip), %rsi      # 0x13202
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x61a0
testl %eax, %eax
je 0xf7a6
leaq 0x3a95(%rip), %rsi      # 0x13207
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x61a0
testl %eax, %eax
je 0xf7ae
leaq 0x3a76(%rip), %rsi      # 0x13202
movsd 0x352c(%rip), %xmm0     # 0x12cc0
movq %r14, %rdi
callq 0x6160
movsd 0x351c(%rip), %xmm0     # 0x12cc0
jmp 0xf7b6
movsd 0x8(%rsp), %xmm0
jmp 0xf7b6
movsd 0x34e2(%rip), %xmm0     # 0x12c98
movsd %xmm0, 0xe502(%rip)     # 0x1dcc0
movsd %xmm0, 0xe502(%rip)     # 0x1dcc8
leaq 0xe23b(%rip), %rdi      # 0x1da08
movq %r14, %rsi
callq 0xfe17
testl %eax, %eax
je 0xf7ea
leaq 0x3a0e(%rip), %rdi      # 0x131ee
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6f9f
xorpd %xmm0, %xmm0
ucomisd 0xe4ca(%rip), %xmm0     # 0x1dcc0
jbe 0xf83f
movq 0xe229(%rip), %rax      # 0x1da28
movq 0x18(%rax), %rdi
leaq 0x39f8(%rip), %rsi      # 0x13202
leaq 0x8(%rsp), %r15
xorl %edx, %edx
movq %r15, %rcx
callq 0x61a0
movsd (%r15), %xmm0
movsd %xmm0, 0xe49a(%rip)     # 0x1dcc0
movsd (%rsp), %xmm1
ucomisd 0x347d(%rip), %xmm1     # 0x12cb0
jne 0xf83f
jp 0xf83f
movsd %xmm0, 0xe489(%rip)     # 0x1dcc8
xorps %xmm0, %xmm0
cvtsi2ssl 0xe1c2(%rip), %xmm0 # 0x1da0c
mulss 0xa5b6(%rip), %xmm0     # 0x19e08
callq 0x67a0
cvttss2si %xmm0, %eax
xorps %xmm0, %xmm0
cvtsi2ssl 0xe1a2(%rip), %xmm0 # 0x1da08
movl %eax, 0xe3a8(%rip)      # 0x1dc14
mulss 0xa598(%rip), %xmm0     # 0x19e0c
callq 0x67a0
cvttss2si %xmm0, %eax
movl %eax, 0xe38d(%rip)      # 0x1dc10
leaq 0x3982(%rip), %r15      # 0x1320c
movq %r14, %rdi
movq %r15, %rsi
callq 0x6140
movq %r14, %rdi
movq %r15, %rsi
movl $0x64, %edx
callq 0x6880
leaq 0xe1cc(%rip), %rdi      # 0x1da78
movq %r14, %rsi
callq 0xfe17
testl %eax, %eax
je 0xf8c9
leaq 0x392f(%rip), %rdi      # 0x131ee
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6f9f
leaq 0x3942(%rip), %r15      # 0x13212
movq %r14, %rdi
movq %r15, %rsi
callq 0x6140
movq %r14, %rdi
movq %r15, %rsi
movl $0xc8, %edx
callq 0x6880
leaq 0xe1be(%rip), %rdi      # 0x1dab0
movq %r14, %rsi
callq 0xfe17
testl %eax, %eax
je 0xf90f
leaq 0x38e9(%rip), %rdi      # 0x131ee
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6f9f
leaq 0x38f6(%rip), %r15      # 0x1320c
movq %r14, %rdi
movq %r15, %rsi
callq 0x6140
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x6880
leaq 0xe10b(%rip), %rdi      # 0x1da40
movq %r14, %rsi
callq 0xfe17
testl %eax, %eax
je 0xf952
leaq 0x38a6(%rip), %rdi      # 0x131ee
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6f9f
movq %r14, %rdi
callq 0x6050
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq