// File: /workspace/github_c_makefile_star2_O1/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 0x1e83
testq %rax, %rax
je 0x1e74
movq %rax, %r14
movq 0x233e(%rip), %r13      # 0x3fd8
movq (%r13), %rdi
testq %rdi, %rdi
je 0x1cab
movswl 0x6(%rdi), %ebx
decl %ebx
jmp 0x1cb0
movl $0xfffffffd, %ebx       # imm = 0xFFFFFFFD
testl %r15d, %r15d
je 0x1cc1
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x1140
cmpq $0x0, 0x8(%r14)
je 0x1de9
movq %r14, %rax
xorl %r14d, %r14d
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x10(%rax)
je 0x1ce9
movq 0x18(%rax), %rax
incl %r14d
testq %rax, %rax
jne 0x1cd7
movl %r15d, 0x4(%rsp)
xorl %r15d, %r15d
cmpl $0x2, %r14d
jl 0x1d56
incl %r14d
xorl %r12d, %r12d
movl %r12d, %r15d
movq (%r13), %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1d21
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 0x1d46
movq (%r13), %rdi
movl $0x20, %esi
callq 0x11f0
decl %r14d
incl %r12d
cmpl $0x2, %r14d
jg 0x1cfd
addl $0x2, %r15d
movq 0x8(%rsp), %r14
cmpl $0x0, (%r14)
je 0x1d71
movq (%r13), %rdi
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 0x1d96
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 0x1db8
movq (%r13), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x1220
addl %r12d, %r15d
cmpl $0x1, 0x10(%r14)
jne 0x1e1b
movq (%r13), %rdi
leal 0x1(%r15), %r14d
movl %ebp, %esi
movl %r15d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1e1e
movq (%r13), %rdi
movl $0x2f, %esi
callq 0x11f0
jmp 0x1e1e
testl %ebx, %ebx
jle 0x1e51
xorl %r14d, %r14d
movq (%r13), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1e11
movq (%r13), %rdi
movl $0x20, %esi
callq 0x11f0
incl %r14d
cmpl %r14d, %ebx
jne 0x1df0
jmp 0x1e51
movl %r15d, %r14d
movl 0x4(%rsp), %r15d
cmpl %ebx, %r14d
jge 0x1e51
movq (%r13), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x11d0
cmpl $-0x1, %eax
je 0x1e49
movq (%r13), %rdi
movl $0x20, %esi
callq 0x11f0
incl %r14d
cmpl %r14d, %ebx
jne 0x1e28
testl %r15d, %r15d
je 0x1e74
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