// File: /workspace/github_c_makefile_star2_O2/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, 0x18(%rsp)
movl %ecx, %eax
movq %rdx, %r14
movq %rsi, %rcx
movq %rdi, 0x20(%rsp)
movq %rsi, %rbx
shrq $0x2a, %rcx
andb $0x1, %cl
movq %rax, 0x28(%rsp)
shll %cl, %eax
movl %eax, 0x1c(%rsp)
shrq $0x20, %rbx
movl %r14d, %r13d
movl 0x131f7(%rip), %eax     # 0x1ed8c
movq %rax, 0x8(%rsp)
movl 0x131e8(%rip), %eax     # 0x1ed88
movl %r9d, 0x14(%rsp)
imull %r9d, %eax
movq %rax, 0x30(%rsp)
movl %ebx, %eax
notl %eax
testb $0xa, %al
jne 0xbbd8
movl 0x13088(%rip), %eax     # 0x1ec44
orl 0x1307e(%rip), %eax     # 0x1ec40
pushq $0xb
popq %rax
cmovel %r13d, %eax
movl %eax, %r13d
btl $0x18, %r13d
jb 0xbc0a
movl %r13d, %eax
jmp 0xbbf7
pushq $0xb
popq %rax
testb $0x8, %bl
je 0xbbe9
cmpl $0x0, 0x13021(%rip)     # 0x1ec08
jne 0xbbf7
testb $0x2, %bl
je 0xbbcc
cmpl $0x0, 0x12fdf(%rip)     # 0x1ebd4
je 0xbbcc
movl %eax, %r12d
shlq $0x4, %r12
addq 0x12f73(%rip), %r12     # 0x1eb78
movl %eax, %r13d
jmp 0xbc57
leaq 0x38(%rsp), %rcx
orw $-0x1, 0x6(%rcx)
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 0x13034(%rip), %rdi     # 0x1ec70
movq 0x130a5(%rip), %rsi     # 0x1ece8
movq 0x1302e(%rip), %rdx     # 0x1ec78
leaq 0x68(%rsp), %r12
movq %r12, %r8
callq 0x56d0
movq %r14, %r15
shrq $0x20, %r15
btq $0x38, %r14
jb 0xbc75
movq 0x12f0c(%rip), %rax     # 0x1eb78
shlq $0x4, %r15
addq %rax, %r15
jmp 0xbcca
leaq 0x40(%rsp), %rcx
orw $-0x1, 0x6(%rcx)
movl $0xff00, %eax           # imm = 0xFF00
movl %r15d, %edx
andl %eax, %edx
movw %dx, 0x2(%rcx)
shrq $0x28, %r14
andl %eax, %r14d
movw %r14w, (%rcx)
shll $0x8, %r15d
movw %r15w, 0x4(%rcx)
movq 0x12fc8(%rip), %rdi     # 0x1ec70
movq 0x13039(%rip), %rsi     # 0x1ece8
movq 0x12fc2(%rip), %rdx     # 0x1ec78
leaq 0x58(%rsp), %r15
movq %r15, %r8
callq 0x56d0
movq 0x12eae(%rip), %rax     # 0x1eb78
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 %r12, %r14
cmovneq %r13, %r14
testb $0x20, 0x1309b(%rip)    # 0x1ed94
je 0xbde8
movl 0xc7d7(%rip), %edx      # 0x184dc
shlq $0x4, %rdx
addq %rax, %rdx
cmpq %rdx, %r14
je 0xbd78
testb %cl, %cl
cmovneq %r13, %r12
movl 0x8(%r12), %eax
notl %eax
leaq 0x38(%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 0x12f22(%rip), %rdi     # 0x1ec70
movq 0x12f93(%rip), %rsi     # 0x1ece8
movq 0x12f1c(%rip), %rdx     # 0x1ec78
leaq 0x48(%rsp), %r14
movq %r14, %r8
callq 0x56d0
movq 0x12e08(%rip), %rax     # 0x1eb78
movl 0xc76a(%rip), %ecx      # 0x184e0
jmp 0xbd88
movl 0xc762(%rip), %ecx      # 0x184e0
movq %rcx, %r14
shlq $0x4, %r14
addq %rax, %r14
shlq $0x4, %rcx
addq %rax, %rcx
cmpq %rcx, %r15
je 0xbdd8
movl 0x8(%r15), %eax
notl %eax
leaq 0x40(%rsp), %rcx
movl %eax, (%rcx)
movl 0xc(%r15), %eax
notl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%r15), %eax
movw %ax, 0x6(%rcx)
movq 0x12eb5(%rip), %rdi     # 0x1ec70
movq 0x12f26(%rip), %rsi     # 0x1ece8
movq 0x12eaf(%rip), %rdx     # 0x1ec78
leaq 0x78(%rsp), %r15
movq %r15, %r8
callq 0x56d0
jmp 0xbde8
movl 0xc6fe(%rip), %ecx      # 0x184dc
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, %r15
movq 0x8(%rsp), %r13
imull 0x18(%rsp), %r13d
movl 0xc0(%rsp), %edx
cmpl $0x4, %ebp
jne 0xbe4d
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 0x12e42(%rip), %rdi     # 0x1ec70
movl %edx, %ebp
movq 0x12eb1(%rip), %rsi     # 0x1ece8
movq 0x12e3a(%rip), %rdx     # 0x1ec78
leaq 0x48(%rsp), %r14
movq %r14, %r8
callq 0x56d0
movl %ebp, %edx
addl $0x2, %r13d
movq 0x8(%rsp), %rax
imull 0x1c(%rsp), %eax
movq %rax, 0x8(%rsp)
testb $0x40, %bl
movq %r14, %rbp
cmoveq %r15, %rbp
cmoveq %r14, %r15
btl $0xb, 0x12f1e(%rip)     # 0x1ed94
movq %rbp, %r14
cmovaeq %r15, %r14
movq 0x30(%rsp), %rax
leal 0x2(%rax), %r12d
testb $0x20, %bl
cmoveq %r15, %r14
testb %bl, %bl
cmovsq %rbp, %r14
testb $0x1, %dl
je 0xbf91
cmpl $0x0, 0x18(%rsp)
jne 0xbedc
movl 0x14(%rsp), %eax
testl %eax, %eax
movl %r12d, %esi
cmovel %eax, %esi
movl 0x12ed3(%rip), %eax     # 0x1ed88
addl %r12d, %eax
movl 0x12ebe(%rip), %edx     # 0x1ed7c
addl $0x2, %edx
movl $0x0, %ecx
cmpl %edx, %eax
jl 0xbed0
movl 0x12eb4(%rip), %ecx     # 0x1ed84
addl %eax, %ecx
pushq $0x2
popq %rdx
xorl %edi, %edi
callq 0xcf7d
movq 0x8(%rsp), %rax
leal (%rax,%r13), %r15d
movl 0x12e8d(%rip), %eax     # 0x1ed78
addl $0x2, %eax
cmpl %eax, %r15d
jl 0xbf29
movl 0x14(%rsp), %eax
testl %eax, %eax
movl %r12d, %esi
cmovel %eax, %esi
movl 0x12e7b(%rip), %edx     # 0x1ed80
movl 0x12e7d(%rip), %ecx     # 0x1ed88
addl %r12d, %ecx
movl 0x12e68(%rip), %eax     # 0x1ed7c
addl $0x2, %eax
cmpl %eax, %ecx
jl 0xbf21
movl 0x12e63(%rip), %ecx     # 0x1ed84
movl %r15d, %edi
callq 0xcf7d
cmpl $0x0, 0x14(%rsp)
jne 0xbf40
pushq $0x2
popq %rcx
movl %r13d, %edi
xorl %esi, %esi
movl %r15d, %edx
callq 0xcf7d
movl 0x12e41(%rip), %r9d     # 0x1ed88
leal (%r9,%r12), %esi
movl 0x12e2b(%rip), %eax     # 0x1ed7c
addl $0x2, %eax
cmpl %eax, %esi
jl 0xbf70
movl 0x12e26(%rip), %ecx     # 0x1ed84
movl %r13d, %edi
movl %r15d, %edx
callq 0xcf7d
movl 0x12e18(%rip), %r9d     # 0x1ed88
movq 0x12d69(%rip), %rdi     # 0x1ece0
movq %rbp, %rsi
movl %r13d, %edx
movl %r12d, %ecx
movq 0x8(%rsp), %r8
callq 0x53d0
movl 0xc0(%rsp), %edx
testb $0x2, %dl
je 0xc05c
btl $0xd, %ebx
jb 0xbfbb
movq 0x12d39(%rip), %rdi     # 0x1ece0
movq %r14, %rsi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
callq 0x5380
jmp 0xbfea
movq 0x8(%rsp), %rax
cltd
movq 0x28(%rsp), %r10
idivl %r10d
movl 0x12db9(%rip), %ecx     # 0x1ed88
movl %r13d, %edi
movl %r12d, %esi
movl %eax, %edx
movq %r14, %r8
movq %rbp, %r9
pushq %r10
pushq 0x28(%rsp)
callq 0xe95e
popq %rax
popq %rcx
testb $0x10, %bl
je 0xc020
movq 0x12cea(%rip), %rdi     # 0x1ece0
movl 0x12b94(%rip), %eax     # 0x1eb90
movq 0x30(%rsp), %rcx
addl 0x12d89(%rip), %ecx     # 0x1ed90
addl %eax, %ecx
addl $0x3, %ecx
pushq $0x1
popq %r9
movq %r14, %rsi
movl %r13d, %edx
movq 0x8(%rsp), %r8
callq 0x53d0
btl $0x8, %ebx
jae 0xc05c
movq 0x12cb3(%rip), %rdi     # 0x1ece0
addl 0x12d5c(%rip), %r12d    # 0x1ed90
movl 0x12b56(%rip), %eax     # 0x1eb90
addl %eax, %eax
pushq $0x3
popq %rcx
cltd
idivl %ecx
addl %eax, %r12d
pushq $0x1
popq %r9
movq %r14, %rsi
movl %r13d, %edx
movl %r12d, %ecx
movq 0x8(%rsp), %r8
callq 0x53d0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq