// File: /workspace/github_cpp_makefile_star2_O3/Gydo194[P]server/controller/controller.cpp
// Function: Controller::handleServerInput(unsigned short, char*)
void Controller::handleServerInput(uint16_t fd, char *buffer)
{
	cout << "Controller: got input '" << buffer << "'from " << fd << endl;
	prs.parse(buffer);
	for(string i : prs.values)
	{
		cout << "Controller::handleServerInput -> for: input: '" << i << "'.\n";
	}


	//get the first argument name
	string key;
	try
	{
		key = prs.values.at(0);
	}
	catch(out_of_range oor)
	{
		cerr << "no action" << endl;
	}

	//look it up in the handlers map
	Controller::handler h = NULL;
	if(map_get<string,Controller::handler>(&handlers, key, &h))
	{
		printf("Controller: handler address = '%x'\n",h);
		//call the callback function
		h(&prs.values);
	}
	else
	{
		cerr << "[ERROR] Controller: No such action (" << key << ")\n";
	}

	prs.values.clear();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movl %edi, %ebp
movq 0x42f6(%rip), %r14      # 0x6fd0
leaq 0x14b4(%rip), %rsi      # 0x4195
movl $0x17, %edx
movq %r14, %rdi
callq 0x2220
testq %rbx, %rbx
je 0x2d0f
movq %rbx, %rdi
callq 0x20f0
movq 0x42ce(%rip), %rdi      # 0x6fd0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2220
jmp 0x2d27
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x22e0
movq 0x42a2(%rip), %r14      # 0x6fd0
leaq 0x1478(%rip), %rsi      # 0x41ad
movl $0x6, %edx
movq %r14, %rdi
callq 0x2220
movzwl %bp, %esi
movq %r14, %rdi
callq 0x2150
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2160
leaq 0x444a(%rip), %rdi      # 0x71c8
movq %rbx, %rsi
callq 0x3648
movq 0x443b(%rip), %rbp      # 0x71c8
movq 0x443c(%rip), %rbx      # 0x71d0
leaq 0x18(%rsp), %r13
cmpq %rbx, %rbp
je 0x2f4e
movq 0x4227(%rip), %r14      # 0x6fd0
leaq 0x1404(%rip), %r15      # 0x41b4
leaq 0x142c(%rip), %r12      # 0x41e3
movq %r13, 0x8(%rsp)
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x2b70
movl $0x2e, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2220
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r14, %rdi
callq 0x2220
movl $0x3, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2220
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x2e1a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
addq $0x20, %rbp
cmpq %rbx, %rbp
jne 0x2db7
movq 0x43a6(%rip), %rax      # 0x71d0
movq 0x4397(%rip), %rsi      # 0x71c8
movq %r13, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
cmpq %rsi, %rax
je 0x2f5f
leaq 0x8(%rsp), %rdi
callq 0x2130
movq $0x0, 0x28(%rsp)
leaq 0x48(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x2b70
leaq 0x4359(%rip), %rdi      # 0x71e0
leaq 0x38(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x313b
movl %eax, %ebx
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x2eaf
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21f0
testb %bl, %bl
je 0x2ed3
movq 0x28(%rsp), %rsi
leaq 0x1332(%rip), %rdi      # 0x41f1
xorl %eax, %eax
callq 0x2050
leaq 0x42fb(%rip), %rdi      # 0x71c8
callq *0x28(%rsp)
jmp 0x2f15
movq 0x4116(%rip), %rdi      # 0x6ff0
leaq 0x1334(%rip), %rsi      # 0x4215
movl $0x24, %edx
callq 0x2220
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x40f4(%rip), %rdi      # 0x6ff0
callq 0x2220
leaq 0x1332(%rip), %rsi      # 0x423a
movl $0x2, %edx
movq %rax, %rdi
callq 0x2220
movq 0x42ac(%rip), %rsi      # 0x71c8
leaq 0x42a5(%rip), %rdi      # 0x71c8
callq 0x32ca
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x2f3f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
leaq 0x12f7(%rip), %rdi      # 0x425d
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2290
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x302c
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21f0
jmp 0x302c
jmp 0x3029
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x302c
movq %rbx, %rdi
callq 0x2230
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x22c0
movq 0x3ffc(%rip), %rax      # 0x6fc0
addq $0x10, %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0x20e0
movq 0x4016(%rip), %rdi      # 0x6ff0
leaq 0x1206(%rip), %rsi      # 0x41e7
movl $0x9, %edx
callq 0x2220
movq 0x3ffe(%rip), %rdi      # 0x6ff0
callq 0x2100
leaq 0x28(%rsp), %rdi
callq 0x2250
callq 0x22b0
jmp 0x2e57
jmp 0x3029
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2250
callq 0x22b0
jmp 0x302c
movq %rax, %rdi
callq 0x2a81
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x3043
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x22f0