// File: /workspace/github_c_makefile_star2_O0/moefh[P]hed/src/file_sel.c
// Function: process_input
static void process_input(struct file_sel *fs)
{
  struct hed_screen *scr = &fs->editor->screen;
  char key_err[64];

  int k = read_key(scr->term_fd, key_err, sizeof(key_err));
  switch (k) {
  case KEY_REDRAW:
    reset_color();
    clear_screen();
    scr->redraw_needed = true;
    break;

  case CTRL_KEY('l'):
    scr->redraw_needed = true;
    break;
    
  case CTRL_KEY('c'):
    scr->redraw_needed = true;
    fs->quit = true;
    fs->ret = -1;
    break;

  case '\r':
    if (fs->sel) {
      if (fs->sel->is_file) {
        fs->quit = true;
        fs->ret = 0;
        return;
      }
      change_dir(fs, fs->sel->filename);
      scr->redraw_needed = true;
    }
        
    break;

  case CTRL_KEY('p'):  move_sel_up(fs); break;
  case CTRL_KEY('n'):  move_sel_down(fs); break;
  case CTRL_KEY('y'):  move_sel_page_up(fs); break;
  case CTRL_KEY('v'):  move_sel_page_down(fs); break;
  case KEY_ARROW_UP:   move_sel_up(fs); break;
  case KEY_ARROW_DOWN: move_sel_down(fs); break;
  case KEY_PAGE_UP:    move_sel_page_up(fs); break;
  case KEY_PAGE_DOWN:  move_sel_page_down(fs); break;
  }
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq (%rax), %rax
addq $0x108, %rax            # imm = 0x108
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rax
movl (%rax), %edi
leaq 0x10(%rsp), %rsi
movl $0x40, %edx
callq 0x2a80
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x8(%rsp)
subl $0x3, %eax
je 0x55ed
jmp 0x5519
movl 0x8(%rsp), %eax
subl $0xc, %eax
je 0x55df
jmp 0x5528
movl 0x8(%rsp), %eax
subl $0xd, %eax
je 0x5610
jmp 0x5537
movl 0x8(%rsp), %eax
subl $0xe, %eax
je 0x5673
jmp 0x5546
movl 0x8(%rsp), %eax
subl $0x10, %eax
je 0x5667
jmp 0x5555
movl 0x8(%rsp), %eax
subl $0x16, %eax
je 0x568b
jmp 0x5564
movl 0x8(%rsp), %eax
subl $0x19, %eax
je 0x567f
jmp 0x5573
movl 0x8(%rsp), %eax
subl $0x110002, %eax         # imm = 0x110002
je 0x55c7
jmp 0x5580
movl 0x8(%rsp), %eax
subl $0x111002, %eax         # imm = 0x111002
je 0x5697
jmp 0x5591
movl 0x8(%rsp), %eax
subl $0x111003, %eax         # imm = 0x111003
je 0x56a3
jmp 0x55a2
movl 0x8(%rsp), %eax
subl $0x111008, %eax         # imm = 0x111008
je 0x56af
jmp 0x55b3
movl 0x8(%rsp), %eax
subl $0x111009, %eax         # imm = 0x111009
je 0x56bb
jmp 0x56c5
callq 0x3d40
callq 0x3e40
movq 0x58(%rsp), %rax
movb $0x1, 0xd(%rax)
jmp 0x56c5
movq 0x58(%rsp), %rax
movb $0x1, 0xd(%rax)
jmp 0x56c5
movq 0x58(%rsp), %rax
movb $0x1, 0xd(%rax)
movq 0x60(%rsp), %rax
movb $0x1, 0x8(%rax)
movq 0x60(%rsp), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
jmp 0x56c5
movq 0x60(%rsp), %rax
cmpq $0x0, 0x28(%rax)
je 0x5665
movq 0x60(%rsp), %rax
movq 0x28(%rax), %rax
testb $0x1, 0x18(%rax)
je 0x5645
movq 0x60(%rsp), %rax
movb $0x1, 0x8(%rax)
movq 0x60(%rsp), %rax
movl $0x0, 0xc(%rax)
jmp 0x56c5
movq 0x60(%rsp), %rdi
movq 0x60(%rsp), %rax
movq 0x28(%rax), %rsi
addq $0x28, %rsi
callq 0x4fe0
movq 0x58(%rsp), %rax
movb $0x1, 0xd(%rax)
jmp 0x56c5
movq 0x60(%rsp), %rdi
callq 0x5e60
jmp 0x56c5
movq 0x60(%rsp), %rdi
callq 0x5ee0
jmp 0x56c5
movq 0x60(%rsp), %rdi
callq 0x5f80
jmp 0x56c5
movq 0x60(%rsp), %rdi
callq 0x6070
jmp 0x56c5
movq 0x60(%rsp), %rdi
callq 0x5e60
jmp 0x56c5
movq 0x60(%rsp), %rdi
callq 0x5ee0
jmp 0x56c5
movq 0x60(%rsp), %rdi
callq 0x5f80
jmp 0x56c5
movq 0x60(%rsp), %rdi
callq 0x6070
addq $0x68, %rsp
retq
nopw (%rax,%rax)