// File: /workspace/github_c_makefile_star2_O2/jarun[P]nnn/src/nnn.c
// Function: handle_screen_move
static void handle_screen_move(enum action sel)
{
	switch (sel) {
	case SEL_NEXT:
		if (cfg.rollover || (cur != ndents - 1))
			move_cursor((cur + 1) % ndents, 0);
		break;
	case SEL_PREV:
		if (cfg.rollover || cur)
			move_cursor((cur + ndents - 1) % ndents, 0);
		break;
	case SEL_PGDN:
		move_cursor(curscroll + (ONSCREEN - 1), 1);
		curscroll += ONSCREEN - 1;
		break;
	case SEL_CTRL_D:
		move_cursor(curscroll + (ONSCREEN - 1), 1);
		curscroll += ONSCREEN >> 1;
		break;
	case SEL_PGUP:
		move_cursor(curscroll, 1);
		curscroll -= ONSCREEN - 1;
		break;
	case SEL_CTRL_U:
		move_cursor(curscroll, 1);
		curscroll -= ONSCREEN >> 1;
		break;
	case SEL_JUMP:
	{
		char *input = xreadline(NULL, "jump (+n/-n/n): ");

		if (!input || !*input)
			break;
		if (input[0] == '-') {
			cur -= atoi(input + 1);
			if (cur < 0)
				cur = 0;
		} else if (input[0] == '+') {
			cur += atoi(input + 1);
			if (cur >= ndents)
				cur = ndents - 1;
		} else {
			int index = atoi(input);

			if ((index < 1) || (index > ndents))
				break;
			cur = index - 1;
		}
		move_cursor(cur, 1);
		curscroll -= ONSCREEN >> 1;
		break;
	}
	case SEL_HOME:
		move_cursor(0, 1);
		break;
	case SEL_END:
		move_cursor(ndents - 1, 1);
		break;
	case SEL_YOUNG:
	{
		for (int r = cur;;) {
			if (++r >= ndents)
				r = 0;
			if (r == cur)
				break;
			if (pdents[r].flags & FILE_YOUNG) {
				move_cursor(r, 0);
				break;
			}
		}
		break;
	}
	default: /* case SEL_FIRST */
	{
		int c = get_input(messages[MSG_FIRST]);

		if (!c)
			break;

		c = TOUPPER(c);

		int r = (c == TOUPPER(*pdents[cur].name)) ? (cur + 1) : 0;

		for (; r < ndents; ++r) {
			if (((c == '\'') && !(pdents[r].flags & DIR_OR_DIRLNK))
			    || (c == TOUPPER(*pdents[r].name))) {
				move_cursor((r) % ndents, 0);
				break;
			}
		}
		break;
	}
	}
}

