// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq (%rdi), %rsi
leaq 0x1554(%rip), %rdx      # 0x6085
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
callq 0x4301
movq (%rbx), %rsi
leaq 0x15cc(%rip), %rdx      # 0x6113
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
callq 0x4301
movq (%rbx), %rbx
leaq 0x1567(%rip), %rsi      # 0x60c4
movq %rbx, %rdi
callq 0x22a0
testl %eax, %eax
je 0x4b87
leaq 0x155c(%rip), %rsi      # 0x60cc
movq %rbx, %rdi
callq 0x22a0
testl %eax, %eax
je 0x4c5f
pushq $-0x1
jmp 0x4c4a
movq -0x68(%rbp), %rsi
leaq -0x100(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x515c
leaq -0x158(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x4f55
leaq -0x100(%rbp), %rdi
callq 0x2140
movq 0x5a67(%rip), %rsi      # 0xa628
cmpq 0x5a58(%rip), %rsi      # 0xa620
jne 0x4bd6
callq 0x44a8
movq 0x5a52(%rip), %rsi      # 0xa628
addq $-0x48, %rsi
leaq -0x1a0(%rbp), %rdi
callq 0x2c9a
leaq -0x48(%rbp), %rdi
pushq $0x64
popq %rsi
leaq -0x1a0(%rbp), %rdx
callq 0x4549
leaq -0x1a0(%rbp), %rdi
callq 0x2d36
leaq 0x5a14(%rip), %rdi      # 0xa620
callq 0x51d4
leaq -0x158(%rbp), %rdi
callq 0x2940
movq -0x48(%rbp), %rsi
pushq $0x64
popq %rdx
movl %eax, %edi
xorl %ecx, %ecx
callq 0x2150
movl %eax, 0x565d(%rip)      # 0xa290
leaq -0x48(%rbp), %rdi
callq 0x2140
leaq -0x158(%rbp), %rdi
callq 0x50ea
pushq $0x1
popq %rcx
movl %ecx, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x78(%rbp), %rsi
leaq 0x14a9(%rip), %rdx      # 0x6113
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
callq 0x4301
movq (%rbx), %rbx
leaq 0x1453(%rip), %rsi      # 0x60d3
movq %rbx, %rdi
callq 0x22a0
testl %eax, %eax
je 0x4d4b
leaq 0x1444(%rip), %rsi      # 0x60db
movq %rbx, %rdi
callq 0x22a0
pushq $0x1
popq %rcx
testl %eax, %eax
jne 0x4c4b
movq -0x58(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
leaq -0x48(%rbp), %rdx
movq %rsi, -0x50(%rbp)
callq 0x515c
leaq -0x158(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x4f55
leaq -0xc0(%rbp), %rdi
callq 0x2140
xorl %r13d, %r13d
leaq -0x48(%rbp), %r15
leaq -0x158(%rbp), %r12
xorl %ebx, %ebx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2bfa
movq -0x40(%rbp), %rax
subq -0x48(%rbp), %rax
cqto
pushq $0x48
popq %rcx
idivq %rcx
movq %rax, %r14
movq %r15, %rdi
callq 0x2c32
cmpq %rbx, %r14
jbe 0x4ded
movq %r15, %rdi
movq %r12, %rsi
callq 0x2bfa
movq -0x48(%rbp), %rsi
addq %r13, %rsi
leaq 0x58bb(%rip), %rdi      # 0xa5f0
callq 0x2c5e
movq %r15, %rdi
callq 0x2c32
incq %rbx
addq $0x48, %r13
jmp 0x4ced
xorl %r14d, %r14d
pushq $0x48
popq %r15
leaq 0x5897(%rip), %rbx      # 0xa5f0
xorl %r12d, %r12d
movq 0x587d(%rip), %rax      # 0xa5e0
movq 0x586e(%rip), %rsi      # 0xa5d8
subq %rsi, %rax
cqto
idivq %r15
cmpq %r12, %rax
jbe 0x4d8b
addq %r14, %rsi
movq %rbx, %rdi
callq 0x2c5e
incq %r12
addq $0x48, %r14
jmp 0x4d5c
leaq 0x5846(%rip), %rdi      # 0xa5d8
callq 0x5140
movq -0x58(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x515c
leaq -0x158(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x4f55
leaq 0x5773(%rip), %rdi      # 0xa538
leaq -0x158(%rbp), %rbx
movq %rbx, %rsi
callq 0x52ba
movq %rbx, %rdi
callq 0x50ea
leaq -0xe0(%rbp), %rdi
callq 0x2140
jmp 0x4c48
leaq -0x158(%rbp), %rdi
callq 0x2940
movl %eax, %edi
callq 0x2380
leaq -0xa0(%rbp), %rdi
leaq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rsi
callq 0x515c
leaq -0xa0(%rbp), %rdi
callq 0x4fff
leaq -0xa0(%rbp), %rdi
callq 0x2140
movq 0x580d(%rip), %rax      # 0xa640
cmpq 0x57fe(%rip), %rax      # 0xa638
jne 0x4c3c
pushq $0x1
popq %rdi
callq 0x2260
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
jmp 0x4ea6
jmp 0x4ebd
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
jmp 0x4e93
jmp 0x4e9a
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
jmp 0x4e93
jmp 0x4e9a
jmp 0x4ebd
jmp 0x4ebd
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x2d36
jmp 0x4ec0
jmp 0x4ebd
movq %rax, %rbx
leaq -0x100(%rbp), %rdi
callq 0x2140
jmp 0x4ecc
movq %rax, %rbx
jmp 0x4ecc
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x2140
jmp 0x4ec0
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x2c32
jmp 0x4ec0
jmp 0x4ebd
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
callq 0x50ea
movq %rbx, %rdi
callq 0x2320