// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/menu/menu.c
// Function: update_screen
static void update_screen(void)
{
  int n, i, maxy, maxx;
  int scrollbar_size, scrollbar_pos;

  getmaxyx(stdscr, maxy, maxx);
  erase();

  /* Draw text lines. */
  for (n = 0; n < maxy; n++) {
    if ((n + scroll_offset) >= list_size)
      break;

    if (n == (selected_entry - scroll_offset)) {
      attron(A_REVERSE);
      mvaddstr(n, 0, list[n + scroll_offset]);
      for (i = strlen(list[n + scroll_offset]); i < maxx - 2; i++)
        mvaddch(n, i, ' ');
      attroff(A_REVERSE);
    } else {
      mvaddstr(n, 0, list[n + scroll_offset]);
    }
  }

  /* Draw scrollbar. */
  if (list_size <= maxy)
    scrollbar_size = maxy;
  else
    scrollbar_size = maxy / (list_size / (double)maxy);

  scrollbar_pos = selected_entry / (double)list_size * (maxy - scrollbar_size);
  attron(A_REVERSE);
  for (i = 0; i <= scrollbar_size; i++)
    mvaddch(i + scrollbar_pos, maxx - 1, ' ');
  attroff(A_REVERSE);

  mvvline(0, maxx - 2, 0, maxy);

  /* Place cursor at end of selected line. */
  move(selected_entry - scroll_offset, maxx - 3);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x2a3d(%rip), %r12      # 0x3fe0
movq (%r12), %rdi
testq %rdi, %rdi
je 0x16f8
movswl 0x4(%rdi), %r13d
leal 0x1(%r13), %eax
movl %eax, 0x10(%rsp)
movswl 0x6(%rdi), %ebp
leal 0x1(%rbp), %eax
movq %rax, 0x8(%rsp)
callq 0x1030
testl %r13d, %r13d
js 0x16ed
decl %ebp
xorl %r14d, %r14d
leaq 0x2b0d(%rip), %rbx      # 0x40f0
movl 0xaa8f(%rip), %eax      # 0xc078
leal (%rax,%r14), %ecx
cmpl 0xaa7d(%rip), %ecx      # 0xc070
jge 0x16ed
movl 0xaa75(%rip), %ecx      # 0xc074
subl %eax, %ecx
movq (%r12), %rdi
cmpl %ecx, %r14d
jne 0x16ac
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x10e0
movq (%r12), %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x1130
cmpl $-0x1, %eax
je 0x164f
movq (%r12), %rdi
movslq 0xaa40(%rip), %rax      # 0xc078
movslq %r14d, %rsi
addq %rax, %rsi
shlq $0x7, %rsi
addq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movslq 0xaa22(%rip), %rax      # 0xc078
movslq %r14d, %rdi
addq %rax, %rdi
shlq $0x7, %rdi
addq %rbx, %rdi
callq 0x1090
movq %rax, %r15
cmpl %r15d, %ebp
jle 0x169a
movq (%r12), %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x1130
cmpl $-0x1, %eax
je 0x1692
movq (%r12), %rdi
movl $0x20, %esi
callq 0x1150
incl %r15d
cmpl %r15d, %ebp
jne 0x1670
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x1190
jmp 0x16dd
movl %r14d, %esi
xorl %edx, %edx
callq 0x1130
cmpl $-0x1, %eax
je 0x16dd
movq (%r12), %rdi
movslq 0xa9b2(%rip), %rax      # 0xc078
movslq %r14d, %rsi
addq %rax, %rsi
shlq $0x7, %rsi
addq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
leal 0x1(%r14), %eax
cmpl %r13d, %r14d
movl %eax, %r14d
jne 0x15e3
movq 0x8(%rsp), %r13
movl 0x10(%rsp), %ebp
jmp 0x1708
callq 0x1030
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl 0xa962(%rip), %eax      # 0xc070
cmpl %ebp, %eax
jle 0x172e
cvtsi2sd %ebp, %xmm0
cvtsi2sd %eax, %xmm1
movsd %xmm1, 0x8(%rsp)
divsd %xmm0, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ebx
jmp 0x173a
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x8(%rsp)
movl %ebp, %ebx
xorps %xmm0, %xmm0
cvtsi2sdl 0xa92f(%rip), %xmm0 # 0xc074
movsd %xmm0, 0x10(%rsp)
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x10e0
testl %ebx, %ebx
js 0x17ae
movsd 0x10(%rsp), %xmm1
divsd 0x8(%rsp), %xmm1
movl %ebp, %eax
subl %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %r14d
leal -0x1(%r13), %r15d
incl %ebx
movq (%r12), %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x1130
cmpl $-0x1, %eax
je 0x17a7
movq (%r12), %rdi
movl $0x20, %esi
callq 0x1150
incl %r14d
decl %ebx
jne 0x1785
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x1190
movq (%r12), %rdi
leal -0x2(%r13), %edx
xorl %esi, %esi
callq 0x1130
cmpl $-0x1, %eax
je 0x17df
movq (%r12), %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x1120
movq (%r12), %rdi
movl 0xa88b(%rip), %esi      # 0xc074
subl 0xa889(%rip), %esi      # 0xc078
addl $-0x3, %r13d
movl %r13d, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1130
nopl (%rax)