// File: Doug0855[P]TigerZone/main.cpp
// Function: main
int main(int argc, char *argv[]) {
	std::string SERVER_IP, PORT, TOURNAMENT_PASS, TEAM_ID, TEAM_PASSWORD;
	if( argc == 6 ) { //getting command line args
		SERVER_IP = argv[1];
		PORT = argv[2];
		TOURNAMENT_PASS = argv[3];
		TEAM_ID = argv[4];
		TEAM_PASSWORD = argv[5];
	}
	else if( argc > 6 ) {
		printf("Too many arguments supplied.\n");
		exit (EXIT_FAILURE);
	}
	else {
		printf("Five arguments expected.\n");
		exit (EXIT_FAILURE);
	}
	Client serverConnection(SERVER_IP, PORT);
	serverConnection.connectToServer();


	std::string message_list = "";

	//starting auth protocol...

	std::string PLAYER_ID = authenticationProtocol(serverConnection, TOURNAMENT_PASS, TEAM_ID, TEAM_PASSWORD);
	challengeProtocol(serverConnection);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5c0, %rsp            # imm = 0x5C0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x33c0
leaq -0x50(%rbp), %rdi
callq 0x33c0
leaq -0x70(%rbp), %rdi
callq 0x33c0
leaq -0x90(%rbp), %rdi
callq 0x33c0
leaq -0xb0(%rbp), %rdi
callq 0x33c0
cmpl $0x6, -0x8(%rbp)
jne 0x7c60
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0x33a0
jmp 0x7bf5
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x50(%rbp), %rdi
callq 0x33a0
jmp 0x7c08
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x70(%rbp), %rdi
callq 0x33a0
jmp 0x7c1b
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
leaq -0x90(%rbp), %rdi
callq 0x33a0
jmp 0x7c31
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x33a0
jmp 0x7c47
jmp 0x7c9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7f64
cmpl $0x6, -0x8(%rbp)
jle 0x7c80
leaq 0x216e7(%rip), %rdi     # 0x29354
xorl %eax, %eax
callq 0x3060
jmp 0x7c76
movl $0x1, %edi
callq 0x3350
leaq 0x216eb(%rip), %rdi     # 0x29372
xorl %eax, %eax
callq 0x3060
jmp 0x7c90
movl $0x1, %edi
callq 0x3350
leaq -0x4f0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3160
jmp 0x7cac
leaq -0x510(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3160
jmp 0x7cbe
leaq -0x4d0(%rbp), %rdi
leaq -0x4f0(%rbp), %rsi
leaq -0x510(%rbp), %rdx
callq 0x18300
jmp 0x7cda
leaq -0x510(%rbp), %rdi
callq 0x3210
leaq -0x4f0(%rbp), %rdi
callq 0x3210
leaq -0x4d0(%rbp), %rdi
callq 0x18450
jmp 0x7d00
leaq -0x531(%rbp), %rdi
movq %rdi, -0x5c0(%rbp)
callq 0x3500
movq -0x5c0(%rbp), %rdx
leaq 0x21970(%rip), %rsi     # 0x29691
leaq -0x530(%rbp), %rdi
callq 0x33b0
jmp 0x7d2f
leaq -0x531(%rbp), %rdi
callq 0x32f0
leaq -0x578(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x3160
jmp 0x7d4d
leaq -0x598(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x3160
jmp 0x7d62
leaq -0x5b8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3160
jmp 0x7d77
leaq -0x558(%rbp), %rdi
leaq -0x4d0(%rbp), %rsi
leaq -0x578(%rbp), %rdx
leaq -0x598(%rbp), %rcx
leaq -0x5b8(%rbp), %r8
callq 0x71d0
jmp 0x7da1
leaq -0x5b8(%rbp), %rdi
callq 0x3210
leaq -0x598(%rbp), %rdi
callq 0x3210
leaq -0x578(%rbp), %rdi
callq 0x3210
leaq -0x4d0(%rbp), %rdi
callq 0x6aa0
jmp 0x7dd3
movl $0x0, -0x4(%rbp)
leaq -0x558(%rbp), %rdi
callq 0x3210
leaq -0x530(%rbp), %rdi
callq 0x3210
leaq -0x4d0(%rbp), %rdi
callq 0x18440
leaq -0xb0(%rbp), %rdi
callq 0x3210
leaq -0x90(%rbp), %rdi
callq 0x3210
leaq -0x70(%rbp), %rdi
callq 0x3210
leaq -0x50(%rbp), %rdi
callq 0x3210
leaq -0x30(%rbp), %rdi
callq 0x3210
movl -0x4(%rbp), %eax
addq $0x5c0, %rsp            # imm = 0x5C0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7e6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x510(%rbp), %rdi
callq 0x3210
leaq -0x4f0(%rbp), %rdi
callq 0x3210
jmp 0x7f64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7f58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x531(%rbp), %rdi
callq 0x32f0
jmp 0x7f58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7f4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7f20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x7f14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x5b8(%rbp), %rdi
callq 0x3210
leaq -0x598(%rbp), %rdi
callq 0x3210
leaq -0x578(%rbp), %rdi
callq 0x3210
jmp 0x7f4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x558(%rbp), %rdi
callq 0x3210
leaq -0x530(%rbp), %rdi
callq 0x3210
leaq -0x4d0(%rbp), %rdi
callq 0x18440
leaq -0xb0(%rbp), %rdi
callq 0x3210
leaq -0x90(%rbp), %rdi
callq 0x3210
leaq -0x70(%rbp), %rdi
callq 0x3210
leaq -0x50(%rbp), %rdi
callq 0x3210
leaq -0x30(%rbp), %rdi
callq 0x3210
movq -0xb8(%rbp), %rdi
callq 0x34f0
nopw %cs:(%rax,%rax)
nopl (%rax)