// File: /workspace/github_c_makefile_star2_O1/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
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x15bc
movswl 0x4(%rdi), %ebp
incl %ebp
testq %rdi, %rdi
je 0x15c7
movswl 0x6(%rdi), %eax
incl %eax
movq %rax, (%rsp)
callq 0x1030
testl %ebp, %ebp
jle 0x16f0
movq (%rsp), %rax
leal -0x2(%rax), %r13d
xorl %r14d, %r14d
leaq 0x2b06(%rip), %rbx      # 0x40f0
movl 0xaa88(%rip), %eax      # 0xc078
leal (%rax,%r14), %ecx
cmpl 0xaa76(%rip), %ecx      # 0xc070
jge 0x16f0
movl 0xaa6e(%rip), %ecx      # 0xc074
subl %eax, %ecx
movq (%r12), %rdi
cmpl %ecx, %r14d
jne 0x16b3
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 0x1656
movq (%r12), %rdi
movslq 0xaa39(%rip), %rax      # 0xc078
movslq %r14d, %rsi
addq %rax, %rsi
shlq $0x7, %rsi
addq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
movslq 0xaa1b(%rip), %rax      # 0xc078
movslq %r14d, %rdi
addq %rax, %rdi
shlq $0x7, %rdi
addq %rbx, %rdi
callq 0x1090
movq %rax, %r15
cmpl %r15d, %r13d
jle 0x16a1
movq (%r12), %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x1130
cmpl $-0x1, %eax
je 0x1699
movq (%r12), %rdi
movl $0x20, %esi
callq 0x1150
incl %r15d
cmpl %r15d, %r13d
jne 0x1677
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x1190
jmp 0x16e4
movl %r14d, %esi
xorl %edx, %edx
callq 0x1130
cmpl $-0x1, %eax
je 0x16e4
movq (%r12), %rdi
movslq 0xa9ab(%rip), %rax      # 0xc078
movslq %r14d, %rsi
addq %rax, %rsi
shlq $0x7, %rsi
addq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1180
incl %r14d
cmpl %ebp, %r14d
jne 0x15ea
movl 0xa97a(%rip), %eax      # 0xc070
cvtsi2sd %eax, %xmm2
movl %ebp, %ebx
cmpl %ebp, %eax
jle 0x1714
cvtsi2sd %ebp, %xmm0
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ebx
movsd %xmm2, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0xa94f(%rip), %xmm0 # 0xc074
movsd %xmm0, 0x8(%rsp)
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x10e0
testl %ebx, %ebx
movq (%rsp), %r13
js 0x1792
movsd 0x8(%rsp), %xmm1
divsd 0x10(%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 0x178b
movq (%r12), %rdi
movl $0x20, %esi
callq 0x1150
incl %r14d
decl %ebx
jne 0x1769
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 0x17c3
movq (%r12), %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x1120
movq (%r12), %rdi
movl 0xa8a7(%rip), %esi      # 0xc074
subl 0xa8a5(%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)