// File: /workspace/github_c_makefile_star2_O3/odknt[P]st/x.c
// Function: xmakeglyphfontspecs
int
xmakeglyphfontspecs(GlyphFontSpec *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;
	int i, f, numspecs = 0;

	for (i = 0, xp = winx, yp = winy + font->ascent + win.cyo; 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 + win.cyo;
		}

		/* select font */
		glyphidx = FT_Get_Char_Index(font->match.face, rune);
		if (!glyphidx)
			glyphidx = xselectfont(rune, frcflags, &specs[numspecs].font);
		else
			specs[numspecs].font = &font->match;
		if (glyphidx) {
			specs[numspecs].glyph.index = glyphidx;
			specs[numspecs].glyph.x = (short)xp;
			specs[numspecs].glyph.y = (short)yp;
		}

		xp += runewidth;
		numspecs++;
	}

	return numspecs;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, 0x10(%rsp)
testl %edx, %edx
jle 0xd09b
movl 0xbf20(%rip), %eax      # 0x18dfc
imull 0x12a44(%rip), %r8d     # 0x1f928
addl %eax, %r8d
cvtsi2ss %r8d, %xmm1
cvtsi2ssl 0x127dc(%rip), %xmm0 # 0x1f6d0
cvtsi2ssl 0x12a34(%rip), %xmm2 # 0x1f930
movss %xmm1, 0xc(%rsp)
addss %xmm1, %xmm0
addss %xmm0, %xmm2
movaps %xmm2, 0x20(%rsp)
movl 0x12a17(%rip), %edi     # 0x1f92c
xorps %xmm0, %xmm0
cvtsi2ss %edi, %xmm0
movss %xmm0, 0x8(%rsp)
imull %edi, %ecx
addl %eax, %ecx
xorps %xmm1, %xmm1
cvtsi2ss %ecx, %xmm1
movl %edx, %ebx
shlq $0x4, %rbx
movw $0xffff, 0x2(%rsp)      # imm = 0xFFFF
leaq 0x12786(%rip), %r15     # 0x1f6c8
xorl %r13d, %r13d
xorl %r14d, %r14d
movl $0x0, 0x4(%rsp)
movq %rsi, 0x18(%rsp)
movzwl 0x4(%rsi,%r13), %eax
cmpl $0x400, %eax            # imm = 0x400
je 0xd08c
movaps %xmm1, 0x30(%rsp)
cmpw %ax, 0x2(%rsp)
je 0xd00f
xorps %xmm0, %xmm0
cvtsi2ssl 0x129ab(%rip), %xmm0 # 0x1f92c
xorl %ecx, %ecx
btl $0x9, %eax
setae %cl
leaq 0x4ccf(%rip), %rdx      # 0x11c60
mulss (%rdx,%rcx,4), %xmm0
movss %xmm0, 0x8(%rsp)
movl %eax, %ecx
andl $0x1, %ecx
movl %eax, %edx
notl %edx
xorl %edi, %edi
testb $0x5, %dl
sete %dil
leaq 0x127a3(%rip), %rdx     # 0x1f758
leaq 0x127e4(%rip), %r8      # 0x1f7a0
cmoveq %r8, %rdx
testl %ecx, %ecx
leaq 0x12747(%rip), %r15     # 0x1f710
leaq 0x126f8(%rip), %r8      # 0x1f6c8
cmoveq %r8, %r15
addl %ecx, %ecx
testb $0x4, %al
leal 0x1(%rdi,%rdi), %edi
cmovneq %rdx, %r15
cmovel %ecx, %edi
movl %edi, 0x4(%rsp)
xorps %xmm0, %xmm0
cvtsi2ssl 0x8(%r15), %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl 0x12935(%rip), %xmm1 # 0x1f930
addss 0xc(%rsp), %xmm0
addss %xmm0, %xmm1
movaps %xmm1, 0x20(%rsp)
movw %ax, 0x2(%rsp)
movl (%rsi,%r13), %r12d
movq 0x20(%r15), %rdi
movq %r12, %rsi
callq 0x6870
movl %r14d, %ebp
movslq %r14d, %r14
shlq $0x5, %r14
movq 0x10(%rsp), %rcx
leaq (%rcx,%r14), %rdx
testl %eax, %eax
je 0xd044
leaq 0x20(%r15), %rcx
movq %rcx, (%rdx)
movaps 0x30(%rsp), %xmm1
jmp 0xd059
movl %r12d, %edi
movl 0x4(%rsp), %esi
callq 0xc591
testl %eax, %eax
movaps 0x30(%rsp), %xmm1
je 0xd07b
movl %eax, %eax
movq 0x10(%rsp), %rcx
movq %rax, 0x8(%rcx,%r14)
movaps %xmm1, %xmm0
unpcklps 0x20(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
cvttps2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
movups %xmm0, 0x10(%rcx,%r14)
addss 0x8(%rsp), %xmm1
movl %ebp, %r14d
incl %r14d
movq 0x18(%rsp), %rsi
addq $0x10, %r13
cmpq %r13, %rbx
jne 0xcf55
jmp 0xd09e
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq