// File: /workspace/github_c_makefile_star2_O0/khuedoan[P]st/x.c
// Function: xdrawcursor
void
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
{
	Color drawcol;

	/* remove the old cursor */
	if (selected(ox, oy))
		og.mode ^= ATTR_REVERSE;
	xdrawglyph(og, ox, oy);

	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
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 0x6200
cmpl $0x0, %eax
je 0xc8e5
movq -0x38(%rbp), %rax
movzwl 0x4(%rax), %ecx
xorl $0x20, %ecx
movw %cx, 0x4(%rax)
movq -0x38(%rbp), %rax
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
movq (%rax), %rdi
movq 0x8(%rax), %rsi
callq 0xcc90
movl 0x139ff(%rip), %eax     # 0x20300
andl $0x80, %eax
cmpl $0x0, %eax
je 0xc910
jmp 0xcc7e
movzwl -0xc(%rbp), %eax
andl $0x28d, %eax            # imm = 0x28D
movw %ax, -0xc(%rbp)
movl 0x139dd(%rip), %eax     # 0x20300
andl $0x20, %eax
cmpl $0x0, %eax
je 0xc9af
movzwl -0xc(%rbp), %eax
orl $0x20, %eax
movw %ax, -0xc(%rbp)
movl 0xadec(%rip), %eax      # 0x1772c
movl %eax, -0x4(%rbp)
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x6200
cmpl $0x0, %eax
je 0xc981
movq 0x13796(%rip), %rax     # 0x200f0
movl 0xb5f0(%rip), %ecx      # 0x17f50
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl 0xb5d8(%rip), %eax      # 0x17f54
movl %eax, -0x8(%rbp)
jmp 0xc9ad
movq 0x13768(%rip), %rax     # 0x200f0
movl 0xb5c6(%rip), %ecx      # 0x17f54
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movl 0xb5a6(%rip), %eax      # 0x17f50
movl %eax, -0x8(%rbp)
jmp 0xca05
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x6200
cmpl $0x0, %eax
je 0xc9d3
movl 0xad67(%rip), %eax      # 0x1772c
movl %eax, -0x8(%rbp)
movl 0xb586(%rip), %eax      # 0x17f54
movl %eax, -0x4(%rbp)
jmp 0xc9e5
movl 0xad57(%rip), %eax      # 0x17730
movl %eax, -0x8(%rbp)
movl 0xb56e(%rip), %eax      # 0x17f50
movl %eax, -0x4(%rbp)
movq 0x13704(%rip), %rax     # 0x200f0
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 0x138f5(%rip), %eax     # 0x20300
andl $0x2, %eax
cmpl $0x0, %eax
je 0xcb62
movl 0x138e7(%rip), %eax     # 0x20304
movq %rax, -0x40(%rbp)
subq $0x8, %rax
ja 0xcb5d
movq -0x40(%rbp), %rax
leaq 0x62a6(%rip), %rcx      # 0x12cdc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x138bb(%rip), %eax     # 0x20300
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xca54
jmp 0xcb5d
jmp 0xca56
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xcc90
jmp 0xcb5d
movl 0x1388c(%rip), %eax     # 0x20300
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xca83
jmp 0xcb5d
jmp 0xca85
movq 0x137c4(%rip), %rdi     # 0x20250
movl 0x13876(%rip), %edx     # 0x20308
movl -0x14(%rbp), %eax
imull 0x13860(%rip), %eax     # 0x202fc
addl %eax, %edx
movl 0x13864(%rip), %ecx     # 0x20308
movl -0x18(%rbp), %eax
addl $0x1, %eax
imull 0x13847(%rip), %eax     # 0x202f8
addl %eax, %ecx
subl 0xb49f(%rip), %ecx      # 0x17f58
movl 0x1383c(%rip), %r8d     # 0x202fc
movl 0xb491(%rip), %r9d      # 0x17f58
leaq -0x30(%rbp), %rsi
callq 0x53e0
jmp 0xcb5d
movl 0x13825(%rip), %eax     # 0x20300
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xcae7
jmp 0xcb5d
jmp 0xcae9
movq 0x13760(%rip), %rdi     # 0x20250
movl 0x13812(%rip), %edx     # 0x20308
movl -0x14(%rbp), %eax
imull 0x137fc(%rip), %eax     # 0x202fc
addl %eax, %edx
movl 0x13800(%rip), %ecx     # 0x20308
movl -0x18(%rbp), %eax
imull 0x137e6(%rip), %eax     # 0x202f8
addl %eax, %ecx
movl 0xb43d(%rip), %r8d      # 0x17f58
movl 0x137d6(%rip), %r9d     # 0x202f8
leaq -0x30(%rbp), %rsi
callq 0x53e0
jmp 0xcb5d
movl 0x137cd(%rip), %eax     # 0x20300
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0xcb3f
jmp 0xcb5d
jmp 0xcb41
movl 0xb415(%rip), %eax      # 0x17f5c
movl %eax, -0x10(%rbp)
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xcc90
jmp 0xcc7e
movq 0x136e7(%rip), %rdi     # 0x20250
movl 0x13799(%rip), %edx     # 0x20308
movl -0x14(%rbp), %eax
imull 0x13783(%rip), %eax     # 0x202fc
addl %eax, %edx
movl 0x13787(%rip), %ecx     # 0x20308
movl -0x18(%rbp), %eax
imull 0x1376d(%rip), %eax     # 0x202f8
addl %eax, %ecx
movl 0x13768(%rip), %r8d     # 0x202fc
subl $0x1, %r8d
leaq -0x30(%rbp), %rsi
movl $0x1, %r9d
callq 0x53e0
movq 0x136a2(%rip), %rdi     # 0x20250
movl 0x13754(%rip), %edx     # 0x20308
movl -0x14(%rbp), %eax
imull 0x1373e(%rip), %eax     # 0x202fc
addl %eax, %edx
movl 0x13742(%rip), %ecx     # 0x20308
movl -0x18(%rbp), %eax
imull 0x13728(%rip), %eax     # 0x202f8
addl %eax, %ecx
movl 0x1371f(%rip), %r9d     # 0x202f8
subl $0x1, %r9d
leaq -0x30(%rbp), %rsi
movl $0x1, %r8d
callq 0x53e0
movq 0x1365d(%rip), %rdi     # 0x20250
movl 0x1370f(%rip), %edx     # 0x20308
movl -0x14(%rbp), %eax
addl $0x1, %eax
imull 0x136f6(%rip), %eax     # 0x202fc
addl %eax, %edx
subl $0x1, %edx
movl 0x136f7(%rip), %ecx     # 0x20308
movl -0x18(%rbp), %eax
imull 0x136dd(%rip), %eax     # 0x202f8
addl %eax, %ecx
movl 0x136d4(%rip), %r9d     # 0x202f8
subl $0x1, %r9d
leaq -0x30(%rbp), %rsi
movl $0x1, %r8d
callq 0x53e0
movq 0x13612(%rip), %rdi     # 0x20250
movl 0x136c4(%rip), %edx     # 0x20308
movl -0x14(%rbp), %eax
imull 0x136ae(%rip), %eax     # 0x202fc
addl %eax, %edx
movl 0x136b2(%rip), %ecx     # 0x20308
movl -0x18(%rbp), %eax
addl $0x1, %eax
imull 0x13695(%rip), %eax     # 0x202f8
addl %eax, %ecx
subl $0x1, %ecx
movl 0x1368d(%rip), %r8d     # 0x202fc
leaq -0x30(%rbp), %rsi
movl $0x1, %r9d
callq 0x53e0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)