// File: /workspace/github_cpp_makefile_star2_O2/Doug0855[P]TigerZone/main.cpp
// Function: roundProtocol(Client&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, int)
void roundProtocol(Client &client, std::string &message_list, int rounds)
{
	int round_id;
	std::string message;
	std::string TERMINATE_ROUND = "END OF ROUND " + std::to_string(rounds) + " OF " + std::to_string(rounds);
	message = getMesssage(client, message_list);
	std::cout << GREEN << "Server sent: " << RESET << message << std::endl;

	while (message != TERMINATE_ROUND)
	{
		if (message.compare(0,1,"B") == 0) //executing a new round
		{
			std::cout << "	BEGINNING ROUND..." << std::endl;
			round_id = stoi(message.substr(12,message.find(" OF")-12));
			matchProtocol(client, message_list); // pass message reference
			message = getMesssage(client, message_list);
			std::cout << GREEN << "Server sent: " << RESET << message << std::endl;
		}
		else if (message.compare(0,1,"E") == 0) //waiting for the next round to begin
		{
			std::cout << "	END OF ROUND...WAITING FOR THE NEXT MATCH" << std::endl;
			message = getMesssage(client, message_list);
			std::cout << GREEN << "Server sent: " << RESET << message << std::endl;
		}
		else //hopefully this is never reached
		{
			std::cout << "	ERROR: previous message could not be processed correctly. Message skipped!" << std::endl;
			std::cout << "		ERROR message: " << message << std::endl;
			message = getMesssage(client, message_list);
			std::cout << GREEN << "Server sent: " << RESET << message << std::endl;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0xa8(%rbp), %rdi
movl %edx, %esi
callq 0x646c
leaq 0xd0ed(%rip), %rsi      # 0x121de
leaq -0xc8(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
callq 0x643e
leaq 0xd0e1(%rip), %rdx      # 0x121ec
leaq -0x48(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x6415
leaq -0x88(%rbp), %rdi
movl %r15d, %esi
callq 0x646c
leaq -0xe8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x63a4
leaq -0x88(%rbp), %rdi
callq 0x3120
leaq -0x48(%rbp), %rdi
callq 0x3120
leaq -0xc8(%rbp), %rdi
callq 0x3120
leaq -0xa8(%rbp), %rdi
callq 0x3120
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3b80
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %r15
movq %r15, %rsi
callq 0x3280
movq %r15, %rdi
callq 0x3120
movq 0x13e24(%rip), %rdi     # 0x18fc0
leaq 0xcea3(%rip), %rsi      # 0x12046
callq 0x3200
leaq 0xcebf(%rip), %rsi      # 0x1206e
movq %rax, %rdi
callq 0x3200
leaq 0xce94(%rip), %rsi      # 0x12052
movq %rax, %rdi
callq 0x3200
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x31e0
movq %rax, %rdi
callq 0x3140
leaq -0x68(%rbp), %r15
movq 0x13ddb(%rip), %r12     # 0x18fc0
leaq -0x48(%rbp), %r13
movq %r15, %rdi
leaq -0xe8(%rbp), %rsi
callq 0x6321
testb %al, %al
je 0x5367
movq %r15, %rdi
xorl %esi, %esi
pushq $0x1
popq %rdx
leaq 0xd2de(%rip), %rcx      # 0x124ed
callq 0x32b0
testl %eax, %eax
je 0x5280
movq %r15, %rdi
xorl %esi, %esi
pushq $0x1
popq %rdx
leaq 0xd317(%rip), %rcx      # 0x1253e
callq 0x32b0
testl %eax, %eax
je 0x52ea
movq %r12, %rdi
leaq 0xcf42(%rip), %rsi      # 0x12180
callq 0x3200
movq %rax, %rdi
callq 0x3140
movq %r12, %rdi
leaq 0xcf77(%rip), %rsi      # 0x121cc
callq 0x3200
movq %rax, %rdi
movq %r15, %rsi
callq 0x31e0
movq %rax, %rdi
callq 0x3140
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3b80
jmp 0x530f
movq %r12, %rdi
leaq 0xcf67(%rip), %rsi      # 0x121f1
callq 0x3200
movq %rax, %rdi
callq 0x3140
movq %r15, %rdi
leaq 0xcf64(%rip), %rsi      # 0x12205
xorl %edx, %edx
callq 0x3430
leaq -0xc(%rax), %rcx
movq %r13, %rdi
movq %r15, %rsi
pushq $0xc
popq %rdx
callq 0x3220
movq %r13, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x64cc
movq %r13, %rdi
callq 0x3120
movq %r14, %rdi
movq %rbx, %rsi
callq 0x458f
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3b80
jmp 0x530f
movq %r12, %rdi
leaq 0xcf15(%rip), %rsi      # 0x12209
callq 0x3200
movq %rax, %rdi
callq 0x3140
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3b80
movq %r15, %rdi
movq %r13, %rsi
callq 0x3280
movq %r13, %rdi
callq 0x3120
movq %r12, %rdi
leaq 0xcd1a(%rip), %rsi      # 0x12046
callq 0x3200
movq %rax, %rdi
leaq 0xcd33(%rip), %rsi      # 0x1206e
callq 0x3200
movq %rax, %rdi
leaq 0xcd08(%rip), %rsi      # 0x12052
callq 0x3200
movq %rax, %rdi
movq %r15, %rsi
callq 0x31e0
movq %rax, %rdi
callq 0x3140
jmp 0x51e9
leaq -0xe8(%rbp), %rdi
callq 0x3120
leaq -0x68(%rbp), %rdi
callq 0x3120
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x53e9
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x3120
jmp 0x53a4
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x3120
jmp 0x53b2
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
callq 0x3120
jmp 0x53c3
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
jmp 0x53f3
movq %rax, %rbx
jmp 0x53f8
jmp 0x53e9
jmp 0x53e9
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x3120
jmp 0x53ec
jmp 0x53e9
jmp 0x53e9
jmp 0x53e9
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
callq 0x3120
leaq -0x68(%rbp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x33c0