// File: /workspace/github_c_makefile_star2_O3/Babkock[P]st/x.c
// Function: xdrawglyphfontspecs
void
xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y)
{
	int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
	int winx = borderpx + x * win.cw, winy = borderpx + y * win.ch,
	    width = charlen * win.cw;
	Color *fg, *bg, *temp, revfg, revbg, truefg, truebg;
	XRenderColor colfg, colbg;
	XRectangle r;

	/* Fallback on color display for attributes not supported by the font */
	if (base.mode & ATTR_ITALIC && base.mode & ATTR_BOLD) {
		if (dc.ibfont.badslant || dc.ibfont.badweight)
			base.fg = defaultattr;
	} else if ((base.mode & ATTR_ITALIC && dc.ifont.badslant) ||
	    (base.mode & ATTR_BOLD && dc.bfont.badweight)) {
		base.fg = defaultattr;
	}

	if (IS_TRUECOL(base.fg)) {
		colfg.alpha = 0xffff;
		colfg.red = TRUERED(base.fg);
		colfg.green = TRUEGREEN(base.fg);
		colfg.blue = TRUEBLUE(base.fg);
		XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colfg, &truefg);
		fg = &truefg;
	} else {
		fg = &dc.col[base.fg];
	}

	if (IS_TRUECOL(base.bg)) {
		colbg.alpha = 0xffff;
		colbg.green = TRUEGREEN(base.bg);
		colbg.red = TRUERED(base.bg);
		colbg.blue = TRUEBLUE(base.bg);
		XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colbg, &truebg);
		bg = &truebg;
	} else {
		bg = &dc.col[base.bg];
	}

	/* Change basic system colors [0-7] to bright system colors [8-15] */
	if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7))
		fg = &dc.col[base.fg + 8];

	if (IS_SET(MODE_REVERSE)) {
		if (fg == &dc.col[defaultfg]) {
			fg = &dc.col[defaultbg];
		} else {
			colfg.red = ~fg->color.red;
			colfg.green = ~fg->color.green;
			colfg.blue = ~fg->color.blue;
			colfg.alpha = fg->color.alpha;
			XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colfg,
					&revfg);
			fg = &revfg;
		}

		if (bg == &dc.col[defaultbg]) {
			bg = &dc.col[defaultfg];
		} else {
			colbg.red = ~bg->color.red;
			colbg.green = ~bg->color.green;
			colbg.blue = ~bg->color.blue;
			colbg.alpha = bg->color.alpha;
			XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colbg,
					&revbg);
			bg = &revbg;
		}
	}

	if ((base.mode & ATTR_BOLD_FAINT) == ATTR_FAINT) {
		colfg.red = fg->color.red / 2;
		colfg.green = fg->color.green / 2;
		colfg.blue = fg->color.blue / 2;
		colfg.alpha = fg->color.alpha;
		XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colfg, &revfg);
		fg = &revfg;
	}

	if (base.mode & ATTR_REVERSE) {
		temp = fg;
		fg = bg;
		bg = temp;
	}

	if (base.mode & ATTR_SELECTED) {
		bg = &dc.col[selectionbg];
		if (!ignoreselfg)
			fg = &dc.col[selectionfg];
	}

	if (base.mode & ATTR_BLINK && win.mode & MODE_BLINK)
		fg = bg;

	if (base.mode & ATTR_INVISIBLE)
		fg = bg;

	// gradient
	bg->color.alpha = grad_alpha * 0xffff * (win.h - y*win.ch) / win.h + stat_alpha * 0xffff;
	// uncomment to invert the gradient
	// bg->color.alpha = grad_alpha * 0xffff * (y*win.ch) / win.h + stat_alpha * 0xffff;

	/* Intelligent cleaning up of the borders. */
	if (x == 0) {
		xclear(0, (y == 0)? 0 : winy, borderpx,
			winy + win.ch +
			((winy + win.ch >= borderpx + win.th)? win.h : 0));
	}
	if (winx + width >= borderpx + win.tw) {
		xclear(winx + width, (y == 0)? 0 : winy, win.w,
			((winy + win.ch >= borderpx + win.th)? win.h : (winy + win.ch)));
	}
	if (y == 0)
		xclear(winx, 0, winx + width, borderpx);
	if (winy + win.ch >= borderpx + win.th)
		xclear(winx, winy + win.ch, winx + width, win.h);

	/* Clean up the region we want to draw to. */
	XftDrawRect(xw.draw, bg, winx, winy, width, win.ch);

	/* Set the clip region because Xft is sometimes dirty. */
	r.x = 0;
	r.y = 0;
	r.height = win.ch;
	r.width = width;
	XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1);

	if (base.mode & ATTR_BOXDRAW) {
		drawboxes(winx, winy, width / len, win.ch, fg, bg, specs, len);
	} else {
		/* Render the glyphs. */
		XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
	}

	/* Render underline and strikethrough. */
	if (base.mode & ATTR_UNDERLINE) {
		XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent * chscale + 1,
				width, 1);
	}

	if (base.mode & ATTR_STRUCK) {
		XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent * chscale / 3,
				width, 1);
	}

	/* Reset clip to none. */
	XftDrawSetClip(xw.draw, 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r9d, (%rsp)
movl %r8d, 0x4(%rsp)
movl %ecx, %eax
movq %rdx, %rbp
movq %rsi, %rcx
movq %rdi, 0x10(%rsp)
movq %rsi, %r15
shrq $0x20, %r15
shrq $0x29, %rcx
andb $0x1, %cl
movq %rax, 0x18(%rsp)
shll %cl, %eax
movl %eax, 0xc(%rsp)
movl %ebp, %ebx
movl 0xc109(%rip), %eax      # 0x18dc0
movl %eax, 0x8(%rsp)
movl 0x12bca(%rip), %r14d    # 0x1f88c
movl 0x12bc0(%rip), %ecx     # 0x1f888
imull %r9d, %ecx
movl %r15d, %eax
notl %eax
testb $0x5, %al
movq %rcx, 0x20(%rsp)
jne 0xccfa
movl 0x12a5c(%rip), %eax     # 0x1f73c
orl 0x12a52(%rip), %eax     # 0x1f738
movl $0xb, %eax
cmovel %ebx, %eax
movl %eax, %ebx
btl $0x18, %ebx
jb 0xcd2f
movl %ebx, %eax
jmp 0xcd1d
movl $0xb, %eax
testb $0x4, %r15b
je 0xcd0e
cmpl $0x0, 0x129f4(%rip)     # 0x1f700
jne 0xcd1d
testb $0x1, %r15b
je 0xccf0
cmpl $0x0, 0x129b1(%rip)     # 0x1f6cc
je 0xccf0
movl %eax, %r12d
shlq $0x4, %r12
addq 0x12945(%rip), %r12     # 0x1f670
movl %eax, %ebx
jmp 0xcd7a
leaq 0x30(%rsp), %rcx
movw $0xffff, 0x6(%rcx)      # imm = 0xFFFF
movl %ebx, %eax
shrl $0x8, %eax
movl $0xff00, %edx           # imm = 0xFF00
andl %edx, %eax
movw %ax, (%rcx)
andl %ebx, %edx
movw %dx, 0x2(%rcx)
movl %ebx, %eax
shll $0x8, %eax
movw %ax, 0x4(%rcx)
movq 0x12a09(%rip), %rdi     # 0x1f768
movq 0x12a7a(%rip), %rsi     # 0x1f7e0
movq 0x12a03(%rip), %rdx     # 0x1f770
leaq 0x68(%rsp), %r12
movq %r12, %r8
callq 0x6760
movq %rbp, %r13
shrq $0x20, %r13
btq $0x38, %rbp
movq %r14, 0x28(%rsp)
jb 0xcd9d
movq 0x128dc(%rip), %rax     # 0x1f670
shlq $0x4, %r13
addq %rax, %r13
jmp 0xcdf1
leaq 0x38(%rsp), %rcx
movw $0xffff, 0x6(%rcx)      # imm = 0xFFFF
movl $0xff00, %eax           # imm = 0xFF00
movl %r13d, %edx
andl %eax, %edx
movw %dx, 0x2(%rcx)
shrq $0x28, %rbp
andl %eax, %ebp
movw %bp, (%rcx)
shll $0x8, %r13d
movw %r13w, 0x4(%rcx)
movq 0x12999(%rip), %rdi     # 0x1f768
movq 0x12a0a(%rip), %rsi     # 0x1f7e0
movq 0x12993(%rip), %rdx     # 0x1f770
leaq 0x58(%rsp), %r13
movq %r13, %r8
callq 0x6760
movq 0x1287f(%rip), %rax     # 0x1f670
movl %r15d, %r14d
andl $0x3, %r14d
cmpl $0x1, %r14d
sete %dl
cmpl $0x8, %ebx
setb %cl
andb %dl, %cl
orl $0x8, %ebx
shlq $0x4, %rbx
addq %rax, %rbx
testb %cl, %cl
movq %r12, %rbp
cmovneq %rbx, %rbp
testb $0x20, 0x12a6f(%rip)    # 0x1f890
jne 0xce2d
movq 0x20(%rsp), %r12
jmp 0xcf1b
movl 0xb725(%rip), %edx      # 0x18558
shlq $0x4, %rdx
addq %rax, %rdx
cmpq %rdx, %rbp
je 0xcea6
testb %cl, %cl
cmovneq %rbx, %r12
movl 0x8(%r12), %eax
notl %eax
leaq 0x30(%rsp), %rcx
movw %ax, (%rcx)
movzwl 0xa(%r12), %eax
notl %eax
movw %ax, 0x2(%rcx)
movl 0xc(%r12), %eax
notl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%r12), %eax
movw %ax, 0x6(%rcx)
movq 0x128ec(%rip), %rdi     # 0x1f768
movq 0x1295d(%rip), %rsi     # 0x1f7e0
movq 0x128e6(%rip), %rdx     # 0x1f770
leaq 0x40(%rsp), %rbp
movq %rbp, %r8
callq 0x6760
movq 0x127d2(%rip), %rax     # 0x1f670
movl 0xb6b8(%rip), %ecx      # 0x1855c
jmp 0xceb6
movl 0xb6b0(%rip), %ecx      # 0x1855c
movq %rcx, %rbp
shlq $0x4, %rbp
addq %rax, %rbp
shlq $0x4, %rcx
addq %rax, %rcx
cmpq %rcx, %r13
movq 0x20(%rsp), %r12
je 0xcf0b
movl 0x8(%r13), %eax
notl %eax
leaq 0x38(%rsp), %rcx
movl %eax, (%rcx)
movl 0xc(%r13), %eax
notl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%r13), %eax
movw %ax, 0x6(%rcx)
movq 0x1287a(%rip), %rdi     # 0x1f768
movq 0x128eb(%rip), %rsi     # 0x1f7e0
movq 0x12874(%rip), %rdx     # 0x1f770
leaq 0x78(%rsp), %r13
movq %r13, %r8
callq 0x6760
jmp 0xcf1b
movl 0xb647(%rip), %ecx      # 0x18558
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, %r13
cmpl $0x2, %r14d
jne 0xcf68
movq 0x8(%rbp), %xmm0
psrlw $0x1, %xmm0
leaq 0x30(%rsp), %rcx
movd %xmm0, (%rcx)
movzwl 0xc(%rbp), %eax
shrl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%rbp), %eax
movw %ax, 0x6(%rcx)
movq 0x1281b(%rip), %rdi     # 0x1f768
movq 0x1288c(%rip), %rsi     # 0x1f7e0
movq 0x12815(%rip), %rdx     # 0x1f770
leaq 0x40(%rsp), %rbp
movq %rbp, %r8
callq 0x6760
movq 0x28(%rsp), %r14
movl (%rsp), %esi
movl 0x4(%rsp), %edi
movl %r14d, %ebx
imull %edi, %ebx
testb $0x20, %r15b
movq %r13, %rax
cmoveq %rbp, %rax
cmoveq %r13, %rbp
btl $0xc, %r15d
jae 0xcfb1
movq 0x126d9(%rip), %rcx     # 0x1f670
movl 0xb5c7(%rip), %ebp      # 0x18564
shlq $0x4, %rbp
addq %rcx, %rbp
movl 0xb5be(%rip), %eax      # 0x18568
shlq $0x4, %rax
addq %rcx, %rax
movl 0x8(%rsp), %ecx
addl %ecx, %ebx
addl %ecx, %r12d
imull 0xc(%rsp), %r14d
movl 0x128ca(%rip), %edx     # 0x1f890
btl $0xb, %edx
movq %rbp, %r13
cmovaeq %rax, %r13
testb $0x10, %r15b
cmoveq %rax, %r13
testb $0x40, %r15b
cmovneq %rbp, %r13
movss 0x4bb3(%rip), %xmm0     # 0x11b9c
movl 0x12894(%rip), %r8d     # 0x1f884
movl 0x12891(%rip), %r9d     # 0x1f888
movl %r9d, %eax
imull %esi, %eax
movl %r8d, %ecx
subl %eax, %ecx
cvtsi2ss %ecx, %xmm1
movss 0xb542(%rip), %xmm2     # 0x18550
cvtsi2ss %r8d, %xmm3
mulss %xmm0, %xmm2
mulss %xmm2, %xmm1
mulss 0xb531(%rip), %xmm0     # 0x18554
divss %xmm3, %xmm1
addss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movw %ax, 0xe(%rbp)
movl 0xbd87(%rip), %eax      # 0x18dc0
testl %edi, %edi
jne 0xd09b
testl %esi, %esi
movl %r12d, %ecx
cmovel %esi, %ecx
addl %r12d, %r9d
movl 0x1282e(%rip), %esi     # 0x1f87c
addl %eax, %esi
xorl %edi, %edi
cmpl %esi, %r9d
cmovll %edi, %r8d
movq 0x12778(%rip), %rdi     # 0x1f7d8
testb $0x20, %dl
leaq 0xb4ee(%rip), %rdx      # 0x18558
leaq 0xb4eb(%rip), %rsi      # 0x1855c
cmovneq %rdx, %rsi
movl (%rsi), %esi
shlq $0x4, %rsi
addq 0x125ee(%rip), %rsi     # 0x1f670
subl %ecx, %r9d
addl %r8d, %r9d
xorl %edx, %edx
movl %eax, %r8d
callq 0x6430
movl (%rsp), %esi
movl 0xbd25(%rip), %eax      # 0x18dc0
leal (%rbx,%r14), %edx
movl 0x127d3(%rip), %ecx     # 0x1f878
addl %eax, %ecx
cmpl %ecx, %edx
jl 0xd117
testl %esi, %esi
movl %r12d, %ecx
cmovel %esi, %ecx
movl 0x127c6(%rip), %r8d     # 0x1f880
movl 0x127c7(%rip), %r9d     # 0x1f888
addl %r12d, %r9d
addl 0x127b2(%rip), %eax     # 0x1f87c
cmpl %eax, %r9d
jl 0xd0d6
movl 0x127ae(%rip), %r9d     # 0x1f884
movq 0x126fb(%rip), %rdi     # 0x1f7d8
testb $0x20, 0x127ac(%rip)    # 0x1f890
leaq 0xb46d(%rip), %rax      # 0x18558
leaq 0xb46a(%rip), %rsi      # 0x1855c
cmovneq %rax, %rsi
movl (%rsi), %esi
shlq $0x4, %rsi
addq 0x1256d(%rip), %rsi     # 0x1f670
subl %edx, %r8d
subl %ecx, %r9d
callq 0x6430
movl 0xbcac(%rip), %eax      # 0x18dc0
movl (%rsp), %esi
testl %esi, %esi
jne 0xd15d
movq 0x126b6(%rip), %rdi     # 0x1f7d8
testb $0x20, 0x12767(%rip)    # 0x1f890
leaq 0xb428(%rip), %rcx      # 0x18558
leaq 0xb425(%rip), %rdx      # 0x1855c
cmovneq %rcx, %rdx
movl (%rdx), %esi
shlq $0x4, %rsi
addq 0x12528(%rip), %rsi     # 0x1f670
movl %ebx, %edx
xorl %ecx, %ecx
movl %r14d, %r8d
movl %eax, %r9d
callq 0x6430
movl 0xbc63(%rip), %eax      # 0x18dc0
movl 0x12724(%rip), %r9d     # 0x1f888
leal (%r9,%r12), %ecx
addl 0x1270e(%rip), %eax     # 0x1f87c
cmpl %eax, %ecx
jl 0xd1ba
movl 0x1270b(%rip), %r9d     # 0x1f884
movq 0x12658(%rip), %rdi     # 0x1f7d8
testb $0x20, 0x12709(%rip)    # 0x1f890
leaq 0xb3ca(%rip), %rax      # 0x18558
leaq 0xb3c7(%rip), %rdx      # 0x1855c
cmovneq %rax, %rdx
movl (%rdx), %esi
shlq $0x4, %rsi
addq 0x124ca(%rip), %rsi     # 0x1f670
subl %ecx, %r9d
movl %ebx, %edx
movl %r14d, %r8d
callq 0x6430
movl 0x126ce(%rip), %r9d     # 0x1f888
movq 0x12617(%rip), %rdi     # 0x1f7d8
movq %rbp, %rsi
movl %ebx, %edx
movl %r12d, %ecx
movl %r14d, %r8d
callq 0x6430
leaq 0x50(%rsp), %rcx
movl $0x0, (%rcx)
movzwl 0x126a5(%rip), %eax     # 0x1f888
movw %ax, 0x6(%rcx)
movw %r14w, 0x4(%rcx)
movq 0x125e5(%rip), %rdi     # 0x1f7d8
movl %ebx, %esi
movl %r12d, %edx
movl $0x1, %r8d
callq 0x6690
btl $0xb, %r15d
jb 0xd225
movq 0x125c7(%rip), %rdi     # 0x1f7d8
movq %r13, %rsi
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
callq 0x63e0
jmp 0xd253
movl %r14d, %eax
cltd
movq 0x18(%rsp), %r10
idivl %r10d
movl 0x12651(%rip), %ecx     # 0x1f888
movl %ebx, %edi
movl %r12d, %esi
movl %eax, %edx
movq %r13, %r8
movq %rbp, %r9
pushq %r10
pushq 0x18(%rsp)
callq 0xfc7b
addq $0x10, %rsp
testb $0x8, %r15b
je 0xd29e
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl 0x1241c(%rip), %xmm1 # 0x1f688
movq 0x12565(%rip), %rdi     # 0x1f7d8
mulss 0xbb4d(%rip), %xmm1     # 0x18dc8
addss %xmm0, %xmm1
addss 0x491d(%rip), %xmm1     # 0x11ba4
cvttss2si %xmm1, %ecx
movq %r13, %rsi
movl %ebx, %edx
movl %r14d, %r8d
movl $0x1, %r9d
callq 0x6430
testb %r15b, %r15b
jns 0xd2ec
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
movl 0x123d7(%rip), %eax     # 0x1f688
addl %eax, %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
mulss 0xbb06(%rip), %xmm1     # 0x18dc8
divss 0x48de(%rip), %xmm1     # 0x11ba8
movq 0x12507(%rip), %rdi     # 0x1f7d8
addss %xmm0, %xmm1
cvttss2si %xmm1, %ecx
movq %r13, %rsi
movl %ebx, %edx
movl %r14d, %r8d
movl $0x1, %r9d
callq 0x6430
movq 0x124e5(%rip), %rdi     # 0x1f7d8
xorl %esi, %esi
callq 0x6650
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq