// File: /workspace/github_c_makefile_star2_O2/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, %r12d
movl %esi, %ebp
leaq 0x14(%rsp), %rax
andl $0x0, (%rax)
movl %edx, %esi
movq %rax, %rdx
callq 0x1d77
testq %rax, %rax
je 0x1d68
movq %rax, %r14
movq 0x241c(%rip), %rbx      # 0x3fd8
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1bce
movswl 0x6(%rdi), %r13d
decl %r13d
jmp 0x1bd2
pushq $-0x3
popq %r13
testl %r12d, %r12d
je 0x1be3
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x1140
cmpq $0x0, 0x8(%r14)
je 0x1cde
movl %r13d, 0x10(%rsp)
movl %r12d, 0xc(%rsp)
movq %r14, %rdi
callq 0x1dd1
movl %eax, %r12d
xorl %r15d, %r15d
pushq $0x20
popq %r13
cmpl $0x2, %r12d
jl 0x1c54
movq (%rbx), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1c2d
movq (%rbx), %rdi
movl %r13d, %esi
callq 0x11f0
leal 0x1(%r15), %edx
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x11d0
cmpl $-0x1, %eax
je 0x1c4b
movq (%rbx), %rdi
movl %r13d, %esi
callq 0x11f0
decl %r12d
addl $0x2, %r15d
jmp 0x1c0a
cmpl $0x0, (%r14)
movq (%rbx), %rdi
je 0x1c6c
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x1140
movq (%rbx), %rdi
movl 0x10(%rsp), %r13d
movl %ebp, %esi
movl %r15d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1c8f
movq (%rbx), %rdi
movq 0x8(%r14), %rsi
pushq $-0x1
popq %rdx
callq 0x1210
movq 0x8(%r14), %rdi
callq 0x10d0
movq %rax, %r12
cmpl $0x0, (%r14)
je 0x1cb0
movq (%rbx), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x1220
leal (%r12,%r15), %edx
cmpl $0x1, 0x10(%r14)
jne 0x1d13
movq (%rbx), %rdi
leal (%r12,%r15), %r14d
incl %r14d
movl %ebp, %esi
callq 0x11d0
cmpl $-0x1, %eax
je 0x1d16
movq (%rbx), %rdi
pushq $0x2f
popq %rsi
callq 0x11f0
jmp 0x1d16
xorl %r14d, %r14d
testl %r13d, %r13d
cmovlel %r14d, %r13d
pushq $0x20
popq %r15
cmpl %r14d, %r13d
je 0x1d46
movq (%rbx), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1d0e
movq (%rbx), %rdi
movl %r15d, %esi
callq 0x11f0
incl %r14d
jmp 0x1cec
movl %edx, %r14d
movl 0xc(%rsp), %r12d
pushq $0x20
popq %r15
cmpl %r13d, %r14d
jge 0x1d46
movq (%rbx), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1d41
movq (%rbx), %rdi
movl %r15d, %esi
callq 0x11f0
incl %r14d
jmp 0x1d1f
testl %r12d, %r12d
je 0x1d68
movq (%rbx), %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