// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %rdi, 0x18(%rsp)
testl %edx, %edx
jle 0xca73
movl 0xb571(%rip), %eax      # 0x17e0c
imull 0x12095(%rip), %r8d     # 0x1e938
addl %eax, %r8d
cvtsi2ss %r8d, %xmm1
cvtsi2ssl 0x11e2d(%rip), %xmm0 # 0x1e6e0
cvtsi2ssl 0x12085(%rip), %xmm2 # 0x1e940
movss %xmm1, 0x10(%rsp)
addss %xmm1, %xmm0
addss %xmm0, %xmm2
movss %xmm2, 0x8(%rsp)
movl 0x12067(%rip), %edi     # 0x1e93c
xorps %xmm0, %xmm0
cvtsi2ss %edi, %xmm0
movss %xmm0, 0xc(%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 0x11dd6(%rip), %r15     # 0x1e6d8
xorl %r13d, %r13d
xorl %r14d, %r14d
movl $0x0, 0x4(%rsp)
movq %rbx, 0x20(%rsp)
movzwl 0x4(%rsi,%r13), %eax
cmpl $0x400, %eax            # imm = 0x400
je 0xca64
movss %xmm1, 0x14(%rsp)
cmpw %ax, 0x2(%rsp)
je 0xc9d1
xorps %xmm0, %xmm0
cvtsi2ssl 0x11ffa(%rip), %xmm0 # 0x1e93c
xorl %ecx, %ecx
btl $0x9, %eax
setae %cl
leaq 0x42ee(%rip), %rdx      # 0x10c40
mulss (%rdx,%rcx,4), %xmm0
movss %xmm0, 0xc(%rsp)
movl %eax, %ecx
andl $0x1, %ecx
movl %eax, %edx
notl %edx
xorl %edi, %edi
testb $0x5, %dl
sete %dil
leaq 0x11df2(%rip), %rdx     # 0x1e768
leaq 0x11e33(%rip), %r8      # 0x1e7b0
cmoveq %r8, %rdx
testl %ecx, %ecx
leaq 0x11d96(%rip), %r15     # 0x1e720
leaq 0x11d47(%rip), %r8      # 0x1e6d8
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 0x11f84(%rip), %xmm1 # 0x1e940
addss 0x10(%rsp), %xmm0
addss %xmm0, %xmm1
movss %xmm1, 0x8(%rsp)
movw %ax, 0x2(%rsp)
movq %rsi, %rbp
movl (%rsi,%r13), %r12d
movq 0x20(%r15), %rdi
movq %r12, %rsi
callq 0x6890
movl %r14d, %ebx
movslq %r14d, %r14
shlq $0x5, %r14
movq 0x18(%rsp), %rcx
leaq (%rcx,%r14), %rdx
testl %eax, %eax
je 0xca04
leaq 0x20(%r15), %rcx
movq %rcx, (%rdx)
jmp 0xca10
movl %r12d, %edi
movl 0x4(%rsp), %esi
callq 0xbf39
testl %eax, %eax
movss 0x14(%rsp), %xmm1
movq %rbp, %rsi
je 0xca53
cvttss2si %xmm1, %ecx
movswl %cx, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movl %eax, %eax
movq 0x18(%rsp), %rcx
movq %rax, 0x8(%rcx,%r14)
movsd %xmm0, 0x10(%rcx,%r14)
cvttss2si 0x8(%rsp), %eax
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x18(%rcx,%r14)
addss 0xc(%rsp), %xmm1
movl %ebx, %r14d
incl %r14d
movq 0x20(%rsp), %rbx
addq $0x10, %r13
cmpq %r13, %rbx
jne 0xc915
jmp 0xca76
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq