// File: /workspace/github_c_makefile_star2_O2/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 0x9fff
movq %r12, %rdi
xorl %esi, %esi
movl %ebp, %edx
movl %r13d, %ecx
callq 0xe595
movl 0x17553(%rip), %eax     # 0x25840
testb %al, %al
js 0xe586
movq %r15, %r12
shrq $0x20, %r12
andl $0x28d, %r12d           # imm = 0x28D
testb $0x20, %al
jne 0xe34d
movl %ebx, %edi
movl %r14d, %esi
callq 0x9fff
testl %eax, %eax
movl $0x101, %r13d           # imm = 0x101
cmovel 0x10263(%rip), %r13d    # 0x1e584
leaq 0x10258(%rip), %rax     # 0x1e580
leaq 0x1024d(%rip), %rcx     # 0x1e57c
cmoveq %rax, %rcx
movl (%rcx), %eax
movq 0x172ec(%rip), %rcx     # 0x25628
movq %r13, %rdx
shlq $0x4, %rdx
movups (%rcx,%rdx), %xmm0
movaps %xmm0, (%rsp)
jmp 0xe39b
movzwl %r12w, %r12d
orl $0x20, %r12d
movl 0x10220(%rip), %r13d    # 0x1e57c
movl %ebx, %edi
movl %r14d, %esi
callq 0x9fff
movq 0x172bb(%rip), %rcx     # 0x25628
testl %eax, %eax
je 0xe38a
movl 0x1020d(%rip), %eax     # 0x1e584
shlq $0x4, %rax
movups (%rcx,%rax), %xmm0
movaps %xmm0, (%rsp)
movl $0x101, %eax            # imm = 0x101
jmp 0xe39b
movups 0x1010(%rcx), %xmm0
movaps %xmm0, (%rsp)
movl 0x101e9(%rip), %eax     # 0x1e584
testb $0x2, 0x1749e(%rip)     # 0x25840
jne 0xe491
movq 0x173e1(%rip), %rdi     # 0x25790
movl 0x10a17(%rip), %eax     # 0x1edcc
movl 0x17480(%rip), %r8d     # 0x2583c
movl %r8d, %edx
imull %ebx, %edx
addl %eax, %edx
movl 0x1746e(%rip), %ecx     # 0x25838
imull %r14d, %ecx
addl %eax, %ecx
decl %r8d
movq %rsp, %r15
pushq $0x1
popq %rbp
movq %r15, %rsi
movl %ebp, %r9d
callq 0x9410
movq 0x173a5(%rip), %rdi     # 0x25790
movl 0x109db(%rip), %eax     # 0x1edcc
movl 0x17445(%rip), %edx     # 0x2583c
imull %ebx, %edx
addl %eax, %edx
movl 0x17435(%rip), %r9d     # 0x25838
movl %r9d, %ecx
imull %r14d, %ecx
addl %eax, %ecx
decl %r9d
movq %r15, %rsi
movl %ebp, %r8d
callq 0x9410
movq 0x1736f(%rip), %rdi     # 0x25790
movl 0x109a5(%rip), %eax     # 0x1edcc
leal 0x1(%rbx), %ecx
imull 0x1740b(%rip), %ecx     # 0x2583c
leal (%rax,%rcx), %edx
decl %edx
movl 0x173fb(%rip), %r9d     # 0x25838
movl %r9d, %ecx
imull %r14d, %ecx
addl %eax, %ecx
decl %r9d
movq %r15, %rsi
movl %ebp, %r8d
callq 0x9410
movq 0x17335(%rip), %rdi     # 0x25790
movl 0x1096b(%rip), %eax     # 0x1edcc
movl 0x173d4(%rip), %r8d     # 0x2583c
imull %r8d, %ebx
addl %eax, %ebx
incl %r14d
imull 0x173bf(%rip), %r14d    # 0x25838
leal (%rax,%r14), %ecx
decl %ecx
movq %r15, %rsi
movl %ebx, %edx
movl %ebp, %r9d
callq 0x9410
jmp 0xe586
movl 0x173ad(%rip), %ecx     # 0x25844
cmpq $0x7, %rcx
ja 0xe586
leaq 0x46b8(%rip), %rdx      # 0x12b60
movslq (%rdx,%rcx,4), %rsi
addq %rdx, %rsi
movq %r15, %rcx
jmpq *%rsi
movq 0x172d5(%rip), %rdi     # 0x25790
movl 0x1090b(%rip), %eax     # 0x1edcc
movl 0x17374(%rip), %r8d     # 0x2583c
imull %r8d, %ebx
addl %eax, %ebx
incl %r14d
imull 0x1735f(%rip), %r14d    # 0x25838
leal (%rax,%r14), %ecx
addl $-0x2, %ecx
movq %rsp, %rsi
pushq $0x2
popq %r9
movl %ebx, %edx
jmp 0xe487
movq 0x1729e(%rip), %rdi     # 0x25790
movl 0x108d4(%rip), %eax     # 0x1edcc
imull 0x1733d(%rip), %ebx     # 0x2583c
addl %eax, %ebx
movl 0x17330(%rip), %r9d     # 0x25838
imull %r9d, %r14d
addl %eax, %r14d
movq %rsp, %rsi
pushq $0x2
popq %r8
movl %ebx, %edx
movl %r14d, %ecx
jmp 0xe487
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
pushq $0x1
popq %rdx
movq %r12, %rdi
movq %r15, %rsi
movl %ebx, %ecx
movl %r14d, %r8d
callq 0xe865
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r12, %rdi
movl %eax, %ecx
movl %ebx, %r8d
movl %r14d, %r9d
callq 0xec7f
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq