// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/navi.c
// Function: diff_navi_list_draw
static void diff_navi_list_draw(diff_node_t *node, int line_no, int node_no, int selected)
{
  int size, maxy, maxx, pos, depth;
  diff_node_t *found;

  size = 0;
  found = diff_navi_node_get(node, node_no, &size);
  if (found == NULL)
    return;

  getmaxyx(stdscr, maxy, maxx);

  if (selected)
    attron(A_REVERSE);

  /* Color. */
  switch (found->type) {
  case DIFF_TYPE_FILE_EQUAL:
  case DIFF_TYPE_DIR_EQUAL:
    if (selected) {
      attrset(COLOR_PAIR(COLOR_SELECTED_EQUAL));
    } else {
      attrset(COLOR_PAIR(COLOR_EQUAL));
    }
    break;

  case DIFF_TYPE_FILE_DIFFERS:
  case DIFF_TYPE_DIR_DIFFERS:
    if (selected) {
      attrset(COLOR_PAIR(COLOR_SELECTED_DIFFERS));
    } else {
      attrset(COLOR_PAIR(COLOR_DIFFERS));
    }
    break;

  case DIFF_TYPE_FILE_ADDED:
  case DIFF_TYPE_DIR_ADDED:
    if (selected) {
      attrset(COLOR_PAIR(COLOR_SELECTED_ADDED));
    } else {
      attrset(COLOR_PAIR(COLOR_ADDED));
    }
    break;

  case DIFF_TYPE_FILE_MISSING:
  case DIFF_TYPE_DIR_MISSING:
    if (selected) {
      attrset(COLOR_PAIR(COLOR_SELECTED_MISSING));
    } else {
      attrset(COLOR_PAIR(COLOR_MISSING));
    }
    break;

  default:
    break;
  }

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

  } else {

    pos = 0;

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

    /* Type indicator. */
    switch (found->type) {
    case DIFF_TYPE_FILE_EQUAL:
    case DIFF_TYPE_DIR_EQUAL:
      mvaddch(line_no, pos++, '=');
      break;

    case DIFF_TYPE_FILE_DIFFERS:
    case DIFF_TYPE_DIR_DIFFERS:
      mvaddch(line_no, pos++, '*');
      break;

    case DIFF_TYPE_FILE_ADDED:
    case DIFF_TYPE_DIR_ADDED:
      mvaddch(line_no, pos++, '+');
      break;

    case DIFF_TYPE_FILE_MISSING:
    case DIFF_TYPE_DIR_MISSING:
      mvaddch(line_no, pos++, '-');
      break;

    default:
      break;
    }

    /* File/directory name. */
    mvaddstr(line_no, pos, found->name);
    pos += strlen(found->name);

    /* Slash for directory. */
    switch (found->type) {
    case DIFF_TYPE_DIR_EQUAL:
    case DIFF_TYPE_DIR_DIFFERS:
    case DIFF_TYPE_DIR_ADDED:
    case DIFF_TYPE_DIR_MISSING:
      mvaddch(line_no, pos++, '/');
      break;

    default:
      break;
    }

    /* Arrow when not expanded. */
    if (! found->expanded) {
      mvaddch(line_no, pos++, ' ');
      mvaddch(line_no, pos++, '-');
      mvaddch(line_no, pos++, '>');
    }

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

  if (selected)
    attroff(A_REVERSE);

  attrset(COLOR_PAIR(COLOR_EQUAL));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r13d
movl %esi, %ebp
leaq 0x14(%rsp), %rax
movl $0x0, (%rax)
movl %edx, %esi
movq %rax, %rdx
callq 0x38e3
testq %rax, %rax
je 0x35b2
movq %rax, %r14
movq 0x2a38(%rip), %rbx      # 0x5fd8
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x35c1
movswl 0x6(%rdi), %r15d
decl %r15d
jmp 0x35c7
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xfffffffd, %r15d      # imm = 0xFFFFFFFD
testl %r13d, %r13d
je 0x35d8
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x21c0
movl 0x4(%r14), %eax
decl %eax
cmpl $0x7, %eax
ja 0x364e
leaq 0xac6(%rip), %rcx       # 0x40b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x363d
movl $0x500, %esi            # imm = 0x500
jmp 0x3649
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x362f
movl $0x700, %esi            # imm = 0x700
jmp 0x3649
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x3636
movl $0x800, %esi            # imm = 0x800
jmp 0x3649
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x3644
movl $0x600, %esi            # imm = 0x600
jmp 0x3649
movl $0x300, %esi            # imm = 0x300
jmp 0x3649
movl $0x400, %esi            # imm = 0x400
jmp 0x3649
movl $0x100, %esi            # imm = 0x100
jmp 0x3649
movl $0x200, %esi            # imm = 0x200
callq 0x2040
cmpq $0x0, 0x8(%r14)
je 0x3713
movl %r15d, 0xc(%rsp)
movq %r14, %rdi
callq 0x252a
xorl %r15d, %r15d
cmpl $0x2, %eax
jl 0x36d6
movl %eax, %r12d
movl %r13d, 0x10(%rsp)
incl %r12d
xorl %r13d, %r13d
movl %r13d, %r15d
movq (%rbx), %rdi
movl %ebp, %esi
movl %r13d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x369e
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x2290
movq (%rbx), %rdi
leal 0x1(%r15), %r13d
movl %ebp, %esi
movl %r13d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x36c1
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x2290
decl %r12d
incl %r13d
cmpl $0x2, %r12d
ja 0x367c
addl $0x2, %r15d
movl 0x10(%rsp), %r13d
movl 0x4(%r14), %eax
decl %eax
cmpl $0x7, %eax
ja 0x37aa
leaq 0x9e4(%rip), %rcx       # 0x40d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%rbx), %rdi
movl %r15d, %r12d
orl $0x1, %r12d
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
movl $0x3d, %esi
jmp 0x379a
testl %r15d, %r15d
jle 0x38b4
xorl %r14d, %r14d
movq (%rbx), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x373e
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x2290
incl %r14d
cmpl %r14d, %r15d
jne 0x371f
jmp 0x38b4
movq (%rbx), %rdi
movl %r15d, %r12d
orl $0x1, %r12d
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
movl $0x2b, %esi
jmp 0x379a
movq (%rbx), %rdi
movl %r15d, %r12d
orl $0x1, %r12d
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
movl $0x2d, %esi
jmp 0x379a
movq (%rbx), %rdi
movl %r15d, %r12d
orl $0x1, %r12d
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
movl $0x2a, %esi
movl %r12d, %r15d
cmpl $-0x1, %eax
je 0x37aa
movq (%rbx), %rdi
callq 0x2290
movq (%rbx), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x37cd
movq (%rbx), %rdi
movq 0x8(%r14), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x22c0
movq 0x8(%r14), %rdi
callq 0x2100
addl %eax, %r15d
movl 0x4(%r14), %eax
addl $-0x5, %eax
cmpl $0x3, %eax
ja 0x380a
movq (%rbx), %rdi
leal 0x1(%r15), %r12d
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x380d
movq (%rbx), %rdi
movl $0x2f, %esi
callq 0x2290
jmp 0x380d
movl %r15d, %r12d
movl 0xc(%rsp), %r15d
cmpb $0x0, (%r14)
jne 0x3888
movq (%rbx), %rdi
leal 0x1(%r12), %r14d
movl %ebp, %esi
movl %r12d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x383c
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x2290
movq (%rbx), %rdi
leal 0x2(%r12), %r15d
movl %ebp, %esi
movl %r14d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x3860
movq (%rbx), %rdi
movl $0x2d, %esi
callq 0x2290
movq (%rbx), %rdi
addl $0x3, %r12d
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x3883
movq (%rbx), %rdi
movl $0x3e, %esi
callq 0x2290
movl 0xc(%rsp), %r15d
cmpl %r15d, %r12d
jge 0x38b4
movq (%rbx), %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x38ac
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x2290
incl %r12d
cmpl %r12d, %r15d
jne 0x388d
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x38cb
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x22e0
movq (%rbx), %rdi
movl $0x100, %esi            # imm = 0x100
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2040