// File: /workspace/github_c_makefile_star2_O3/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 0x15110(%rip), %rbx     # 0x1e6d8
movl 0x15115(%rip), %r15d    # 0x1e6e4
movl 0x15112(%rip), %r14d    # 0x1e6e8
callq 0xce8f
testl %eax, %eax
je 0x97b6
movl 0x150fb(%rip), %edx     # 0x1e6e4
xorl %ecx, %ecx
movl $0x0, %eax
testl %edx, %edx
js 0x9601
movl 0x150a2(%rip), %eax     # 0x1e69c
decl %eax
cmpl %eax, %edx
cmovll %edx, %eax
movl %eax, 0x150dd(%rip)     # 0x1e6e4
movl 0x150db(%rip), %edx     # 0x1e6e8
testl %edx, %edx
js 0x961e
movl 0x15081(%rip), %ecx     # 0x1e698
decl %ecx
cmpl %ecx, %edx
cmovll %edx, %ecx
movl %ecx, 0x150c4(%rip)     # 0x1e6e8
movq 0x15075(%rip), %rdx     # 0x1e6a0
movslq %ecx, %rcx
movq (%rdx,%rcx,8), %rcx
movslq %eax, %rsi
shlq $0x4, %rsi
testb $0x4, 0x5(%rcx,%rsi)
je 0x9648
decl %eax
movl %eax, 0x1509c(%rip)     # 0x1e6e4
movslq 0x1508d(%rip), %rax     # 0x1e6dc
movq (%rdx,%rax,8), %rcx
movq %rbx, %rdx
shlq $0x4, %rdx
movl 0x4(%rcx,%rdx), %ecx
shll $0x5, %ecx
movswl %cx, %r13d
sarl $0xf, %r13d
movslq 0x15028(%rip), %rbp     # 0x1e698
testq %rbp, %rbp
jle 0x972a
movq %rbx, 0x18(%rsp)
movl %r15d, 0x10(%rsp)
movl %r14d, 0x14(%rsp)
movl 0x1500e(%rip), %ebx     # 0x1e69c
movq 0x1502b(%rip), %rax     # 0x1e6c0
xorl %r15d, %r15d
leaq 0x13ee1(%rip), %r12     # 0x1d580
xorl %r14d, %r14d
cmpl $0x0, (%rax,%r14,4)
je 0x9709
movl $0x0, (%rax,%r14,4)
movslq 0x15004(%rip), %rax     # 0x1e6bc
cmpq %rax, %r14
jge 0x96e2
movl (%r12), %ecx
movl 0x14ff1(%rip), %edx     # 0x1e6b8
addl %ecx, %edx
subl %eax, %edx
leal (%r14,%rdx), %eax
incl %eax
xorl %edx, %edx
divl %ecx
shlq $0x3, %rdx
addq 0x14fd0(%rip), %rdx     # 0x1e6b0
jmp 0x96f3
movq 0x14fb7(%rip), %rdx     # 0x1e6a0
shlq $0x3, %rax
subq %rax, %rdx
addq %r15, %rdx
movq (%rdx), %rdi
xorl %esi, %esi
movl %r14d, %edx
movl %ebx, %ecx
callq 0xce99
movq 0x14fb7(%rip), %rax     # 0x1e6c0
incq %r14
addq $0x8, %r15
cmpq %r14, %rbp
jne 0x96a2
movl 0x14fc1(%rip), %eax     # 0x1e6dc
movl 0x14(%rsp), %r14d
movl 0x10(%rsp), %r15d
movq 0x18(%rsp), %rbx
addl %ebx, %r13d
cmpl $0x0, 0x14f88(%rip)     # 0x1e6bc
jne 0x978e
movq 0x14f63(%rip), %rcx     # 0x1e6a0
movslq %eax, %rsi
movq (%rcx,%rsi,8), %rax
movslq %r13d, %rdi
movq %rdi, %r10
shlq $0x4, %r10
movslq 0x14f8f(%rip), %r8      # 0x1e6e4
movslq 0x14f8c(%rip), %r9      # 0x1e6e8
movq (%rcx,%r9,8), %r11
movq %r8, %rbx
shlq $0x4, %rbx
movq (%rax,%r10), %rdx
movq 0x8(%rax,%r10), %rcx
movups (%r11,%rbx), %xmm0
movaps %xmm0, 0x20(%rsp)
movaps 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xc962
movl 0x14f4e(%rip), %eax     # 0x1e6dc
movl %r13d, 0x14f4f(%rip)    # 0x1e6e4
movl %eax, 0x14f4d(%rip)     # 0x1e6e8
callq 0xdb3d
movl 0x14f3e(%rip), %edi     # 0x1e6e4
movl 0x14f3c(%rip), %esi     # 0x1e6e8
cmpl %edi, %r15d
jne 0x97c5
cmpl %esi, %r14d
jne 0x97c5
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 0xdbbe