// File: /workspace/github_c_makefile_star2_O2/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 0x2a69(%rip), %rbp      # 0x3fe0
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x1590
movswl 0x4(%rdi), %r14d
incl %r14d
movswl 0x6(%rdi), %ebx
incl %ebx
jmp 0x1597
pushq $-0x1
popq %r14
movl %r14d, %ebx
callq 0x1030
xorl %r15d, %r15d
testl %r14d, %r14d
movl $0x0, %r13d
movl %r14d, 0x8(%rsp)
cmovgl %r14d, %r13d
movq %rbx, 0x10(%rsp)
leal -0x2(%rbx), %r14d
pushq $0x20
popq %r12
movl %r13d, 0xc(%rsp)
movl 0xaaa7(%rip), %eax      # 0xc070
cmpl %r13d, %r15d
je 0x16ce
movl 0xaaa0(%rip), %ecx      # 0xc078
leal (%rcx,%r15), %edx
cmpl %eax, %edx
jge 0x16ce
movl 0xaa8a(%rip), %eax      # 0xc074
subl %ecx, %eax
movq (%rbp), %rdi
movslq %r15d, %rbx
cmpl %eax, %r15d
jne 0x1693
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x10e0
movq (%rbp), %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x1130
cmpl $-0x1, %eax
leaq 0x2ad0(%rip), %r13      # 0x40f0
je 0x163f
movq (%rbp), %rdi
movslq 0xaa4b(%rip), %rsi      # 0xc078
addq %rbx, %rsi
shlq $0x7, %rsi
addq %r13, %rsi
pushq $-0x1
popq %rdx
callq 0x1180
movslq 0xaa32(%rip), %rdi      # 0xc078
addq %rbx, %rdi
shlq $0x7, %rdi
addq %r13, %rdi
callq 0x1090
movq %rax, %rbx
movl 0xc(%rsp), %r13d
movq (%rbp), %rdi
cmpl %r14d, %ebx
jge 0x1685
movl %r15d, %esi
movl %ebx, %edx
callq 0x1130
cmpl $-0x1, %eax
je 0x1681
movq (%rbp), %rdi
movl %r12d, %esi
callq 0x1150
incl %ebx
jmp 0x165d
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x1190
jmp 0x16c6
movl %r15d, %esi
xorl %edx, %edx
callq 0x1130
cmpl $-0x1, %eax
je 0x16c6
movq (%rbp), %rdi
movslq 0xa9cb(%rip), %rsi      # 0xc078
addq %rbx, %rsi
shlq $0x7, %rsi
leaq 0x2a35(%rip), %rax      # 0x40f0
addq %rax, %rsi
pushq $-0x1
popq %rdx
callq 0x1180
incl %r15d
jmp 0x15c3
movl 0x8(%rsp), %ecx
cmpl %ecx, %eax
jle 0x16f0
cvtsi2sd %ecx, %xmm1
cvtsi2sd %eax, %xmm0
movapd %xmm0, %xmm2
divsd %xmm1, %xmm2
divsd %xmm2, %xmm1
cvttsd2si %xmm1, %ebx
jmp 0x16f6
cvtsi2sd %eax, %xmm0
movl %ecx, %ebx
cvtsi2sdl 0xa976(%rip), %xmm1 # 0xc074
divsd %xmm0, %xmm1
movl %ecx, %eax
subl %ebx, %eax
cvtsi2sd %eax, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %r13d
movq (%rbp), %rdi
xorl %r12d, %r12d
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x10e0
movq 0x10(%rsp), %rax
leal -0x1(%rax), %r15d
movq (%rbp), %rdi
cmpl %ebx, %r12d
jg 0x175a
leal (%r12,%r13), %esi
movl %r15d, %edx
callq 0x1130
cmpl $-0x1, %eax
je 0x1755
movq (%rbp), %rdi
pushq $0x20
popq %rsi
callq 0x1150
incl %r12d
jmp 0x172f
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x1190
movq (%rbp), %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x1130
cmpl $-0x1, %eax
je 0x1788
movq (%rbp), %rdi
xorl %esi, %esi
movl 0x8(%rsp), %edx
callq 0x1120
movq (%rbp), %rdi
movl 0xa8e2(%rip), %esi      # 0xc074
subl 0xa8e0(%rip), %esi      # 0xc078
movq 0x10(%rsp), %rdx
addl $-0x3, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1130
nopw %cs:(%rax,%rax)
nopl (%rax)