// File: /workspace/github_cpp_makefile_star2_O3/Linkerist[P]xs/src/ui.cc
// Function: user_interaction(int)
bool
user_interaction(int c)
{
 int num;
 string curen;

 switch (c) {
  // ==== Exits
  case CTRL('['): // vi
  case CTRL('g'): // emacs
   abort_xs();
   break;
  case 'q':
   finish(".", false);
   break;
  case 13: // ENTER
   // choose dir at cur pos
   return false;
  case '0':
  case '1':
  case '2':
  case '3':
  case '4':
  case '5':
  case '6':
  case '7':
  case '8':
  case '9':
   num =  c - '0' + shorties_offset;
   if(mode == LIST) {
	if (entry_nr_exists(num)) {
	 CurrPosition = num + yoffset;
	 return opt_no_resolve;
	}
   } else {
	CurrPosition = num + yoffset;
	return true;
   }
   break;

  // ==== Modes
  case '.':
   // show hidden files
   toggle_hidden();
   break;
  case '\t': // TAB
   toggle_mode();
   break;      

  // ==== Navigate The List
#if TERMINFO
  case KEY_DOWN:
#endif
   // navigate list++
   cur_pos_adjust(+1);
   break;

#if TERMINFO
  case KEY_UP:
#endif
   // navigate list--
   cur_pos_adjust(-1);
   break;

  case '^':       // vi?
  case CTRL('a'): // emacs
#if TERMINFO
  case KEY_HOME:
#endif
   // go to top
   CurrPosition = 0;
   yoffset = 0;
   break;

# if TERMINFO
  case KEY_END:
#endif
   // go to end
   if (mode == BROWSE)
	CurrPosition = cur_list.size() - 1;
   else if (mode == LIST)
	CurrPosition = default_list.size() - 1;

   yoffset = max_yoffset();
   break;

  //==== move the shortcut digits ('shorties')
  // FIXME maybe change the scrolling behaviour to not take the window but the whole
  // list? That means recentering when shorties leave the screen (adjust yoffset and
  // CurrPosition) 
#if TERMINFO      
  case KEY_NPAGE:
#endif
   for(int i = 0; i < 10; i++)
	cur_pos_adjust(+1, false);
   break;

#if TERMINFO
  case KEY_PPAGE:
#endif
   for(int i = 0; i < 10; i++)
	cur_pos_adjust(-1, false);
   break;

#if TERMINFO
  case KEY_LEFT:
#endif
   // up dir
   if (mode == BROWSE)
	//             LastPositions[get_current_dir_name()] = CurrPosition;
	LastPositions[get_cwd_as_charp()] = CurrPosition;
   else if (mode == LIST)
	mode = BROWSE;

   list_from_dir("..");
   break;

#if TERMINFO
  case KEY_RIGHT:
#endif
   // descend dir at cur pos
   curen = current_entry();
   if (mode == BROWSE)
	LastPositions[get_cwd_as_charp()] = CurrPosition;
   else
	mode = BROWSE;

   list_from_dir(curen.c_str());
   break;

  case '?':
   helpscreen();
   break;

#if TERMINFO
  case KEY_BACKSPACE:
#endif
   // delete dir acp
   if (mode == LIST && !NeedleGiven)
	delete_from_default_list(CurrPosition);
   else
	beep();

   break;

  #if TERMINFO
  case KEY_IC:
  #endif
  case 'a':
   // add dir acp (if in browse mode)
   if (!NeedleGiven) {
	if (mode == BROWSE)
	 add_to_default_list(current_entry());
	else
	 add_to_default_list(get_cwd_as_string());
   } else
	beep();

   break;

  case 'A':
   if (!NeedleGiven) {
	// add dir acp (if in browse mode) (ask for desc)
	if (mode == BROWSE)
	 add_to_default_list(current_entry(),"",true);
	else
	 add_to_default_list(get_cwd_as_string(),"",true);
   } else
	beep();

   break;
  case 'c':
   if (!NeedleGiven)
	// add the current dir in every mode
	add_to_default_list(get_cwd_as_string());
   else
	beep();

   break;
  case 'C':
   if (!NeedleGiven)
	// add the current dir in every mode (ask for desc)
	add_to_default_list(get_cwd_as_string(), "", true);
   else
	beep();

   break;

  // ==== EDIT the list
  case 'v':
  case 'e':
   if (!NeedleGiven)
	edit_list_file();
   else
	beep();

   break;

  case 'm':
   swap_two_entries(1);
   break;
  case 'M':
   swap_two_entries(-1);
   break;
  case 't':
  case 's':
   swap_two_entries(0);
   break;

  // ==== Filesystem Hotspots
  case '~':
   mode = BROWSE;
   list_from_dir(getenv("HOME"));
   break;
  case '/':
   mode = BROWSE;
   list_from_dir("/");
   break;
  default:
   beep();
   message("unknown command");
 }
 return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
leaq 0xf8(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
cmpl $0x5d, %edi
jg 0x7f56
cmpl $0xc, %edi
jle 0x8057
leal -0x2e(%rdi), %eax
cmpl $0x1f, %eax
ja 0x8209
leaq 0x28c3(%rip), %rcx      # 0xa7e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x6658(%rip), %eax      # 0xe584
leal (%rdi,%rax), %ebp
addl $-0x30, %ebp
leaq 0x65af(%rip), %rax      # 0xe4e8
cmpl $0x0, (%rax)
je 0x80e3
addl 0x6634(%rip), %ebp      # 0xe57c
leaq 0x6565(%rip), %rax      # 0xe4b4
movl %ebp, (%rax)
jmp 0x8625
movl $0x1, %eax
cmpl $0x101, %edi            # imm = 0x101
jg 0x8018
leal -0x6d(%rdi), %ecx
cmpl $0x9, %ecx
jbe 0x807a
leal -0x5e(%rdi), %eax
cmpl $0x7, %eax
ja 0x8223
leaq 0x28da(%rip), %rcx      # 0xa860
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x651a(%rip), %rax      # 0xe4b0
cmpb $0x0, (%rax)
jne 0x84b4
leaq 0x128(%rsp), %rdi
callq 0x40a0
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x23d7(%rip), %rdx      # 0xa393
leaq 0x28(%rsp), %rdi
movq %rdx, %rsi
callq 0x4b0e
leaq 0x128(%rsp), %rdi
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
callq 0x61b4
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x7ff4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3350
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
movb $0x1, %bl
cmpq %rax, %rdi
je 0x8627
movq 0x138(%rsp), %rsi
jmp 0x86dd
cmpl $0x14a, %edi            # imm = 0x14A
jg 0x8091
addl $0xfffffefe, %edi       # imm = 0xFFFFFEFE
cmpl $0x5, %edi
ja 0x8249
leaq 0x2872(%rip), %rcx      # 0xa8a8
movslq (%rcx,%rdi,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movb $0x1, %bl
movl %eax, %edi
movl $0x1, %esi
callq 0x5f48
jmp 0x8627
cmpl $0x1, %edi
je 0x80cd
cmpl $0x7, %edi
je 0x8217
cmpl $0x9, %edi
jne 0x8249
movb $0x1, %bl
callq 0x88c1
jmp 0x8627
leaq 0x27ff(%rip), %rdx      # 0xa880
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
xorl %eax, %eax
jmp 0x8471
cmpl $0x152, %edi            # imm = 0x152
jg 0x8111
cmpl $0x14b, %edi            # imm = 0x14B
je 0x8161
cmpl $0x152, %edi            # imm = 0x152
jne 0x8249
movl $0xa, %ebp
movl $0x1, %edi
xorl %esi, %esi
callq 0x5f48
movb $0x1, %bl
decl %ebp
jne 0x80b6
jmp 0x8627
leaq 0x63e0(%rip), %rax      # 0xe4b4
xorl %ecx, %ecx
movl %ecx, (%rax)
movl %ecx, 0x649e(%rip)      # 0xe57c
jmp 0x8625
movl %ebp, %edi
callq 0x6032
movb $0x1, %bl
testb %al, %al
je 0x8627
addl 0x6482(%rip), %ebp      # 0xe57c
leaq 0x63b3(%rip), %rax      # 0xe4b4
movl %ebp, (%rax)
leaq 0x63e4(%rip), %rax      # 0xe4ee
movb (%rax), %bl
jmp 0x8627
cmpl $0x168, %edi            # imm = 0x168
je 0x8338
cmpl $0x153, %edi            # imm = 0x153
jne 0x8249
movl $0xa, %ebp
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %esi, %esi
callq 0x5f48
movb $0x1, %bl
decl %ebp
jne 0x812e
jmp 0x8627
leaq 0x6364(%rip), %rax      # 0xe4b0
cmpb $0x0, (%rax)
jne 0x84b4
movb $0x1, %bl
callq 0x65a5
jmp 0x8627
leaq 0x6348(%rip), %rax      # 0xe4b0
cmpb $0x0, (%rax)
jne 0x84b4
leaq 0x6370(%rip), %rax      # 0xe4e8
cmpl $0x1, (%rax)
jne 0x84d3
leaq 0x1a8(%rsp), %rdi
callq 0x606d
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x21f2(%rip), %rdx      # 0xa393
leaq 0xa8(%rsp), %rdi
movq %rdx, %rsi
callq 0x4b0e
leaq 0x1a8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
xorl %edx, %edx
callq 0x61b4
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0x81e5
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3350
leaq 0x1b8(%rsp), %rax
movq -0x10(%rax), %rdi
movb $0x1, %bl
cmpq %rax, %rdi
je 0x8627
movq 0x1b8(%rsp), %rsi
jmp 0x86dd
cmpl $0xd, %edi
je 0x84cc
cmpl $0x1b, %edi
jne 0x8249
movb $0x1, %bl
callq 0x4010
jmp 0x8627
cmpl $0x7e, %edi
jne 0x8249
leaq 0x62b9(%rip), %rax      # 0xe4e8
movl $0x1, (%rax)
leaq 0x1dfb(%rip), %rdi      # 0xa037
callq 0x3420
movq %rax, %rdi
jmp 0x8569
callq 0x3090
movb $0x1, %bl
leaq 0x2669(%rip), %rdi      # 0xa8c0
callq 0x9214
jmp 0x8627
leaq 0xd8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1f3d(%rip), %rsi      # 0xa1b1
leaq 0x1f37(%rip), %rdx      # 0xa1b2
leaq 0xc8(%rsp), %rdi
callq 0x4b0e
leaq 0xc8(%rsp), %rdi
xorl %esi, %esi
callq 0x41e8
movq 0xc8(%rsp), %rdi
movb $0x1, %bl
cmpq %r14, %rdi
je 0x8627
movq 0xd8(%rsp), %rsi
jmp 0x86dd
leaq 0x1c8(%rsp), %rdi
callq 0x606d
leaq 0xe8(%rsp), %rdi
leaq 0x1c8(%rsp), %rbx
movq %rbx, %rsi
callq 0x3430
movq (%rbx), %rdi
leaq 0x1d8(%rsp), %rax
cmpq %rax, %rdi
je 0x82fc
movq 0x1d8(%rsp), %rsi
incq %rsi
callq 0x3350
leaq 0x61e5(%rip), %rax      # 0xe4e8
cmpl $0x1, (%rax)
jne 0x855b
leaq 0x61a1(%rip), %rax      # 0xe4b4
movl (%rax), %ebx
callq 0x4034
leaq 0x1c8(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x618c(%rip), %rdi      # 0xe4b8
callq 0x68fa
movl %ebx, (%rax)
jmp 0x8561
leaq 0x61a9(%rip), %rax      # 0xe4e8
movl (%rax), %eax
cmpl $0x1, %eax
je 0x85fd
testl %eax, %eax
jne 0x861a
leaq 0x6137(%rip), %rax      # 0xe490
jmp 0x8604
leaq 0x6183(%rip), %rax      # 0xe4e8
movl (%rax), %ecx
leaq 0x1e42(%rip), %r14      # 0xa1b0
testl %ecx, %ecx
je 0x8654
cmpl $0x1, %ecx
jne 0x865a
leaq 0x612e(%rip), %rax      # 0xe4b4
movl (%rax), %ebx
callq 0x4034
leaq 0x1c8(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x6119(%rip), %rdi      # 0xe4b8
callq 0x68fa
movl %ebx, (%rax)
jmp 0x865a
leaq 0x6136(%rip), %rax      # 0xe4e8
cmpl $0x0, (%rax)
jne 0x84b4
leaq 0x60ee(%rip), %rax      # 0xe4b0
cmpb $0x0, (%rax)
jne 0x84b4
leaq 0x60e2(%rip), %rax      # 0xe4b4
movl (%rax), %edi
movb $0x1, %bl
callq 0x6554
jmp 0x8627
leaq 0x60c9(%rip), %rax      # 0xe4b0
cmpb $0x0, (%rax)
jne 0x84b4
leaq 0x108(%rsp), %rdi
callq 0x40a0
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1f86(%rip), %rdx      # 0xa393
leaq 0x8(%rsp), %rdi
movq %rdx, %rsi
callq 0x4b0e
leaq 0x108(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movl $0x1, %edx
callq 0x61b4
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x8448
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3350
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
movb $0x1, %bl
cmpq %rax, %rdi
je 0x8627
movq 0x118(%rsp), %rsi
jmp 0x86dd
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movb $0x1, %bl
movl %eax, %edi
callq 0x90d2
jmp 0x8627
movb $0x1, %bl
callq 0x44cc
jmp 0x8627
leaq 0x6056(%rip), %rax      # 0xe4e8
movl $0x1, (%rax)
leaq 0x1b96(%rip), %r14      # 0xa035
jmp 0x865a
leaq 0x6005(%rip), %rax      # 0xe4b0
cmpb $0x0, (%rax)
je 0x8575
movb $0x1, %bl
callq 0x3090
jmp 0x8627
movb $0x1, %bl
callq 0x8953
jmp 0x8627
xorl %ebx, %ebx
jmp 0x8627
leaq 0x188(%rsp), %rdi
callq 0x40a0
leaq 0x98(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1ea0(%rip), %rdx      # 0xa393
leaq 0x88(%rsp), %rdi
movq %rdx, %rsi
callq 0x4b0e
leaq 0x188(%rsp), %rdi
leaq 0x88(%rsp), %rsi
xorl %edx, %edx
callq 0x61b4
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x8537
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3350
leaq 0x198(%rsp), %rax
movq -0x10(%rax), %rdi
movb $0x1, %bl
cmpq %rax, %rdi
je 0x8627
movq 0x198(%rsp), %rsi
jmp 0x86dd
movl $0x1, (%rax)
movq 0xe8(%rsp), %rdi
movb $0x1, %bl
callq 0x5102
jmp 0x8627
leaq 0x5f6c(%rip), %rax      # 0xe4e8
cmpl $0x1, (%rax)
jne 0x8666
leaq 0x168(%rsp), %rdi
callq 0x606d
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1df1(%rip), %rdx      # 0xa393
leaq 0x68(%rsp), %rdi
movq %rdx, %rsi
callq 0x4b0e
leaq 0x168(%rsp), %rdi
leaq 0x68(%rsp), %rsi
movl $0x1, %edx
callq 0x61b4
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x85dd
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3350
leaq 0x178(%rsp), %rax
movq -0x10(%rax), %rdi
movb $0x1, %bl
cmpq %rax, %rdi
je 0x8627
movq 0x178(%rsp), %rsi
jmp 0x86dd
leaq 0x5e74(%rip), %rax      # 0xe478
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x6, %rcx
decl %ecx
leaq 0x5e9c(%rip), %rax      # 0xe4b4
movl %ecx, (%rax)
callq 0x44e9
movl %eax, 0x5f57(%rip)      # 0xe57c
movb $0x1, %bl
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0x8644
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x3350
movl %ebx, %eax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, (%rax)
movb $0x1, %bl
movq %r14, %rdi
callq 0x5102
jmp 0x8627
leaq 0x148(%rsp), %rdi
callq 0x40a0
leaq 0x58(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1d10(%rip), %rdx      # 0xa393
leaq 0x48(%rsp), %rdi
movq %rdx, %rsi
callq 0x4b0e
leaq 0x148(%rsp), %rdi
leaq 0x48(%rsp), %rsi
movl $0x1, %edx
callq 0x61b4
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x86be
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3350
leaq 0x158(%rsp), %rax
movq -0x10(%rax), %rdi
movb $0x1, %bl
cmpq %rax, %rdi
je 0x8627
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x3350
jmp 0x8627
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x8725
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3350
jmp 0x8725
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x874a
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3350
jmp 0x874a
movq %rax, %rbx
leaq 0x158(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x889c
movq 0x158(%rsp), %rsi
jmp 0x8889
movq %rax, %rbx
leaq 0x178(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x889c
movq 0x178(%rsp), %rsi
jmp 0x8889
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x878b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3350
jmp 0x878b
movq %rax, %rbx
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x889c
movq 0x118(%rsp), %rsi
jmp 0x8889
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x87f4
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3350
jmp 0x87f4
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0x8816
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3350
jmp 0x8816
movq %rax, %rbx
leaq 0x198(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x889c
movq 0x198(%rsp), %rsi
jmp 0x8889
movq %rax, %rbx
leaq 0x1b8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x889c
movq 0x1b8(%rsp), %rsi
jmp 0x8889
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x8850
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3350
jmp 0x8850
movq %rax, %rbx
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x889c
movq 0x138(%rsp), %rsi
jmp 0x8889
jmp 0x8899
jmp 0x8899
jmp 0x8899
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x889c
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x3350
jmp 0x889c
jmp 0x8899
jmp 0x8899
jmp 0x8899
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
cmpq %r15, %rdi
je 0x88b9
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x3350
movq %rbx, %rdi
callq 0x3620