// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movl 0xf4c1(%rip), %eax      # 0x17e80
decl %eax
cmpl $0x1, %eax
ja 0x8aa3
movq 0xe5ef(%rip), %rax      # 0x16fc0
movq (%rax), %rdi
leaq -0x58(%rbp), %rsi
callq 0x4260
testl %eax, %eax
je 0x8aef
cmpl $0x100, %eax            # imm = 0x100
jne 0x9075
movl -0x58(%rbp), %eax
cmpl $0x149, %eax            # imm = 0x149
jg 0x8c58
addl $0xfffffefe, %eax       # imm = 0xFFFFFEFE
cmpl $0x5, %eax
ja 0x9075
leaq 0x7bd9(%rip), %rcx      # 0x105ec
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xf465(%rip), %rcx      # 0x17e88
movq 0xf466(%rip), %rax      # 0x17e90
cmpq %rax, %rcx
je 0x8fe6
movq 0xf4ae(%rip), %rsi      # 0x17ee8
leaq 0x20(%rsi), %rdx
cmpq %rax, %rsi
cmoveq %rcx, %rdx
movq %rdx, 0xf49c(%rip)      # 0x17ee8
cmpq %rax, %rdx
je 0x8a8d
movq 0xf448(%rip), %rsi      # 0x17ea0
movq 0xf449(%rip), %rcx      # 0x17ea8
movq %rdx, %rdi
xorl %edx, %edx
callq 0x4660
movq 0xf478(%rip), %rdx      # 0x17ee8
testq %rax, %rax
je 0x8fa8
addq $0x20, %rdx
movq %rdx, 0xf464(%rip)      # 0x17ee8
cmpq 0xf405(%rip), %rdx      # 0x17e90
jne 0x8a51
leaq 0xf42c(%rip), %rbx      # 0x17ec0
leaq 0xf405(%rip), %rsi      # 0x17ea0
movq %rbx, %rdi
jmp 0x8fb5
movq 0xe516(%rip), %rax      # 0x16fc0
movq (%rax), %rdi
callq 0x44c0
cmpl $-0x1, %eax
je 0x8b85
movl %eax, %ebx
movb $0x1, %r14b
cmpl $0x3, %eax
je 0x9078
movl 0xf3b1(%rip), %eax      # 0x17e80
andl $-0x2, %eax
cmpl $0x4, %eax
jne 0x8c05
movl $0x0, 0xf39b(%rip)      # 0x17e80
callq 0xebd3
jmp 0x8bfb
movl -0x58(%rbp), %esi
cmpl $0xc, %esi
jg 0x8bc9
cmpl $0x3, %esi
je 0x8bd7
cmpl $0x9, %esi
je 0x8bd7
movswl 0xf3cc(%rip), %edx      # 0x17ee0
leaq 0xf3a5(%rip), %rbx      # 0x17ec0
movq %rbx, %rdi
callq 0xf70d
leaq 0xf376(%rip), %rdi      # 0x17ea0
movq %rbx, %rsi
callq 0x4200
movq 0xf357(%rip), %rax      # 0x17e90
movq %rax, 0xf3a8(%rip)      # 0x17ee8
movzwl 0xf3ab(%rip), %eax      # 0x17ef2
movl %eax, %ecx
incl %ecx
movw %cx, 0xf3a0(%rip)       # 0x17ef2
movzwl 0xf387(%rip), %ecx      # 0x17ee0
movl %ecx, %edx
incl %edx
movw %dx, 0xf37c(%rip)       # 0x17ee0
cmpw %ax, %cx
setne %al
cmpw $0x39, %dx
setl %cl
orb %al, %cl
jne 0x8fe6
incw 0xf370(%rip)            # 0x17ef0
jmp 0x8fe6
cmpl $0x0, 0xf2f4(%rip)      # 0x17e80
jne 0x9075
cmpb $0x1, 0xf2eb(%rip)      # 0x17e84
jne 0x9075
cmpl $0x8, 0xe81e(%rip)      # 0x173c4
je 0x9075
callq 0xcc90
testb %al, %al
je 0x9075
movl 0xe805(%rip), %edi      # 0x173c4
callq 0x7634
jmp 0x9075
cmpl $0xd, %esi
je 0x8bec
cmpl $0x1b, %esi
jne 0x8b0d
movq $0x0, 0xf2e6(%rip) # 0x17ec8
movq 0xf2d7(%rip), %rax      # 0x17ec0
movb $0x0, (%rax)
callq 0x93ca
movl $0x0, 0xf285(%rip)      # 0x17e80
callq 0x6c08
jmp 0x9075
callq 0x7861
testb %al, %al
je 0x8c29
leal -0x109(%rbx), %eax
xorl %r14d, %r14d
cmpl %r14d, %eax
je 0x8d32
incl %r14d
cmpb $0xc, %r14b
jne 0x8c17
cmpl $0x3, 0xf250(%rip)      # 0x17e80
jne 0x8cea
movl %ebx, %edi
callq 0x4530
leal -0x61(%rax), %ecx
cmpl $0xa, %ecx
ja 0x8d61
addb $-0x61, %al
movzbl %al, %edi
callq 0xcb5f
jmp 0x8adb
cmpl $0x156, %eax            # imm = 0x156
jg 0x8cc8
cmpl $0x14a, %eax            # imm = 0x14A
je 0x8d9a
cmpl $0x152, %eax            # imm = 0x152
jne 0x9075
movq 0xf214(%rip), %rax      # 0x17e90
movq %rax, 0xf265(%rip)      # 0x17ee8
movq 0xf23e(%rip), %rdx      # 0x17ec8
cmpq 0xf217(%rip), %rdx      # 0x17ea8
jne 0x8cb7
testq %rdx, %rdx
je 0x8f55
movq 0xf1fd(%rip), %rsi      # 0x17ea0
movq 0xf216(%rip), %rdi      # 0x17ec0
callq 0x43b0
testl %eax, %eax
je 0x8f55
leaq 0xf1e2(%rip), %rdi      # 0x17ea0
callq 0x9578
jmp 0x8fe6
cmpl $0x157, %eax            # imm = 0x157
je 0x8bec
cmpl $0x168, %eax            # imm = 0x168
jne 0x9075
movzwl 0xf20d(%rip), %eax      # 0x17ef2
jmp 0x8fc9
cmpl $0x3f, %ebx
jne 0x8d81
movl $0x4, 0xf183(%rip)      # 0x17e80
cmpb $0x1, 0xf180(%rip)      # 0x17e84
jne 0x8d14
movb $0x0, 0xf177(%rip)      # 0x17e84
xorl %edi, %edi
callq 0x6d03
movl $0x8, 0xe6a6(%rip)      # 0x173c4
callq 0xebd3
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x6c36
jmp 0x9078
movsbl %r14b, %edi
callq 0xe08a
cmpq $0x0, 0x8(%rax)
je 0x9075
movsbl %r14b, %edi
callq 0xe08a
xorl %r14d, %r14d
movq %rax, %rdi
xorl %esi, %esi
callq 0xca58
jmp 0x9078
cmpl $0x72, %eax
jg 0x8eea
cmpl $0x1b, %eax
je 0x8adb
cmpl $0x6c, %eax
je 0x8adb
jmp 0x9075
cmpl $0xff, %ebx
jg 0x8f06
movsbl %bl, %edi
callq 0xde65
jmp 0x8f22
movswl 0xf13f(%rip), %esi      # 0x17ee0
cmpw 0xf14a(%rip), %si       # 0x17ef2
jge 0x8fe6
leaq 0xf10b(%rip), %rbx      # 0x17ec0
movq %rbx, %rdi
callq 0xf570
leaq 0xf0dc(%rip), %rdi      # 0x17ea0
movq %rbx, %rsi
callq 0x4200
movq 0xf0bd(%rip), %rax      # 0x17e90
movq %rax, 0xf10e(%rip)      # 0x17ee8
jmp 0x8ede
xorl %eax, %eax
movw %ax, 0xf108(%rip)       # 0x17ef0
movw %ax, 0xf0f1(%rip)       # 0x17ee0
jmp 0x8fe6
movzwl 0xf0e5(%rip), %eax      # 0x17ee0
testw %ax, %ax
jle 0x8fe6
leal -0x1(%rax), %ecx
movw %cx, 0xf0d2(%rip)       # 0x17ee0
movzwl 0xf0db(%rip), %ecx      # 0x17ef0
cmpw %cx, %ax
jg 0x8fe6
cmpw $0x1d, %cx
movl $0x1c, %eax
cmovgel %ecx, %eax
addl $-0x1c, %eax
movw %ax, 0xf0bc(%rip)       # 0x17ef0
jmp 0x8fe6
movzwl 0xf0a0(%rip), %eax      # 0x17ee0
cmpw 0xf0ab(%rip), %ax       # 0x17ef2
jge 0x8fe6
incl %eax
movw %ax, 0xf08a(%rip)       # 0x17ee0
cmpw $0x39, %ax
jge 0x8b79
jmp 0x8fe6
callq 0x9492
jmp 0x8fe6
movswl 0xf06a(%rip), %esi      # 0x17ee0
testl %esi, %esi
jle 0x8fe6
decl %esi
leaq 0xf039(%rip), %rbx      # 0x17ec0
movq %rbx, %rdi
callq 0xf570
leaq 0xf00a(%rip), %rdi      # 0x17ea0
movq %rbx, %rsi
callq 0x4200
movq 0xefeb(%rip), %rax      # 0x17e90
movq %rax, 0xf03c(%rip)      # 0x17ee8
movzwl 0xf02d(%rip), %ecx      # 0x17ee0
decl %ecx
movw %cx, 0xf024(%rip)       # 0x17ee0
movzwl 0xf02d(%rip), %eax      # 0x17ef0
cmpw %ax, %cx
jge 0x8ede
cmpw $0x1d, %ax
movl $0x1c, %ecx
cmovgel %eax, %ecx
addl $-0x1c, %ecx
movw %cx, 0xf012(%rip)       # 0x17ef0
decw 0xf00d(%rip)            # 0x17ef2
jmp 0x8fe6
cmpl $0x73, %eax
je 0x8f9e
cmpl $0x74, %eax
jne 0x9075
callq 0xcbcc
jmp 0x8adb
addl $0xfffffefe, %ebx       # imm = 0xFFFFFEFE
movl $0x1b, %eax
cmpl $0x3, %ebx
ja 0x8f22
movl %ebx, %eax
leaq 0x7715(%rip), %rcx      # 0x10634
movl (%rcx,%rax,4), %eax
cmpl $0x1a, %eax
jg 0x920a
ja 0x920a
movl %eax, %ecx
leaq 0x7646(%rip), %rdx      # 0x10580
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl %eax, 0xe47b(%rip)      # 0x173c4
movl %eax, %edi
callq 0x7634
jmp 0x920a
leaq -0x28(%rbp), %r14
movq %r14, -0x10(%r14)
movq $0x0, -0x8(%r14)
movb $0x0, (%r14)
leaq -0x38(%rbp), %rdi
callq 0x9578
movq -0x38(%rbp), %rdi
cmpq %r14, %rdi
je 0x8f87
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x43a0
movq $0x0, 0xef16(%rip) # 0x17ea8
movq 0xef07(%rip), %rax      # 0x17ea0
movb $0x0, (%rax)
jmp 0x8fe6
movl $0xb, %edi
jmp 0x8c4e
leaq 0xef11(%rip), %rbx      # 0x17ec0
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x4200
movq %rbx, %rdi
callq 0xf89c
movw %ax, 0xef29(%rip)       # 0x17ef2
movw %ax, 0xef10(%rip)       # 0x17ee0
cmpw $0x39, %ax
movl $0x38, %ecx
cmovgel %eax, %ecx
addl $-0x38, %ecx
movw %cx, 0xef0a(%rip)       # 0x17ef0
xorl %r14d, %r14d
cmpl $0x1, 0xee90(%rip)      # 0x17e80
setne %r14b
movswl 0xeef5(%rip), %edx      # 0x17ef0
movswl 0xeef0(%rip), %eax      # 0x17ef2
subl %edx, %eax
cmpl $0x39, %eax
movl $0x39, %ecx
cmovll %eax, %ecx
movswl %cx, %ecx
leaq 0xeea7(%rip), %rsi      # 0x17ec0
leaq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0xf9bd
movq (%rbx), %rdi
leal 0x7(,%r14,4), %esi
xorl %edx, %edx
movl $0xe, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
callq 0x68af
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9061
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x43a0
movb 0xee79(%rip), %al       # 0x17ee0
subb 0xee83(%rip), %al       # 0x17ef0
movsbl %al, %edi
callq 0x6c36
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x787d
jmp 0x91e9
callq 0xcc2e
jmp 0x920a
callq 0x78a4
jmp 0x91e9
leaq -0x48(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x7551(%rip), %rsi      # 0x10604
leaq 0x755e(%rip), %rdx      # 0x10618
leaq -0x58(%rbp), %rdi
callq 0x8912
callq 0xe19b
movzbl %al, %eax
leaq 0xdc4e(%rip), %rcx      # 0x16d20
movq (%rcx,%rax,8), %rsi
leaq -0x58(%rbp), %rdi
callq 0x46f0
leaq -0x28(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x927b
movq %rdx, -0x38(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x28(%rbp)
jmp 0x9282
xorl %edi, %edi
jmp 0x91be
cmpb $0x1, 0xed6c(%rip)      # 0x17e84
je 0x91f2
movb $0x1, 0xed5f(%rip)      # 0x17e84
movl $0x1, %edi
callq 0x6d03
jmp 0x920a
callq 0xb09b
jmp 0x920a
callq 0xb0d6
jmp 0x920a
callq 0xea74
jmp 0x920a
callq 0x7794
jmp 0x91e9
movl $0x1, 0xed1a(%rip)      # 0x17e80
jmp 0x91e4
callq 0x772f
jmp 0x9200
movl $0x3, 0xed04(%rip)      # 0x17e80
cmpb $0x1, 0xed01(%rip)      # 0x17e84
jne 0x9193
movb $0x0, 0xecf8(%rip)      # 0x17e84
xorl %edi, %edi
callq 0x6d03
movl $0x8, 0xe227(%rip)      # 0x173c4
callq 0xebd3
xorl %edi, %edi
callq 0x6c36
jmp 0x920a
movl $0x2, %edi
jmp 0x91be
callq 0xef0b
jmp 0x920a
movl $0x1, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0xc928
movl $0x0, 0xecaf(%rip)      # 0x17e80
jmp 0x91e9
movb $0x1, %r14b
xorl %eax, %eax
jmp 0x920f
movl $0x2, 0xec9c(%rip)      # 0x17e80
callq 0x9371
cmpb $0x1, 0xec94(%rip)      # 0x17e84
jne 0x9200
movb $0x0, 0xec8b(%rip)      # 0x17e84
xorl %edi, %edi
callq 0x6d03
movl $0x8, 0xe1ba(%rip)      # 0x173c4
movb $0x1, %al
xorl %r14d, %r14d
testb %al, %al
jne 0x9075
jmp 0x9078
leaq -0x48(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x73ee(%rip), %rsi      # 0x10619
leaq 0x73f5(%rip), %rdx      # 0x10627
leaq -0x58(%rbp), %rdi
callq 0x8912
callq 0xe1bd
movzbl %al, %eax
leaq 0xdad6(%rip), %rcx      # 0x16d20
movq (%rcx,%rax,8), %rsi
leaq -0x58(%rbp), %rdi
callq 0x46f0
leaq -0x28(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x92a9
movq %rdx, -0x38(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x28(%rbp)
jmp 0x92b0
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq -0x38(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl $0xf, %esi
callq 0x9c17
jmp 0x92d5
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq -0x38(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl $0xf, %esi
callq 0x9c17
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x92ea
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x43a0
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x920a
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x43a0
jmp 0x920a
jmp 0x930a
movq %rax, %rbx
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x9330
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x43a0
jmp 0x9330
jmp 0x9326
movq %rax, %rbx
jmp 0x9369
jmp 0x932d
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x9369
movq -0x48(%rbp), %rsi
jmp 0x9361
movq %rax, %rbx
movq -0x38(%rbp), %rdi
cmpq %r14, %rdi
jne 0x935d
jmp 0x9369
movq %rax, %rbx
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9369
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x43a0
movq %rbx, %rdi
callq 0x4670