// File: /workspace/github_c_makefile_star2_O1/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
movl 0x88(%rsp), %r12d
movq 0x80(%rsp), %r13
movl %r8d, %edi
movl %r9d, %esi
callq 0xa498
testl %eax, %eax
je 0xeb85
leaq 0x70(%rsp), %rax
xorb $0x20, 0x4(%rax)
movq %r13, %rdi
xorl %esi, %esi
movl %ebp, %edx
movl %r12d, %ecx
callq 0xee51
movl 0x17ca6(%rip), %eax     # 0x26840
testb %al, %al
js 0xee42
movq %r15, %r12
shrq $0x20, %r12
andl $0x28d, %r12d           # imm = 0x28D
testb $0x20, %al
jne 0xebfa
movl %ebx, %edi
movl %r14d, %esi
callq 0xa498
testl %eax, %eax
movl $0x101, %r13d           # imm = 0x101
cmovel 0x109b6(%rip), %r13d    # 0x1f584
leaq 0x109ab(%rip), %rax     # 0x1f580
leaq 0x109a0(%rip), %rcx     # 0x1f57c
cmoveq %rax, %rcx
movl (%rcx), %eax
movq 0x17a3f(%rip), %rcx     # 0x26628
movq %r13, %rdx
shlq $0x4, %rdx
movups (%rcx,%rdx), %xmm0
movaps %xmm0, (%rsp)
jmp 0xec48
movzwl %r12w, %r12d
orl $0x20, %r12d
movl 0x10973(%rip), %r13d    # 0x1f57c
movl %ebx, %edi
movl %r14d, %esi
callq 0xa498
movq 0x17a0e(%rip), %rcx     # 0x26628
testl %eax, %eax
je 0xec37
movl 0x10960(%rip), %eax     # 0x1f584
shlq $0x4, %rax
movups (%rcx,%rax), %xmm0
movaps %xmm0, (%rsp)
movl $0x101, %eax            # imm = 0x101
jmp 0xec48
movups 0x1010(%rcx), %xmm0
movaps %xmm0, (%rsp)
movl 0x1093c(%rip), %eax     # 0x1f584
testb $0x2, 0x17bf1(%rip)     # 0x26840
jne 0xed47
movq 0x17b34(%rip), %rdi     # 0x26790
movl 0x1116a(%rip), %eax     # 0x1fdcc
movl 0x17bd3(%rip), %r8d     # 0x2683c
movl %r8d, %edx
imull %ebx, %edx
addl %eax, %edx
movl 0x17bc1(%rip), %ecx     # 0x26838
imull %r14d, %ecx
addl %eax, %ecx
decl %r8d
movq %rsp, %r15
movq %r15, %rsi
movl $0x1, %r9d
callq 0x9410
movq 0x17af8(%rip), %rdi     # 0x26790
movl 0x1112e(%rip), %eax     # 0x1fdcc
movl 0x17b98(%rip), %edx     # 0x2683c
imull %ebx, %edx
addl %eax, %edx
movl 0x17b88(%rip), %r9d     # 0x26838
movl %r9d, %ecx
imull %r14d, %ecx
addl %eax, %ecx
decl %r9d
movq %r15, %rsi
movl $0x1, %r8d
callq 0x9410
movq 0x17abf(%rip), %rdi     # 0x26790
movl 0x110f5(%rip), %eax     # 0x1fdcc
leal 0x1(%rbx), %ecx
imull 0x17b5b(%rip), %ecx     # 0x2683c
leal (%rax,%rcx), %edx
decl %edx
movl 0x17b4b(%rip), %r9d     # 0x26838
movl %r9d, %ecx
imull %r14d, %ecx
addl %eax, %ecx
decl %r9d
movq %r15, %rsi
movl $0x1, %r8d
callq 0x9410
movq 0x17a82(%rip), %rdi     # 0x26790
movl 0x110b8(%rip), %eax     # 0x1fdcc
movl 0x17b21(%rip), %r8d     # 0x2683c
imull %r8d, %ebx
addl %eax, %ebx
incl %r14d
imull 0x17b0c(%rip), %r14d    # 0x26838
leal (%rax,%r14), %ecx
decl %ecx
movq %r15, %rsi
movl %ebx, %edx
movl $0x1, %r9d
callq 0x9410
jmp 0xee42
movl 0x17af7(%rip), %ecx     # 0x26844
cmpq $0x7, %rcx
ja 0xee42
leaq 0x4e02(%rip), %rdx      # 0x13b60
movslq (%rdx,%rcx,4), %rsi
addq %rdx, %rsi
movq %r15, %rcx
jmpq *%rsi
movq 0x17a1f(%rip), %rdi     # 0x26790
movl 0x11055(%rip), %eax     # 0x1fdcc
movl 0x17abe(%rip), %r8d     # 0x2683c
imull %r8d, %ebx
addl %eax, %ebx
incl %r14d
imull 0x17aa9(%rip), %r14d    # 0x26838
leal (%rax,%r14), %ecx
addl $-0x2, %ecx
movq %rsp, %rsi
movl %ebx, %edx
movl $0x2, %r9d
jmp 0xed3d
movq 0x179e6(%rip), %rdi     # 0x26790
movl 0x1101c(%rip), %eax     # 0x1fdcc
imull 0x17a85(%rip), %ebx     # 0x2683c
addl %eax, %ebx
movl 0x17a78(%rip), %r9d     # 0x26838
imull %r9d, %r14d
addl %eax, %r14d
movq %rsp, %rsi
movl %ebx, %edx
movl %r14d, %ecx
movl $0x2, %r8d
jmp 0xed3d
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 0xf143
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r12, %rdi
movl %eax, %ecx
movl %ebx, %r8d
movl %r14d, %r9d
callq 0xf594
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq