// File: /workspace/github_cpp_makefile_star2_O2/Doug0855[P]TigerZone/main.cpp
// Function: authenticationProtocol(Client&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
std::string authenticationProtocol(Client &client, std::string tournament_password, std::string username, std::string password)
{ //This protocol is called only to authenticate the client to the server.

	std::string message, message_to_send, player_id;
	std::string message_list = "";
	message = getMesssage(client, message_list);
	std::cout << GREEN << "Server sent: " << RESET << message << std::endl;

	if ( message == "THIS IS SPARTA!") //message to send tournament password
	{
		message_to_send = "JOIN " + tournament_password + "\r\n";
		std::cout << RED << "	We sent: " << RESET << message_to_send << std::endl;
		client.sendMessage(message_to_send);
	}
	else
	{
		std::cout << "ERROR: first message from server is: " << message;
		client.sendMessage("ILLEGAL MESSAGE SENT BY SERVER");
	}

	message = getMesssage(client, message_list);
	std::cout << GREEN << "Server sent: " << RESET << message << std::endl;
	if ( message == "HELLO!") //message to send team username and password
	{
		message_to_send = "I AM " + username + " " + password + "\r\n";
		std::cout << RED << "	We sent: " << RESET << message_to_send << std::endl;
		client.sendMessage(message_to_send);
	}
	else
	{
		std::cout << "ERROR: second message from server is: " << message;
		client.sendMessage("ILLEGAL MESSAGE SENT BY SERVER");
	}

	message = getMesssage(client, message_list); //last authentication message giving player id back
	std::cout << GREEN << "Server sent: " << RESET << message << std::endl;
	player_id = message.substr(8,message.find(" PLEASE")-8);
	std::cout << "	Player ID returned is: " << player_id << std::endl;
	return player_id;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %r8, %r12
movq %rcx, -0x90(%rbp)
movq %rdx, %r13
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, %r14
movq %rdi, %rbx
xorl %ecx, %ecx
leaq -0x78(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb %cl, 0x10(%rdi)
leaq 0xceb4(%rip), %rsi      # 0x12715
leaq -0xd0(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x30e0
leaq -0x48(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
movq %r14, %rsi
callq 0x3b80
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %r15
movq %r15, %rsi
callq 0x3280
movq %r15, %rdi
callq 0x3120
movq 0x1371d(%rip), %rdi     # 0x18fc0
leaq 0xc79c(%rip), %rsi      # 0x12046
callq 0x3200
leaq 0xc7b8(%rip), %rsi      # 0x1206e
movq %rax, %rdi
callq 0x3200
leaq 0xc78d(%rip), %rsi      # 0x12052
movq %rax, %rdi
callq 0x3200
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x31e0
movq %rax, %rdi
callq 0x3140
leaq 0xc9bc(%rip), %rsi      # 0x122a4
leaq -0x68(%rbp), %rdi
callq 0x6261
testb %al, %al
je 0x59bc
leaq 0xc9b4(%rip), %rsi      # 0x122b4
leaq -0xb0(%rbp), %rdi
movq %r13, %rdx
callq 0x64fa
leaq 0xcdfd(%rip), %rdx      # 0x12713
leaq -0x48(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x6415
leaq -0x88(%rbp), %rdi
movq %r15, %rsi
callq 0x3280
movq %r15, %rdi
callq 0x3120
leaq -0xb0(%rbp), %rdi
callq 0x3120
movq 0x13670(%rip), %rdi     # 0x18fc0
leaq 0xc741(%rip), %rsi      # 0x12098
callq 0x3200
leaq 0xc73b(%rip), %rsi      # 0x1209e
movq %rax, %rdi
callq 0x3200
leaq 0xc6e0(%rip), %rsi      # 0x12052
movq %rax, %rdi
callq 0x3200
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x31e0
movq %rax, %rdi
callq 0x3140
leaq -0x190(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x32c0
leaq -0x190(%rbp), %rsi
movq %r14, %rdi
callq 0xaf76
leaq -0x190(%rbp), %rdi
jmp 0x5a08
movq 0x135fd(%rip), %rdi     # 0x18fc0
leaq 0xc8f0(%rip), %rsi      # 0x122ba
callq 0x3200
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x31e0
leaq 0xc8fe(%rip), %rsi      # 0x122e0
leaq -0x170(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x30e0
leaq -0x170(%rbp), %rsi
movq %r14, %rdi
callq 0xaf76
leaq -0x170(%rbp), %rdi
callq 0x3120
leaq -0x48(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
movq %r14, %rsi
callq 0x3b80
leaq -0x68(%rbp), %rdi
movq %r15, %rsi
callq 0x3280
movq %r15, %rdi
callq 0x3120
movq 0x13585(%rip), %rdi     # 0x18fc0
leaq 0xc604(%rip), %rsi      # 0x12046
callq 0x3200
leaq 0xc620(%rip), %rsi      # 0x1206e
movq %rax, %rdi
callq 0x3200
leaq 0xc5f5(%rip), %rsi      # 0x12052
movq %rax, %rdi
callq 0x3200
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x31e0
movq %rax, %rdi
callq 0x3140
leaq 0xc87f(%rip), %rsi      # 0x122ff
leaq -0x68(%rbp), %rdi
callq 0x6261
testb %al, %al
je 0x5ba0
leaq 0xc86e(%rip), %rsi      # 0x12306
leaq -0x130(%rbp), %rdi
movq -0x90(%rbp), %rdx
callq 0x64fa
leaq 0xcb9d(%rip), %rdx      # 0x1264f
leaq -0x150(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x6415
leaq -0xb0(%rbp), %rdi
leaq -0x150(%rbp), %rsi
movq %r12, %rdx
callq 0x6570
leaq 0xcc31(%rip), %rdx      # 0x12713
leaq -0x48(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x6415
leaq -0x88(%rbp), %rdi
movq %r15, %rsi
callq 0x3280
movq %r15, %rdi
callq 0x3120
leaq -0xb0(%rbp), %rdi
callq 0x3120
leaq -0x150(%rbp), %rdi
callq 0x3120
leaq -0x130(%rbp), %rdi
callq 0x3120
movq 0x1348c(%rip), %rdi     # 0x18fc0
leaq 0xc55d(%rip), %rsi      # 0x12098
callq 0x3200
leaq 0xc557(%rip), %rsi      # 0x1209e
movq %rax, %rdi
callq 0x3200
leaq 0xc4fc(%rip), %rsi      # 0x12052
movq %rax, %rdi
callq 0x3200
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x31e0
movq %rax, %rdi
callq 0x3140
leaq -0x110(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x32c0
leaq -0x110(%rbp), %rsi
movq %r14, %rdi
callq 0xaf76
leaq -0x110(%rbp), %rdi
jmp 0x5bec
movq 0x13419(%rip), %rdi     # 0x18fc0
leaq 0xc75e(%rip), %rsi      # 0x1230c
callq 0x3200
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x31e0
leaq 0xc71a(%rip), %rsi      # 0x122e0
leaq -0xf0(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x30e0
leaq -0xf0(%rbp), %rsi
movq %r14, %rdi
callq 0xaf76
leaq -0xf0(%rbp), %rdi
callq 0x3120
leaq -0x48(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
movq %r14, %rsi
callq 0x3b80
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %r14
movq %r14, %rsi
callq 0x3280
movq %r14, %rdi
callq 0x3120
movq 0x1339d(%rip), %rdi     # 0x18fc0
leaq 0xc41c(%rip), %rsi      # 0x12046
callq 0x3200
leaq 0xc438(%rip), %rsi      # 0x1206e
movq %rax, %rdi
callq 0x3200
leaq 0xc40d(%rip), %rsi      # 0x12052
movq %rax, %rdi
callq 0x3200
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x31e0
movq %rax, %rdi
callq 0x3140
leaq 0xc6cb(%rip), %rsi      # 0x12333
leaq -0x68(%rbp), %r14
movq %r14, %rdi
xorl %edx, %edx
callq 0x3430
leaq -0x8(%rax), %rcx
leaq -0x48(%rbp), %rdi
pushq $0x8
popq %rdx
movq %r14, %rsi
callq 0x3220
leaq -0x48(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3280
movq %r14, %rdi
callq 0x3120
movq 0x13319(%rip), %rdi     # 0x18fc0
leaq 0xc68d(%rip), %rsi      # 0x1233b
callq 0x3200
movq %rax, %rdi
movq %rbx, %rsi
callq 0x31e0
movq %rax, %rdi
callq 0x3140
leaq -0xd0(%rbp), %rdi
callq 0x3120
leaq -0x88(%rbp), %rdi
callq 0x3120
leaq -0x68(%rbp), %rdi
callq 0x3120
movq %rbx, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq -0x110(%rbp), %rdi
jmp 0x5d6a
movq %rax, %r14
leaq -0xf0(%rbp), %rdi
jmp 0x5d6a
movq %rax, %r14
leaq -0xb0(%rbp), %rdi
callq 0x3120
jmp 0x5d2a
jmp 0x5d80
movq %rax, %r14
leaq -0x150(%rbp), %rdi
callq 0x3120
jmp 0x5d3b
movq %rax, %r14
leaq -0x130(%rbp), %rdi
jmp 0x5d6a
jmp 0x5d80
movq %rax, %r14
leaq -0x190(%rbp), %rdi
jmp 0x5d6a
movq %rax, %r14
leaq -0x170(%rbp), %rdi
jmp 0x5d6a
jmp 0x5d80
movq %rax, %r14
leaq -0xb0(%rbp), %rdi
callq 0x3120
jmp 0x5d83
jmp 0x5d80
jmp 0x5d80
jmp 0x5d80
jmp 0x5d80
jmp 0x5d80
movq %rax, %r14
jmp 0x5d8f
movq %rax, %r14
leaq -0xd0(%rbp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3120
leaq -0x88(%rbp), %rdi
callq 0x3120
leaq -0x68(%rbp), %rdi
callq 0x3120
movq %r14, %rdi
callq 0x33c0