// Assembly:
pushq %rax
addl $-0x4, %edi
cmpl $0xa, %edi
ja 0xfd5c
leaq 0x3600(%rip), %rax      # 0x13298
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
cmpl $0x0, 0x9820(%rip)      # 0x194c8
setns %dl
movl 0x133c7(%rip), %eax     # 0x23078
movl 0xaed5(%rip), %ecx      # 0x1ab8c
leal -0x1(%rcx), %esi
cmpl %esi, %eax
sete %sil
testb %sil, %dl
jne 0xff4f
incl %eax
jmp 0xfd3a
movl 0x135d5(%rip), %eax     # 0x232a8
movzwl 0xaeae(%rip), %ecx      # 0x1ab88
leal (%rax,%rcx), %edi
addl $-0x5, %edi
pushq $0x1
popq %rsi
callq 0xf3e7
movzwl 0xae99(%rip), %eax      # 0x1ab88
movl 0x135b3(%rip), %ecx     # 0x232a8
addl %ecx, %eax
addl $-0x5, %eax
movl %eax, 0x135a8(%rip)     # 0x232a8
jmp 0xff4f
movl 0x1359d(%rip), %edi     # 0x232a8
jmp 0xff35
cmpl $0x0, 0x97b1(%rip)      # 0x194c8
sets %cl
movl 0x13358(%rip), %eax     # 0x23078
testl %eax, %eax
setne %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0xff4f
movl 0xae56(%rip), %ecx      # 0x1ab8c
addl %ecx, %eax
decl %eax
cltd
idivl %ecx
jmp 0xfedf
pushq $0x1
popq %rsi
xorl %edi, %edi
jmp 0xfee3
movl 0xae3a(%rip), %edi      # 0x1ab8c
decl %edi
pushq $0x1
popq %rsi
jmp 0xfee3
leaq 0x43bc(%rip), %rdi      # 0x1411f
callq 0xfb15
testl %eax, %eax
je 0xff4f
leal -0x61(%rax), %edx
leal -0x20(%rax), %ecx
cmpl $0x1a, %edx
cmovael %eax, %ecx
movq 0x132ed(%rip), %rdx     # 0x23070
movslq 0x132ee(%rip), %rax     # 0x23078
imulq $0x30, %rax, %rsi
movq (%rdx,%rsi), %rsi
movsbl (%rsi), %esi
leal -0x61(%rsi), %edi
leal -0x20(%rsi), %r8d
cmpb $0x1a, %dil
cmovael %esi, %r8d
incl %eax
xorl %edi, %edi
cmpl %r8d, %ecx
cmovel %eax, %edi
movslq 0xadd7(%rip), %rsi      # 0x1ab8c
movslq %edi, %rax
imulq $0x30, %rax, %rdi
addq %rdi, %rdx
addq $0x20, %rdx
cmpq %rsi, %rax
jge 0xff4f
cmpl $0x27, %ecx
jne 0xfddb
testb $0x1, 0x7(%rdx)
je 0xfedc
movq -0x20(%rdx), %rdi
movsbl (%rdi), %edi
leal -0x61(%rdi), %r8d
leal -0x20(%rdi), %r9d
cmpb $0x1a, %r8b
cmovael %edi, %r9d
cmpl %r9d, %ecx
je 0xfedc
incq %rax
addq $0x30, %rdx
jmp 0xfdc3
movl 0x1349e(%rip), %edi     # 0x232a8
pushq $0x1
popq %rsi
callq 0xf3e7
movzwl 0xad6f(%rip), %eax      # 0x1ab88
movl 0x13489(%rip), %ecx     # 0x232a8
subl %eax, %ecx
addl $0x5, %ecx
movl %ecx, 0x1347e(%rip)     # 0x232a8
jmp 0xff4f
movl 0x13473(%rip), %eax     # 0x232a8
movzwl 0xad4c(%rip), %ecx      # 0x1ab88
leal (%rax,%rcx), %edi
addl $-0x5, %edi
pushq $0x1
popq %rsi
callq 0xf3e7
movzwl 0xad37(%rip), %eax      # 0x1ab88
addl $-0x4, %eax
sarl %eax
addl %eax, 0x1344c(%rip)     # 0x232a8
jmp 0xff4f
movl 0x13211(%rip), %eax     # 0x23078
movl 0xad1f(%rip), %ecx      # 0x1ab8c
movq 0x131fc(%rip), %rdx     # 0x23070
xorl %esi, %esi
movl %eax, %edi
incl %edi
cmpl %ecx, %edi
cmovgel %esi, %edi
cmpl %eax, %edi
je 0xff4f
movslq %edi, %r8
imulq $0x30, %r8, %r8
testb $0x40, 0x27(%rdx,%r8)
je 0xfe78
jmp 0xfee1
leaq 0x4559(%rip), %rsi      # 0x143f8
xorl %edi, %edi
callq 0x102bd
movzbl 0x98a3(%rip), %eax      # 0x19750
testl %eax, %eax
je 0xff4f
cmpl $0x2b, %eax
je 0xfee9
cmpl $0x2d, %eax
jne 0xff13
leaq 0x988b(%rip), %rdi      # 0x19751
callq 0x47b0
movl 0x131a7(%rip), %ecx     # 0x23078
subl %eax, %ecx
xorl %edi, %edi
testl %ecx, %ecx
cmovgl %ecx, %edi
jmp 0xff2f
cltd
idivl %esi
movl %edx, %edi
xorl %esi, %esi
popq %rax
jmp 0xf3e7
leaq 0x9861(%rip), %rdi      # 0x19751
callq 0x47b0
movl %eax, %edi
addl 0x1317b(%rip), %edi     # 0x23078
movl %edi, 0x13175(%rip)     # 0x23078
movl 0xac83(%rip), %eax      # 0x1ab8c
cmpl %eax, %edi
jl 0xff35
decl %eax
movl %eax, %edi
jmp 0xff2f
leaq 0x9836(%rip), %rdi      # 0x19750
callq 0x47b0
testl %eax, %eax
jle 0xff4f
movl %eax, %edi
cmpl 0xac61(%rip), %eax      # 0x1ab8c
jg 0xff4f
decl %edi
movl %edi, 0x13143(%rip)     # 0x23078
pushq $0x1
popq %rsi
callq 0xf3e7
movzwl 0xac44(%rip), %eax      # 0x1ab88
addl $-0x4, %eax
sarl %eax
subl %eax, 0x13359(%rip)     # 0x232a8
popq %rax
retq