// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl 0x28(%rbp), %eax
movq 0x20(%rbp), %rax
leaq 0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x8(%rbp)
movl %edi, -0x14(%rbp)
movl %esi, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movl -0x1c(%rbp), %edi
movl -0x20(%rbp), %esi
callq 0x72f0
cmpl $0x0, %eax
je 0xd28c
movq -0x38(%rbp), %rax
movzwl 0x4(%rax), %ecx
xorl $0x20, %ecx
movw %cx, 0x4(%rax)
movq 0x20(%rbp), %rdi
movl -0x20(%rbp), %edx
movl 0x28(%rbp), %ecx
xorl %esi, %esi
callq 0xd630
movl 0x18505(%rip), %eax     # 0x257a8
andl $0x80, %eax
cmpl $0x0, %eax
je 0xd2b2
jmp 0xd620
movzwl -0xc(%rbp), %eax
andl $0x28d, %eax            # imm = 0x28D
movw %ax, -0xc(%rbp)
movl 0x184e3(%rip), %eax     # 0x257a8
andl $0x20, %eax
cmpl $0x0, %eax
je 0xd351
movzwl -0xc(%rbp), %eax
orl $0x20, %eax
movw %ax, -0xc(%rbp)
movl 0x134ca(%rip), %eax     # 0x207ac
movl %eax, -0x4(%rbp)
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x72f0
cmpl $0x0, %eax
je 0xd323
movq 0x18294(%rip), %rax     # 0x25590
movl 0x134b2(%rip), %ecx     # 0x207b4
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl 0x1349a(%rip), %eax     # 0x207b8
movl %eax, -0x8(%rbp)
jmp 0xd34f
movq 0x18266(%rip), %rax     # 0x25590
movl 0x13488(%rip), %ecx     # 0x207b8
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl 0x13468(%rip), %eax     # 0x207b4
movl %eax, -0x8(%rbp)
jmp 0xd3a7
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x72f0
cmpl $0x0, %eax
je 0xd375
movl 0x13445(%rip), %eax     # 0x207ac
movl %eax, -0x8(%rbp)
movl 0x13448(%rip), %eax     # 0x207b8
movl %eax, -0x4(%rbp)
jmp 0xd387
movl 0x13435(%rip), %eax     # 0x207b0
movl %eax, -0x8(%rbp)
movl 0x13430(%rip), %eax     # 0x207b4
movl %eax, -0x4(%rbp)
movq 0x18202(%rip), %rax     # 0x25590
movl -0x4(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl 0x183fb(%rip), %eax     # 0x257a8
andl $0x2, %eax
cmpl $0x0, %eax
je 0xd504
movl 0x183ed(%rip), %eax     # 0x257ac
movq %rax, -0x40(%rbp)
subq $0x8, %rax
ja 0xd4ff
movq -0x40(%rbp), %rax
leaq 0x68f4(%rip), %rcx      # 0x13ccc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x183c1(%rip), %eax     # 0x257a8
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xd3f6
jmp 0xd4ff
jmp 0xd3f8
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xd7d0
jmp 0xd4ff
movl 0x18392(%rip), %eax     # 0x257a8
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xd425
jmp 0xd4ff
jmp 0xd427
movq 0x182ca(%rip), %rdi     # 0x256f8
movl 0x13bd8(%rip), %edx     # 0x2100c
movl -0x14(%rbp), %eax
imull 0x18366(%rip), %eax     # 0x257a4
addl %eax, %edx
movl 0x13bc6(%rip), %ecx     # 0x2100c
movl -0x18(%rbp), %eax
addl $0x1, %eax
imull 0x1834d(%rip), %eax     # 0x257a0
addl %eax, %ecx
subl 0x13ef5(%rip), %ecx     # 0x21350
movl 0x18342(%rip), %r8d     # 0x257a4
movl 0x13ee7(%rip), %r9d     # 0x21350
leaq -0x30(%rbp), %rsi
callq 0x6400
jmp 0xd4ff
movl 0x1832b(%rip), %eax     # 0x257a8
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xd489
jmp 0xd4ff
jmp 0xd48b
movq 0x18266(%rip), %rdi     # 0x256f8
movl 0x13b74(%rip), %edx     # 0x2100c
movl -0x14(%rbp), %eax
imull 0x18302(%rip), %eax     # 0x257a4
addl %eax, %edx
movl 0x13b62(%rip), %ecx     # 0x2100c
movl -0x18(%rbp), %eax
imull 0x182ec(%rip), %eax     # 0x257a0
addl %eax, %ecx
movl 0x13e93(%rip), %r8d     # 0x21350
movl 0x182dc(%rip), %r9d     # 0x257a0
leaq -0x30(%rbp), %rsi
callq 0x6400
jmp 0xd4ff
movl 0x182d3(%rip), %eax     # 0x257a8
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xd4e1
jmp 0xd4ff
jmp 0xd4e3
movl 0x13e6b(%rip), %eax     # 0x21354
movl %eax, -0x10(%rbp)
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xd7d0
jmp 0xd620
movq 0x181ed(%rip), %rdi     # 0x256f8
movl 0x13afb(%rip), %edx     # 0x2100c
movl -0x14(%rbp), %eax
imull 0x18289(%rip), %eax     # 0x257a4
addl %eax, %edx
movl 0x13ae9(%rip), %ecx     # 0x2100c
movl -0x18(%rbp), %eax
imull 0x18273(%rip), %eax     # 0x257a0
addl %eax, %ecx
movl 0x1826e(%rip), %r8d     # 0x257a4
subl $0x1, %r8d
leaq -0x30(%rbp), %rsi
movl $0x1, %r9d
callq 0x6400
movq 0x181a8(%rip), %rdi     # 0x256f8
movl 0x13ab6(%rip), %edx     # 0x2100c
movl -0x14(%rbp), %eax
imull 0x18244(%rip), %eax     # 0x257a4
addl %eax, %edx
movl 0x13aa4(%rip), %ecx     # 0x2100c
movl -0x18(%rbp), %eax
imull 0x1822e(%rip), %eax     # 0x257a0
addl %eax, %ecx
movl 0x18225(%rip), %r9d     # 0x257a0
subl $0x1, %r9d
leaq -0x30(%rbp), %rsi
movl $0x1, %r8d
callq 0x6400
movq 0x18163(%rip), %rdi     # 0x256f8
movl 0x13a71(%rip), %edx     # 0x2100c
movl -0x14(%rbp), %eax
addl $0x1, %eax
imull 0x181fc(%rip), %eax     # 0x257a4
addl %eax, %edx
subl $0x1, %edx
movl 0x13a59(%rip), %ecx     # 0x2100c
movl -0x18(%rbp), %eax
imull 0x181e3(%rip), %eax     # 0x257a0
addl %eax, %ecx
movl 0x181da(%rip), %r9d     # 0x257a0
subl $0x1, %r9d
leaq -0x30(%rbp), %rsi
movl $0x1, %r8d
callq 0x6400
movq 0x18118(%rip), %rdi     # 0x256f8
movl 0x13a26(%rip), %edx     # 0x2100c
movl -0x14(%rbp), %eax
imull 0x181b4(%rip), %eax     # 0x257a4
addl %eax, %edx
movl 0x13a14(%rip), %ecx     # 0x2100c
movl -0x18(%rbp), %eax
addl $0x1, %eax
imull 0x1819b(%rip), %eax     # 0x257a0
addl %eax, %ecx
subl $0x1, %ecx
movl 0x18193(%rip), %r8d     # 0x257a4
leaq -0x30(%rbp), %rsi
movl $0x1, %r9d
callq 0x6400
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)