// File: /workspace/github_c_makefile_star2_O3/anachronic[P]st/x.c
// Function: xdrawglyphfontspecs
void
xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y, int dmode)
{
	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_BLINK && win.mode & MODE_BLINK)
		fg = bg;

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

    if (dmode & DRAW_BG) {
        /* 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);
        /* Fill the background */
        XftDrawRect(xw.draw, bg, winx, winy, width, win.ch);
    }


    if (dmode & DRAW_FG) {
		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 + win.cyo + dc.font.ascent + 1,
						width, 1);
		}

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r8d, 0x10(%rsp)
movl %ecx, %eax
movq %rdx, %r14
movq %rsi, %rcx
movq %rdi, 0x18(%rsp)
movq %rsi, %rbx
shrq $0x2a, %rcx
andb $0x1, %cl
movq %rax, 0x20(%rsp)
shll %cl, %eax
movl %eax, 0x14(%rsp)
shrq $0x20, %rbx
movl %r14d, %r13d
movl 0x1247a(%rip), %ecx     # 0x1ed7c
movl 0x12470(%rip), %eax     # 0x1ed78
movl %r9d, 0xc(%rsp)
imull %r9d, %eax
movq %rax, 0x28(%rsp)
movl %ebx, %eax
notl %eax
testb $0xa, %al
movq %rcx, 0x30(%rsp)
jne 0xc947
movl 0x1230b(%rip), %eax     # 0x1ec34
orl 0x12301(%rip), %eax     # 0x1ec30
movl $0xb, %eax
cmovel %r13d, %eax
movl %eax, %r13d
btl $0x18, %r13d
jb 0xc97b
movl %r13d, %eax
jmp 0xc968
movl $0xb, %eax
testb $0x8, %bl
je 0xc95a
cmpl $0x0, 0x122a0(%rip)     # 0x1ebf8
jne 0xc968
testb $0x2, %bl
je 0xc93b
cmpl $0x0, 0x1225e(%rip)     # 0x1ebc4
je 0xc93b
movl %eax, %r15d
shlq $0x4, %r15
addq 0x121f2(%rip), %r15     # 0x1eb68
movl %eax, %r13d
jmp 0xc9c9
leaq 0x38(%rsp), %rcx
movw $0xffff, 0x6(%rcx)      # imm = 0xFFFF
movl %r13d, %eax
shrl $0x8, %eax
movl $0xff00, %edx           # imm = 0xFF00
andl %edx, %eax
movw %ax, (%rcx)
andl %r13d, %edx
movw %dx, 0x2(%rcx)
movl %r13d, %eax
shll $0x8, %eax
movw %ax, 0x4(%rcx)
movq 0x122b2(%rip), %rdi     # 0x1ec60
movq 0x12323(%rip), %rsi     # 0x1ecd8
movq 0x122ac(%rip), %rdx     # 0x1ec68
leaq 0x68(%rsp), %r15
movq %r15, %r8
callq 0x56d0
movq %r14, %r12
shrq $0x20, %r12
btq $0x38, %r14
jb 0xc9e7
movq 0x1218a(%rip), %rax     # 0x1eb68
shlq $0x4, %r12
addq %rax, %r12
jmp 0xca3d
leaq 0x40(%rsp), %rcx
movw $0xffff, 0x6(%rcx)      # imm = 0xFFFF
movl $0xff00, %eax           # imm = 0xFF00
movl %r12d, %edx
andl %eax, %edx
movw %dx, 0x2(%rcx)
shrq $0x28, %r14
andl %eax, %r14d
movw %r14w, (%rcx)
shll $0x8, %r12d
movw %r12w, 0x4(%rcx)
movq 0x12245(%rip), %rdi     # 0x1ec60
movq 0x122b6(%rip), %rsi     # 0x1ecd8
movq 0x1223f(%rip), %rdx     # 0x1ec68
leaq 0x58(%rsp), %r12
movq %r12, %r8
callq 0x56d0
movq 0x1212b(%rip), %rax     # 0x1eb68
movl %ebx, %ebp
andl $0x6, %ebp
cmpl $0x2, %ebp
sete %dl
cmpl $0x8, %r13d
setb %cl
andb %dl, %cl
orl $0x8, %r13d
shlq $0x4, %r13
addq %rax, %r13
testb %cl, %cl
movq %r15, %r14
cmovneq %r13, %r14
testb $0x20, 0x12318(%rip)    # 0x1ed84
je 0xcb5a
movl 0xba64(%rip), %edx      # 0x184dc
shlq $0x4, %rdx
addq %rax, %rdx
cmpq %rdx, %r14
je 0xcae7
testb %cl, %cl
cmovneq %r13, %r15
movl 0x8(%r15), %eax
notl %eax
leaq 0x38(%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 0x121a3(%rip), %rdi     # 0x1ec60
movq 0x12214(%rip), %rsi     # 0x1ecd8
movq 0x1219d(%rip), %rdx     # 0x1ec68
leaq 0x48(%rsp), %r14
movq %r14, %r8
callq 0x56d0
movq 0x12089(%rip), %rax     # 0x1eb68
movl 0xb9fb(%rip), %ecx      # 0x184e0
jmp 0xcaf7
movl 0xb9f3(%rip), %ecx      # 0x184e0
movq %rcx, %r14
shlq $0x4, %r14
addq %rax, %r14
shlq $0x4, %rcx
addq %rax, %rcx
cmpq %rcx, %r12
je 0xcb4a
movl 0x8(%r12), %eax
notl %eax
leaq 0x40(%rsp), %rcx
movl %eax, (%rcx)
movl 0xc(%r12), %eax
notl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%r12), %eax
movw %ax, 0x6(%rcx)
movq 0x12133(%rip), %rdi     # 0x1ec60
movq 0x121a4(%rip), %rsi     # 0x1ecd8
movq 0x1212d(%rip), %rdx     # 0x1ec68
leaq 0x78(%rsp), %r12
movq %r12, %r8
callq 0x56d0
jmp 0xcb5a
movl 0xb98c(%rip), %ecx      # 0x184dc
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, %r12
movq 0x30(%rsp), %r13
imull 0x10(%rsp), %r13d
movl 0xc0(%rsp), %r9d
cmpl $0x4, %ebp
jne 0xcbc2
movq 0x8(%r14), %xmm0
psrlw $0x1, %xmm0
leaq 0x38(%rsp), %rcx
movd %xmm0, (%rcx)
movzwl 0xc(%r14), %eax
shrl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%r14), %eax
movw %ax, 0x6(%rcx)
movq 0x120bf(%rip), %rdi     # 0x1ec60
movq 0x12130(%rip), %rsi     # 0x1ecd8
movq 0x120b9(%rip), %rdx     # 0x1ec68
leaq 0x48(%rsp), %r14
movq %r14, %r8
movl %r9d, %ebp
callq 0x56d0
movl %ebp, %r9d
addl $0x2, %r13d
movq 0x30(%rsp), %rcx
imull 0x14(%rsp), %ecx
testb $0x40, %bl
movq %r14, %rbp
cmoveq %r12, %rbp
cmoveq %r14, %r12
movl 0x121a0(%rip), %eax     # 0x1ed84
btl $0xb, %eax
movq %rbp, %r15
cmovaeq %r12, %r15
movq 0x28(%rsp), %rdx
leal 0x2(%rdx), %r14d
testb $0x20, %bl
cmoveq %r12, %r15
movq %rcx, %r12
testb %bl, %bl
cmovsq %rbp, %r15
testb $0x1, %r9b
je 0xcdc6
cmpl $0x0, 0x10(%rsp)
jne 0xcc83
movl 0xc(%rsp), %edx
testl %edx, %edx
movl %r14d, %ecx
cmovel %edx, %ecx
movl 0x1214c(%rip), %r9d     # 0x1ed78
addl %r14d, %r9d
movl 0x12137(%rip), %esi     # 0x1ed6c
addl $0x2, %esi
movl $0x0, %edx
cmpl %esi, %r9d
jl 0xcc48
movl 0x1212c(%rip), %edx     # 0x1ed74
movq 0x12081(%rip), %rdi     # 0x1ecd0
testb $0x20, %al
leaq 0xb884(%rip), %rax      # 0x184dc
leaq 0xb881(%rip), %rsi      # 0x184e0
cmovneq %rax, %rsi
movl (%rsi), %esi
shlq $0x4, %rsi
addq 0x11ef8(%rip), %rsi     # 0x1eb68
subl %ecx, %r9d
addl %edx, %r9d
xorl %edx, %edx
movl $0x2, %r8d
callq 0x53d0
leal (%r12,%r13), %edx
movl 0x120db(%rip), %eax     # 0x1ed68
addl $0x2, %eax
cmpl %eax, %edx
jl 0xccfe
movl 0xc(%rsp), %eax
testl %eax, %eax
movl %r14d, %ecx
cmovel %eax, %ecx
movl 0x120c9(%rip), %r8d     # 0x1ed70
movl 0x120ca(%rip), %r9d     # 0x1ed78
addl %r14d, %r9d
movl 0x120b5(%rip), %eax     # 0x1ed6c
addl $0x2, %eax
cmpl %eax, %r9d
jl 0xccc6
movl 0x120ae(%rip), %r9d     # 0x1ed74
movq 0x12003(%rip), %rdi     # 0x1ecd0
testb $0x20, 0x120b0(%rip)    # 0x1ed84
leaq 0xb801(%rip), %rax      # 0x184dc
leaq 0xb7fe(%rip), %rsi      # 0x184e0
cmovneq %rax, %rsi
movl (%rsi), %esi
shlq $0x4, %rsi
addq 0x11e75(%rip), %rsi     # 0x1eb68
subl %edx, %r8d
subl %ecx, %r9d
callq 0x53d0
cmpl $0x0, 0xc(%rsp)
jne 0xcd45
movq 0x11fc4(%rip), %rdi     # 0x1ecd0
testb $0x20, 0x12071(%rip)    # 0x1ed84
leaq 0xb7c2(%rip), %rax      # 0x184dc
leaq 0xb7bf(%rip), %rcx      # 0x184e0
cmovneq %rax, %rcx
movl (%rcx), %esi
shlq $0x4, %rsi
addq 0x11e36(%rip), %rsi     # 0x1eb68
movl %r13d, %edx
xorl %ecx, %ecx
movl %r12d, %r8d
movl $0x2, %r9d
callq 0x53d0
movl 0x1202c(%rip), %r9d     # 0x1ed78
leal (%r9,%r14), %ecx
movl 0x12016(%rip), %eax     # 0x1ed6c
addl $0x2, %eax
cmpl %eax, %ecx
jl 0xcda6
movl 0x12010(%rip), %r9d     # 0x1ed74
movq 0x11f65(%rip), %rdi     # 0x1ecd0
testb $0x20, 0x12012(%rip)    # 0x1ed84
leaq 0xb763(%rip), %rax      # 0x184dc
leaq 0xb760(%rip), %rdx      # 0x184e0
cmovneq %rax, %rdx
movl (%rdx), %esi
shlq $0x4, %rsi
addq 0x11dd7(%rip), %rsi     # 0x1eb68
subl %ecx, %r9d
movl %r13d, %edx
movl %r12d, %r8d
callq 0x53d0
movl 0x11fd2(%rip), %r9d     # 0x1ed78
movq 0x11f23(%rip), %rdi     # 0x1ecd0
movq %rbp, %rsi
movl %r13d, %edx
movl %r14d, %ecx
movl %r12d, %r8d
callq 0x53d0
movl 0xc0(%rsp), %r9d
testb $0x2, %r9b
je 0xce9f
btl $0xd, %ebx
jb 0xcdf1
movq 0x11ef3(%rip), %rdi     # 0x1ecd0
movq %r15, %rsi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x5380
jmp 0xce20
movl %r12d, %eax
cltd
movq 0x20(%rsp), %r10
idivl %r10d
movl 0x11f75(%rip), %ecx     # 0x1ed78
movl %r13d, %edi
movl %r14d, %esi
movl %eax, %edx
movq %r15, %r8
movq %rbp, %r9
pushq %r10
pushq 0x20(%rsp)
callq 0xf83b
addq $0x10, %rsp
testb $0x10, %bl
je 0xce56
movq 0x11ea4(%rip), %rdi     # 0x1ecd0
movl 0x11d4e(%rip), %eax     # 0x1eb80
movq 0x28(%rsp), %rcx
addl 0x11f43(%rip), %ecx     # 0x1ed80
addl %eax, %ecx
addl $0x3, %ecx
movq %r15, %rsi
movl %r13d, %edx
movl %r12d, %r8d
movl $0x1, %r9d
callq 0x53d0
btl $0x8, %ebx
jae 0xce9f
movq 0x11e6d(%rip), %rdi     # 0x1ecd0
addl 0x11f16(%rip), %r14d    # 0x1ed80
movl 0x11d10(%rip), %eax     # 0x1eb80
addl %eax, %eax
cltq
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rax
shrq $0x3f, %rax
shrq $0x20, %rcx
addl %eax, %ecx
addl %r14d, %ecx
movq %r15, %rsi
movl %r13d, %edx
movl %r12d, %r8d
movl $0x1, %r9d
callq 0x53d0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq