// File: /workspace/github_c_makefile_star2_O1/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 %r9d, %ebp
movl %r8d, 0x10(%rsp)
movl %ecx, %eax
movq %rdx, %rbx
movq %rsi, %rcx
movq %rdi, 0x18(%rsp)
movq %rsi, %r14
shrq $0x20, %r14
shrq $0x2a, %rcx
andb $0x1, %cl
movq %rax, 0x20(%rsp)
shll %cl, %eax
movl %eax, 0x14(%rsp)
movl %ebx, %r13d
movl %r14d, %eax
notl %eax
testb $0xa, %al
jne 0xc822
movl 0x12436(%rip), %eax     # 0x1ec44
orl 0x1242c(%rip), %eax     # 0x1ec40
movl $0xb, %eax
cmovel %r13d, %eax
movl %eax, %r13d
jmp 0xc846
testb $0x8, %r14b
je 0xc831
cmpl $0x0, 0x123d9(%rip)     # 0x1ec08
jne 0xc840
testb $0x2, %r14b
je 0xc846
cmpl $0x0, 0x12396(%rip)     # 0x1ebd4
je 0xc846
movl $0xb, %r13d
movl 0x12540(%rip), %eax     # 0x1ed8c
movl 0x12536(%rip), %ecx     # 0x1ed88
imull %ebp, %ecx
movq %rcx, 0x28(%rsp)
btl $0x18, %r13d
movq %rax, 0x30(%rsp)
jb 0xc876
movl %r13d, %r15d
shlq $0x4, %r15
addq 0x12304(%rip), %r15     # 0x1eb78
jmp 0xc8c4
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 0x123c7(%rip), %rdi     # 0x1ec70
movq 0x12438(%rip), %rsi     # 0x1ece8
movq 0x123c1(%rip), %rdx     # 0x1ec78
leaq 0x68(%rsp), %r15
movq %r15, %r8
callq 0x56e0
movq %rbx, %r12
shrq $0x20, %r12
btq $0x38, %rbx
movl %ebp, 0xc(%rsp)
jb 0xc8e3
shlq $0x4, %r12
addq 0x12297(%rip), %r12     # 0x1eb78
jmp 0xc930
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, %rbx
andl %eax, %ebx
movw %bx, (%rcx)
shll $0x8, %r12d
movw %r12w, 0x4(%rcx)
movq 0x1235b(%rip), %rdi     # 0x1ec70
movq 0x123cc(%rip), %rsi     # 0x1ece8
movq 0x12355(%rip), %rdx     # 0x1ec78
leaq 0x58(%rsp), %r12
movq %r12, %r8
callq 0x56e0
movl %r14d, %ebp
andl $0x6, %ebp
cmpl $0x2, %ebp
sete %al
cmpl $0x8, %r13d
setb %cl
andb %al, %cl
movq 0x1222c(%rip), %rax     # 0x1eb78
orl $0x8, %r13d
shlq $0x4, %r13
addq %rax, %r13
testb %cl, %cl
movq %r15, %rbx
cmovneq %r13, %rbx
testb $0x20, 0x1242d(%rip)    # 0x1ed94
je 0xca62
movl 0xbb79(%rip), %edx      # 0x184ec
shlq $0x4, %rdx
addq %rax, %rdx
cmpq %rdx, %rbx
je 0xc9d5
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 0x122b8(%rip), %rdi     # 0x1ec70
movq 0x12329(%rip), %rsi     # 0x1ece8
movq 0x122b2(%rip), %rdx     # 0x1ec78
leaq 0x48(%rsp), %rbx
movq %rbx, %r8
callq 0x56e0
jmp 0xc9e5
movl 0xbb15(%rip), %ecx      # 0x184f0
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, %rbx
movq 0x1218c(%rip), %rax     # 0x1eb78
movl 0xbafe(%rip), %ecx      # 0x184f0
shlq $0x4, %rcx
addq %rax, %rcx
cmpq %rcx, %r12
je 0xca52
movl 0x8(%r12), %eax
notl %eax
leaq 0x40(%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 0x1223b(%rip), %rdi     # 0x1ec70
movq 0x122ac(%rip), %rsi     # 0x1ece8
movq 0x12235(%rip), %rdx     # 0x1ec78
leaq 0x78(%rsp), %r12
movq %r12, %r8
callq 0x56e0
jmp 0xca62
movl 0xba94(%rip), %ecx      # 0x184ec
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, %r12
movq 0x30(%rsp), %r13
imull 0x10(%rsp), %r13d
cmpl $0x4, %ebp
jne 0xcabe
movzwl 0x8(%rbx), %eax
shrl %eax
leaq 0x38(%rsp), %rcx
movw %ax, (%rcx)
movzwl 0xa(%rbx), %eax
shrl %eax
movw %ax, 0x2(%rcx)
movzwl 0xc(%rbx), %eax
shrl %eax
movw %ax, 0x4(%rcx)
movzwl 0xe(%rbx), %eax
movw %ax, 0x6(%rcx)
movq 0x121cd(%rip), %rdi     # 0x1ec70
movq 0x1223e(%rip), %rsi     # 0x1ece8
movq 0x121c7(%rip), %rdx     # 0x1ec78
leaq 0x48(%rsp), %rbx
movq %rbx, %r8
callq 0x56e0
addl $0x2, %r13d
movq 0x30(%rsp), %rcx
imull 0x14(%rsp), %ecx
testb $0x40, %r14b
movq %rbx, %rbp
cmoveq %r12, %rbp
cmoveq %rbx, %r12
movl 0x122b3(%rip), %eax     # 0x1ed94
btl $0xb, %eax
movq %rbp, %r15
cmovaeq %r12, %r15
movq 0x28(%rsp), %rdx
leal 0x2(%rdx), %ebx
testb $0x20, %r14b
cmoveq %r12, %r15
movq %rcx, %r12
testb %r14b, %r14b
cmovsq %rbp, %r15
movl 0xc0(%rsp), %ecx
testb $0x1, %cl
je 0xccbc
cmpl $0x0, 0x10(%rsp)
jne 0xcb86
movl 0xc(%rsp), %edx
testl %edx, %edx
movl %ebx, %ecx
cmovel %edx, %ecx
movl 0x12259(%rip), %r9d     # 0x1ed88
addl %ebx, %r9d
movl 0x12244(%rip), %esi     # 0x1ed7c
addl $0x2, %esi
movl $0x0, %edx
cmpl %esi, %r9d
jl 0xcb4b
movl 0x12239(%rip), %edx     # 0x1ed84
movq 0x1218e(%rip), %rdi     # 0x1ece0
testb $0x20, %al
leaq 0xb991(%rip), %rax      # 0x184ec
leaq 0xb98e(%rip), %rsi      # 0x184f0
cmovneq %rax, %rsi
movl (%rsi), %esi
shlq $0x4, %rsi
addq 0x12005(%rip), %rsi     # 0x1eb78
subl %ecx, %r9d
addl %edx, %r9d
xorl %edx, %edx
movl $0x2, %r8d
callq 0x53d0
leal (%r12,%r13), %edx
movl 0x121e8(%rip), %eax     # 0x1ed78
addl $0x2, %eax
cmpl %eax, %edx
jl 0xcc00
movl 0xc(%rsp), %eax
testl %eax, %eax
movl %ebx, %ecx
cmovel %eax, %ecx
movl 0x121d7(%rip), %r8d     # 0x1ed80
movl 0x121d8(%rip), %r9d     # 0x1ed88
addl %ebx, %r9d
movl 0x121c3(%rip), %eax     # 0x1ed7c
addl $0x2, %eax
cmpl %eax, %r9d
jl 0xcbc8
movl 0x121bc(%rip), %r9d     # 0x1ed84
movq 0x12111(%rip), %rdi     # 0x1ece0
testb $0x20, 0x121be(%rip)    # 0x1ed94
leaq 0xb90f(%rip), %rax      # 0x184ec
leaq 0xb90c(%rip), %rsi      # 0x184f0
cmovneq %rax, %rsi
movl (%rsi), %esi
shlq $0x4, %rsi
addq 0x11f83(%rip), %rsi     # 0x1eb78
subl %edx, %r8d
subl %ecx, %r9d
callq 0x53d0
cmpl $0x0, 0xc(%rsp)
jne 0xcc47
movq 0x120d2(%rip), %rdi     # 0x1ece0
testb $0x20, 0x1217f(%rip)    # 0x1ed94
leaq 0xb8d0(%rip), %rax      # 0x184ec
leaq 0xb8cd(%rip), %rcx      # 0x184f0
cmovneq %rax, %rcx
movl (%rcx), %esi
shlq $0x4, %rsi
addq 0x11f44(%rip), %rsi     # 0x1eb78
movl %r13d, %edx
xorl %ecx, %ecx
movl %r12d, %r8d
movl $0x2, %r9d
callq 0x53d0
movl 0x1213b(%rip), %ecx     # 0x1ed88
addl %ebx, %ecx
movl 0x12127(%rip), %eax     # 0x1ed7c
addl $0x2, %eax
cmpl %eax, %ecx
jl 0xcc9e
movl 0x12121(%rip), %r9d     # 0x1ed84
movq 0x12076(%rip), %rdi     # 0x1ece0
testb $0x20, 0x12123(%rip)    # 0x1ed94
leaq 0xb874(%rip), %rax      # 0x184ec
leaq 0xb871(%rip), %rdx      # 0x184f0
cmovneq %rax, %rdx
movl (%rdx), %esi
shlq $0x4, %rsi
addq 0x11ee8(%rip), %rsi     # 0x1eb78
subl %ecx, %r9d
movl %r13d, %edx
movl %r12d, %r8d
callq 0x53d0
movq 0x1203b(%rip), %rdi     # 0x1ece0
movl 0x120dc(%rip), %r9d     # 0x1ed88
movq %rbp, %rsi
movl %r13d, %edx
movl %ebx, %ecx
movl %r12d, %r8d
callq 0x53d0
movl 0xc0(%rsp), %eax
testb $0x2, %al
je 0xcd9a
btl $0xd, %r14d
jb 0xcced
movq 0x12007(%rip), %rdi     # 0x1ece0
movq %r15, %rsi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x5380
jmp 0xcd1b
movl %r12d, %eax
cltd
movq 0x20(%rsp), %r10
idivl %r10d
movl 0x12089(%rip), %ecx     # 0x1ed88
movl %r13d, %edi
movl %ebx, %esi
movl %eax, %edx
movq %r15, %r8
movq %rbp, %r9
pushq %r10
pushq 0x20(%rsp)
callq 0xf709
addq $0x10, %rsp
testb $0x10, %r14b
je 0xcd52
movq 0x11fb8(%rip), %rdi     # 0x1ece0
movl 0x11e62(%rip), %eax     # 0x1eb90
movq 0x28(%rsp), %rcx
addl 0x12057(%rip), %ecx     # 0x1ed90
addl %eax, %ecx
addl $0x3, %ecx
movq %r15, %rsi
movl %r13d, %edx
movl %r12d, %r8d
movl $0x1, %r9d
callq 0x53d0
btl $0x8, %r14d
jae 0xcd9a
movq 0x11f80(%rip), %rdi     # 0x1ece0
addl 0x1202a(%rip), %ebx     # 0x1ed90
movl 0x11e24(%rip), %eax     # 0x1eb90
addl %eax, %eax
cltq
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rax
shrq $0x3f, %rax
shrq $0x20, %rcx
addl %eax, %ecx
addl %ebx, %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