// File: /workspace/github_cpp_makefile_star2_O2/lotuskip[P]yuxtapa/client/input.cpp
// Function: Input::inputhandle()
bool Input::inputhandle()
{
	if(clientstate == CS_TYPE_CHAT || clientstate == CS_TYPE_SHOUT)
	{
		if(check_typing()) // returns true if done typing
		{
			clientstate = CS_NORMAL;
			Base::def_cursor();
		}
		return false;
	}
	// else
	
	int key = getch();
	if(key != ERR) // there is some key
	{
		if(key == KEYCODE_INT)
			return true; // ^C quits

		if(clientstate == CS_HELP || clientstate == CS_TEAM_INFO)
		{
			// any key in help screen closes help
			leave_limbo(); // not leaving limbo, but the functionality is the same
			return false;
		}

		// Quickshouts handled regardless of clientstate:
		if(ClassCPV::im_alive())
		{
			for(char f = 1; f <= MAX_QUICK_SHOUTS; ++f)
			{
				if(key == KEY_F(f))
				{
					if(!Config::quick_shout(--f).empty())
						Network::send_line(Config::quick_shout(f), false);
					return false;
				}
			}
		}

		if(clientstate == CS_LIMBO)
		{
			key = tolower(key);
			if(key <= 'k' && key >= 'a') // switch class
			{
				Network::send_spawn((unsigned char)(key - 'a'));
				leave_limbo();
			}
			else if(key == 't')
			{
				Network::send_switch();
				leave_limbo();
			}
			else if(key == 's')
			{
				Network::send_spawn(NO_CLASS);
				leave_limbo();
			}
			else if(key == 'l' || key == 27) // 27: escape
				leave_limbo();
		}
		else
		{
			if(key == '?') // help key
			{
				clientstate = CS_HELP;
				walkmode_off();
				redraw_view();
				Base::type_cursor(0);
				return false;
			}

			// if here, we need to convert the key:
			e_Key_binding kb = MAX_KEY_BINDING;
			if(key < 256) // fits in a byte; try to convert
				kb = Config::convert_key(char(key));
			// map arrow keys to the directions, for the n00bs:
			else if(key == KEY_UP)
				kb = KB_8;
			else if(key == KEY_DOWN)
				kb = KB_2;
			else if(key == KEY_LEFT)
				kb = KB_4;
			else if(key == KEY_RIGHT)
				kb = KB_6;
		
			if(kb < MAX_KEY_BINDING) // a recognized key
			{
			switch(kb)
			{
			/*
			 * The effect of these depends on clientstate & class.
			 * The handling is delegated to class_cpv.cpp
			 */
			case KB_1: // movement
			case KB_2: case KB_3: case KB_4: case KB_6: case KB_7: case KB_8: case KB_9:
				ClassCPV::move((last_dir = e_Dir(kb)));
				break;
			case KB_5: // special direction
				ClassCPV::five();
				last_dir = MAX_D;
				break;
			case KB_SPACE: // action key
				ClassCPV::space();
				walkmode_off();
				break;
			case KB_p: // follow previous key
				ClassCPV::follow_prev();
				walkmode_off();
				break;

			/*
			 * These can be done in the middle of unfinished actions, but will cause
			 * interruption:
			 */
			case KB_C: // say in chat
				clientstate = CS_TYPE_CHAT;
				init_type();
				walkmode_off();
				break;
			case KB_s: // say aloud
				clientstate = CS_TYPE_SHOUT;
				init_type();
				walkmode_off();
				break;
			case KB_c: // close a door
				Network::send_action(XN_CLOSE_DOOR);
				// interrupts any aiming/casting etc:
				clientstate = CS_NORMAL;
				walkmode_off();
				break;
			case KB_u: // torch handling
				Network::send_action(XN_TORCH_HANDLE);
				// interrupts any aiming/casting etc:
				clientstate = CS_NORMAL;
				walkmode_off();
				break;
			case KB_T: // trigger a trap
				Network::send_action(XN_TRAP_TRIGGER);
				// interrupts any aiming/casting etc:
				clientstate = CS_NORMAL;
				walkmode_off();
				break;
			case KB_X: // suicide
				ClassCPV::suicide();
				walkmode_off();
				break;
			case KB_l: // limbo toggle
				clientstate = CS_LIMBO;
				walkmode_off();
				redraw_view();
				Base::type_cursor(0);
				break;
			case KB_i: // request team info
				Network::send_teami_req();
				break;	
			case KB_Q: // quit
				return true; // confirmation? nah

			/*
			 * The following can be carried out in any clientstate except limbo
			 * without interruption:
			 */
			case KB_w: // walk toggle
				if(walkmode)
					walkmode_off();
				else
					Base::print_walk((walkmode = true));
				break;
			case KB_t: // titles toggle
				toggle_titles();
				break;
			case KB_d: // differentiate titles
				diff_titles();
				break;
			case KB_o: // ouching toggle
				add_msg(string("[Reacting to damage ") + offon[Config::toggle_ouch()], 15);
				break;
			case KB_PLUS:
				scroll_chat_up();
				break;
			case KB_MINUS:
				scroll_chat_down();
				break;
			case KB_PERCENT:
				add_msg(string("[Act per turn ") + offon[Config::toggle_act_per_turn()], 15);
				break;
			default: break;
			}
			} // a recognized key binding
		} // need to convert key
	} // key != ERR
	else if(clientstate == CS_NORMAL && walkmode && last_dir != MAX_D
		&& Network::not_acted())
		ClassCPV::move(last_dir);
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x50, %rsp
movl 0xf503(%rip), %eax      # 0x16e80
decl %eax
cmpl $0x1, %eax
ja 0x7a37
movq 0xe631(%rip), %rax      # 0x15fc0
movq (%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4270
testl %eax, %eax
je 0x7a75
cmpl $0x100, %eax            # imm = 0x100
jne 0x7fa0
movl -0x58(%rbp), %eax
leal -0x102(%rax), %ecx
cmpl $0x5, %ecx
ja 0x7b4b
leaq 0x6c35(%rip), %rax      # 0xe5fc
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0xf4b1(%rip), %rcx      # 0x16e88
movq 0xf4b2(%rip), %rax      # 0x16e90
cmpq %rax, %rcx
je 0x7f29
movq 0xf4fa(%rip), %rdx      # 0x16ee8
leaq 0x20(%rdx), %rdi
cmpq %rax, %rdx
cmoveq %rcx, %rdi
leaq 0xf4a0(%rip), %rbx      # 0x16ea0
movq %rdi, 0xf4e1(%rip)      # 0x16ee8
cmpq %rax, %rdi
je 0x7f21
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4720
movq 0xf4c7(%rip), %rdi      # 0x16ee8
testq %rax, %rax
je 0x7f1e
addq $0x20, %rdi
movq 0xf45b(%rip), %rax      # 0x16e90
jmp 0x7a00
movq 0xe582(%rip), %rax      # 0x15fc0
movq (%rax), %rdi
callq 0x44c0
cmpl $-0x1, %eax
je 0x7ab8
movl %eax, %r14d
movb $0x1, %bl
cmpl $0x3, %eax
je 0x7fa2
movl 0xf421(%rip), %eax      # 0x16e80
andl $-0x2, %eax
cmpl $0x4, %eax
jne 0x7afe
callq 0x816e
jmp 0x7fa0
movl -0x58(%rbp), %esi
cmpl $0x3, %esi
je 0x7a90
cmpl $0x1b, %esi
je 0x7a90
cmpl $0xd, %esi
je 0x7aa2
cmpl $0x9, %esi
jne 0x7bce
andq $0x0, 0xf430(%rip)      # 0x16ec8
movq 0xf421(%rip), %rax      # 0x16ec0
movb $0x0, (%rax)
callq 0x8202
andl $0x0, 0xf3d2(%rip)      # 0x16e80
callq 0x650d
jmp 0x7fa0
cmpl $0x0, 0xf3c1(%rip)      # 0x16e80
jne 0x7fa0
xorl %ebx, %ebx
cmpb $0x1, 0xf3b6(%rip)      # 0x16e84
jne 0x7fa2
cmpl $0x8, 0xe8e9(%rip)      # 0x163c4
je 0x7fa2
callq 0xab71
testb %al, %al
je 0x7fa0
movl 0xe8d0(%rip), %edi      # 0x163c4
callq 0x6d7c
jmp 0x7fa0
callq 0x6f7d
xorb $0x1, %al
leal -0x109(%r14), %ecx
cmpl $0xc, %ecx
setae %cl
orb %al, %cl
jne 0x7b9e
leal -0x9(%r14), %eax
movsbl %al, %ebx
movl %ebx, %edi
callq 0xb9cc
cmpq $0x0, 0x8(%rax)
je 0x7fa0
movl %ebx, %edi
callq 0xb9cc
xorl %ebx, %ebx
movq %rax, %rdi
xorl %esi, %esi
callq 0xa9f7
jmp 0x7fa2
cmpl $0x14a, %eax            # imm = 0x14A
je 0x7c87
cmpl $0x152, %eax            # imm = 0x152
je 0x7d3c
cmpl $0x157, %eax            # imm = 0x157
je 0x7aa2
cmpl $0x168, %eax            # imm = 0x168
jne 0x7fa0
movzwl 0xf374(%rip), %eax      # 0x16ef2
movw %ax, 0xf35b(%rip)       # 0x16ee0
cmpw $0x39, %ax
pushq $0x38
popq %rcx
cmovgel %eax, %ecx
addl $-0x38, %ecx
movw %cx, 0xf357(%rip)       # 0x16ef0
jmp 0x7f29
cmpl $0x3, 0xf2db(%rip)      # 0x16e80
jne 0x7c46
movl %r14d, %edi
callq 0x4540
leal -0x61(%rax), %ecx
cmpl $0xa, %ecx
ja 0x7e44
addb $-0x61, %al
movzbl %al, %edi
callq 0xaab8
jmp 0x7a6b
movswl 0xf30b(%rip), %edx      # 0x16ee0
leaq 0xf2e4(%rip), %rbx      # 0x16ec0
movq %rbx, %rdi
callq 0xcf66
leaq 0xf2b5(%rip), %rdi      # 0x16ea0
movq %rbx, %rsi
callq 0x4220
movq 0xf296(%rip), %rax      # 0x16e90
movq %rax, 0xf2e7(%rip)      # 0x16ee8
movzwl 0xf2ea(%rip), %eax      # 0x16ef2
movl %eax, %ecx
incl %ecx
movw %cx, 0xf2df(%rip)       # 0x16ef2
movzwl 0xf2c6(%rip), %ecx      # 0x16ee0
movl %ecx, %edx
incl %edx
movw %dx, 0xf2bb(%rip)       # 0x16ee0
cmpw %ax, %cx
setne %al
cmpw $0x39, %dx
setl %cl
orb %al, %cl
jne 0x7f29
incw 0xf2af(%rip)            # 0x16ef0
jmp 0x7f29
cmpl $0x3f, %r14d
jne 0x7e72
movl $0x4, 0xf226(%rip)      # 0x16e80
callq 0x8184
callq 0xc5e5
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x6523
jmp 0x7fa2
andw $0x0, 0xf276(%rip)      # 0x16ef0
andw $0x0, 0xf25e(%rip)      # 0x16ee0
jmp 0x7f29
movswl 0xf252(%rip), %esi      # 0x16ee0
cmpw 0xf25d(%rip), %si       # 0x16ef2
jge 0x7f29
leaq 0xf21e(%rip), %rbx      # 0x16ec0
movq %rbx, %rdi
callq 0xce3c
leaq 0xf1ef(%rip), %rdi      # 0x16ea0
movq %rbx, %rsi
callq 0x4220
movq 0xf1d0(%rip), %rax      # 0x16e90
movq %rax, 0xf221(%rip)      # 0x16ee8
jmp 0x7e38
movzwl 0xf20d(%rip), %eax      # 0x16ee0
testw %ax, %ax
jle 0x7f29
leal -0x1(%rax), %ecx
movw %cx, 0xf1fa(%rip)       # 0x16ee0
movzwl 0xf203(%rip), %ecx      # 0x16ef0
cmpw %cx, %ax
jg 0x7f29
cmpw $0x1d, %cx
pushq $0x1c
popq %rax
cmovael %ecx, %eax
addl $-0x1c, %eax
movw %ax, 0xf1e6(%rip)       # 0x16ef0
jmp 0x7f29
movzwl 0xf1ca(%rip), %eax      # 0x16ee0
cmpw 0xf1d5(%rip), %ax       # 0x16ef2
jge 0x7f29
leal 0x1(%rax), %ecx
movw %cx, 0xf1b3(%rip)       # 0x16ee0
cmpw $0x38, %ax
jge 0x7c3a
jmp 0x7f29
movq 0xf14d(%rip), %rax      # 0x16e90
movq %rax, 0xf19e(%rip)      # 0x16ee8
leaq 0xf16f(%rip), %rdi      # 0x16ec0
leaq 0xf148(%rip), %rsi      # 0x16ea0
callq 0x8305
testb %al, %al
je 0x7eb9
leaq 0xf134(%rip), %rdi      # 0x16ea0
jmp 0x7f24
movq 0xf110(%rip), %rcx      # 0x16e88
movq 0xf169(%rip), %rax      # 0x16ee8
leaq 0xf11a(%rip), %rbx      # 0x16ea0
cmpq %rcx, %rax
je 0x7fb5
movq 0xf0f2(%rip), %rax      # 0x16e88
movq 0xf14b(%rip), %rdi      # 0x16ee8
movq %rax, %rcx
cmpq %rax, %rdi
je 0x7d86
addq $-0x20, %rdi
movq %rdi, 0xf138(%rip)      # 0x16ee8
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4720
testq %rax, %rax
jne 0x7d8f
movq 0xf122(%rip), %rdi      # 0x16ee8
jmp 0x7f24
movswl 0xf10e(%rip), %esi      # 0x16ee0
testl %esi, %esi
jle 0x7f29
decl %esi
leaq 0xf0dd(%rip), %rbx      # 0x16ec0
movq %rbx, %rdi
callq 0xce3c
leaq 0xf0ae(%rip), %rdi      # 0x16ea0
movq %rbx, %rsi
callq 0x4220
movq 0xf08f(%rip), %rax      # 0x16e90
movq %rax, 0xf0e0(%rip)      # 0x16ee8
movzwl 0xf0d1(%rip), %ecx      # 0x16ee0
decl %ecx
movw %cx, 0xf0c8(%rip)       # 0x16ee0
movzwl 0xf0d1(%rip), %eax      # 0x16ef0
cmpw %ax, %cx
jge 0x7e38
cmpw $0x1d, %ax
pushq $0x1c
popq %rcx
cmovgel %eax, %ecx
addl $-0x1c, %ecx
movw %cx, 0xf0b8(%rip)       # 0x16ef0
decw 0xf0b3(%rip)            # 0x16ef2
jmp 0x7f29
cmpl $0x1b, %eax
je 0x7a6b
cmpl $0x6c, %eax
je 0x7a6b
cmpl $0x73, %eax
je 0x7fad
cmpl $0x74, %eax
jne 0x7fa0
callq 0xaafd
jmp 0x7a6b
cmpl $0x100, %r14d           # imm = 0x100
jge 0x7ef3
movsbl %r14b, %edi
callq 0xb81d
cmpl $0x1a, %eax
jg 0x7fa0
ja 0x7fa0
movl %eax, %ecx
leaq 0x66f4(%rip), %rdx      # 0xe590
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
callq 0x6e70
movl $0x8, 0xe510(%rip)      # 0x163c4
jmp 0x7fa0
leaq 0x65c9(%rip), %rsi      # 0xe489
leaq -0x38(%rbp), %rdi
leaq -0x11(%rbp), %rdx
callq 0x69bc
leaq -0x38(%rbp), %rdi
callq 0x82bc
leaq -0x38(%rbp), %rdi
callq 0x4748
andq $0x0, 0xefc1(%rip)      # 0x16ea8
movq 0xefb2(%rip), %rax      # 0x16ea0
movb $0x0, (%rax)
jmp 0x7f29
addl $0xfffffefe, %r14d      # imm = 0xFFFFFEFE
cmpl $0x4, %r14d
jae 0x7fa0
movl %r14d, %eax
leaq 0x6736(%rip), %rcx      # 0xe644
movl (%rcx,%rax,4), %eax
movl %eax, 0xe4ad(%rip)      # 0x163c4
movl %eax, %edi
jmp 0x7af4
movq %rdi, %rbx
movq %rbx, %rdi
callq 0x82bc
xorl %r14d, %r14d
cmpl $0x1, 0xef4d(%rip)      # 0x16e80
setne %r14b
movswl 0xefb2(%rip), %edx      # 0x16ef0
movswl 0xefad(%rip), %eax      # 0x16ef2
subl %edx, %eax
cmpl $0x39, %eax
pushq $0x39
popq %rcx
cmovll %eax, %ecx
movswl %cx, %ecx
leaq 0xef66(%rip), %rsi      # 0x16ec0
leaq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0xd119
movq (%rbx), %rdi
leal 0x7(,%r14,4), %esi
pushq $0xe
popq %rcx
pushq $0x2
popq %r8
pushq $0x1
popq %r9
xorl %edx, %edx
callq 0x61ca
leaq -0x38(%rbp), %rdi
callq 0x4748
movb 0xef4e(%rip), %al       # 0x16ee0
subb 0xef58(%rip), %al       # 0x16ef0
movsbl %al, %edi
callq 0x6523
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
pushq $0xb
popq %rdi
jmp 0x7bc4
leaq 0xeee4(%rip), %rdi      # 0x16ea0
callq 0x82bc
movq 0xeec8(%rip), %rax      # 0x16e90
movq %rax, 0xef19(%rip)      # 0x16ee8
jmp 0x7f29
callq 0x6ecb
jmp 0x80d3
callq 0xab37
jmp 0x7fa0
pushq $0x2
jmp 0x803f
leaq 0x6624(%rip), %rsi      # 0xe614
leaq -0x58(%rbp), %rdi
leaq -0x11(%rbp), %rdx
callq 0x69bc
callq 0xbaa0
movzbl %al, %eax
leaq 0xdd24(%rip), %rcx      # 0x15d30
movq (%rcx,%rax,8), %rdx
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x6a23
leaq -0x38(%rbp), %rdi
pushq $0xf
popq %rsi
callq 0x86ae
jmp 0x811d
movl $0x2, 0xee48(%rip)      # 0x16e80
jmp 0x80ce
pushq $0x1
popq %rdi
jmp 0x8086
callq 0xc8d8
jmp 0x7fa0
callq 0x974e
jmp 0x7fa0
cmpb $0x1, 0xee27(%rip)      # 0x16e84
je 0x80d3
movb $0x1, 0xee1e(%rip)      # 0x16e84
pushq $0x1
popq %rdi
callq 0x65d1
jmp 0x7fa0
callq 0x6f99
jmp 0x80d3
callq 0x9789
jmp 0x7fa0
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0xa8ef
andl $0x0, 0xedea(%rip)      # 0x16e80
jmp 0x80d3
callq 0xc4d0
jmp 0x7fa0
callq 0x6fc0
jmp 0x80d3
movl $0x3, 0xedcd(%rip)      # 0x16e80
callq 0x8184
callq 0xc5e5
xorl %edi, %edi
jmp 0x7f9b
movl $0x1, 0xedb2(%rip)      # 0x16e80
callq 0x81ab
callq 0x8184
jmp 0x7fa0
leaq 0x6545(%rip), %rsi      # 0xe629
leaq -0x58(%rbp), %rdi
leaq -0x11(%rbp), %rdx
callq 0x69bc
callq 0xbac2
movzbl %al, %eax
leaq 0xdc30(%rip), %rcx      # 0x15d30
movq (%rcx,%rax,8), %rdx
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x6a23
leaq -0x38(%rbp), %rdi
pushq $0xf
popq %rsi
callq 0x86ae
leaq -0x38(%rbp), %rdi
callq 0x4748
leaq -0x58(%rbp), %rdi
callq 0x4748
jmp 0x7fa0
jmp 0x8136
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x4748
jmp 0x814d
jmp 0x8155
jmp 0x8155
jmp 0x814a
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
jmp 0x8161
jmp 0x815a
movq %rax, %rbx
jmp 0x8166
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x4748
movq %rbx, %rdi
callq 0x4650