// File: /workspace/github_c_makefile_star2_O0/mrdotx[P]st/x.c
// Function: xmakeglyphfontspecs
int
xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x, int y)
{
	float winx = borderpx + x * win.cw, winy = borderpx + y * win.ch, xp, yp;
	ushort mode, prevmode = USHRT_MAX;
	Font *font = &dc.font;
	int frcflags = FRC_NORMAL;
	float runewidth = win.cw;
	Rune rune;
	FT_UInt glyphidx;
	FcResult fcres;
	FcPattern *fcpattern, *fontpattern;
	FcFontSet *fcsets[] = { NULL };
	FcCharSet *fccharset;
	int i, f, numspecs = 0;

	for (i = 0, xp = winx, yp = winy + font->ascent; i < len; ++i) {
		/* Fetch rune and mode for current glyph. */
		rune = glyphs[i].u;
		mode = glyphs[i].mode;

		/* Skip dummy wide-character spacing. */
		if (mode == ATTR_WDUMMY)
			continue;

		/* Determine font for glyph if different from previous glyph. */
		if (prevmode != mode) {
			prevmode = mode;
			font = &dc.font;
			frcflags = FRC_NORMAL;
			runewidth = win.cw * ((mode & ATTR_WIDE) ? 2.0f : 1.0f);
			if ((mode & ATTR_ITALIC) && (mode & ATTR_BOLD)) {
				font = &dc.ibfont;
				frcflags = FRC_ITALICBOLD;
			} else if (mode & ATTR_ITALIC) {
				font = &dc.ifont;
				frcflags = FRC_ITALIC;
			} else if (mode & ATTR_BOLD) {
				font = &dc.bfont;
				frcflags = FRC_BOLD;
			}
			yp = winy + font->ascent;
		}

		if (mode & ATTR_BOXDRAW) {
			/* minor shoehorning: boxdraw uses only this ushort */
			glyphidx = boxdrawindex(&glyphs[i]);
		} else {
			/* Lookup character index with default font. */
			glyphidx = XftCharIndex(xw.dpy, font->match, rune);
		}
		if (glyphidx) {
			specs[numspecs].font = font->match;
			specs[numspecs].glyph = glyphidx;
			specs[numspecs].x = (short)xp;
			specs[numspecs].y = (short)yp;
			xp += runewidth;
			numspecs++;
			continue;
		}

		/* Fallback on font cache, search the font cache for match. */
		for (f = 0; f < frclen; f++) {
			glyphidx = XftCharIndex(xw.dpy, frc[f].font, rune);
			/* Everything correct. */
			if (glyphidx && frc[f].flags == frcflags)
				break;
			/* We got a default font for a not found glyph. */
			if (!glyphidx && frc[f].flags == frcflags
					&& frc[f].unicodep == rune) {
				break;
			}
		}

		/* Nothing was found. Use fontconfig to find matching font. */
		if (f >= frclen) {
			if (!font->set)
				font->set = FcFontSort(0, font->pattern,
				                       1, 0, &fcres);
			fcsets[0] = font->set;

			/*
			 * Nothing was found in the cache. Now use
			 * some dozen of Fontconfig calls to get the
			 * font for one single character.
			 *
			 * Xft and fontconfig are design failures.
			 */
			fcpattern = FcPatternDuplicate(font->pattern);
			fccharset = FcCharSetCreate();

			FcCharSetAddChar(fccharset, rune);
			FcPatternAddCharSet(fcpattern, FC_CHARSET,
					fccharset);
			FcPatternAddBool(fcpattern, FC_SCALABLE, 1);

			FcConfigSubstitute(0, fcpattern,
					FcMatchPattern);
			FcDefaultSubstitute(fcpattern);

			fontpattern = FcFontSetMatch(0, fcsets, 1,
					fcpattern, &fcres);

			/* Allocate memory for the new cache entry. */
			if (frclen >= frccap) {
				frccap += 16;
				frc = xrealloc(frc, frccap * sizeof(Fontcache));
			}

			frc[frclen].font = XftFontOpenPattern(xw.dpy,
					fontpattern);
			if (!frc[frclen].font)
				die("XftFontOpenPattern failed seeking fallback font: %s\n",
					strerror(errno));
			frc[frclen].flags = frcflags;
			frc[frclen].unicodep = rune;

			glyphidx = XftCharIndex(xw.dpy, frc[frclen].font, rune);

			f = frclen;
			frclen++;

			FcPatternDestroy(fcpattern);
			FcCharSetDestroy(fccharset);
		}

		specs[numspecs].font = frc[f].font;
		specs[numspecs].glyph = glyphidx;
		specs[numspecs].x = (short)xp;
		specs[numspecs].y = (short)yp;
		xp += runewidth;
		numspecs++;
	}

	return numspecs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl 0xc5a1(%rip), %eax      # 0x1c034
movl -0x18(%rbp), %ecx
imull 0x11f37(%rip), %ecx     # 0x219d4
addl %ecx, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x20(%rbp)
movl 0xc586(%rip), %eax      # 0x1c034
movl -0x1c(%rbp), %ecx
imull 0x11f18(%rip), %ecx     # 0x219d0
addl %ecx, %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x24(%rbp)
movw $0xffff, -0x30(%rbp)    # imm = 0xFFFF
leaq 0x11ce8(%rip), %rax     # 0x217b8
addq $0x10, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
cvtsi2ssl 0x11eed(%rip), %xmm0 # 0x219d4
movss %xmm0, -0x40(%rbp)
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x60a0
movl $0x0, -0x7c(%rbp)
movl $0x0, -0x74(%rbp)
movss -0x20(%rbp), %xmm0
movss %xmm0, -0x28(%rbp)
movss -0x24(%rbp), %xmm0
movq -0x38(%rbp), %rax
cvtsi2ssl 0x8(%rax), %xmm1
addss %xmm1, %xmm0
movss %xmm0, -0x2c(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x1009b
movq -0x10(%rbp), %rax
movslq -0x74(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movslq -0x74(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movw 0x4(%rax), %ax
movw %ax, -0x2e(%rbp)
movzwl -0x2e(%rbp), %eax
cmpl $0x400, %eax            # imm = 0x400
jne 0xfb72
jmp 0x1008d
movzwl -0x30(%rbp), %eax
movzwl -0x2e(%rbp), %ecx
cmpl %ecx, %eax
je 0xfc93
movw -0x2e(%rbp), %ax
movw %ax, -0x30(%rbp)
leaq 0x11c27(%rip), %rax     # 0x217b8
addq $0x10, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
cvtsi2ssl 0x11e2c(%rip), %xmm0 # 0x219d4
movss %xmm0, -0x88(%rbp)
movzwl -0x2e(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
movss 0x7297(%rip), %xmm0     # 0x16e58
movss 0x7293(%rip), %xmm1     # 0x16e5c
movss %xmm1, -0x84(%rbp)
cmpl $0x0, %eax
movss %xmm0, -0x80(%rbp)
jne 0xfbe8
movss -0x84(%rbp), %xmm0
movss %xmm0, -0x80(%rbp)
movss -0x88(%rbp), %xmm0
movss -0x80(%rbp), %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0x40(%rbp)
movzwl -0x2e(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xfc30
movzwl -0x2e(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xfc30
leaq 0x11b9b(%rip), %rax     # 0x217b8
addq $0xb8, %rax
movq %rax, -0x38(%rbp)
movl $0x3, -0x3c(%rbp)
jmp 0xfc7c
movzwl -0x2e(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xfc56
leaq 0x11b75(%rip), %rax     # 0x217b8
addq $0x80, %rax
movq %rax, -0x38(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0xfc7a
movzwl -0x2e(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xfc78
leaq 0x11b4f(%rip), %rax     # 0x217b8
addq $0x48, %rax
movq %rax, -0x38(%rbp)
movl $0x2, -0x3c(%rbp)
jmp 0xfc7a
jmp 0xfc7c
movss -0x24(%rbp), %xmm0
movq -0x38(%rbp), %rax
cvtsi2ssl 0x8(%rax), %xmm1
addss %xmm1, %xmm0
movss %xmm0, -0x2c(%rbp)
movzwl -0x2e(%rbp), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xfcbd
movq -0x10(%rbp), %rdi
movslq -0x74(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
callq 0x14e20
movzwl %ax, %eax
movl %eax, -0x48(%rbp)
jmp 0xfcd7
movq 0x11bec(%rip), %rdi     # 0x218b0
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rsi
movl -0x44(%rbp), %edx
callq 0x6410
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
je 0xfd61
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
shlq $0x4, %rcx
movq %rdx, (%rax,%rcx)
movl -0x48(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
shlq $0x4, %rcx
movl %edx, 0x8(%rax,%rcx)
cvttss2si -0x28(%rbp), %eax
movw %ax, %dx
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
shlq $0x4, %rcx
movw %dx, 0xc(%rax,%rcx)
movss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0xe(%rax)
movss -0x40(%rbp), %xmm0
addss -0x28(%rbp), %xmm0
movss %xmm0, -0x28(%rbp)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x1008d
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl 0x11cef(%rip), %eax     # 0x21a60
jge 0xfe0c
movq 0x11b32(%rip), %rdi     # 0x218b0
movq 0x11ce3(%rip), %rax     # 0x21a68
movslq -0x78(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movl -0x44(%rbp), %edx
callq 0x6410
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
je 0xfdc0
movq 0x11cbd(%rip), %rax     # 0x21a68
movslq -0x78(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0x3c(%rbp), %eax
jne 0xfdc0
jmp 0xfe0c
cmpl $0x0, -0x48(%rbp)
jne 0xfdfc
movq 0x11c9b(%rip), %rax     # 0x21a68
movslq -0x78(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0x3c(%rbp), %eax
jne 0xfdfc
movq 0x11c81(%rip), %rax     # 0x21a68
movslq -0x78(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
cmpl -0x44(%rbp), %eax
jne 0xfdfc
jmp 0xfe0c
jmp 0xfdfe
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0xfd68
movl -0x78(%rbp), %eax
cmpl 0x11c4b(%rip), %eax     # 0x21a60
jl 0x10007
movq -0x38(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0xfe4e
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rsi
xorl %eax, %eax
movl %eax, %ecx
movl $0x1, %edx
leaq -0x4c(%rbp), %r8
movq %rcx, %rdi
callq 0x65c0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x60e0
movq %rax, -0x58(%rbp)
callq 0x6270
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x6040
movq -0x58(%rbp), %rdi
movq -0x70(%rbp), %rdx
leaq 0x742e(%rip), %rsi      # 0x172bd
callq 0x69b0
movq -0x58(%rbp), %rdi
leaq 0x7426(%rip), %rsi      # 0x172c5
movl $0x1, %edx
callq 0x6630
movq -0x58(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
xorl %edx, %edx
callq 0x6810
movq -0x58(%rbp), %rdi
callq 0x6860
leaq -0x68(%rbp), %rsi
movq -0x58(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edi
movl $0x1, %edx
leaq -0x4c(%rbp), %r8
callq 0x66c0
movq %rax, -0x60(%rbp)
movl 0x11b7b(%rip), %eax     # 0x21a60
cmpl 0x11b85(%rip), %eax     # 0x21a70
jl 0xff1a
movl 0x11b7d(%rip), %eax     # 0x21a70
addl $0x10, %eax
movl %eax, 0x11b74(%rip)     # 0x21a70
movq 0x11b65(%rip), %rdi     # 0x21a68
movslq 0x11b66(%rip), %rsi     # 0x21a70
shlq $0x4, %rsi
callq 0x6c60
movq %rax, 0x11b4e(%rip)     # 0x21a68
movq 0x1198f(%rip), %rdi     # 0x218b0
movq -0x60(%rbp), %rsi
callq 0x67d0
movq %rax, %rcx
movq 0x11b34(%rip), %rax     # 0x21a68
movslq 0x11b25(%rip), %rdx     # 0x21a60
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq 0x11b1c(%rip), %rax     # 0x21a68
movslq 0x11b0d(%rip), %rcx     # 0x21a60
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
jne 0xff7d
callq 0x65d0
movl (%rax), %edi
callq 0x6470
movq %rax, %rsi
leaq 0x7358(%rip), %rdi      # 0x172ce
movb $0x0, %al
callq 0x6bb0
movl -0x3c(%rbp), %ecx
movq 0x11ae1(%rip), %rax     # 0x21a68
movslq 0x11ad2(%rip), %rdx     # 0x21a60
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl -0x44(%rbp), %ecx
movq 0x11ac6(%rip), %rax     # 0x21a68
movslq 0x11ab7(%rip), %rdx     # 0x21a60
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movq 0x118f6(%rip), %rdi     # 0x218b0
movq 0x11aa7(%rip), %rax     # 0x21a68
movslq 0x11a98(%rip), %rcx     # 0x21a60
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movl -0x44(%rbp), %edx
callq 0x6410
movl %eax, -0x48(%rbp)
movl 0x11a7d(%rip), %eax     # 0x21a60
movl %eax, -0x78(%rbp)
movl 0x11a74(%rip), %eax     # 0x21a60
addl $0x1, %eax
movl %eax, 0x11a6b(%rip)     # 0x21a60
movq -0x58(%rbp), %rdi
callq 0x6050
movq -0x70(%rbp), %rdi
callq 0x66f0
movq 0x11a5a(%rip), %rax     # 0x21a68
movslq -0x78(%rbp), %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rdx
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
shlq $0x4, %rcx
movq %rdx, (%rax,%rcx)
movl -0x48(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
shlq $0x4, %rcx
movl %edx, 0x8(%rax,%rcx)
cvttss2si -0x28(%rbp), %eax
movw %ax, %dx
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rcx
shlq $0x4, %rcx
movw %dx, 0xc(%rax,%rcx)
movss -0x2c(%rbp), %xmm0
cvttss2si %xmm0, %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movslq -0x7c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0xe(%rax)
movss -0x40(%rbp), %xmm0
addss -0x28(%rbp), %xmm0
movss %xmm0, -0x28(%rbp)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0xfb2b
movl -0x7c(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)