// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movl 0x1871a(%rip), %eax     # 0x22498
movl %eax, -0x4(%rbp)
movl 0x1871d(%rip), %eax     # 0x224a4
movl %eax, -0x8(%rbp)
movl 0x18718(%rip), %eax     # 0x224a8
movl %eax, -0xc(%rbp)
callq 0xf0d0
cmpl $0x0, %eax
jne 0x9da2
jmp 0x9f8b
cmpl $0x0, 0x186fb(%rip)     # 0x224a4
jge 0x9db2
xorl %eax, %eax
movl %eax, -0x24(%rbp)
jmp 0x9de2
movl 0x186ec(%rip), %eax     # 0x224a4
movl 0x1869e(%rip), %ecx     # 0x2245c
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x9dd3
movl 0x18691(%rip), %eax     # 0x2245c
subl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x9ddc
movl 0x186cb(%rip), %eax     # 0x224a4
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, 0x186b9(%rip)     # 0x224a4
cmpl $0x0, 0x186b6(%rip)     # 0x224a8
jge 0x9dfb
xorl %eax, %eax
movl %eax, -0x2c(%rbp)
jmp 0x9e2b
movl 0x186a7(%rip), %eax     # 0x224a8
movl 0x18651(%rip), %ecx     # 0x22458
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x9e1c
movl 0x18644(%rip), %eax     # 0x22458
subl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x9e25
movl 0x18686(%rip), %eax     # 0x224a8
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, 0x18674(%rip)     # 0x224a8
movq 0x18625(%rip), %rax     # 0x22460
movslq 0x18666(%rip), %rcx     # 0x224a8
movq (%rax,%rcx,8), %rax
movslq 0x18657(%rip), %rcx     # 0x224a4
shlq $0x4, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x9e71
movl 0x1863c(%rip), %eax     # 0x224a4
addl $-0x1, %eax
movl %eax, 0x18633(%rip)     # 0x224a4
movq 0x185e8(%rip), %rax     # 0x22460
movslq 0x1861d(%rip), %rcx     # 0x2249c
movq (%rax,%rcx,8), %rax
movslq -0x4(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movzwl 0x4(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x9ea5
movl -0x4(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4(%rbp)
movl 0x185b1(%rip), %edx     # 0x2245c
movl 0x185a7(%rip), %ecx     # 0x22458
xorl %esi, %esi
movl %esi, %edi
callq 0x9fa0
cmpl $0x0, 0x185bb(%rip)     # 0x2247c
jne 0x9f4a
movl -0x4(%rbp), %edi
movl 0x185cc(%rip), %esi     # 0x2249c
movq 0x18589(%rip), %rax     # 0x22460
movslq 0x185be(%rip), %rcx     # 0x2249c
movq (%rax,%rcx,8), %rcx
movslq -0x4(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rcx
movl 0x185b0(%rip), %r8d     # 0x224a4
movl 0x185ad(%rip), %r9d     # 0x224a8
movq 0x1855e(%rip), %rax     # 0x22460
movslq 0x1859f(%rip), %rdx     # 0x224a8
movq (%rax,%rdx,8), %rax
movslq 0x18590(%rip), %rdx     # 0x224a4
shlq $0x4, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq 0x8(%rcx), %rcx
movq (%rax), %r10
movq %r10, -0x20(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
leaq -0x20(%rbp), %rax
movq (%rax), %r10
movq %r10, (%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
callq 0xe9f0
movl -0x4(%rbp), %eax
movl %eax, 0x18551(%rip)     # 0x224a4
movl 0x18543(%rip), %eax     # 0x2249c
movl %eax, 0x18549(%rip)     # 0x224a8
callq 0x100d0
movl -0x8(%rbp), %eax
cmpl 0x18537(%rip), %eax     # 0x224a4
jne 0x9f7a
movl -0xc(%rbp), %eax
cmpl 0x18530(%rip), %eax     # 0x224a8
je 0x9f8b
movl 0x18524(%rip), %edi     # 0x224a4
movl 0x18522(%rip), %esi     # 0x224a8
callq 0x10190
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)