// File: /workspace/github_c_makefile_star2_O1/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 %ecx, %eax
movq %rdx, %r12
movq %rsi, %rcx
movq %rdi, 0x18(%rsp)
movq %rsi, %r14
shrq $0x20, %r14
shrq $0x29, %rcx
andb $0x1, %cl
movq %rax, 0x20(%rsp)
shll %cl, %eax
movl %eax, 0x14(%rsp)
movl %r12d, %ebx
movl %r14d, %eax
notl %eax
testb $0x5, %al
jne 0xc652
movl 0x120fc(%rip), %eax     # 0x1e73c
orl 0x120f2(%rip), %eax     # 0x1e738
movl $0xb, %eax
cmovel %ebx, %eax
movl %eax, %ebx
jmp 0xc675
testb $0x4, %r14b
je 0xc661
cmpl $0x0, 0x120a1(%rip)     # 0x1e700
jne 0xc670
testb $0x1, %r14b
je 0xc675
cmpl $0x0, 0x1205e(%rip)     # 0x1e6cc
je 0xc675
movl $0xb, %ebx
movl 0x12211(%rip), %eax     # 0x1e88c
movq %rax, 0x28(%rsp)
movl 0xb73a(%rip), %eax      # 0x17dc0
movl %eax, 0x10(%rsp)
movl 0x121f8(%rip), %ebp     # 0x1e888
imull %r9d, %ebp
btl $0x18, %ebx
movl %r9d, 0x4(%rsp)
movl %r8d, 0x8(%rsp)
jb 0xc6b4
movl %ebx, %r15d
shlq $0x4, %r15
addq 0x11fbe(%rip), %r15     # 0x1e670
jmp 0xc6ff
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 0x12084(%rip), %rdi     # 0x1e768
movq 0x120f5(%rip), %rsi     # 0x1e7e0
movq 0x1207e(%rip), %rdx     # 0x1e770
leaq 0x68(%rsp), %r15
movq %r15, %r8
callq 0x6770
movq %r12, %r13
shrq $0x20, %r13
btq $0x38, %r12
movl %ebp, 0xc(%rsp)
jb 0xc71e
shlq $0x4, %r13
addq 0x11f54(%rip), %r13     # 0x1e670
jmp 0xc76d
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, %r12
andl %eax, %r12d
movw %r12w, (%rcx)
shll $0x8, %r13d
movw %r13w, 0x4(%rcx)
movq 0x12016(%rip), %rdi     # 0x1e768
movq 0x12087(%rip), %rsi     # 0x1e7e0
movq 0x12010(%rip), %rdx     # 0x1e770
leaq 0x58(%rsp), %r13
movq %r13, %r8
callq 0x6770
movl %r14d, %ebp
andl $0x3, %ebp
cmpl $0x1, %ebp
sete %al
cmpl $0x8, %ebx
setb %cl
andb %al, %cl
movq 0x11ee8(%rip), %rax     # 0x1e670
orl $0x8, %ebx
shlq $0x4, %rbx
addq %rax, %rbx
testb %cl, %cl
movq %r15, %r12
cmovneq %rbx, %r12
testb $0x20, 0x120ee(%rip)    # 0x1e890
jne 0xc7ae
movq 0x28(%rsp), %r15
jmp 0xc8a4
movl 0xada4(%rip), %edx      # 0x17558
shlq $0x4, %rdx
addq %rax, %rdx
cmpq %rdx, %r12
je 0xc816
testb %cl, %cl
cmovneq %rbx, %r15
movl 0x8(%r15), %eax
notl %eax
leaq 0x30(%rsp), %rcx
movw %ax, (%rcx)
movzwl 0xa(%r15), %eax
notl %eax
movw %ax, 0x2(%rcx)
movl 0xc(%r15), %eax
notl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%r15), %eax
movw %ax, 0x6(%rcx)
movq 0x11f6f(%rip), %rdi     # 0x1e768
movq 0x11fe0(%rip), %rsi     # 0x1e7e0
movq 0x11f69(%rip), %rdx     # 0x1e770
leaq 0x40(%rsp), %r12
movq %r12, %r8
callq 0x6770
jmp 0xc826
movl 0xad40(%rip), %ecx      # 0x1755c
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, %r12
movq 0x11e43(%rip), %rax     # 0x1e670
movl 0xad29(%rip), %ecx      # 0x1755c
shlq $0x4, %rcx
addq %rax, %rcx
cmpq %rcx, %r13
movq 0x28(%rsp), %r15
je 0xc894
movl 0x8(%r13), %eax
notl %eax
leaq 0x38(%rsp), %rcx
movw %ax, (%rcx)
movzwl 0xa(%r13), %eax
notl %eax
movw %ax, 0x2(%rcx)
movl 0xc(%r13), %eax
notl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%r13), %eax
movw %ax, 0x6(%rcx)
movq 0x11ef1(%rip), %rdi     # 0x1e768
movq 0x11f62(%rip), %rsi     # 0x1e7e0
movq 0x11eeb(%rip), %rdx     # 0x1e770
leaq 0x78(%rsp), %r13
movq %r13, %r8
callq 0x6770
jmp 0xc8a4
movl 0xacbe(%rip), %ecx      # 0x17558
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, %r13
cmpl $0x2, %ebp
jne 0xc8fd
movzwl 0x8(%r12), %eax
shrl %eax
leaq 0x30(%rsp), %rcx
movw %ax, (%rcx)
movzwl 0xa(%r12), %eax
shrl %eax
movw %ax, 0x2(%rcx)
movzwl 0xc(%r12), %eax
shrl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%r12), %eax
movw %ax, 0x6(%rcx)
movq 0x11e86(%rip), %rdi     # 0x1e768
movq 0x11ef7(%rip), %rsi     # 0x1e7e0
movq 0x11e80(%rip), %rdx     # 0x1e770
leaq 0x40(%rsp), %r12
movq %r12, %r8
callq 0x6770
movl 0xc(%rsp), %ebp
movl 0x4(%rsp), %edi
movl 0x8(%rsp), %r8d
movl %r15d, %ebx
imull %r8d, %ebx
testb $0x20, %r14b
movq %r13, %rcx
cmoveq %r12, %rcx
cmoveq %r13, %r12
btl $0xc, %r14d
jae 0xc949
movq 0x11d42(%rip), %rax     # 0x1e670
movl 0xac2f(%rip), %r12d     # 0x17564
shlq $0x4, %r12
addq %rax, %r12
movl 0xac26(%rip), %ecx      # 0x17568
shlq $0x4, %rcx
addq %rax, %rcx
movl 0x10(%rsp), %eax
addl %eax, %ebx
addl %eax, %ebp
imull 0x14(%rsp), %r15d
movl 0x11f33(%rip), %eax     # 0x1e890
btl $0xb, %eax
movq %r12, %r13
cmovaeq %rcx, %r13
testb $0x10, %r14b
cmoveq %rcx, %r13
testb $0x40, %r14b
cmovneq %r12, %r13
movss 0x41f0(%rip), %xmm0     # 0x10b70
movss 0xabc8(%rip), %xmm1     # 0x17550
mulss %xmm0, %xmm1
movl 0x11ef2(%rip), %edx     # 0x1e884
movl 0x11eef(%rip), %r9d     # 0x1e888
movl %r9d, %ecx
imull %edi, %ecx
movl %edx, %esi
subl %ecx, %esi
cvtsi2ss %esi, %xmm2
mulss %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
divss %xmm1, %xmm2
mulss 0xab96(%rip), %xmm0     # 0x17554
addss %xmm2, %xmm0
cvttss2si %xmm0, %ecx
movw %cx, 0xe(%r12)
testl %r8d, %r8d
jne 0xca2c
testl %edi, %edi
movl %ebp, %ecx
cmovel %edi, %ecx
movl 0xb3e1(%rip), %r8d      # 0x17dc0
addl %ebp, %r9d
movl 0x11e94(%rip), %esi     # 0x1e87c
addl %r8d, %esi
xorl %edi, %edi
cmpl %esi, %r9d
cmovll %edi, %edx
movq 0x11dde(%rip), %rdi     # 0x1e7d8
testb $0x20, %al
leaq 0xab55(%rip), %rax      # 0x17558
leaq 0xab52(%rip), %rsi      # 0x1755c
cmovneq %rax, %rsi
movl (%rsi), %esi
shlq $0x4, %rsi
addq 0x11c55(%rip), %rsi     # 0x1e670
subl %ecx, %r9d
addl %edx, %r9d
xorl %edx, %edx
callq 0x6430
movl 0x4(%rsp), %edi
leal (%rbx,%r15), %edx
movl 0xb38a(%rip), %eax      # 0x17dc0
movl 0x11e3c(%rip), %ecx     # 0x1e878
addl %eax, %ecx
cmpl %ecx, %edx
jl 0xcaa8
testl %edi, %edi
movl %ebp, %ecx
cmovel %edi, %ecx
movl 0x11e30(%rip), %r8d     # 0x1e880
movl 0x11e31(%rip), %r9d     # 0x1e888
addl %ebp, %r9d
addl 0x11e1c(%rip), %eax     # 0x1e87c
cmpl %eax, %r9d
jl 0xca6c
movl 0x11e18(%rip), %r9d     # 0x1e884
movq 0x11d65(%rip), %rdi     # 0x1e7d8
testb $0x20, 0x11e16(%rip)    # 0x1e890
leaq 0xaad7(%rip), %rax      # 0x17558
leaq 0xaad4(%rip), %rsi      # 0x1755c
cmovneq %rax, %rsi
movl (%rsi), %esi
shlq $0x4, %rsi
addq 0x11bd7(%rip), %rsi     # 0x1e670
subl %edx, %r8d
subl %ecx, %r9d
callq 0x6430
movl 0x4(%rsp), %edi
testl %edi, %edi
jne 0xcaec
movl 0xb30d(%rip), %r9d      # 0x17dc0
movq 0x11d1e(%rip), %rdi     # 0x1e7d8
testb $0x20, 0x11dcf(%rip)    # 0x1e890
leaq 0xaa90(%rip), %rax      # 0x17558
leaq 0xaa8d(%rip), %rcx      # 0x1755c
cmovneq %rax, %rcx
movl (%rcx), %esi
shlq $0x4, %rsi
addq 0x11b90(%rip), %rsi     # 0x1e670
movl %ebx, %edx
xorl %ecx, %ecx
movl %r15d, %r8d
callq 0x6430
movl 0x11d96(%rip), %ecx     # 0x1e888
addl %ebp, %ecx
movl 0x11d82(%rip), %eax     # 0x1e87c
addl 0xb2c0(%rip), %eax      # 0x17dc0
cmpl %eax, %ecx
jl 0xcb45
movl 0x11d79(%rip), %r9d     # 0x1e884
movq 0x11cc6(%rip), %rdi     # 0x1e7d8
testb $0x20, 0x11d77(%rip)    # 0x1e890
leaq 0xaa38(%rip), %rax      # 0x17558
leaq 0xaa35(%rip), %rdx      # 0x1755c
cmovneq %rax, %rdx
movl (%rdx), %esi
shlq $0x4, %rsi
addq 0x11b38(%rip), %rsi     # 0x1e670
subl %ecx, %r9d
movl %ebx, %edx
movl %r15d, %r8d
callq 0x6430
movq 0x11c8c(%rip), %rdi     # 0x1e7d8
movl 0x11d35(%rip), %r9d     # 0x1e888
movq %r12, %rsi
movl %ebx, %edx
movl %ebp, %ecx
movl %r15d, %r8d
callq 0x6430
leaq 0x50(%rsp), %rcx
movl $0x0, (%rcx)
movzwl 0x11d14(%rip), %eax     # 0x1e888
movw %ax, 0x6(%rcx)
movw %r15w, 0x4(%rcx)
movq 0x11c54(%rip), %rdi     # 0x1e7d8
movl %ebx, %esi
movl %ebp, %edx
movl $0x1, %r8d
callq 0x6690
btl $0xb, %r14d
jb 0xcbb5
movq 0x11c37(%rip), %rdi     # 0x1e7d8
movq %r13, %rsi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x63e0
jmp 0xcbe2
movl %r15d, %eax
cltd
movq 0x20(%rsp), %r10
idivl %r10d
movl 0x11cc1(%rip), %ecx     # 0x1e888
movl %ebx, %edi
movl %ebp, %esi
movl %eax, %edx
movq %r13, %r8
movq %r12, %r9
pushq %r10
pushq 0x20(%rsp)
callq 0xf5e9
addq $0x10, %rsp
testb $0x8, %r14b
je 0xcc2c
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl 0x11a8e(%rip), %xmm1 # 0x1e688
movq 0x11bd7(%rip), %rdi     # 0x1e7d8
mulss 0xb1bf(%rip), %xmm1     # 0x17dc8
addss %xmm0, %xmm1
addss 0x3f63(%rip), %xmm1     # 0x10b78
cvttss2si %xmm1, %ecx
movq %r13, %rsi
movl %ebx, %edx
movl %r15d, %r8d
movl $0x1, %r9d
callq 0x6430
testb %r14b, %r14b
jns 0xcc79
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
movl 0x11a4a(%rip), %eax     # 0x1e688
addl %eax, %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
mulss 0xb179(%rip), %xmm1     # 0x17dc8
divss 0x3f25(%rip), %xmm1     # 0x10b7c
movq 0x11b7a(%rip), %rdi     # 0x1e7d8
addss %xmm0, %xmm1
cvttss2si %xmm1, %ecx
movq %r13, %rsi
movl %ebx, %edx
movl %r15d, %r8d
movl $0x1, %r9d
callq 0x6430
movq 0x11b58(%rip), %rdi     # 0x1e7d8
xorl %esi, %esi
callq 0x6650
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq