// File: /workspace/github_c_makefile_star2_O0/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
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 0xa300
cmpl $0x0, %eax
je 0x10d7c
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 0x110b0
movl 0x19add(%rip), %eax     # 0x2a870
andl $0x80, %eax
cmpl $0x0, %eax
je 0x10da2
jmp 0x110a0
movzwl -0xc(%rbp), %eax
andl $0x28d, %eax            # imm = 0x28D
movw %ax, -0xc(%rbp)
movl 0x19abb(%rip), %eax     # 0x2a870
andl $0x20, %eax
cmpl $0x0, %eax
je 0x10e41
movzwl -0xc(%rbp), %eax
orl $0x20, %eax
movw %ax, -0xc(%rbp)
movl 0xc99a(%rip), %eax      # 0x1d76c
movl %eax, -0x4(%rbp)
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0xa300
cmpl $0x0, %eax
je 0x10e13
movq 0x1986c(%rip), %rax     # 0x2a658
movl 0xc982(%rip), %ecx      # 0x1d774
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl 0xd492(%rip), %eax      # 0x1e2a0
movl %eax, -0x8(%rbp)
jmp 0x10e3f
movq 0x1983e(%rip), %rax     # 0x2a658
movl 0xd480(%rip), %ecx      # 0x1e2a0
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl 0xc938(%rip), %eax      # 0x1d774
movl %eax, -0x8(%rbp)
jmp 0x10e97
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0xa300
cmpl $0x0, %eax
je 0x10e65
movl 0xc915(%rip), %eax      # 0x1d76c
movl %eax, -0x8(%rbp)
movl 0xd440(%rip), %eax      # 0x1e2a0
movl %eax, -0x4(%rbp)
jmp 0x10e77
movl 0xc905(%rip), %eax      # 0x1d770
movl %eax, -0x8(%rbp)
movl 0xc900(%rip), %eax      # 0x1d774
movl %eax, -0x4(%rbp)
movq 0x197da(%rip), %rax     # 0x2a658
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 0x199d3(%rip), %eax     # 0x2a870
andl $0x2, %eax
cmpl $0x0, %eax
je 0x10f84
movl 0x199c5(%rip), %eax     # 0x2a874
movq %rax, -0x40(%rbp)
subq $0x7, %rax
ja 0x10f7f
movq -0x40(%rbp), %rax
leaq 0x6f38(%rip), %rcx      # 0x17e00
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x2603, -0x10(%rbp)    # imm = 0x2603
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x11250
jmp 0x10f7f
movq 0x198c9(%rip), %rdi     # 0x2a7c0
movl 0xd0bf(%rip), %edx      # 0x1dfbc
movl -0x14(%rbp), %eax
imull 0x19965(%rip), %eax     # 0x2a86c
addl %eax, %edx
movl 0xd0ad(%rip), %ecx      # 0x1dfbc
movl -0x18(%rbp), %eax
addl $0x1, %eax
imull 0x1994c(%rip), %eax     # 0x2a868
addl %eax, %ecx
subl 0xd380(%rip), %ecx      # 0x1e2a4
movl 0x19941(%rip), %r8d     # 0x2a86c
movl 0xd372(%rip), %r9d      # 0x1e2a4
leaq -0x30(%rbp), %rsi
callq 0x9410
jmp 0x10f7f
movq 0x1987c(%rip), %rdi     # 0x2a7c0
movl 0xd072(%rip), %edx      # 0x1dfbc
movl -0x14(%rbp), %eax
imull 0x19918(%rip), %eax     # 0x2a86c
addl %eax, %edx
movl 0xd060(%rip), %ecx      # 0x1dfbc
movl -0x18(%rbp), %eax
imull 0x19902(%rip), %eax     # 0x2a868
addl %eax, %ecx
movl 0xd335(%rip), %r8d      # 0x1e2a4
movl 0x198f2(%rip), %r9d     # 0x2a868
leaq -0x30(%rbp), %rsi
callq 0x9410
jmp 0x110a0
movq 0x19835(%rip), %rdi     # 0x2a7c0
movl 0xd02b(%rip), %edx      # 0x1dfbc
movl -0x14(%rbp), %eax
imull 0x198d1(%rip), %eax     # 0x2a86c
addl %eax, %edx
movl 0xd019(%rip), %ecx      # 0x1dfbc
movl -0x18(%rbp), %eax
imull 0x198bb(%rip), %eax     # 0x2a868
addl %eax, %ecx
movl 0x198b6(%rip), %r8d     # 0x2a86c
subl $0x1, %r8d
leaq -0x30(%rbp), %rsi
movl $0x1, %r9d
callq 0x9410
movq 0x197f0(%rip), %rdi     # 0x2a7c0
movl 0xcfe6(%rip), %edx      # 0x1dfbc
movl -0x14(%rbp), %eax
imull 0x1988c(%rip), %eax     # 0x2a86c
addl %eax, %edx
movl 0xcfd4(%rip), %ecx      # 0x1dfbc
movl -0x18(%rbp), %eax
imull 0x19876(%rip), %eax     # 0x2a868
addl %eax, %ecx
movl 0x1986d(%rip), %r9d     # 0x2a868
subl $0x1, %r9d
leaq -0x30(%rbp), %rsi
movl $0x1, %r8d
callq 0x9410
movq 0x197ab(%rip), %rdi     # 0x2a7c0
movl 0xcfa1(%rip), %edx      # 0x1dfbc
movl -0x14(%rbp), %eax
addl $0x1, %eax
imull 0x19844(%rip), %eax     # 0x2a86c
addl %eax, %edx
subl $0x1, %edx
movl 0xcf89(%rip), %ecx      # 0x1dfbc
movl -0x18(%rbp), %eax
imull 0x1982b(%rip), %eax     # 0x2a868
addl %eax, %ecx
movl 0x19822(%rip), %r9d     # 0x2a868
subl $0x1, %r9d
leaq -0x30(%rbp), %rsi
movl $0x1, %r8d
callq 0x9410
movq 0x19760(%rip), %rdi     # 0x2a7c0
movl 0xcf56(%rip), %edx      # 0x1dfbc
movl -0x14(%rbp), %eax
imull 0x197fc(%rip), %eax     # 0x2a86c
addl %eax, %edx
movl 0xcf44(%rip), %ecx      # 0x1dfbc
movl -0x18(%rbp), %eax
addl $0x1, %eax
imull 0x197e3(%rip), %eax     # 0x2a868
addl %eax, %ecx
subl $0x1, %ecx
movl 0x197db(%rip), %r8d     # 0x2a86c
leaq -0x30(%rbp), %rsi
movl $0x1, %r9d
callq 0x9410
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)