// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/fileselect/fileselect.c
// Function: curses_list_draw
static void curses_list_draw(file_node_t *node, int line_no, int node_no, int selected)
{
  int node_count, maxy, maxx, pos, depth;
  file_node_t *found;

  node_count = 0;
  found = file_node_get_by_node_no(node, node_no, &node_count);
  if (found == NULL)
    return;

  getmaxyx(stdscr, maxy, maxx);

  if (selected)
    attron(A_REVERSE);

  if (found->name == NULL) {
    for (pos = 0; pos < maxx - 2; pos++)
      mvaddch(line_no, pos, ' ');

  } else {
    pos = 0;

    /* Depth indicator. */
    depth = file_node_depth(found);
    while (depth-- > 1) {
      mvaddch(line_no, pos++, ' ');
      mvaddch(line_no, pos++, ' ');
    }

    /* File/directory name. */
    if (found->marked)
      attron(A_BOLD);
    mvaddstr(line_no, pos, found->name);
    pos += strlen(found->name);
    if (found->marked)
      attroff(A_BOLD);

    /* Slash for directory. */
    if (found->type == FILE_NODE_TYPE_DIR)
      mvaddch(line_no, pos++, '/');

    /* Padding. */
    for (; pos < maxx - 2; pos++)
      mvaddch(line_no, pos, ' ');
  }

  if (selected)
    attroff(A_REVERSE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r15d
movl %esi, %ebp
leaq 0x14(%rsp), %rax
movl $0x0, (%rax)
movl %edx, %esi
movq %rax, %rdx
callq 0x1e8e
testq %rax, %rax
je 0x1e7f
movq %rax, %r14
movq 0x2333(%rip), %r13      # 0x3fd8
movq (%r13), %rdi
testq %rdi, %rdi
je 0x1cb6
movswl 0x6(%rdi), %ebx
decl %ebx
jmp 0x1cbb
movl $0xfffffffd, %ebx       # imm = 0xFFFFFFFD
testl %r15d, %r15d
je 0x1ccc
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x1140
cmpq $0x0, 0x8(%r14)
je 0x1df4
movq %r14, %rax
xorl %r14d, %r14d
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x10(%rax)
je 0x1cf4
movq 0x18(%rax), %rax
incl %r14d
testq %rax, %rax
jne 0x1ce2
movl %r15d, 0x4(%rsp)
xorl %r15d, %r15d
cmpl $0x2, %r14d
jl 0x1d61
incl %r14d
xorl %r12d, %r12d
movl %r12d, %r15d
movq (%r13), %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1d2c
movq (%r13), %rdi
movl $0x20, %esi
callq 0x11f0
movq (%r13), %rdi
leal 0x1(%r15), %r12d
movl %ebp, %esi
movl %r12d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1d51
movq (%r13), %rdi
movl $0x20, %esi
callq 0x11f0
decl %r14d
incl %r12d
cmpl $0x2, %r14d
ja 0x1d08
addl $0x2, %r15d
movq 0x8(%rsp), %r14
cmpl $0x0, (%r14)
movq (%r13), %rdi
je 0x1d80
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x1140
movq (%r13), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1da1
movq (%r13), %rdi
movq 0x8(%r14), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1210
movq 0x8(%r14), %rdi
callq 0x10d0
movq %rax, %r12
cmpl $0x0, (%r14)
je 0x1dc3
movq (%r13), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x1220
addl %r12d, %r15d
cmpl $0x1, 0x10(%r14)
jne 0x1e26
movq (%r13), %rdi
leal 0x1(%r15), %r14d
movl %ebp, %esi
movl %r15d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1e29
movq (%r13), %rdi
movl $0x2f, %esi
callq 0x11f0
jmp 0x1e29
testl %ebx, %ebx
jle 0x1e5c
xorl %r14d, %r14d
movq (%r13), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1e1c
movq (%r13), %rdi
movl $0x20, %esi
callq 0x11f0
incl %r14d
cmpl %r14d, %ebx
jne 0x1dfb
jmp 0x1e5c
movl %r15d, %r14d
movl 0x4(%rsp), %r15d
cmpl %ebx, %r14d
jge 0x1e5c
movq (%r13), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1e54
movq (%r13), %rdi
movl $0x20, %esi
callq 0x11f0
incl %r14d
cmpl %r14d, %ebx
jne 0x1e33
testl %r15d, %r15d
je 0x1e7f
movq (%r13), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1220
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq