// File: /workspace/github_c_makefile_star2_O3/spacifici[P]st/src/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 0: /* Blinking block */
		case 1: /* Blinking block (default) */
			if (IS_SET(MODE_BLINK))
				break;
			/* FALLTHROUGH */
		case 2: /* Steady block */
			xdrawglyph(g, cx, cy);
			break;
		case 3: /* Blinking underline */
			if (IS_SET(MODE_BLINK))
				break;
			/* FALLTHROUGH */
		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 */
			if (IS_SET(MODE_BLINK))
				break;
			/* FALLTHROUGH */
		case 6: /* Steady bar */
			XftDrawRect(xw.draw, &drawcol,
					borderpx + cx * win.cw,
					borderpx + cy * win.ch,
					cursorthickness, win.ch);
			break;
		case 7: /* Blinking st cursor */
			if (IS_SET(MODE_BLINK))
				break;
			/* FALLTHROUGH */
		case 8: /* Steady st cursor */
			g.u = stcursor;
			xdrawglyph(g, cx, cy);
			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 $0x18, %rsp
movl %r9d, %ebp
movq %rdx, %r15
movl %esi, %r14d
movl %edi, %ebx
movq 0x60(%rsp), %r12
movl 0x68(%rsp), %r13d
movl %r8d, %edi
movl %r9d, %esi
callq 0x752e
movq %r12, %rdi
xorl %esi, %esi
movl %ebp, %edx
movl %r13d, %ecx
callq 0xb759
movl 0x16580(%rip), %eax     # 0x219f8
testb %al, %al
js 0xb631
movq %r15, %r12
shrq $0x20, %r12
andl $0x28d, %r12d           # imm = 0x28D
testb $0x20, %al
jne 0xb4df
movl %ebx, %edi
movl %r14d, %esi
callq 0x752e
testl %eax, %eax
leaq 0x130df(%rip), %rax     # 0x1e584
leaq 0x130dc(%rip), %rcx     # 0x1e588
cmoveq %rax, %rcx
movl (%rcx), %r13d
leaq 0x130c6(%rip), %rax     # 0x1e580
leaq 0x130bb(%rip), %rcx     # 0x1e57c
cmoveq %rax, %rcx
movl (%rcx), %eax
movq 0x16312(%rip), %rcx     # 0x217e0
movq %r13, %rdx
shlq $0x4, %rdx
movups (%rcx,%rdx), %xmm0
movaps %xmm0, (%rsp)
jmp 0xb535
movzwl %r12w, %r12d
orl $0x20, %r12d
movl 0x1308e(%rip), %r13d    # 0x1e57c
movl %ebx, %edi
movl %r14d, %esi
callq 0x752e
movq 0x162e1(%rip), %rcx     # 0x217e0
testl %eax, %eax
je 0xb51d
movl 0x1307b(%rip), %eax     # 0x1e584
shlq $0x4, %rax
movups (%rcx,%rax), %xmm0
movaps %xmm0, (%rsp)
movl 0x1306d(%rip), %eax     # 0x1e588
jmp 0xb535
movl 0x13065(%rip), %eax     # 0x1e588
shlq $0x4, %rax
movups (%rcx,%rax), %xmm0
movaps %xmm0, (%rsp)
movl 0x1304f(%rip), %eax     # 0x1e584
movl 0x164bd(%rip), %ecx     # 0x219f8
testb $0x2, %cl
jne 0xb640
movq 0x163fd(%rip), %rdi     # 0x21948
movl 0x1388b(%rip), %eax     # 0x1eddc
movl 0x1649c(%rip), %r8d     # 0x219f4
movl %r8d, %edx
imull %ebx, %edx
addl %eax, %edx
movl 0x1648a(%rip), %ecx     # 0x219f0
imull %r14d, %ecx
addl %eax, %ecx
decl %r8d
movq %rsp, %r15
movq %r15, %rsi
movl $0x1, %r9d
callq 0x6400
movq 0x163c1(%rip), %rdi     # 0x21948
movl 0x1384f(%rip), %eax     # 0x1eddc
movl 0x16461(%rip), %edx     # 0x219f4
imull %ebx, %edx
addl %eax, %edx
movl 0x16451(%rip), %r9d     # 0x219f0
movl %r9d, %ecx
imull %r14d, %ecx
addl %eax, %ecx
decl %r9d
movq %r15, %rsi
movl $0x1, %r8d
callq 0x6400
movq 0x16388(%rip), %rdi     # 0x21948
movl 0x13816(%rip), %eax     # 0x1eddc
leal 0x1(%rbx), %ecx
imull 0x16424(%rip), %ecx     # 0x219f4
leal (%rax,%rcx), %edx
decl %edx
movl 0x16414(%rip), %r9d     # 0x219f0
movl %r9d, %ecx
imull %r14d, %ecx
addl %eax, %ecx
decl %r9d
movq %r15, %rsi
movl $0x1, %r8d
callq 0x6400
movq 0x1634b(%rip), %rdi     # 0x21948
movl 0x137d9(%rip), %eax     # 0x1eddc
movl 0x163ea(%rip), %r8d     # 0x219f4
imull %r8d, %ebx
addl %eax, %ebx
incl %r14d
imull 0x163d5(%rip), %r14d    # 0x219f0
leal (%rax,%r14), %ecx
decl %ecx
movq %r15, %rsi
movl %ebx, %edx
movl $0x1, %r9d
callq 0x6400
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x163b6(%rip), %edx     # 0x219fc
cmpq $0x8, %rdx
ja 0xb631
leaq 0x441d(%rip), %rsi      # 0xfa70
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
btl $0xb, %ecx
jb 0xb631
movzwl %r12w, %ecx
shlq $0x20, %rcx
movabsq $-0xffff00000001, %rdx  # imm = 0xFFFF0000FFFFFFFF
andq %rdx, %r15
orq %rcx, %r15
shlq $0x20, %r13
movl %eax, %esi
orq %r13, %rsi
movq %r15, %rdi
jmp 0xb741
btl $0xb, %ecx
jb 0xb631
movq 0x162b0(%rip), %rdi     # 0x21948
movl 0x1373e(%rip), %eax     # 0x1eddc
movl 0x1634f(%rip), %r8d     # 0x219f4
imull %r8d, %ebx
addl %eax, %ebx
incl %r14d
imull 0x1633a(%rip), %r14d    # 0x219f0
leal (%rax,%r14), %ecx
addl $-0x2, %ecx
movq %rsp, %rsi
movl %ebx, %edx
movl $0x2, %r9d
jmp 0xb62c
btl $0xb, %ecx
jb 0xb631
movq 0x1626a(%rip), %rdi     # 0x21948
movl 0x136f8(%rip), %eax     # 0x1eddc
imull 0x16309(%rip), %ebx     # 0x219f4
addl %eax, %ebx
movl 0x162fc(%rip), %r9d     # 0x219f0
imull %r9d, %r14d
addl %eax, %r14d
movq %rsp, %rsi
movl %ebx, %edx
movl %r14d, %ecx
movl $0x2, %r8d
jmp 0xb62c
btl $0xb, %ecx
jb 0xb631
movabsq $-0x1000000000000, %rcx # imm = 0xFFFF000000000000
andq %rcx, %r15
movzwl %r12w, %ecx
shlq $0x20, %rcx
leaq (%rcx,%r15), %rdi
addq $0x2603, %rdi           # imm = 0x2603
shlq $0x20, %r13
movl %eax, %esi
orq %r13, %rsi
movl %ebx, %edx
movl %r14d, %ecx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb93b