// File: /workspace/github_c_makefile_star2_O2/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, %r12
movq %rsi, %rcx
movq %rdi, 0x18(%rsp)
movq %rsi, %r15
shrq $0x20, %r15
shrq $0x29, %rcx
andb $0x1, %cl
movq %rax, 0x20(%rsp)
shll %cl, %eax
movl %eax, 0x14(%rsp)
movl %r12d, %ebx
movl 0xc0b9(%rip), %eax      # 0x17dc0
movl %eax, 0x10(%rsp)
movl 0x12b7a(%rip), %r14d    # 0x1e88c
movl 0x12b70(%rip), %ecx     # 0x1e888
imull %r9d, %ecx
movl %r15d, %eax
notl %eax
testb $0x5, %al
movq %rcx, 0x28(%rsp)
jne 0xbd48
movl 0x12a0c(%rip), %eax     # 0x1e73c
orl 0x12a02(%rip), %eax     # 0x1e738
pushq $0xb
popq %rax
cmovel %ebx, %eax
movl %eax, %ebx
btl $0x18, %ebx
jb 0xbd7a
movl %ebx, %eax
jmp 0xbd69
pushq $0xb
popq %rax
testb $0x4, %r15b
je 0xbd5a
cmpl $0x0, 0x129a8(%rip)     # 0x1e700
jne 0xbd69
testb $0x1, %r15b
je 0xbd3e
cmpl $0x0, 0x12965(%rip)     # 0x1e6cc
je 0xbd3e
movl %eax, %ebp
shlq $0x4, %rbp
addq 0x128fa(%rip), %rbp     # 0x1e670
movl %eax, %ebx
jmp 0xbdc4
leaq 0x30(%rsp), %rcx
orw $-0x1, 0x6(%rcx)
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 0x129bf(%rip), %rdi     # 0x1e768
movq 0x12a30(%rip), %rsi     # 0x1e7e0
movq 0x129b9(%rip), %rdx     # 0x1e770
leaq 0x68(%rsp), %rbp
movq %rbp, %r8
callq 0x6760
movq %r12, %r13
shrq $0x20, %r13
btq $0x38, %r12
movq %r14, 0x8(%rsp)
jb 0xbde7
movq 0x12892(%rip), %rax     # 0x1e670
shlq $0x4, %r13
addq %rax, %r13
jmp 0xbe3c
leaq 0x38(%rsp), %rcx
orw $-0x1, 0x6(%rcx)
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 0x1294e(%rip), %rdi     # 0x1e768
movq 0x129bf(%rip), %rsi     # 0x1e7e0
movq 0x12948(%rip), %rdx     # 0x1e770
leaq 0x58(%rsp), %r13
movq %r13, %r8
callq 0x6760
movq 0x12834(%rip), %rax     # 0x1e670
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 %rbp, %r12
cmovneq %rbx, %r12
testb $0x20, 0x12a24(%rip)    # 0x1e890
jne 0xbe78
movq 0x28(%rsp), %rbp
jmp 0xbf5e
movl 0xb6da(%rip), %edx      # 0x17558
shlq $0x4, %rdx
addq %rax, %rdx
cmpq %rdx, %r12
je 0xbee9
testb %cl, %cl
cmovneq %rbx, %rbp
movl 0x8(%rbp), %eax
notl %eax
leaq 0x30(%rsp), %rcx
movw %ax, (%rcx)
movzwl 0xa(%rbp), %eax
notl %eax
movw %ax, 0x2(%rcx)
movl 0xc(%rbp), %eax
notl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%rbp), %eax
movw %ax, 0x6(%rcx)
movq 0x128a9(%rip), %rdi     # 0x1e768
movq 0x1291a(%rip), %rsi     # 0x1e7e0
movq 0x128a3(%rip), %rdx     # 0x1e770
leaq 0x40(%rsp), %r12
movq %r12, %r8
callq 0x6760
movq 0x1278f(%rip), %rax     # 0x1e670
movl 0xb675(%rip), %ecx      # 0x1755c
jmp 0xbef9
movl 0xb66d(%rip), %ecx      # 0x1755c
movq %rcx, %r12
shlq $0x4, %r12
addq %rax, %r12
shlq $0x4, %rcx
addq %rax, %rcx
cmpq %rcx, %r13
movq 0x28(%rsp), %rbp
je 0xbf4e
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 0x12837(%rip), %rdi     # 0x1e768
movq 0x128a8(%rip), %rsi     # 0x1e7e0
movq 0x12831(%rip), %rdx     # 0x1e770
leaq 0x78(%rsp), %r13
movq %r13, %r8
callq 0x6760
jmp 0xbf5e
movl 0xb604(%rip), %ecx      # 0x17558
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, %r13
cmpl $0x2, %r14d
jne 0xbfb1
movq 0x8(%r12), %xmm0
psrlw $0x1, %xmm0
leaq 0x30(%rsp), %rcx
movd %xmm0, (%rcx)
movzwl 0xc(%r12), %eax
shrl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%r12), %eax
movw %ax, 0x6(%rcx)
movq 0x127d2(%rip), %rdi     # 0x1e768
movq 0x12843(%rip), %rsi     # 0x1e7e0
movq 0x127cc(%rip), %rdx     # 0x1e770
leaq 0x40(%rsp), %r12
movq %r12, %r8
callq 0x6760
movq 0x8(%rsp), %r14
movl (%rsp), %r8d
movl 0x4(%rsp), %edi
movl %r14d, %ebx
imull %edi, %ebx
testb $0x20, %r15b
movq %r13, %rax
cmoveq %r12, %rax
cmoveq %r13, %r12
btl $0xc, %r15d
jae 0xbffc
movq 0x1268f(%rip), %rcx     # 0x1e670
movl 0xb57c(%rip), %r12d     # 0x17564
shlq $0x4, %r12
addq %rcx, %r12
movl 0xb573(%rip), %eax      # 0x17568
shlq $0x4, %rax
addq %rcx, %rax
movl 0x10(%rsp), %ecx
addl %ecx, %ebx
addl %ecx, %ebp
imull 0x14(%rsp), %r14d
btl $0xb, 0x1287e(%rip)     # 0x1e890
movq %r12, %r13
cmovaeq %rax, %r13
testb $0x10, %r15b
cmoveq %rax, %r13
movq %r15, 0x8(%rsp)
testb $0x40, %r15b
cmovneq %r12, %r13
movss 0x4b36(%rip), %xmm0     # 0x10b6c
movl 0x12848(%rip), %eax     # 0x1e884
movl 0x12846(%rip), %edx     # 0x1e888
movl %edx, %ecx
imull %r8d, %ecx
movl %eax, %esi
subl %ecx, %esi
cvtsi2ss %esi, %xmm1
movss 0xb4f8(%rip), %xmm2     # 0x17550
cvtsi2ss %eax, %xmm3
mulss %xmm0, %xmm2
mulss %xmm2, %xmm1
mulss 0xb4e8(%rip), %xmm0     # 0x17554
divss %xmm3, %xmm1
addss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movw %cx, 0xe(%r12)
movl 0xbd3c(%rip), %ecx      # 0x17dc0
testl %edi, %edi
movq %rbp, %r15
jne 0xc0be
testl %r8d, %r8d
movl %ebp, %esi
cmovel %r8d, %esi
addl %ebp, %edx
movl 0x127e0(%rip), %edi     # 0x1e87c
addl %ecx, %edi
xorl %r8d, %r8d
cmpl %edi, %edx
cmovll %r8d, %eax
addl %edx, %eax
xorl %edi, %edi
movl %ecx, %edx
movl %eax, %ecx
callq 0xd473
movl (%rsp), %r8d
movl 0xbd02(%rip), %ecx      # 0x17dc0
leal (%rbx,%r14), %ebp
movl 0x127b0(%rip), %eax     # 0x1e878
addl %ecx, %eax
cmpl %eax, %ebp
jl 0xc10b
testl %r8d, %r8d
movq %r15, %rdi
movl %edi, %esi
cmovel %r8d, %esi
movl 0x127a0(%rip), %edx     # 0x1e880
movl 0x127a2(%rip), %eax     # 0x1e888
addl %edi, %eax
addl 0x1278e(%rip), %ecx     # 0x1e87c
cmpl %ecx, %eax
jl 0xc0f8
movl 0x1278c(%rip), %eax     # 0x1e884
movl %ebp, %edi
movl %eax, %ecx
callq 0xd473
movl 0xbcb9(%rip), %ecx      # 0x17dc0
movl (%rsp), %r8d
testl %r8d, %r8d
jne 0xc121
movl %ebx, %edi
xorl %esi, %esi
movl %ebp, %edx
callq 0xd473
movl 0xbc9f(%rip), %ecx      # 0x17dc0
movl 0x12760(%rip), %r9d     # 0x1e888
leal (%r9,%r15), %esi
addl 0x1274a(%rip), %ecx     # 0x1e87c
cmpl %ecx, %esi
jl 0xc14c
movl 0x12748(%rip), %ecx     # 0x1e884
movl %ebx, %edi
movl %ebp, %edx
callq 0xd473
movl 0x1273c(%rip), %r9d     # 0x1e888
movq 0x12685(%rip), %rdi     # 0x1e7d8
movq %r12, %rsi
movl %ebx, %edx
movq %r15, %rbp
movl %ebp, %ecx
movl %r14d, %r8d
callq 0x6430
leaq 0x50(%rsp), %rcx
andl $0x0, (%rcx)
movzwl 0x12714(%rip), %eax     # 0x1e888
movw %ax, 0x6(%rcx)
movw %r14w, 0x4(%rcx)
movq 0x12654(%rip), %rdi     # 0x1e7d8
pushq $0x1
popq %r8
movl %ebx, %esi
movl %ebp, %edx
callq 0x6690
movq 0x8(%rsp), %r15
btl $0xb, %r15d
jb 0xc1b8
movq 0x12634(%rip), %rdi     # 0x1e7d8
movq %r13, %rsi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x63e0
jmp 0xc1e3
movl %r14d, %eax
cltd
movq 0x20(%rsp), %r10
idivl %r10d
movl 0x126be(%rip), %ecx     # 0x1e888
movl %ebx, %edi
movl %ebp, %esi
movl %eax, %edx
movq %r13, %r8
movq %r12, %r9
pushq %r10
pushq 0x20(%rsp)
callq 0xeb22
popq %rax
popq %rcx
testb $0x8, %r15b
je 0xc225
cvtsi2ss %ebp, %xmm0
cvtsi2ssl 0x12493(%rip), %xmm1 # 0x1e688
movq 0x125dc(%rip), %rdi     # 0x1e7d8
mulss 0xbbc4(%rip), %xmm1     # 0x17dc8
addss %xmm0, %xmm1
addss 0x4964(%rip), %xmm1     # 0x10b74
cvttss2si %xmm1, %ecx
pushq $0x1
popq %r9
movq %r13, %rsi
movl %ebx, %edx
movl %r14d, %r8d
callq 0x6430
testb %r15b, %r15b
jns 0xc26a
cvtsi2ss %ebp, %xmm0
movl 0x12454(%rip), %eax     # 0x1e688
addl %eax, %eax
cvtsi2ss %eax, %xmm1
mulss 0xbb86(%rip), %xmm1     # 0x17dc8
divss 0x492e(%rip), %xmm1     # 0x10b78
movq 0x12587(%rip), %rdi     # 0x1e7d8
addss %xmm0, %xmm1
cvttss2si %xmm1, %ecx
pushq $0x1
popq %r9
movq %r13, %rsi
movl %ebx, %edx
movl %r14d, %r8d
callq 0x6430
movq 0x12567(%rip), %rdi     # 0x1e7d8
xorl %esi, %esi
callq 0x6650
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq