// File: /workspace/github_c_makefile_star2_O0/kobolt[P]curses-collection/fileselect/fileselect.c
// Function: curses_update_screen
static void curses_update_screen(file_node_t *node)
{
  int n, i, maxy, maxx;
  int scrollbar_size, scrollbar_pos;
  int list_size;
  
  list_size = file_node_list_size(node);
  
  getmaxyx(stdscr, maxy, maxx);
  erase();
  
  /* Draw text lines. */
  for (n = 0; n < maxy; n++) { 
    if ((n + curses_scroll_offset) >= list_size)
      break;
    
    if (n == (curses_selected_entry - curses_scroll_offset)) {
      curses_list_draw(node, n, n + curses_scroll_offset + 1, 1);
    } else {
      curses_list_draw(node, n, n + curses_scroll_offset + 1, 0);
    }
  }
  
  /* Draw scrollbar. */
  if (list_size <= maxy)
    scrollbar_size = maxy;
  else
    scrollbar_size = maxy / (list_size / (double)maxy);
  
  scrollbar_pos = curses_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(curses_selected_entry - curses_scroll_offset, maxx - 3);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1db0
movl %eax, -0x24(%rbp)
xorl %eax, %eax
movq 0x3197(%rip), %rcx      # 0x4fd8
cmpq (%rcx), %rax
je 0x1e5c
movq 0x318b(%rip), %rax      # 0x4fd8
movq (%rax), %rax
movswl 0x4(%rax), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x1e66
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x28(%rbp)
jmp 0x1e66
movl -0x28(%rbp), %eax
movl %eax, -0x14(%rbp)
xorl %eax, %eax
movq 0x3163(%rip), %rcx      # 0x4fd8
cmpq (%rcx), %rax
je 0x1e90
movq 0x3157(%rip), %rax      # 0x4fd8
movq (%rax), %rax
movswl 0x6(%rax), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1e9a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x2c(%rbp)
jmp 0x1e9a
movl -0x2c(%rbp), %eax
movl %eax, -0x18(%rbp)
movq 0x3131(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
callq 0x1030
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x1f27
movl -0xc(%rbp), %eax
addl 0x3261(%rip), %eax      # 0x5128
cmpl -0x24(%rbp), %eax
jl 0x1ece
jmp 0x1f27
movl -0xc(%rbp), %eax
movl 0x324d(%rip), %ecx      # 0x5124
subl 0x324b(%rip), %ecx      # 0x5128
cmpl %ecx, %eax
jne 0x1f00
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0xc(%rbp), %edx
addl 0x3237(%rip), %edx      # 0x5128
addl $0x1, %edx
movl $0x1, %ecx
callq 0x2110
jmp 0x1f1a
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0xc(%rbp), %edx
addl 0x3218(%rip), %edx      # 0x5128
addl $0x1, %edx
xorl %ecx, %ecx
callq 0x2110
jmp 0x1f1c
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1eb6
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x1f37
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x1f55
cvtsi2sdl -0x14(%rbp), %xmm0
cvtsi2sdl -0x24(%rbp), %xmm1
cvtsi2sdl -0x14(%rbp), %xmm2
divsd %xmm2, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x1c(%rbp)
cvtsi2sdl 0x31c7(%rip), %xmm0 # 0x5124
cvtsi2sdl -0x24(%rbp), %xmm1
divsd %xmm1, %xmm0
movl -0x14(%rbp), %eax
subl -0x1c(%rbp), %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x20(%rbp)
movq 0x3056(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %eax, %eax
movl %eax, %edx
callq 0x1130
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x1fe3
movq 0x302f(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
movl -0x10(%rbp), %esi
addl -0x20(%rbp), %esi
movl -0x18(%rbp), %edx
subl $0x1, %edx
callq 0x11c0
cmpl $-0x1, %eax
jne 0x1fc4
jmp 0x1fd8
movq 0x300d(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
movl $0x20, %esi
callq 0x11e0
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1f9a
movq 0x2fee(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %eax, %eax
movl %eax, %edx
callq 0x1210
movq 0x2fd6(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
movl -0x18(%rbp), %edx
subl $0x2, %edx
xorl %esi, %esi
callq 0x11c0
cmpl $-0x1, %eax
jne 0x2019
jmp 0x202d
movq 0x2fb8(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
movl -0x14(%rbp), %edx
xorl %esi, %esi
callq 0x11b0
movq 0x2fa4(%rip), %rax      # 0x4fd8
movq (%rax), %rdi
movl 0x30e7(%rip), %esi      # 0x5124
subl 0x30e5(%rip), %esi      # 0x5128
movl -0x18(%rbp), %edx
subl $0x3, %edx
callq 0x11c0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)