// File: /workspace/github_c_makefile_star2_O2/mcaimi[P]st/st.c
// Function: draw
void
draw(void)
{
  int cx = term.c.x;
  int ocx = term.ocx, ocy = term.ocy;

  if (!xstartdraw())
    return;

  /* adjust cursor position */
  LIMIT(term.ocx, 0, term.col-1);
  LIMIT(term.ocy, 0, term.row-1);
  if (term.line[term.ocy][term.ocx].mode & ATTR_WDUMMY)
    term.ocx--;
  if (term.line[term.c.y][cx].mode & ATTR_WDUMMY)
    cx--;

  drawregion(0, 0, term.col, term.row);
  if (term.scr == 0) {
    xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
        term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
  }
  term.ocx = cx, term.ocy = term.c.y;
  xfinishdraw();

  // update xim cursor only if position is actually changed
  if (ocx != term.ocx || ocy != term.ocy)
    xximspot(term.ocx, term.ocy);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movslq 0x15c1d(%rip), %r12     # 0x1e6d8
movl 0x15c23(%rip), %ebp     # 0x1e6e4
movl 0x15c21(%rip), %ebx     # 0x1e6e8
callq 0xbef4
testl %eax, %eax
je 0x8c85
movl 0x15c0a(%rip), %edx     # 0x1e6e4
xorl %ecx, %ecx
movl $0x0, %eax
testl %edx, %edx
js 0x8af2
movl 0x15bb1(%rip), %eax     # 0x1e69c
decl %eax
cmpl %eax, %edx
cmovll %edx, %eax
movl %eax, 0x15bec(%rip)     # 0x1e6e4
movl 0x15bea(%rip), %edx     # 0x1e6e8
testl %edx, %edx
js 0x8b0f
movl 0x15b90(%rip), %ecx     # 0x1e698
decl %ecx
cmpl %ecx, %edx
cmovll %edx, %ecx
movl %ebp, 0x18(%rsp)
movl %ebx, 0x1c(%rsp)
movl %ecx, 0x15bcb(%rip)     # 0x1e6e8
movq 0x15b7c(%rip), %rdx     # 0x1e6a0
movslq %ecx, %rcx
movq (%rdx,%rcx,8), %rcx
movslq %eax, %rsi
shlq $0x4, %rsi
testb $0x4, 0x5(%rcx,%rsi)
je 0x8b41
decl %eax
movl %eax, 0x15ba3(%rip)     # 0x1e6e4
movslq 0x15b94(%rip), %rax     # 0x1e6dc
movq (%rdx,%rax,8), %rax
movq %r12, %rcx
shlq $0x4, %rcx
movl 0x4(%rax,%rcx), %eax
shll $0x5, %eax
movswl %ax, %r13d
sarl $0xf, %r13d
movl 0x15b34(%rip), %ebx     # 0x1e69c
movl 0x15b2a(%rip), %ebp     # 0x1e698
xorl %r14d, %r14d
testl %ebp, %ebp
cmovlel %r14d, %ebp
leaq 0x14a02(%rip), %r15     # 0x1d580
cmpq %rbp, %r14
je 0x8bed
movq 0x15b36(%rip), %rax     # 0x1e6c0
cmpl $0x0, (%rax,%r14,4)
je 0x8be8
andl $0x0, (%rax,%r14,4)
movslq 0x15b1f(%rip), %rax     # 0x1e6bc
cmpq %rax, %r14
jge 0x8bc6
movl (%r15), %ecx
movl %r14d, %edx
subl %eax, %edx
addl 0x15b08(%rip), %edx     # 0x1e6b8
leal (%rcx,%rdx), %eax
incl %eax
xorl %edx, %edx
divl %ecx
shlq $0x3, %rdx
addq 0x15aec(%rip), %rdx     # 0x1e6b0
jmp 0x8bd9
movl %r14d, %ecx
subl %eax, %ecx
movslq %ecx, %rdx
shlq $0x3, %rdx
addq 0x15ac7(%rip), %rdx     # 0x1e6a0
movq (%rdx), %rdi
xorl %esi, %esi
movl %r14d, %edx
movl %ebx, %ecx
callq 0xbefe
incq %r14
jmp 0x8b7e
addl %r13d, %r12d
cmpl $0x0, 0x15ac5(%rip)     # 0x1e6bc
movl 0x15adf(%rip), %eax     # 0x1e6dc
jne 0x8c57
movslq %eax, %rsi
movq 0x15a97(%rip), %rax     # 0x1e6a0
movq (%rax,%rsi,8), %rcx
movslq %r12d, %rdi
movq %rdi, %r10
shlq $0x4, %r10
movslq 0x15ac6(%rip), %r8      # 0x1e6e4
movslq 0x15ac3(%rip), %r9      # 0x1e6e8
movq (%rax,%r9,8), %rax
movq %r8, %r11
shlq $0x4, %r11
movq (%rcx,%r10), %rdx
movq 0x8(%rcx,%r10), %rcx
movups (%rax,%r11), %xmm0
movaps %xmm0, 0x20(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xb9e5
movl 0x15a85(%rip), %eax     # 0x1e6dc
movl 0x1c(%rsp), %ebx
movl 0x18(%rsp), %ebp
movl %r12d, 0x15a7e(%rip)    # 0x1e6e4
movl %eax, 0x15a7c(%rip)     # 0x1e6e8
callq 0xca84
movl 0x15a6d(%rip), %edi     # 0x1e6e4
movl 0x15a6b(%rip), %esi     # 0x1e6e8
cmpl %edi, %ebp
jne 0x8c94
cmpl %esi, %ebx
jne 0x8c94
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcb0f