// File: /workspace/github_c_makefile_star2_O2/jaimecgomezz[P]st/x.c
// Function: xdrawcursor
void xdrawcursor(
    int cx,
    int cy,
    Glyph g,
    int ox,
    int oy,
    Glyph og
    // >>>>>>>>>>>>>>>>>>>> ligatures
    // ==================== ligatures
    // ==================== ligatures
    // <<<<<<<<<<<<<<<<<<<< ligatures
  ) {
  Color drawcol;

  /* remove the old cursor */
  if (selected(ox, oy))
    // >>>>>>>>>>>>>>>>>>>> selection-colors
    // ==================== selection-colors
    og.mode ^= ATTR_REVERSE;
    // ==================== selection-colors
    // <<<<<<<<<<<<<<<<<<<< selection-colors

  // >>>>>>>>>>>>>>>>>>>> ligatures
  // ==================== ligatures
  xdrawglyph(og, ox, oy);
  // ==================== ligatures
  // <<<<<<<<<<<<<<<<<<<< ligatures

  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;
    // >>>>>>>>>>>>>>>>>>>> selection-colors
    // ==================== selection-colors
    // ==================== selection-colors
    // <<<<<<<<<<<<<<<<<<<< selection-colors
    g.bg = defaultfg;
    // >>>>>>>>>>>>>>>>>>>> selection-colors
    // ==================== selection-colors
    if (selected(cx, cy)) {
      drawcol = dc.col[defaultcs];
      g.fg = defaultrcs;
    } else {
      drawcol = dc.col[defaultrcs];
      g.fg = defaultcs;
    }
    // ==================== selection-colors
    // <<<<<<<<<<<<<<<<<<<< selection-colors
  } else {
    // >>>>>>>>>>>>>>>>>>>> selection-colors
    // ==================== selection-colors
    if (selected(cx, cy)) {
      g.fg = defaultfg;
      g.bg = defaultrcs;
    } else {
      g.fg = defaultbg;
      g.bg = defaultcs;
    }
    drawcol = dc.col[g.bg];
    // ==================== selection-colors
    // <<<<<<<<<<<<<<<<<<<< selection-colors
  }

  /* draw the new one */
  if (IS_SET(MODE_FOCUSED)) {
    switch (win.cursor) {
    case 0:         /* Blinking Block */
    case 1:         /* Blinking Block (Default) */
      // >>>>>>>>>>>>>>>>>>>> blinking-cursor
      // ==================== blinking-cursor
      // ==================== blinking-cursor
      // <<<<<<<<<<<<<<<<<<<< blinking-cursor
    case 2:         /* Steady Block */
      xdrawglyph(g, cx, cy);
      break;
    case 3: /* Blinking Underline */
      // >>>>>>>>>>>>>>>>>>>> blinking-cursor
      // ==================== blinking-cursor
      // ==================== blinking-cursor
      // <<<<<<<<<<<<<<<<<<<< blinking-cursor
    case 4: /* Steady Underline */
      XftDrawRect(
        xw.draw,
        &drawcol,
        // >>>>>>>>>>>>>>>>>>>> anysize
        // ==================== anysize
        borderpx + cx * win.cw,
        borderpx + (cy + 1) * win.ch - cursorthickness,
        // ==================== anysize
        // <<<<<<<<<<<<<<<<<<<< anysize
        win.cw,
        cursorthickness
      );
      break;
    case 5: /* Blinking bar */
      // >>>>>>>>>>>>>>>>>>>> blinking-cursor
      // ==================== blinking-cursor
      // ==================== blinking-cursor
      // <<<<<<<<<<<<<<<<<<<< blinking-cursor
    case 6: /* Steady bar */
      XftDrawRect(
        xw.draw,
        &drawcol,
        // >>>>>>>>>>>>>>>>>>>> anysize
        // ==================== anysize
        borderpx + cx * win.cw,
        borderpx + cy * win.ch,
        // ==================== anysize
        // <<<<<<<<<<<<<<<<<<<< anysize
        cursorthickness,
        win.ch
      );
      break;
    // >>>>>>>>>>>>>>>>>>>> blinking-cursor
    // ==================== blinking-cursor
    case 7:         /* st extension */
      g.u = 0x2603; /* snowman (U+2603) */
                    /* FALLTHROUGH */
    // ==================== blinking-cursor
    // <<<<<<<<<<<<<<<<<<<< blinking-cursor
    }
  } else {
    XftDrawRect(
      xw.draw,
      &drawcol,
      // >>>>>>>>>>>>>>>>>>>> anysize
      // ==================== anysize
      borderpx + cx * win.cw,
      borderpx + cy * win.ch,
      // ==================== anysize
      // <<<<<<<<<<<<<<<<<<<< anysize
      win.cw - 1,
      1
    );
    XftDrawRect(
      xw.draw,
      &drawcol,
      // >>>>>>>>>>>>>>>>>>>> anysize
      // ==================== anysize
      borderpx + cx * win.cw,
      borderpx + cy * win.ch,
      // ==================== anysize
      // <<<<<<<<<<<<<<<<<<<< anysize
      1,
      win.ch - 1
    );
    XftDrawRect(
      xw.draw,
      &drawcol,
      // >>>>>>>>>>>>>>>>>>>> anysize
      // ==================== anysize
      borderpx + (cx + 1) * win.cw - 1,
      borderpx + cy * win.ch,
      // ==================== anysize
      // <<<<<<<<<<<<<<<<<<<< anysize
      1,
      win.ch - 1
    );
    XftDrawRect(
      xw.draw,
      &drawcol,
      // >>>>>>>>>>>>>>>>>>>> anysize
      // ==================== anysize
      borderpx + cx * win.cw,
      borderpx + (cy + 1) * win.ch - 1,
      // ==================== anysize
      // <<<<<<<<<<<<<<<<<<<< anysize
      win.cw,
      1
    );
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %ebp
movl %r8d, %r12d
movq %rdx, %r15
movl %esi, %ebx
movl %edi, %r14d
leaq 0x50(%rsp), %r13
movl %r8d, %edi
movl %r9d, %esi
callq 0x5eaf
testl %eax, %eax
je 0x9974
xorb $0x20, 0x4(%r13)
movq (%r13), %rdi
movq 0x8(%r13), %rsi
movl %r12d, %edx
movl %ebp, %ecx
callq 0x9bcd
movl 0xd41c(%rip), %eax      # 0x16da8
testb %al, %al
js 0x9bbe
movq %r15, %r13
shrq $0x20, %r13
andl $0x28d, %r13d           # imm = 0x28D
testb $0x20, %al
jne 0x99eb
movl %r14d, %edi
movl %ebx, %esi
callq 0x5eaf
xorl %r12d, %r12d
testl %eax, %eax
leaq 0xd1d0(%rip), %rax      # 0x16b8c
leaq 0xab09(%rip), %rcx      # 0x144cc
cmoveq %rax, %rcx
sete %r12b
xorl $0x101, %r12d           # imm = 0x101
movq 0xd1bf(%rip), %rax      # 0x16b98
movl %r12d, %edx
shll $0x4, %edx
movups (%rax,%rdx), %xmm0
movl (%rcx), %eax
movaps %xmm0, (%rsp)
jmp 0x9a31
movzwl %r13w, %r13d
orl $0x20, %r13d
movl 0xaad2(%rip), %r12d     # 0x144cc
movl %r14d, %edi
movl %ebx, %esi
callq 0x5eaf
movq 0xd18d(%rip), %rcx      # 0x16b98
testl %eax, %eax
je 0x9a21
movups 0x1000(%rcx), %xmm0
movaps %xmm0, (%rsp)
movl $0x101, %eax            # imm = 0x101
jmp 0x9a31
movups 0x1010(%rcx), %xmm0
movaps %xmm0, (%rsp)
movl $0x100, %eax            # imm = 0x100
testb $0x2, 0xd370(%rip)      # 0x16da8
jne 0x9b0b
movq 0xd2b3(%rip), %rdi      # 0x16cf8
movl 0xd358(%rip), %r8d      # 0x16da4
movl %r8d, %edx
imull %r14d, %edx
addl $0x2, %edx
movl 0xd344(%rip), %ecx      # 0x16da0
imull %ebx, %ecx
addl $0x2, %ecx
decl %r8d
movq %rsp, %r15
pushq $0x1
popq %rbp
movq %r15, %rsi
movl %ebp, %r9d
callq 0x53b0
movq 0xd27b(%rip), %rdi      # 0x16cf8
movl 0xd321(%rip), %edx      # 0x16da4
imull %r14d, %edx
addl $0x2, %edx
movl 0xd30f(%rip), %r9d      # 0x16da0
movl %r9d, %ecx
imull %ebx, %ecx
addl $0x2, %ecx
decl %r9d
movq %r15, %rsi
movl %ebp, %r8d
callq 0x53b0
movq 0xd249(%rip), %rdi      # 0x16cf8
leal 0x1(%r14), %edx
imull 0xd2ea(%rip), %edx      # 0x16da4
incl %edx
movl 0xd2dd(%rip), %r9d      # 0x16da0
movl %r9d, %ecx
imull %ebx, %ecx
addl $0x2, %ecx
decl %r9d
movq %r15, %rsi
movl %ebp, %r8d
callq 0x53b0
movq 0xd217(%rip), %rdi      # 0x16cf8
movl 0xd2bc(%rip), %r8d      # 0x16da4
imull %r8d, %r14d
addl $0x2, %r14d
incl %ebx
imull 0xd2a7(%rip), %ebx      # 0x16da0
incl %ebx
movq %r15, %rsi
movl %r14d, %edx
movl %ebx, %ecx
movl %ebp, %r9d
jmp 0x9bb9
movl 0xd29b(%rip), %ecx      # 0x16dac
cmpl $0x6, %ecx
ja 0x9bbe
pushq $0x7
popq %rdx
btl %ecx, %edx
jb 0x9b52
pushq $0x18
popq %rax
btl %ecx, %eax
jae 0x9b8c
movq 0xd1c7(%rip), %rdi      # 0x16cf8
movl 0xd26c(%rip), %r8d      # 0x16da4
imull %r8d, %r14d
addl $0x2, %r14d
incl %ebx
imull 0xd257(%rip), %ebx      # 0x16da0
movq %rsp, %rsi
pushq $0x2
popq %r9
jmp 0x9bb4
movzwl %r13w, %ecx
shlq $0x20, %rcx
movabsq $-0xffff00000001, %rdx  # imm = 0xFFFF0000FFFFFFFF
andq %rdx, %r15
orq %rcx, %r15
shlq $0x20, %r12
orq %rax, %r12
movq %r15, %rdi
movq %r12, %rsi
movl %r14d, %edx
movl %ebx, %ecx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9bcd
movq 0xd165(%rip), %rdi      # 0x16cf8
imull 0xd209(%rip), %r14d     # 0x16da4
addl $0x2, %r14d
movl 0xd1fa(%rip), %r9d      # 0x16da0
imull %r9d, %ebx
addl $0x2, %ebx
movq %rsp, %rsi
pushq $0x2
popq %r8
movl %r14d, %edx
movl %ebx, %ecx
callq 0x53b0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq