// File: /workspace/github_c_makefile_star2_O3/s1n7ax[P]st/x.c
// Function: xdrawcursor
void
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len)
{
	Color drawcol;

	/* remove the old cursor */
	if (selected(ox, oy))
		og.mode ^= ATTR_REVERSE;

	/* Redraw the line where cursor was previously.
	 * It will restore the ligatures broken by the cursor. */
	xdrawline(line, 0, oy, len);

	if (IS_SET(MODE_HIDE))
		return;

	/*
	 * Select the right color for the right mode.
	 */
	g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE;

	if (IS_SET(MODE_REVERSE)) {
		g.mode |= ATTR_REVERSE;
		g.bg = defaultfg;
		if (selected(cx, cy)) {
			drawcol = dc.col[defaultcs];
			g.fg = defaultrcs;
		} else {
			drawcol = dc.col[defaultrcs];
			g.fg = defaultcs;
		}
	} else {
		if (selected(cx, cy)) {
			g.fg = defaultfg;
			g.bg = defaultrcs;
		} else {
			g.fg = defaultbg;
			g.bg = defaultcs;
		}
		drawcol = dc.col[g.bg];
	}

	/* draw the new one */
	if (IS_SET(MODE_FOCUSED)) {
		switch (win.cursor) {
		case 7: /* st extension */
			g.u = 0x2603; /* snowman (U+2603) */
			/* FALLTHROUGH */
		case 0: /* Blinking Block */
		case 1: /* Blinking Block (Default) */
		case 2: /* Steady Block */
			xdrawglyph(g, cx, cy);
			break;
		case 3: /* Blinking Underline */
		case 4: /* Steady Underline */
			XftDrawRect(xw.draw, &drawcol,
					borderpx + cx * win.cw,
					borderpx + (cy + 1) * win.ch - \
						cursorthickness,
					win.cw, cursorthickness);
			break;
		case 5: /* Blinking bar */
		case 6: /* Steady bar */
			XftDrawRect(xw.draw, &drawcol,
					borderpx + cx * win.cw,
					borderpx + cy * win.ch,
					cursorthickness, win.ch);
			break;
		}
	} else {
		XftDrawRect(xw.draw, &drawcol,
				borderpx + cx * win.cw,
				borderpx + cy * win.ch,
				win.cw - 1, 1);
		XftDrawRect(xw.draw, &drawcol,
				borderpx + cx * win.cw,
				borderpx + cy * win.ch,
				1, win.ch - 1);
		XftDrawRect(xw.draw, &drawcol,
				borderpx + (cx + 1) * win.cw - 1,
				borderpx + cy * win.ch,
				1, win.ch - 1);
		XftDrawRect(xw.draw, &drawcol,
				borderpx + cx * win.cw,
				borderpx + (cy + 1) * win.ch - 1,
				win.cw, 1);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r9d, %ebp
movq %rdx, %r15
movl %esi, %r14d
movl %edi, %ebx
movq 0x80(%rsp), %r12
movl 0x88(%rsp), %r13d
movl %r8d, %edi
movl %r9d, %esi
callq 0xa56e
movq %r12, %rdi
xorl %esi, %esi
movl %ebp, %edx
movl %r13d, %ecx
callq 0xf4ce
movl 0x17629(%rip), %eax     # 0x26840
testb %al, %al
js 0xf4bf
movq %r15, %r12
shrq $0x20, %r12
andl $0x28d, %r12d           # imm = 0x28D
testb $0x20, %al
jne 0xf277
movl %ebx, %edi
movl %r14d, %esi
callq 0xa56e
testl %eax, %eax
movl $0x101, %r13d           # imm = 0x101
cmovel 0x10339(%rip), %r13d    # 0x1f584
leaq 0x1032e(%rip), %rax     # 0x1f580
leaq 0x10323(%rip), %rcx     # 0x1f57c
cmoveq %rax, %rcx
movl (%rcx), %eax
movq 0x173c2(%rip), %rcx     # 0x26628
movq %r13, %rdx
shlq $0x4, %rdx
movups (%rcx,%rdx), %xmm0
movaps %xmm0, (%rsp)
jmp 0xf2c5
movzwl %r12w, %r12d
orl $0x20, %r12d
movl 0x102f6(%rip), %r13d    # 0x1f57c
movl %ebx, %edi
movl %r14d, %esi
callq 0xa56e
movq 0x17391(%rip), %rcx     # 0x26628
testl %eax, %eax
je 0xf2b4
movl 0x102e3(%rip), %eax     # 0x1f584
shlq $0x4, %rax
movups (%rcx,%rax), %xmm0
movaps %xmm0, (%rsp)
movl $0x101, %eax            # imm = 0x101
jmp 0xf2c5
movups 0x1010(%rcx), %xmm0
movaps %xmm0, (%rsp)
movl 0x102bf(%rip), %eax     # 0x1f584
testb $0x2, 0x17574(%rip)     # 0x26840
jne 0xf3c4
movq 0x174b7(%rip), %rdi     # 0x26790
movl 0x10aed(%rip), %eax     # 0x1fdcc
movl 0x17556(%rip), %r8d     # 0x2683c
movl %r8d, %edx
imull %ebx, %edx
addl %eax, %edx
movl 0x17544(%rip), %ecx     # 0x26838
imull %r14d, %ecx
addl %eax, %ecx
decl %r8d
movq %rsp, %r15
movq %r15, %rsi
movl $0x1, %r9d
callq 0x9410
movq 0x1747b(%rip), %rdi     # 0x26790
movl 0x10ab1(%rip), %eax     # 0x1fdcc
movl 0x1751b(%rip), %edx     # 0x2683c
imull %ebx, %edx
addl %eax, %edx
movl 0x1750b(%rip), %r9d     # 0x26838
movl %r9d, %ecx
imull %r14d, %ecx
addl %eax, %ecx
decl %r9d
movq %r15, %rsi
movl $0x1, %r8d
callq 0x9410
movq 0x17442(%rip), %rdi     # 0x26790
movl 0x10a78(%rip), %eax     # 0x1fdcc
leal 0x1(%rbx), %ecx
imull 0x174de(%rip), %ecx     # 0x2683c
leal (%rax,%rcx), %edx
decl %edx
movl 0x174ce(%rip), %r9d     # 0x26838
movl %r9d, %ecx
imull %r14d, %ecx
addl %eax, %ecx
decl %r9d
movq %r15, %rsi
movl $0x1, %r8d
callq 0x9410
movq 0x17405(%rip), %rdi     # 0x26790
movl 0x10a3b(%rip), %eax     # 0x1fdcc
movl 0x174a4(%rip), %r8d     # 0x2683c
imull %r8d, %ebx
addl %eax, %ebx
incl %r14d
imull 0x1748f(%rip), %r14d    # 0x26838
leal (%rax,%r14), %ecx
decl %ecx
movq %r15, %rsi
movl %ebx, %edx
movl $0x1, %r9d
callq 0x9410
jmp 0xf4bf
movl 0x1747a(%rip), %ecx     # 0x26844
cmpq $0x7, %rcx
ja 0xf4bf
leaq 0x47b5(%rip), %rdx      # 0x13b90
movslq (%rdx,%rcx,4), %rsi
addq %rdx, %rsi
movq %r15, %rcx
jmpq *%rsi
movq 0x173a2(%rip), %rdi     # 0x26790
movl 0x109d8(%rip), %eax     # 0x1fdcc
movl 0x17441(%rip), %r8d     # 0x2683c
imull %r8d, %ebx
addl %eax, %ebx
incl %r14d
imull 0x1742c(%rip), %r14d    # 0x26838
leal (%rax,%r14), %ecx
addl $-0x2, %ecx
movq %rsp, %rsi
movl %ebx, %edx
movl $0x2, %r9d
jmp 0xf3ba
movq 0x17369(%rip), %rdi     # 0x26790
movl 0x1099f(%rip), %eax     # 0x1fdcc
imull 0x17408(%rip), %ebx     # 0x2683c
addl %eax, %ebx
movl 0x173fb(%rip), %r9d     # 0x26838
imull %r9d, %r14d
addl %eax, %r14d
movq %rsp, %rsi
movl %ebx, %edx
movl %r14d, %ecx
movl $0x2, %r8d
jmp 0xf3ba
movl $0x2603, %ecx           # imm = 0x2603
movabsq $-0x1000000000000, %rdx # imm = 0xFFFF000000000000
andq %rdx, %r15
movzwl %r12w, %edx
shlq $0x20, %rdx
movl %ecx, %ecx
orq %r15, %rcx
orq %rdx, %rcx
shlq $0x20, %r13
movl %eax, %eax
orq %r13, %rax
leaq 0x28(%rsp), %r15
movq %rcx, (%r15)
movq %rax, 0x8(%r15)
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movl $0x1, %edx
movl %ebx, %ecx
movl %r14d, %r8d
callq 0xf7b6
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r12, %rdi
movl %eax, %ecx
movl %ebx, %r8d
movl %r14d, %r9d
callq 0xfc0d
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq