// File: /workspace/github_c_makefile_star2_O2/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
subq $0x28, %rsp
movq 0x37e2(%rip), %r12      # 0x5fe0
movq (%r12), %rdi
testq %rdi, %rdi
je 0x2817
movswl 0x4(%rdi), %r14d
decl %r14d
movswl 0x6(%rdi), %ebx
incl %ebx
jmp 0x281e
pushq $-0x1
popq %rbx
pushq $-0x3
popq %r14
callq 0x2030
xorl %r15d, %r15d
testl %r14d, %r14d
movl $0x0, %eax
movq %r14, -0x38(%rbp)
cmovgl %r14d, %eax
movl %eax, -0x30(%rbp)
pushq $0x20
popq %r13
cmpl -0x30(%rbp), %r15d
je 0x2985
movl 0x396e(%rip), %r14d     # 0x61bc
addl %r15d, %r14d
callq 0x2e8a
cmpl %eax, %r14d
jge 0x2985
movl 0x3957(%rip), %edi      # 0x61bc
addl %r15d, %edi
leaq -0x2c(%rbp), %rsi
callq 0x2e3d
testq %rax, %rax
je 0x2985
movq %rax, %r14
movl 0x3935(%rip), %eax      # 0x61b8
subl 0x3933(%rip), %eax      # 0x61bc
cmpl %eax, %r15d
jne 0x292c
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x2150
cmpl $0x0, -0x2c(%rbp)
je 0x28b8
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 0x28d9
movq (%r12), %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x22b0
movq %r14, %rdi
callq 0x20e0
movq %rax, %r14
cmpl %ebx, %r14d
jge 0x290e
movq (%r12), %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x2909
movq (%r12), %rdi
movl %r13d, %esi
callq 0x2270
incl %r14d
jmp 0x28e4
movl $0x40000, %r14d         # imm = 0x40000
cmpl $0x0, -0x2c(%rbp)
je 0x296f
movq (%r12), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x22f0
jmp 0x296f
cmpl $0x0, -0x2c(%rbp)
je 0x2942
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 0x2963
movq (%r12), %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x22b0
movl $0x200000, %r14d        # imm = 0x200000
cmpl $0x0, -0x2c(%rbp)
je 0x297d
movq (%r12), %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x22f0
incl %r15d
jmp 0x283d
movq (%r12), %rdi
movq -0x38(%rbp), %r14
movl %r14d, %esi
xorl %edx, %edx
callq 0x2250
cmpl $-0x1, %eax
je 0x29a9
movq (%r12), %rdi
xorl %esi, %esi
movl %ebx, %edx
callq 0x22c0
leal 0x1(%r14), %edi
leaq 0x16b9(%rip), %rdx      # 0x406d
leaq 0x3805(%rip), %rcx      # 0x61c0
xorl %esi, %esi
xorl %eax, %eax
callq 0x2180
cmpb $0x0, 0x37e9(%rip)      # 0x61b4
jne 0x2a13
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 0x2a03
movq (%r12), %rdi
leaq 0x1677(%rip), %rsi      # 0x4072
pushq $-0x1
popq %rdx
callq 0x22b0
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x22f0
movq 0x37de(%rip), %rdi      # 0x61f8
cmpb $0x1, 0x378f(%rip)      # 0x61b0
jne 0x2c4a
testq %rdi, %rdi
jne 0x2a4d
movq (%r12), %rdi
addl $-0x6, %ebx
pushq $0xd
popq %rsi
pushq $0x3
popq %rcx
movl %ebx, %edx
movl %ecx, %r8d
callq 0x2200
movq %rax, %rdi
movq %rax, 0x37ab(%rip)      # 0x61f8
callq 0x2030
movq 0x379f(%rip), %rdi      # 0x61f8
pushq $0x1
popq %rdx
movl %edx, %esi
callq 0x2250
cmpl $-0x1, %eax
je 0x2a7e
movq 0x3789(%rip), %rdi      # 0x61f8
leaq 0x160f(%rip), %rsi      # 0x4085
pushq $-0x1
popq %rdx
callq 0x22b0
movq 0x3773(%rip), %rdi      # 0x61f8
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
cmpl $-0x1, %eax
je 0x2aab
movq 0x375c(%rip), %rdi      # 0x61f8
leaq 0x15ec(%rip), %rsi      # 0x408f
pushq $-0x1
popq %rdx
callq 0x22b0
movq 0x3746(%rip), %rdi      # 0x61f8
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
cmpl $-0x1, %eax
je 0x2ad8
movq 0x372f(%rip), %rdi      # 0x61f8
leaq 0x15e1(%rip), %rsi      # 0x40b1
pushq $-0x1
popq %rdx
callq 0x22b0
movq 0x3719(%rip), %rdi      # 0x61f8
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
cmpl $-0x1, %eax
je 0x2b05
movq 0x3702(%rip), %rdi      # 0x61f8
leaq 0x15d8(%rip), %rsi      # 0x40d5
pushq $-0x1
popq %rdx
callq 0x22b0
movq 0x36ec(%rip), %rdi      # 0x61f8
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
cmpl $-0x1, %eax
je 0x2b32
movq 0x36d5(%rip), %rdi      # 0x61f8
leaq 0x15be(%rip), %rsi      # 0x40e8
pushq $-0x1
popq %rdx
callq 0x22b0
movq 0x36bf(%rip), %rdi      # 0x61f8
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
cmpl $-0x1, %eax
je 0x2b5f
movq 0x36a8(%rip), %rdi      # 0x61f8
leaq 0x15a6(%rip), %rsi      # 0x40fd
pushq $-0x1
popq %rdx
callq 0x22b0
movq 0x3692(%rip), %rdi      # 0x61f8
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
cmpl $-0x1, %eax
je 0x2b8c
movq 0x367b(%rip), %rdi      # 0x61f8
leaq 0x159e(%rip), %rsi      # 0x4122
pushq $-0x1
popq %rdx
callq 0x22b0
movq 0x3665(%rip), %rdi      # 0x61f8
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
cmpl $-0x1, %eax
je 0x2bb9
movq 0x364e(%rip), %rdi      # 0x61f8
leaq 0x157f(%rip), %rsi      # 0x4130
pushq $-0x1
popq %rdx
callq 0x22b0
movq 0x3638(%rip), %rdi      # 0x61f8
pushq $0xa
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
cmpl $-0x1, %eax
je 0x2be6
movq 0x3621(%rip), %rdi      # 0x61f8
leaq 0x1595(%rip), %rsi      # 0x4173
pushq $-0x1
popq %rdx
callq 0x22b0
movq 0x360b(%rip), %rdi      # 0x61f8
pushq $0xb
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
cmpl $-0x1, %eax
je 0x2c13
movq 0x35f4(%rip), %rdi      # 0x61f8
leaq 0x15a3(%rip), %rsi      # 0x41ae
pushq $-0x1
popq %rdx
callq 0x22b0
movq 0x35de(%rip), %rdi      # 0x61f8
movq 0x33b7(%rip), %rax      # 0x5fd8
movl 0x1c4(%rax), %ecx
movl 0x1e0(%rax), %edx
andl $0x0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
andl $0x0, (%rsp)
movl %edx, %esi
movl %ecx, %r8d
xorl %r9d, %r9d
callq 0x20b0
jmp 0x2c5c
testq %rdi, %rdi
je 0x2c5c
callq 0x21b0
andq $0x0, 0x359c(%rip)      # 0x61f8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop