// File: nmmmnu[P]HM3/net/worker/keyvalueworker_impl.h
// Function: net::WorkerStatus net::worker::KeyValueWorker<net::protocol::RedisProtocol, KeyValueMockAdapter>::process_request_<net::ClientBuffer>(net::ClientBuffer&)
WorkerStatus KeyValueWorker<PROTOCOL, DB_ADAPTER>::process_request_(CONNECTION &buffer){
	protocol_.print();

	const auto &p = protocol_.getParams();
	const auto &cmd = p[0];

	if (cmp__(cmd, SHUTDOWN)){
		return WorkerStatus::SHUTDOWN;
	}

	if (cmp__(cmd, EXIT)){
		return WorkerStatus::DISCONNECT;
	}

	if (cmp__(cmd, REFRESH)){
		db_.refresh();

		return sendResponseString_(buffer, "OK");
	}

	if (cmp__(cmd, INFO)){
		if (p.size() != 1)
			return sendResponseError_(buffer, "Bad request");

		return sendResponseString_(buffer, db_.info() );
	}

	if (cmp__(cmd, GET)){
		if (p.size() != 2)
			return sendResponseError_(buffer, "Bad request");

		const auto &key = p[1];

		return sendResponseString_(buffer, db_.get(key));
	}

	if (cmp__(cmd, GETALL)){
		if (p.size() != 2)
			return sendResponseError_(buffer, "Bad request");

		const auto &key = p[1];
		(void) key;

		return sendResponseMulti_(buffer, db_.getall(key) );
	}

	return sendResponseError_(buffer, "Not Implemented");
}

// Assembly:
subq $0x188, %rsp            # imm = 0x188
movq %rdi, 0x178(%rsp)
movq %rsi, 0x170(%rsp)
movq 0x178(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x9a60
movq 0x70(%rsp), %rdi
callq 0x6f90
movq %rax, 0x168(%rsp)
movq 0x168(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x6fa0
movq %rax, 0x160(%rsp)
movq 0x160(%rsp), %rdi
leaq 0xb295(%rip), %rsi      # 0x11cf8
callq 0x6fc0
testb $0x1, %al
jne 0x6a6e
jmp 0x6a7e
movl $0x5, 0x184(%rsp)
jmp 0x6ea8
movq 0x160(%rsp), %rdi
leaq 0xb24b(%rip), %rsi      # 0x11cd8
callq 0x6fc0
testb $0x1, %al
jne 0x6a98
jmp 0x6aa8
movl $0x3, 0x184(%rsp)
jmp 0x6ea8
movq 0x160(%rsp), %rdi
leaq 0xb281(%rip), %rsi      # 0x11d38
callq 0x7040
testb $0x1, %al
jne 0x6ac2
jmp 0x6b14
movq 0x70(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x7120
movq 0x170(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x150(%rsp), %rdi
leaq 0x567b(%rip), %rsi      # 0xc167
callq 0x6f10
movq 0x70(%rsp), %rdi
movq 0x68(%rsp), %rsi
leaq 0x150(%rsp), %rdx
callq 0x7130
movl %eax, 0x184(%rsp)
jmp 0x6ea8
movq 0x160(%rsp), %rdi
leaq 0xb1f5(%rip), %rsi      # 0x11d18
callq 0x6fc0
testb $0x1, %al
jne 0x6b31
jmp 0x6c24
movq 0x168(%rsp), %rdi
callq 0x2f70
cmpq $0x1, %rax
je 0x6b88
movq 0x170(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x140(%rsp), %rdi
leaq 0x5614(%rip), %rsi      # 0xc174
callq 0x6f10
movq 0x70(%rsp), %rdi
movq 0x60(%rsp), %rsi
leaq 0x140(%rsp), %rdx
callq 0x6ed0
movl %eax, 0x184(%rsp)
jmp 0x6ea8
movq 0x70(%rsp), %rax
movq 0x170(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movq 0x18(%rax), %rsi
leaq 0x110(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x7170
movq 0x58(%rsp), %rsi
leaq 0x130(%rsp), %rdi
callq 0x71f0
jmp 0x6bc4
movq 0x50(%rsp), %rsi
movq 0x70(%rsp), %rdi
leaq 0x130(%rsp), %rdx
callq 0x7130
movl %eax, 0x4c(%rsp)
jmp 0x6be1
movl 0x4c(%rsp), %eax
movl %eax, 0x184(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x2150
jmp 0x6ea8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x2150
jmp 0x6eb7
movq 0x160(%rsp), %rdi
leaq 0xb145(%rip), %rsi      # 0x11d78
callq 0x6fc0
testb $0x1, %al
jne 0x6c41
jmp 0x6d59
movq 0x168(%rsp), %rdi
callq 0x2f70
cmpq $0x2, %rax
je 0x6c98
movq 0x170(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0x5504(%rip), %rsi      # 0xc174
callq 0x6f10
movq 0x70(%rsp), %rdi
movq 0x40(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
callq 0x6ed0
movl %eax, 0x184(%rsp)
jmp 0x6ea8
movq 0x168(%rsp), %rdi
movl $0x1, %esi
callq 0x6fa0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0xe8(%rsp)
movq 0x170(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movq 0x18(%rax), %rsi
movq 0xe8(%rsp), %rdx
leaq 0xb8(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x7240
movq 0x38(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
callq 0x71f0
jmp 0x6cf9
movq 0x30(%rsp), %rsi
movq 0x70(%rsp), %rdi
leaq 0xd8(%rsp), %rdx
callq 0x7130
movl %eax, 0x2c(%rsp)
jmp 0x6d16
movl 0x2c(%rsp), %eax
movl %eax, 0x184(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x2150
jmp 0x6ea8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x2150
jmp 0x6eb7
movq 0x160(%rsp), %rdi
leaq 0xb030(%rip), %rsi      # 0x11d98
callq 0x6fc0
testb $0x1, %al
jne 0x6d76
jmp 0x6e71
movq 0x168(%rsp), %rdi
callq 0x2f70
cmpq $0x2, %rax
je 0x6dcd
movq 0x170(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0xa8(%rsp), %rdi
leaq 0x53cf(%rip), %rsi      # 0xc174
callq 0x6f10
movq 0x70(%rsp), %rdi
movq 0x20(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x6ed0
movl %eax, 0x184(%rsp)
jmp 0x6ea8
movq 0x168(%rsp), %rdi
movl $0x1, %esi
callq 0x6fa0
movq %rax, %rcx
movq 0x70(%rsp), %rax
movq %rcx, 0xa0(%rsp)
movq 0xa0(%rsp), %rdx
movq 0x170(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movq 0x18(%rax), %rsi
leaq 0x88(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x7300
movq 0x70(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x72c0
movl %eax, 0x1c(%rsp)
jmp 0x6e34
movl 0x1c(%rsp), %eax
movl %eax, 0x184(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x2b50
jmp 0x6ea8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x2b50
jmp 0x6eb7
movq 0x170(%rsp), %rax
movq %rax, (%rsp)
leaq 0x78(%rsp), %rdi
leaq 0x530f(%rip), %rsi      # 0xc198
callq 0x6f10
movq 0x70(%rsp), %rdi
movq (%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x6ed0
movl %eax, 0x184(%rsp)
movl 0x184(%rsp), %eax
addq $0x188, %rsp            # imm = 0x188
retq
movq 0x108(%rsp), %rdi
callq 0x2300
nopw %cs:(%rax,%rax)
nop