// File: muzuka[P]Cards-Against-Humanity-Online/Server.cpp
// Function: parseMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int parseMessage(string message) {
	char* notifyMessage[2]; // [0] has option, [1] has name
	char* messageDiv[2]; // [0] has type and source, [1] has content
	char* getCommand[2]; // [0] has command, [1] has source
	splitString(messageDiv, (char*)message.c_str(), "\n");
	splitString(getCommand, messageDiv[0], " ");
	
	if(strcmp((const char*)getCommand[0], "REQUEST") == 0) {
		Player newP = getPlayer(string(getCommand[1]));
		if (whiteDeck.size() == 0) {
			refill();
		}
		string add = composeSENDMessage('d', whiteDeck[whiteDeck.size() - 1]);
		whiteDeck.pop_back();
		bytesSent = send(newP.getSocket(), (char*)add.c_str(), 100, 0);
		return 1;
	}
	else if(strcmp((const char*)getCommand[0], "NOTIFY") == 0) {
		splitString(notifyMessage, messageDiv[1], " ");
		if (strcmp(notifyMessage[0], "winner:") == 0) {
			for (int i = 0; i < answers.size(); i++) {
				discard.push_back(answers[i]);
			}
			answers.clear();
			winner = getPlayer(string(notifyMessage[1]));
		}
		else if(strcmp(notifyMessage[0], "quit:") == 0) {
			Player temp = getPlayer(string(notifyMessage[1]));
			for(int i = 0; i < temp.getHand().size(); i++) {
				discard.push_back(temp.getHand()[i]);
			}
			close(temp.getSocket());
			deletePlayer(string(notifyMessage[1]));
			if (players.size() == 0)
				exit(1);
		}
		return 1;
	}
	else {
		return -1;
	}
	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x320, %rsp            # imm = 0x320
movq %rdi, -0x10(%rbp)
leaq -0x30(%rbp), %rax
movq %rax, -0x2a0(%rbp)
callq 0x3170
movq -0x2a0(%rbp), %rdi
movq %rax, %rsi
leaq 0x4c3e(%rip), %rdx      # 0xd09e
callq 0x76f0
leaq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq 0x4f0f(%rip), %rdx      # 0xd383
callq 0x76f0
movq -0x40(%rbp), %rdi
leaq 0x4eb0(%rip), %rsi      # 0xd334
callq 0x33b0
cmpl $0x0, %eax
jne 0x8694
movq -0x38(%rbp), %rax
movq %rax, -0x2b0(%rbp)
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x3450
movq -0x2b0(%rbp), %rsi
movq -0x2a8(%rbp), %rdx
leaq -0xb8(%rbp), %rdi
callq 0x8ef0
jmp 0x84cc
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x8bc0
jmp 0x84e1
leaq -0xb8(%rbp), %rdi
callq 0x31f0
leaq -0xb9(%rbp), %rdi
callq 0x3300
leaq 0xa1c0(%rip), %rdi      # 0x126c0
callq 0x4280
cmpq $0x0, %rax
jne 0x856e
callq 0x7960
jmp 0x8512
jmp 0x856e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8546
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x31f0
leaq -0xb9(%rbp), %rdi
callq 0x3300
jmp 0x8aea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8683
leaq 0xa14b(%rip), %rdi      # 0x126c0
movq %rdi, -0x2b8(%rbp)
callq 0x4280
movq -0x2b8(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x42b0
movq %rax, %rsi
leaq -0x138(%rbp), %rdi
callq 0x42d0
jmp 0x85a4
leaq -0xf0(%rbp), %rdi
movl $0x64, %esi
leaq -0x138(%rbp), %rdx
callq 0x7a00
jmp 0x85be
leaq -0x138(%rbp), %rdi
callq 0x4460
leaq 0xa0ef(%rip), %rdi      # 0x126c0
callq 0x90a0
leaq -0x98(%rbp), %rdi
callq 0x3c80
movl %eax, -0x2bc(%rbp)
jmp 0x85ea
leaq -0xf0(%rbp), %rdi
callq 0x3170
movl -0x2bc(%rbp), %edi
movq %rax, %rsi
movl $0x64, %edx
xorl %ecx, %ecx
callq 0x31a0
movq %rax, -0x2c8(%rbp)
jmp 0x8614
movq -0x2c8(%rbp), %rax
movl %eax, 0x9d0f(%rip)      # 0x12330
movl $0x1, -0x4(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x31f0
leaq -0x98(%rbp), %rdi
callq 0x8df0
jmp 0x8ade
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x4460
jmp 0x8683
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x31f0
leaq -0x98(%rbp), %rdi
callq 0x8df0
jmp 0x8aea
movq -0x40(%rbp), %rdi
leaq 0x4c9d(%rip), %rsi      # 0xd33c
callq 0x33b0
cmpl $0x0, %eax
jne 0x8ad7
leaq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq 0x4cc7(%rip), %rdx      # 0xd383
callq 0x76f0
movq -0x20(%rbp), %rdi
leaq 0x4c77(%rip), %rsi      # 0xd343
callq 0x33b0
cmpl $0x0, %eax
jne 0x881a
movl $0x0, -0x13c(%rbp)
movslq -0x13c(%rbp), %rax
movq %rax, -0x2d0(%rbp)
leaq 0x9f7f(%rip), %rdi      # 0x12678
callq 0x4280
movq %rax, %rcx
movq -0x2d0(%rbp), %rax
cmpq %rcx, %rax
jae 0x8740
movslq -0x13c(%rbp), %rsi
leaq 0x9f5d(%rip), %rdi      # 0x12678
callq 0x42b0
movq %rax, %rsi
leaq 0x9f66(%rip), %rdi      # 0x12690
callq 0x4210
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x86e4
leaq 0x9f31(%rip), %rdi      # 0x12678
callq 0x8eb0
movq -0x18(%rbp), %rax
movq %rax, -0x2e0(%rbp)
leaq -0x1b9(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x3450
movq -0x2e0(%rbp), %rsi
movq -0x2d8(%rbp), %rdx
leaq -0x1b8(%rbp), %rdi
callq 0x8ef0
jmp 0x8786
leaq -0x198(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x8bc0
jmp 0x879b
leaq 0x9e36(%rip), %rdi      # 0x125d8
leaq -0x198(%rbp), %rsi
callq 0x92e0
leaq -0x198(%rbp), %rdi
callq 0x8df0
leaq -0x1b8(%rbp), %rdi
callq 0x31f0
leaq -0x1b9(%rbp), %rdi
callq 0x3300
jmp 0x8ace
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8809
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x31f0
leaq -0x1b9(%rbp), %rdi
callq 0x3300
jmp 0x8aea
movq -0x20(%rbp), %rdi
leaq 0x4b26(%rip), %rsi      # 0xd34b
callq 0x33b0
cmpl $0x0, %eax
jne 0x8acc
movq -0x18(%rbp), %rax
movq %rax, -0x2f0(%rbp)
leaq -0x239(%rbp), %rdi
movq %rdi, -0x2e8(%rbp)
callq 0x3450
movq -0x2f0(%rbp), %rsi
movq -0x2e8(%rbp), %rdx
leaq -0x238(%rbp), %rdi
callq 0x8ef0
jmp 0x886d
leaq -0x218(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x8bc0
jmp 0x8882
leaq -0x238(%rbp), %rdi
callq 0x31f0
leaq -0x239(%rbp), %rdi
callq 0x3300
movl $0x0, -0x240(%rbp)
movslq -0x240(%rbp), %rax
movq %rax, -0x2f8(%rbp)
leaq -0x258(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x4130
jmp 0x88c7
leaq -0x258(%rbp), %rdi
callq 0x4280
movq %rax, -0x300(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x41b0
movq -0x300(%rbp), %rcx
movq -0x2f8(%rbp), %rax
cmpq %rcx, %rax
jae 0x89d3
leaq -0x270(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x4130
jmp 0x8912
movslq -0x240(%rbp), %rsi
leaq -0x270(%rbp), %rdi
callq 0x42b0
movq %rax, %rsi
leaq 0x9d61(%rip), %rdi      # 0x12690
callq 0x4210
jmp 0x8936
leaq -0x270(%rbp), %rdi
callq 0x41b0
movl -0x240(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x240(%rbp)
jmp 0x88a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8988
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x31f0
leaq -0x239(%rbp), %rdi
callq 0x3300
jmp 0x8aea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8abe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x41b0
jmp 0x8abe
leaq -0x218(%rbp), %rdi
callq 0x3c80
movl %eax, -0x304(%rbp)
jmp 0x89e7
movl -0x304(%rbp), %edi
callq 0x34a0
jmp 0x89f4
movq -0x18(%rbp), %rax
movq %rax, -0x318(%rbp)
leaq -0x291(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0x3450
movq -0x318(%rbp), %rsi
movq -0x310(%rbp), %rdx
leaq -0x290(%rbp), %rdi
callq 0x8ef0
jmp 0x8a2e
leaq -0x290(%rbp), %rdi
callq 0x8ca0
jmp 0x8a3c
leaq -0x290(%rbp), %rdi
callq 0x31f0
leaq -0x291(%rbp), %rdi
callq 0x3300
leaq 0x9c7d(%rip), %rdi      # 0x126d8
callq 0x8fe0
cmpq $0x0, %rax
jne 0x8ab0
movl $0x1, %edi
callq 0x3350
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x8aa2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc8(%rbp)
movl %eax, -0xcc(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x31f0
leaq -0x291(%rbp), %rdi
callq 0x3300
jmp 0x8abe
leaq -0x218(%rbp), %rdi
callq 0x8df0
jmp 0x8acc
leaq -0x218(%rbp), %rdi
callq 0x8df0
jmp 0x8aea
jmp 0x8ace
movl $0x1, -0x4(%rbp)
jmp 0x8ade
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
movq -0xc8(%rbp), %rdi
callq 0x3440
nopw %cs:(%rax,%rax)