// File: /workspace/github_cpp_makefile_star2_O3/patxitron[P]BattleyeRconToolLinux/main.cpp
// Function: main
int main(int argc, char* argv[])
{
	string host;
	uint16_t port = 0;
	string passwd;
	if(argc > 1) {
		host = string(argv[1]);
		if(argc > 2) {
			port = static_cast<uint16_t>(strtoul(argv[2], nullptr, 10));
		}
	}
	while(host.empty()) {
		cout << "Please enter the name or IP addres of the server:" << endl;
		getline(cin, host);
	}
	while(port == 0) {
		cout << "Please enter the port of the server:" << endl;
		string p;
		getline(cin, p);
		port = static_cast<uint16_t>(strtoul(p.c_str(), nullptr, 10));
	}
	while(passwd.empty()) {
		cout << "Please enter the password:" << endl;
		getline(cin, passwd);
	}
	boost::asio::io_service io_service;
	patxi::a3s server(
		 io_service
		,port
		,host
		,[](char const* data, std::size_t length)
		{
			string msg(data, length);
			cout << msg << endl;
		}
		,[&server](bool logged)
		{
			if(logged) {
				cout << "Successfully logged in." << endl;
				server.consoleInput();
			} else {
				cout << "Failed to log in" << endl;
			}
		}
	);
	server.login(passwd);
	io_service.run();
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x648, %rsp            # imm = 0x648
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
xorl %r15d, %r15d
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb %r15b, (%rax)
cmpl $0x2, %edi
jl 0x10a15
movq %rsi, %rbx
movl %edi, %ebp
movq 0x8(%rsi), %rsi
leaq 0xe8(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x89fc
leaq 0x10(%rsp), %rdi
leaq 0xe8(%rsp), %r14
movq %r14, %rsi
callq 0x6420
movq (%r14), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x109f8
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x6390
cmpl $0x2, %ebp
jne 0x10a02
xorl %r15d, %r15d
jmp 0x10a15
movq 0x10(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x6110
movq %rax, %r15
movq 0xa5ac(%rip), %rbx      # 0x1afc8
leaq 0x29bf(%rip), %r12      # 0x133e2
movq 0xa5ae(%rip), %r14      # 0x1afd8
leaq 0x10(%rsp), %r13
cmpq $0x0, 0x18(%rsp)
jne 0x10a92
movl $0x31, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x63d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6350
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6250
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6350
movsbl %al, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x6660
jmp 0x10a2f
testw %r15w, %r15w
jne 0x10b66
leaq 0xf8(%rsp), %rbp
leaq 0x2969(%rip), %r12      # 0x13414
leaq 0xe8(%rsp), %r13
movl $0x24, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x63d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6350
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6250
movq %rbp, 0xe8(%rsp)
movq $0x0, 0xf0(%rsp)
movb $0x0, 0xf8(%rsp)
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6350
movsbl %al, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x6660
movq 0xe8(%rsp), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x6110
movq %rax, %r15
movq 0xe8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x10b5c
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x6390
testw %r15w, %r15w
je 0x10ab3
leaq 0x28cc(%rip), %r12      # 0x13439
leaq 0x30(%rsp), %r13
cmpq $0x0, 0x38(%rsp)
jne 0x10bd5
movl $0x1a, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x63d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6350
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6250
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6350
movsbl %al, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x6660
jmp 0x10b72
movq %rsp, %rdi
callq 0x1103e
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %r8
movaps %xmm0, (%r8)
leaq 0x2c6(%rip), %rax       # 0x10eb6
movq %rax, 0x18(%r8)
leaq 0x35f(%rip), %rax       # 0x10f5a
movq %rax, 0x10(%r8)
leaq 0x88(%rsp), %r9
movq $0x0, 0x8(%r9)
leaq 0xe8(%rsp), %rdi
movq %rdi, (%r9)
leaq 0x351(%rip), %rax       # 0x10f72
movq %rax, 0x18(%r9)
leaq 0x3ec(%rip), %rax       # 0x11018
movq %rax, 0x10(%r9)
movzwl %r15w, %edx
movq %rsp, %rsi
leaq 0x10(%rsp), %rcx
callq 0x68dc
movq 0x98(%rsp), %rax
testq %rax, %rax
je 0x10c60
leaq 0x88(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0x10c79
leaq 0x60(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0xe8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6ca8
leaq 0x50(%rsp), %rsi
movl $0x0, (%rsi)
movb $0x0, 0x4(%rsi)
leaq 0x91ef(%rip), %rax      # 0x19e90
movq %rax, 0x8(%rsi)
movq 0x8(%rsp), %rdi
callq 0xcb68
cmpb $0x1, 0x54(%rsp)
je 0x10d78
leaq 0xe8(%rsp), %rdi
callq 0x6bf4
movq (%rsp), %rbx
movq 0x38(%rbx), %r14
testq %r14, %r14
je 0x10d12
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq 0x20(%r14), %r14
testq %r14, %r14
jne 0x10cd4
movq (%rsp), %rbx
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x10d12
movq (%rdi), %rax
movq 0x20(%rdi), %r14
callq *0x8(%rax)
movq %r14, 0x38(%rbx)
movq %r14, %rdi
testq %r14, %r14
jne 0x10cf3
movq (%rsp), %rbx
testq %rbx, %rbx
je 0x10d74
leaq 0x8(%rbx), %rdi
callq 0x63f0
movl $0x40, %esi
movq %rbx, %rdi
callq 0x6390
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x10d44
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x6390
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x10d60
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6390
xorl %eax, %eax
addq $0x648, %rsp            # imm = 0x648
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x10d1b
movq 0x50(%rsp), %rbx
movq 0x58(%rsp), %r14
leaq 0x12e5(%rip), %rsi      # 0x1206e
leaq 0xa8(%rsp), %rdi
callq 0x6680
leaq 0x90c3(%rip), %rax      # 0x19e60
leaq 0xd8(%rsp), %rcx
movq %rax, -0x30(%rcx)
movq %rbx, -0x20(%rcx)
movq %r14, -0x18(%rcx)
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0xa8(%rsp), %rdi
callq 0xa600
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x89b2
jmp 0x10e2e
jmp 0x10e73
jmp 0x10e45
jmp 0x10e45
movq %rax, %rbx
movq 0x98(%rsp), %rax
testq %rax, %rax
je 0x10e0a
leaq 0x88(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0x10e3b
leaq 0x60(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x10e3b
jmp 0x10e45
jmp 0x10e45
jmp 0x10e73
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x6bf4
movq %rsp, %rdi
callq 0x111e4
jmp 0x10e76
movq %rax, %rdi
callq 0x8333
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x10e76
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x6390
jmp 0x10e76
jmp 0x10e73
jmp 0x10e73
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x10e92
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x6390
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x10eae
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6390
movq %rbx, %rdi
callq 0x65e0