// File: /workspace/github_c_makefile_star2_O2/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 0xe2bb
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6740
jmp 0xe2c3
movq %rbx, %rdi
callq 0x6970
movq %rax, %r14
testq %rax, %rax
movsd (%rsp), %xmm0
jne 0xe2e6
leaq 0x3ee7(%rip), %rdi      # 0x121be
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6b5a
movsd (%rsp), %xmm0
ucomisd 0x399a(%rip), %xmm0     # 0x11c88
jbe 0xe330
leaq 0x3edb(%rip), %r15      # 0x121d2
movq %r14, %rdi
movq %r15, %rsi
callq 0x6140
leaq 0x3ece(%rip), %rsi      # 0x121d7
movq %r14, %rdi
callq 0x6140
movq %r14, %rdi
movq %r15, %rsi
movsd (%rsp), %xmm0
callq 0x6160
movsd (%rsp), %xmm0
movsd %xmm0, 0xe992(%rip)     # 0x1ccc0
jmp 0xe3a5
leaq 0x3e9b(%rip), %rsi      # 0x121d2
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x61a0
testl %eax, %eax
je 0xe385
leaq 0x3e86(%rip), %rsi      # 0x121d7
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x61a0
testl %eax, %eax
je 0xe38d
leaq 0x3e67(%rip), %rsi      # 0x121d2
movsd 0x391d(%rip), %xmm0     # 0x11c90
movq %r14, %rdi
callq 0x6160
movsd 0x390d(%rip), %xmm0     # 0x11c90
jmp 0xe395
movsd 0x8(%rsp), %xmm0
jmp 0xe395
movsd 0x38d3(%rip), %xmm0     # 0x11c68
movsd %xmm0, 0xe923(%rip)     # 0x1ccc0
movsd %xmm0, 0xe923(%rip)     # 0x1ccc8
leaq 0xe65c(%rip), %rdi      # 0x1ca08
movq %r14, %rsi
callq 0xea19
testl %eax, %eax
je 0xe3c9
leaq 0x3dff(%rip), %rdi      # 0x121be
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6b5a
xorpd %xmm0, %xmm0
ucomisd 0xe8eb(%rip), %xmm0     # 0x1ccc0
jbe 0xe41e
movq 0xe64a(%rip), %rax      # 0x1ca28
movq 0x18(%rax), %rdi
leaq 0x3de9(%rip), %rsi      # 0x121d2
leaq 0x8(%rsp), %r15
xorl %edx, %edx
movq %r15, %rcx
callq 0x61a0
movsd (%r15), %xmm0
movsd %xmm0, 0xe8bb(%rip)     # 0x1ccc0
movsd (%rsp), %xmm1
ucomisd 0x386e(%rip), %xmm1     # 0x11c80
jne 0xe41e
jp 0xe41e
movsd %xmm0, 0xe8aa(%rip)     # 0x1ccc8
cvtsi2ssl 0xe5e6(%rip), %xmm0 # 0x1ca0c
mulss 0xa9da(%rip), %xmm0     # 0x18e08
callq 0x67a0
cvttss2si %xmm0, %eax
cvtsi2ssl 0xe5c9(%rip), %xmm0 # 0x1ca08
movl %eax, 0xe7cf(%rip)      # 0x1cc14
mulss 0xa9bf(%rip), %xmm0     # 0x18e0c
callq 0x67a0
cvttss2si %xmm0, %eax
movl %eax, 0xe7b4(%rip)      # 0x1cc10
leaq 0x3d79(%rip), %r15      # 0x121dc
movq %r14, %rdi
movq %r15, %rsi
callq 0x6140
pushq $0x64
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x6880
leaq 0xe5f5(%rip), %rdi      # 0x1ca78
movq %r14, %rsi
callq 0xea19
testl %eax, %eax
je 0xe4a0
leaq 0x3d28(%rip), %rdi      # 0x121be
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6b5a
leaq 0x3d3b(%rip), %r15      # 0x121e2
movq %r14, %rdi
movq %r15, %rsi
callq 0x6140
movq %r14, %rdi
movq %r15, %rsi
movl $0xc8, %edx
callq 0x6880
leaq 0xe5e7(%rip), %rdi      # 0x1cab0
movq %r14, %rsi
callq 0xea19
testl %eax, %eax
je 0xe4e6
leaq 0x3ce2(%rip), %rdi      # 0x121be
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6b5a
leaq 0x3cef(%rip), %r15      # 0x121dc
movq %r14, %rdi
movq %r15, %rsi
callq 0x6140
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x6880
leaq 0xe534(%rip), %rdi      # 0x1ca40
movq %r14, %rsi
callq 0xea19
testl %eax, %eax
je 0xe529
leaq 0x3c9f(%rip), %rdi      # 0x121be
movq %rbx, %rsi
xorl %eax, %eax
callq 0x6b5a
movq %r14, %rdi
callq 0x6050
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq