// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, (%rax)
movl %edx, %esi
movq %rax, %rdx
callq 0x378f
testq %rax, %rax
je 0x3499
movq %rax, %r14
movq 0x2b4f(%rip), %rbx      # 0x5fd8
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x34a8
movswl 0x6(%rdi), %eax
decl %eax
jmp 0x34ab
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $-0x3
popq %rax
movl %eax, 0xc(%rsp)
testl %r13d, %r13d
je 0x34c0
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x21c0
movl 0x4(%r14), %eax
decl %eax
cmpl $0x7, %eax
ja 0x3536
leaq 0xbde(%rip), %rcx       # 0x40b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x3525
movl $0x500, %esi            # imm = 0x500
jmp 0x3531
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x3517
movl $0x700, %esi            # imm = 0x700
jmp 0x3531
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x351e
movl $0x800, %esi            # imm = 0x800
jmp 0x3531
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x352c
movl $0x600, %esi            # imm = 0x600
jmp 0x3531
movl $0x300, %esi            # imm = 0x300
jmp 0x3531
movl $0x400, %esi            # imm = 0x400
jmp 0x3531
movl $0x100, %esi            # imm = 0x100
jmp 0x3531
movl $0x200, %esi            # imm = 0x200
callq 0x2040
cmpq $0x0, 0x8(%r14)
je 0x35de
movl %r13d, 0x10(%rsp)
movq %r14, %rdi
callq 0x24f3
movl %eax, %r12d
pushq $0x1
popq %r15
pushq $0x20
popq %r13
leal -0x1(%r15), %edx
cmpl $0x2, %r12d
jl 0x35a3
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x2270
cmpl $-0x1, %eax
je 0x357d
movq (%rbx), %rdi
movl %r13d, %esi
callq 0x2290
movq (%rbx), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x359a
movq (%rbx), %rdi
movl %r13d, %esi
callq 0x2290
addl $0x2, %r15d
decl %r12d
jmp 0x3559
movl 0x4(%r14), %eax
decl %eax
cmpl $0x7, %eax
ja 0x3782
leaq 0xb17(%rip), %rcx       # 0x40d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movl 0x10(%rsp), %r13d
jmpq *%rax
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x2270
cmpl $-0x1, %eax
je 0x365c
pushq $0x3d
jmp 0x3653
xorl %r14d, %r14d
movl 0xc(%rsp), %r12d
testl %r12d, %r12d
cmovlel %r14d, %r12d
pushq $0x20
popq %r15
cmpl %r14d, %r12d
je 0x3753
movq (%rbx), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x3617
movq (%rbx), %rdi
movl %r15d, %esi
callq 0x2290
incl %r14d
jmp 0x35f1
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x2270
cmpl $-0x1, %eax
je 0x365c
pushq $0x2b
jmp 0x3653
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x2270
cmpl $-0x1, %eax
je 0x365c
pushq $0x2d
jmp 0x3653
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x2270
cmpl $-0x1, %eax
je 0x365c
pushq $0x2a
popq %rsi
movq (%rbx), %rdi
callq 0x2290
movq (%rbx), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x367d
movq (%rbx), %rdi
movq 0x8(%r14), %rsi
pushq $-0x1
popq %rdx
callq 0x22c0
movq 0x8(%r14), %rdi
callq 0x2100
addl %eax, %r15d
movl 0x4(%r14), %eax
addl $-0x5, %eax
cmpl $0x3, %eax
ja 0x36b8
movq (%rbx), %rdi
leal 0x1(%r15), %r12d
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x36bb
movq (%rbx), %rdi
pushq $0x2f
popq %rsi
callq 0x2290
jmp 0x36bb
movl %r15d, %r12d
cmpb $0x0, (%r14)
jne 0x3726
movq (%rbx), %rdi
leal 0x1(%r12), %r14d
movl %ebp, %esi
movl %r12d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x36e3
movq (%rbx), %rdi
pushq $0x20
popq %rsi
callq 0x2290
movq (%rbx), %rdi
leal 0x2(%r12), %r15d
movl %ebp, %esi
movl %r14d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x3705
movq (%rbx), %rdi
pushq $0x2d
popq %rsi
callq 0x2290
movq (%rbx), %rdi
addl $0x3, %r12d
movl %ebp, %esi
movl %r15d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x3726
movq (%rbx), %rdi
pushq $0x3e
popq %rsi
callq 0x2290
pushq $0x20
popq %r14
cmpl 0xc(%rsp), %r12d
jge 0x3753
movq (%rbx), %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x2270
cmpl $-0x1, %eax
je 0x374e
movq (%rbx), %rdi
movl %r14d, %esi
callq 0x2290
incl %r12d
jmp 0x372a
movq (%rbx), %rdi
testl %r13d, %r13d
je 0x376a
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
movl %edx, %r15d
movl 0x10(%rsp), %r13d
jmp 0x365c