// File: /workspace/github_cpp_makefile_star2_O2/Linkerist[P]xs/src/ui.cc
// Function: helpscreen()
void
helpscreen(void)
{
#define PAGERENV "PAGER"
 const char * __pager = getenv(PAGERENV);
 string pager = __pager == NULL ? "" : string(__pager);
#undef PAGERENV
 if (pager.empty()) {
  // FIXME:  how to detect debian and the /usr/bin/pager rule?
  struct stat buf;
  if (stat("/usr/bin/pager", &buf) == 0)
   pager = "/usr/bin/pager";
  else {
   if (stat("/usr/bin/less", &buf) == 0)
	pager = "/usr/bin/less";
   else
	pager = "more";
  }
 }

 endwin();
 FILE * help = popen(pager.c_str(), "w");
 // FIXME: error checking this doesn't work, er?
 if (help == NULL) {
  init_curses();
  message("could not open pager");
  return;
 }

 int l = 0;
 string help_lines[] = {
  "xs - Linkerist <Linkerist@163.com>",
  "<UP>/<DOWN>  move selection up/down and scroll",
  "             please see manpage for alternative bindings!",
  "<ENTER>      select current entry",
  "<TAB>        toggle modes: LIST or BROWSE",
  "<HOME>/<END> goto first/last entry in list if available in terminal",
  "c            add current directory to list",
  "C            same as 'c' but ask for a description",
  "<PgUP/Dn>    scroll the list 10 lines up or down",
  "e,v          edit the list in $EDITOR",
  "H,?          show this help",
  "~,/          browse home/root directory",
  "q            quit - saving the list",
  "C-c,C-g,C-[  abort - don't save the list",
  "             ",
  "Commands in BROWSE-mode:",
  "<LEFT>       descent into current directory",
  "<RIGHT>      up one directory",
  "[num]        make [num] the highlighted entry",
  "a            add current entry to list",
  "A            same as 'a' but ask for a description",
  ".            toggle display of hidden files",
  "             ",
  "Commands in LIST-mode:",
  "[num]        select and resolve entry [num] if displayed",
  "<LEFT>       descent into the current entry",
  "<RIGHT>      up one directory from current dir",
  "d            delete current entry from list",
  "a            add current directory to list",
  "s,t          swap(transpose) two lines in the list",
  "M/m          move an entry up down in the list",
  ""
 };

 int help_lines_size = 31;
 while (l < help_lines_size) {
  fprintf(help, "%s\n", help_lines[l].c_str());
  ++l;
 }
 fprintf(help, "\n");

 pclose(help);

 if (strstr(pager.c_str(), "more"))
  sleep(1);

 refresh();
 init_curses();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x440, %rsp            # imm = 0x440
leaq 0x261d(%rip), %rdi      # 0x9924
callq 0x33d0
testq %rax, %rax
je 0x7320
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movq %rax, %rsi
jmp 0x7331
leaq 0x206f(%rip), %rsi      # 0x9396
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x43c8
cmpq $0x0, 0x28(%rsp)
jne 0x7384
leaq 0x25e5(%rip), %rbx      # 0x992a
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x32f0
testl %eax, %eax
je 0x7377
leaq 0x25dc(%rip), %r14      # 0x9939
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
callq 0x32f0
testl %eax, %eax
leaq 0x25d4(%rip), %rbx      # 0x9947
cmoveq %r14, %rbx
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x3630
callq 0x3390
movq 0x20(%rsp), %rdi
leaq 0x25b7(%rip), %rsi      # 0x994c
callq 0x30f0
testq %rax, %rax
je 0x77a2
movq %rax, %r15
leaq 0x25b6(%rip), %rsi      # 0x9963
leaq 0x40(%rsp), %rbx
leaq 0x1f(%rsp), %rdx
movq %rbx, %rdi
callq 0x43c8
leaq 0x60(%rsp), %r14
leaq 0x25bb(%rip), %rsi      # 0x9986
leaq 0x1e(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x80(%rsp), %r14
leaq 0x25ce(%rip), %rsi      # 0x99b5
leaq 0x1d(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0xa0(%rsp), %r14
leaq 0x25ec(%rip), %rsi      # 0x99ef
leaq 0x1c(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0xc0(%rsp), %r14
leaq 0x25f2(%rip), %rsi      # 0x9a11
leaq 0x1b(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0xe0(%rsp), %r14
leaq 0x2600(%rip), %rsi      # 0x9a3b
leaq 0x1a(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x100(%rsp), %r14
leaq 0x2628(%rip), %rsi      # 0x9a7f
leaq 0x19(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x120(%rsp), %r14
leaq 0x2637(%rip), %rsi      # 0x9aaa
leaq 0x18(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x140(%rsp), %r14
leaq 0x264e(%rip), %rsi      # 0x9add
leaq 0x17(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x160(%rsp), %r14
leaq 0x2663(%rip), %rsi      # 0x9b0e
leaq 0x16(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x180(%rsp), %r14
leaq 0x266d(%rip), %rsi      # 0x9b34
leaq 0x15(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x1a0(%rsp), %r14
leaq 0x266d(%rip), %rsi      # 0x9b50
leaq 0x14(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x1c0(%rsp), %r14
leaq 0x2679(%rip), %rsi      # 0x9b78
leaq 0x13(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x1e0(%rsp), %r14
leaq 0x2681(%rip), %rsi      # 0x9b9c
leaq 0x12(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x200(%rsp), %r14
leaq 0x268e(%rip), %rsi      # 0x9bc5
leaq 0x11(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x220(%rsp), %r14
leaq 0x2680(%rip), %rsi      # 0x9bd3
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x240(%rsp), %r14
leaq 0x267d(%rip), %rsi      # 0x9bec
leaq 0xf(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x260(%rsp), %r14
leaq 0x268d(%rip), %rsi      # 0x9c18
leaq 0xe(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x280(%rsp), %r14
leaq 0x268f(%rip), %rsi      # 0x9c36
leaq 0xd(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x2a0(%rsp), %r14
leaq 0x26a1(%rip), %rsi      # 0x9c64
leaq 0xc(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x2c0(%rsp), %r14
leaq 0x26ac(%rip), %rsi      # 0x9c8b
leaq 0xb(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x2e0(%rsp), %r14
leaq 0x26c3(%rip), %rsi      # 0x9cbe
leaq 0xa(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x300(%rsp), %r14
leaq 0x25ae(%rip), %rsi      # 0x9bc5
leaq 0x9(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x320(%rsp), %r14
leaq 0x26b7(%rip), %rsi      # 0x9cea
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x340(%rsp), %r14
leaq 0x26b2(%rip), %rsi      # 0x9d01
leaq 0x7(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x360(%rsp), %r14
leaq 0x26cf(%rip), %rsi      # 0x9d3a
leaq 0x6(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x380(%rsp), %r14
leaq 0x26df(%rip), %rsi      # 0x9d66
leaq 0x5(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x3a0(%rsp), %r14
leaq 0x26f2(%rip), %rsi      # 0x9d95
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x3c0(%rsp), %r14
leaq 0x2702(%rip), %rsi      # 0x9dc1
leaq 0x3(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x3e0(%rsp), %r14
leaq 0x2711(%rip), %rsi      # 0x9dec
leaq 0x2(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x400(%rsp), %r14
leaq 0x2728(%rip), %rsi      # 0x9e1f
leaq 0x1(%rsp), %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x420(%rsp), %r14
leaq 0x1c83(%rip), %rsi      # 0x9396
movq %rsp, %rdx
movq %r14, %rdi
callq 0x43c8
leaq 0x1984(%rip), %rbx      # 0x90a9
xorl %r14d, %r14d
cmpq $0x3e0, %r14            # imm = 0x3E0
je 0x7749
movq 0x40(%rsp,%r14), %rdx
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3490
addq $0x20, %r14
jmp 0x7728
pushq $0xa
popq %rdi
movq %r15, %rsi
callq 0x33f0
movq %r15, %rdi
callq 0x3470
movq 0x20(%rsp), %rdi
leaq 0x21df(%rip), %rsi      # 0x9947
callq 0x30b0
testq %rax, %rax
je 0x777a
pushq $0x1
popq %rdi
callq 0x3270
callq 0x35b0
callq 0x6ad0
movl $0x3e0, %ebx            # imm = 0x3E0
leaq (%rsp,%rbx), %rdi
addq $0x40, %rdi
callq 0x36a8
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x7789
jmp 0x77b3
callq 0x6ad0
leaq 0x21a0(%rip), %rdi      # 0x994e
callq 0x7931
leaq 0x20(%rsp), %rdi
callq 0x36a8
addq $0x440, %rsp            # imm = 0x440
popq %rbx
popq %r14
popq %r15
retq
jmp 0x7832
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
jmp 0x7808
movq %rax, %r15
addq $-0x20, %r14
movq %r14, %rdi
callq 0x36a8
cmpq %rbx, %r14
jne 0x780b
leaq 0x20(%rsp), %rdi
callq 0x36a8
movq %r15, %rdi
callq 0x35d0
jmp 0x7832
jmp 0x7832
movq %rax, %r15
jmp 0x781c
movq %rax, %r15
movl $0x3e0, %ebx            # imm = 0x3E0
leaq (%rsp,%rbx), %rdi
addq $0x40, %rdi
callq 0x36a8
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x783f
jmp 0x781c