// File: /workspace/github_c_makefile_star2_O1/kobolt[P]curses-collection/playlist/ui.c
// Function: update_screen
static void update_screen(void)
{
  int n, i, maxy, maxx, playing;
  char *entry;

  getmaxyx(stdscr, maxy, maxx);
  maxy -= 2;
  erase();

  /* Draw entries. */
  for (n = 0; n < maxy; n++) {
    if ((n + scroll_offset) >= list_size_get())
      break;

    entry = list_get(n + scroll_offset, &playing);
    if (entry == NULL)
      break;

    if (n == (selected_entry - scroll_offset)) {
      attron(A_REVERSE);
      if (playing)
        attron(A_BOLD);
      mvaddnstr(n, 0, entry, maxx);
      for (i = strlen(entry); i < maxx; i++)
        mvaddch(n, i, ' ');
      if (playing)
        attroff(A_BOLD);
      attroff(A_REVERSE);
    } else {
      if (playing)
        attron(A_BOLD);
      mvaddnstr(n, 0, entry, maxx);
      if (playing)
        attroff(A_BOLD);
    }
  }

  /* Draw status bar and filter input, and let cursor rest there. */
  mvhline(maxy, 0, 0, maxx);
  mvprintw(maxy + 1, 0, "> %s", file_filter);

  if (help_hint_active) {
    attron(A_REVERSE);
    mvaddstr(maxy, 0, "Press F1 for help.");
    attroff(A_REVERSE);
  }

  if (help_window_active) {
    if (help_window == NULL) {
      help_window = subwin(stdscr, 13, maxx - 6, 3, 3);
    }
    werase(help_window);
    mvwaddstr(help_window, 1, 1, "F1 - Help");
    mvwaddstr(help_window, 2, 1, "F5 - Go to top (Same as Home key)");
    mvwaddstr(help_window, 3, 1, "F6 - Go to bottom (Same as End key)");
    mvwaddstr(help_window, 4, 1, "F7 - Move entry up");
    mvwaddstr(help_window, 5, 1, "F8 - Move entry down");
    mvwaddstr(help_window, 6, 1, "F9 - Shuffle list (Also if filtered)");
    mvwaddstr(help_window, 7, 1, "Escape - Quit");
    mvwaddstr(help_window, 9, 1,
      "Use Up/Down Arrow keys and Page Up/Down to scroll and move cursor.");
    mvwaddstr(help_window, 10, 1,
      "Use Left or Right Arrow keys to select entry under cursor.");
    mvwaddstr(help_window, 11, 1,
      "Use characters to enter a filter, and press Enter to apply it.");
    box(help_window, ACS_VLINE, ACS_HLINE);
  } else {
    if (help_window != NULL) {
      delwin(help_window);
      help_window = NULL;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x37aa(%rip), %r12      # 0x5fe0
movq (%r12), %rdi
testq %rdi, %rdi
je 0x2849
movswl 0x4(%rdi), %r14d
decl %r14d
jmp 0x284f
movl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
testq %rdi, %rdi
je 0x285c
movswl 0x6(%rdi), %ebx
incl %ebx
jmp 0x2861
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
callq 0x2030
testl %r14d, %r14d
jle 0x29b9
xorl %r15d, %r15d
movl 0x3943(%rip), %r13d     # 0x61bc
addl %r15d, %r13d
callq 0x2f3b
cmpl %eax, %r13d
jge 0x29b9
movl 0x392c(%rip), %edi      # 0x61bc
addl %r15d, %edi
leaq -0x2c(%rbp), %rsi
callq 0x2eec
testq %rax, %rax
je 0x29b9
movq %rax, %r13
movl 0x390a(%rip), %eax      # 0x61b8
subl 0x3908(%rip), %eax      # 0x61bc
cmpl %eax, %r15d
jne 0x295c
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x2150
cmpl $0x0, -0x2c(%rbp)
je 0x28e3
movq (%r12), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x2150
movq (%r12), %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2904
movq (%r12), %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x22b0
movq %r13, %rdi
callq 0x20e0
movq %rax, %r13
cmpl %r13d, %ebx
jle 0x293e
movq (%r12), %rdi
movl %r15d, %esi
movl %r13d, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2936
movq (%r12), %rdi
movl $0x20, %esi
callq 0x2270
incl %r13d
cmpl %r13d, %ebx
jne 0x2914
movl $0x40000, %r13d         # imm = 0x40000
cmpl $0x0, -0x2c(%rbp)
je 0x299f
movq (%r12), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x22f0
jmp 0x299f
cmpl $0x0, -0x2c(%rbp)
je 0x2972
movq (%r12), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x2150
movq (%r12), %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2993
movq (%r12), %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x22b0
movl $0x200000, %r13d        # imm = 0x200000
cmpl $0x0, -0x2c(%rbp)
je 0x29ad
movq (%r12), %rdi
movl %r13d, %esi
xorl %edx, %edx
callq 0x22f0
incl %r15d
cmpl %r14d, %r15d
jne 0x2872
movq (%r12), %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x29d9
movq (%r12), %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0x22c0
leal 0x1(%r14), %edi
leaq 0x1689(%rip), %rdx      # 0x406d
leaq 0x37d5(%rip), %rcx      # 0x61c0
xorl %esi, %esi
xorl %eax, %eax
callq 0x2180
cmpb $0x0, 0x37b9(%rip)      # 0x61b4
jne 0x2a45
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x2150
movq (%r12), %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2a35
movq (%r12), %rdi
leaq 0x1647(%rip), %rsi      # 0x4072
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22b0
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x22f0
movq 0x37ac(%rip), %rdi      # 0x61f8
cmpb $0x1, 0x375d(%rip)      # 0x61b0
jne 0x2cc3
testq %rdi, %rdi
jne 0x2a83
movq (%r12), %rdi
addl $-0x6, %ebx
movl $0xd, %esi
movl %ebx, %edx
movl $0x3, %ecx
movl $0x3, %r8d
callq 0x2200
movq %rax, 0x3775(%rip)      # 0x61f8
movq 0x376e(%rip), %rdi      # 0x61f8
callq 0x2030
movq 0x3762(%rip), %rdi      # 0x61f8
movl $0x1, %esi
movl $0x1, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2ac2
movq 0x3747(%rip), %rdi      # 0x61f8
leaq 0x15cd(%rip), %rsi      # 0x4085
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22b0
movq 0x372f(%rip), %rdi      # 0x61f8
movl $0x2, %esi
movl $0x1, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2af5
movq 0x3714(%rip), %rdi      # 0x61f8
leaq 0x15a4(%rip), %rsi      # 0x408f
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22b0
movq 0x36fc(%rip), %rdi      # 0x61f8
movl $0x3, %esi
movl $0x1, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2b28
movq 0x36e1(%rip), %rdi      # 0x61f8
leaq 0x1593(%rip), %rsi      # 0x40b1
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22b0
movq 0x36c9(%rip), %rdi      # 0x61f8
movl $0x4, %esi
movl $0x1, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2b5b
movq 0x36ae(%rip), %rdi      # 0x61f8
leaq 0x1584(%rip), %rsi      # 0x40d5
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22b0
movq 0x3696(%rip), %rdi      # 0x61f8
movl $0x5, %esi
movl $0x1, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2b8e
movq 0x367b(%rip), %rdi      # 0x61f8
leaq 0x1564(%rip), %rsi      # 0x40e8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22b0
movq 0x3663(%rip), %rdi      # 0x61f8
movl $0x6, %esi
movl $0x1, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2bc1
movq 0x3648(%rip), %rdi      # 0x61f8
leaq 0x1546(%rip), %rsi      # 0x40fd
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22b0
movq 0x3630(%rip), %rdi      # 0x61f8
movl $0x7, %esi
movl $0x1, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2bf4
movq 0x3615(%rip), %rdi      # 0x61f8
leaq 0x1538(%rip), %rsi      # 0x4122
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22b0
movq 0x35fd(%rip), %rdi      # 0x61f8
movl $0x9, %esi
movl $0x1, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2c27
movq 0x35e2(%rip), %rdi      # 0x61f8
leaq 0x1513(%rip), %rsi      # 0x4130
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22b0
movq 0x35ca(%rip), %rdi      # 0x61f8
movl $0xa, %esi
movl $0x1, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2c5a
movq 0x35af(%rip), %rdi      # 0x61f8
leaq 0x1523(%rip), %rsi      # 0x4173
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22b0
movq 0x3597(%rip), %rdi      # 0x61f8
movl $0xb, %esi
movl $0x1, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2c8d
movq 0x357c(%rip), %rdi      # 0x61f8
leaq 0x152b(%rip), %rsi      # 0x41ae
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22b0
movq 0x3564(%rip), %rdi      # 0x61f8
movq 0x333d(%rip), %rax      # 0x5fd8
movl 0x1c4(%rax), %ecx
movl 0x1e0(%rax), %edx
subq $0x8, %rsp
xorl %eax, %eax
movl %edx, %esi
movl %ecx, %r8d
xorl %r9d, %r9d
pushq %rax
pushq %rax
pushq %rax
callq 0x20b0
addq $0x20, %rsp
jmp 0x2cd8
testq %rdi, %rdi
je 0x2cd8
callq 0x21b0
movq $0x0, 0x3520(%rip) # 0x61f8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop