// File: /workspace/github_c_makefile_star2_O1/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 0x38cb
testq %rax, %rax
je 0x359a
movq %rax, %r14
movq 0x2a50(%rip), %rbx      # 0x5fd8
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x35a9
movswl 0x6(%rdi), %r15d
decl %r15d
jmp 0x35af
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 0x35c0
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x21c0
movl 0x4(%r14), %eax
decl %eax
cmpl $0x7, %eax
ja 0x3636
leaq 0xade(%rip), %rcx       # 0x40b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x3625
movl $0x500, %esi            # imm = 0x500
jmp 0x3631
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x3617
movl $0x700, %esi            # imm = 0x700
jmp 0x3631
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x361e
movl $0x800, %esi            # imm = 0x800
jmp 0x3631
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x362c
movl $0x600, %esi            # imm = 0x600
jmp 0x3631
movl $0x300, %esi            # imm = 0x300
jmp 0x3631
movl $0x400, %esi            # imm = 0x400
jmp 0x3631
movl $0x100, %esi            # imm = 0x100
jmp 0x3631
movl $0x200, %esi            # imm = 0x200
callq 0x2040
cmpq $0x0, 0x8(%r14)
je 0x36fb
movl %r15d, 0xc(%rsp)
movq %r14, %rdi
callq 0x2523
xorl %r15d, %r15d
cmpl $0x2, %eax
jl 0x36be
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 0x3686
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 0x36a9
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x2290
decl %r12d
incl %r13d
cmpl $0x2, %r12d
jg 0x3664
addl $0x2, %r15d
movl 0x10(%rsp), %r13d
movl 0x4(%r14), %eax
decl %eax
cmpl $0x7, %eax
ja 0x3792
leaq 0x9fc(%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 0x3782
testl %r15d, %r15d
jle 0x389c
xorl %r14d, %r14d
movq (%rbx), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x3726
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x2290
incl %r14d
cmpl %r14d, %r15d
jne 0x3707
jmp 0x389c
movq (%rbx), %rdi
movl %r15d, %r12d
orl $0x1, %r12d
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
movl $0x2b, %esi
jmp 0x3782
movq (%rbx), %rdi
movl %r15d, %r12d
orl $0x1, %r12d
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
movl $0x2d, %esi
jmp 0x3782
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 0x3792
movq (%rbx), %rdi
callq 0x2290
movq (%rbx), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x37b5
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 0x37f2
movq (%rbx), %rdi
leal 0x1(%r15), %r12d
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x37f5
movq (%rbx), %rdi
movl $0x2f, %esi
callq 0x2290
jmp 0x37f5
movl %r15d, %r12d
movl 0xc(%rsp), %r15d
cmpb $0x0, (%r14)
jne 0x3870
movq (%rbx), %rdi
leal 0x1(%r12), %r14d
movl %ebp, %esi
movl %r12d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x3824
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 0x3848
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 0x386b
movq (%rbx), %rdi
movl $0x3e, %esi
callq 0x2290
movl 0xc(%rsp), %r15d
cmpl %r15d, %r12d
jge 0x389c
movq (%rbx), %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x3894
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x2290
incl %r12d
cmpl %r12d, %r15d
jne 0x3875
testl %r13d, %r13d
je 0x38b0
movq (%rbx), %rdi
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