// File: /workspace/github_c_makefile_star2_O2/odknt[P]st/x.c
// Function: xdrawglyphfontspecs
void
xdrawglyphfontspecs(const GlyphFontSpec *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, 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.red = TRUERED(base.fg);
		colfg.green = TRUEGREEN(base.fg);
		colfg.blue = TRUEBLUE(base.fg);
		XAllocColor(xw.dpy, xw.cmap, &colfg);
		fg = &colfg;
	} else {
		fg = &dc.col[base.fg];
	}

	if (IS_TRUECOL(base.bg)) {
		colbg.green = TRUEGREEN(base.bg);
		colbg.red = TRUERED(base.bg);
		colbg.blue = TRUEBLUE(base.bg);
		XAllocColor(xw.dpy, xw.cmap, &colbg);
		bg = &colbg;
	} 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->red;
			colfg.green = ~fg->green;
			colfg.blue = ~fg->blue;
			XAllocColor(xw.dpy, xw.cmap, &colfg);
			fg = &colfg;
		}

		if (bg == &dc.col[defaultbg]) {
			bg = &dc.col[defaultfg];
		} else {
			colbg.red = ~bg->red;
			colbg.green = ~bg->green;
			colbg.blue = ~bg->blue;
			XAllocColor(xw.dpy, xw.cmap, &colbg);
			bg = &colbg;
		}
	}

	if ((base.mode & ATTR_BOLD_FAINT) == ATTR_FAINT) {
		colfg.red = fg->red / 2;
		colfg.green = fg->green / 2;
		colfg.blue = fg->blue / 2;
		XAllocColor(xw.dpy, xw.cmap, &colfg);
		fg = &colfg;
	}

	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;

	/* 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. */
	xdrawrect(bg, winx, winy, width, win.ch);

	/* Render the glyphs. */
	xdrawglyphfontspec(fg, specs, len);

	/* Render underline and strikethrough. */
	if (base.mode & ATTR_UNDERLINE)
		xdrawrect(fg, winx, winy + win.cyo + dc.font.ascent + 1, width, 1);

	if (base.mode & ATTR_STRUCK)
		xdrawrect(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 $0x78, %rsp
movl %r8d, 0x34(%rsp)
movl %ecx, %r15d
movq %rdx, %rbp
movq %rsi, %rcx
movq %rdi, %r12
movq %rsi, %rdx
shrq $0x20, %rdx
shrq $0x29, %rcx
andb $0x1, %cl
movl %r15d, %eax
shll %cl, %eax
movl %eax, 0x38(%rsp)
movl %ebp, %ebx
movl 0xbd19(%rip), %eax      # 0x17e0c
movl %eax, 0x40(%rsp)
movl 0x1283f(%rip), %ecx     # 0x1e93c
movl 0x12834(%rip), %r13d    # 0x1e938
movl %r9d, 0xc(%rsp)
imull %r9d, %r13d
movl %edx, %eax
notl %eax
testb $0x5, %al
movq %rdx, 0x48(%rsp)
movq %rcx, 0x28(%rsp)
jne 0xc13d
movl 0x1269f(%rip), %eax     # 0x1e7c4
orl 0x12695(%rip), %eax     # 0x1e7c0
pushq $0xb
popq %rax
cmovel %ebx, %eax
movl %eax, %ebx
btl $0x18, %ebx
jb 0xc170
movl %ebx, %eax
jmp 0xc15e
pushq $0xb
popq %rax
testb $0x4, %dl
je 0xc14e
cmpl $0x0, 0x1262c(%rip)     # 0x1e778
jne 0xc15e
testb $0x1, 0x48(%rsp)
je 0xc133
cmpl $0x0, 0x125d8(%rip)     # 0x1e734
je 0xc133
movl %eax, %r14d
shlq $0x4, %r14
addq 0x1255c(%rip), %r14     # 0x1e6c8
movl %eax, %ebx
jmp 0xc1ad
movl %ebx, %eax
shrl $0x8, %eax
movl $0xff00, %ecx           # imm = 0xFF00
andl %ecx, %eax
leaq 0x58(%rsp), %r14
movw %ax, 0x8(%r14)
andl %ebx, %ecx
movw %cx, 0xa(%r14)
movl %ebx, %eax
shll $0x8, %eax
movw %ax, 0xc(%r14)
movq 0x12662(%rip), %rdi     # 0x1e800
movq 0x12663(%rip), %rsi     # 0x1e808
movq %r14, %rdx
callq 0x6850
movq %rbp, %rcx
shrq $0x20, %rcx
btq $0x38, %rbp
movq %r13, 0x20(%rsp)
jb 0xc1d5
movq 0x12501(%rip), %rax     # 0x1e6c8
shlq $0x4, %rcx
addq %rax, %rcx
movq %rcx, 0x18(%rsp)
jmp 0xc217
movl $0xff00, %eax           # imm = 0xFF00
movl %ecx, %esi
andl %eax, %esi
leaq 0x68(%rsp), %rdx
movw %si, 0xa(%rdx)
shrq $0x28, %rbp
andl %eax, %ebp
movw %bp, 0x8(%rdx)
shll $0x8, %ecx
movw %cx, 0xc(%rdx)
movq 0x12601(%rip), %rdi     # 0x1e800
movq 0x12602(%rip), %rsi     # 0x1e808
movq %rdx, 0x18(%rsp)
callq 0x6850
movq 0x124b1(%rip), %rax     # 0x1e6c8
movq 0x48(%rsp), %rbp
movl %ebp, %r13d
andl $0x3, %r13d
cmpl $0x1, %r13d
sete %dl
cmpl $0x8, %ebx
setb %cl
andb %dl, %cl
orl $0x8, %ebx
shlq $0x4, %rbx
addq %rax, %rbx
testb %cl, %cl
movq %r14, %rsi
cmovneq %rbx, %rsi
testb $0x20, 0x126f8(%rip)    # 0x1e944
jne 0xc25d
movq 0x28(%rsp), %r14
movq 0x18(%rsp), %rcx
jmp 0xc331
movl 0xb359(%rip), %edx      # 0x175bc
shlq $0x4, %rdx
addq %rax, %rdx
cmpq %rdx, %rsi
je 0xc2c0
testb %cl, %cl
cmovneq %rbx, %r14
movl 0x8(%r14), %eax
notl %eax
leaq 0x58(%rsp), %rdx
movw %ax, 0x8(%rdx)
movzwl 0xa(%r14), %eax
notl %eax
movw %ax, 0xa(%rdx)
movl 0xc(%r14), %eax
notl %eax
movw %ax, 0xc(%rdx)
movq 0x12560(%rip), %rdi     # 0x1e800
movq 0x12561(%rip), %rsi     # 0x1e808
movq %rdx, 0x10(%rsp)
callq 0x6850
movq 0x12410(%rip), %rax     # 0x1e6c8
movl 0xb302(%rip), %ecx      # 0x175c0
jmp 0xc2d5
movl 0xb2fa(%rip), %ecx      # 0x175c0
movq %rcx, %rdx
shlq $0x4, %rdx
addq %rax, %rdx
movq %rdx, 0x10(%rsp)
shlq $0x4, %rcx
addq %rax, %rcx
movq 0x18(%rsp), %rdx
cmpq %rcx, %rdx
movq 0x28(%rsp), %r14
je 0xc31c
movl 0x8(%rdx), %eax
notl %eax
leaq 0x68(%rsp), %rbx
movl %eax, 0x8(%rbx)
movl 0xc(%rdx), %eax
notl %eax
movw %ax, 0xc(%rbx)
movq 0x124f8(%rip), %rdi     # 0x1e800
movq 0x124f9(%rip), %rsi     # 0x1e808
movq %rbx, %rdx
callq 0x6850
movq %rbx, %rcx
jmp 0xc32c
movl 0xb29a(%rip), %ecx      # 0x175bc
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, %rcx
movq 0x10(%rsp), %rsi
movl %r14d, %eax
imull 0x34(%rsp), %eax
movq %rax, (%rsp)
cmpl $0x2, %r13d
jne 0xc380
movq 0x8(%rsi), %xmm0
psrlw $0x1, %xmm0
leaq 0x58(%rsp), %rbx
movd %xmm0, 0x8(%rbx)
movzwl 0xc(%rsi), %eax
shrl %eax
movw %ax, 0xc(%rbx)
movq 0x12498(%rip), %rdi     # 0x1e800
movq 0x12499(%rip), %rsi     # 0x1e808
movq %rbx, %rdx
movq %rcx, %r13
callq 0x6850
movq %r13, %rcx
movq %rbx, %rsi
movq 0x20(%rsp), %r13
movq %rsi, 0x10(%rsp)
movq (%rsp), %rax
movl 0x40(%rsp), %edx
addl %edx, %eax
movq %rax, (%rsp)
addl %edx, %r13d
imull 0x38(%rsp), %r14d
testb $0x20, %bpl
movq %rsi, %rdx
cmoveq %rcx, %rdx
movq %rcx, 0x18(%rsp)
movq %rcx, %rax
cmoveq %rsi, %rax
movl 0x12586(%rip), %ecx     # 0x1e944
movl %ecx, 0x54(%rsp)
btl $0xb, %ecx
movq %rdx, %rcx
cmovaeq %rax, %rcx
testb $0x10, %bpl
cmoveq %rax, %rcx
testb $0x40, %bpl
movq %rdx, 0x40(%rsp)
cmovneq %rdx, %rcx
movq %rcx, 0x38(%rsp)
movl 0xba1f(%rip), %ecx      # 0x17e0c
cmpl $0x0, 0x34(%rsp)
jne 0xc433
movl 0xc(%rsp), %eax
testl %eax, %eax
movl %r13d, %esi
cmovel %eax, %esi
movl 0x12532(%rip), %edx     # 0x1e938
addl %r13d, %edx
movl 0x1251d(%rip), %edi     # 0x1e92c
addl %ecx, %edi
movl $0x0, %eax
cmpl %edi, %edx
jl 0xc420
movl 0x12514(%rip), %eax     # 0x1e934
addl %edx, %eax
xorl %edi, %edi
movl %ecx, %edx
movl %eax, %ecx
callq 0xd832
movl 0xb9d9(%rip), %ecx      # 0x17e0c
movq (%rsp), %rax
leal (%rax,%r14), %ebx
movl 0x124e7(%rip), %eax     # 0x1e928
addl %ecx, %eax
cmpl %eax, %ebx
jl 0xc481
movl 0xc(%rsp), %eax
testl %eax, %eax
movl %r13d, %esi
cmovel %eax, %esi
movl 0x124d7(%rip), %edx     # 0x1e930
movl 0x124d9(%rip), %eax     # 0x1e938
addl %r13d, %eax
addl 0x124c4(%rip), %ecx     # 0x1e92c
cmpl %ecx, %eax
jl 0xc472
movl 0x124c2(%rip), %eax     # 0x1e934
movl %ebx, %edi
movl %eax, %ecx
callq 0xd832
movl 0xb98b(%rip), %ecx      # 0x17e0c
cmpl $0x0, 0xc(%rsp)
jne 0xc49b
movq (%rsp), %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0xd832
movl 0xb971(%rip), %ecx      # 0x17e0c
movq %r14, 0x28(%rsp)
movl 0x12491(%rip), %r8d     # 0x1e938
movq %r13, 0x20(%rsp)
leal (%r8,%r13), %esi
addl 0x12476(%rip), %ecx     # 0x1e92c
cmpl %ecx, %esi
jl 0xc4d2
movl 0x12474(%rip), %ecx     # 0x1e934
movq (%rsp), %rdi
movl %ebx, %edx
callq 0xd832
movl 0x12466(%rip), %r8d     # 0x1e938
testb $0x40, %bpl
sete %bl
btl $0xb, 0x54(%rsp)
setae %r13b
testb $0x10, %bpl
movq %rbp, %rax
sete %bpl
testb $0x20, %al
sete %r14b
movq 0x40(%rsp), %rdi
movq (%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
callq 0xbbac
movq 0x1235d(%rip), %rdi     # 0x1e870
movsd 0x124b5(%rip), %xmm0    # 0x1e9d0
callq 0x64e0
movq 0x12349(%rip), %rdi     # 0x1e870
orb %r13b, %bpl
andb %bl, %bpl
xorb %r14b, %bpl
movq 0x18(%rsp), %rcx
cmoveq 0x10(%rsp), %rcx
movzwl 0x8(%rcx), %eax
cvtsi2sd %eax, %xmm0
movsd 0x46ed(%rip), %xmm3     # 0x10c38
divsd %xmm3, %xmm0
movzwl 0xa(%rcx), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm3, %xmm1
movzwl 0xc(%rcx), %eax
cvtsi2sd %eax, %xmm2
divsd %xmm3, %xmm2
callq 0x63e0
xorl %r13d, %r13d
testl %r15d, %r15d
cmovlel %r13d, %r15d
addq $0x8, %r12
pushq $0x1
popq %rbx
subq $0x1, %r15
jb 0xc5ba
movq -0x8(%r12), %rax
movq 0x8(%rax), %r14
cmpq %r14, %r13
je 0xc5a3
movq 0x122d8(%rip), %rdi     # 0x1e870
movq %r14, %rsi
callq 0x6450
movq %r14, %r13
movq 0x122c6(%rip), %rdi     # 0x1e870
movq %r12, %rsi
movl %ebx, %edx
callq 0x60a0
addq $0x20, %r12
jmp 0xc57d
movq 0x48(%rsp), %r15
testb $0x8, %r15b
movq 0x28(%rsp), %rbx
movq 0x20(%rsp), %r14
je 0xc5f7
movl 0x1210b(%rip), %eax     # 0x1e6e0
movl 0x12365(%rip), %ecx     # 0x1e940
addl %r14d, %ecx
leal (%rax,%rcx), %edx
incl %edx
pushq $0x1
popq %r8
movq 0x38(%rsp), %rdi
movq (%rsp), %rsi
movl %ebx, %ecx
callq 0xbbac
testb %r15b, %r15b
jns 0xc62b
addl 0x1233d(%rip), %r14d    # 0x1e940
movl 0x120d7(%rip), %eax     # 0x1e6e0
addl %eax, %eax
pushq $0x3
popq %rcx
cltd
idivl %ecx
addl %eax, %r14d
pushq $0x1
popq %r8
movq 0x38(%rsp), %rdi
movq (%rsp), %rsi
movl %r14d, %edx
movl %ebx, %ecx
callq 0xbbac
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq