// File: /workspace/github_cpp_makefile_star2_O1/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 0x10ee9
movq %rsi, %rbx
movl %edi, %ebp
movq 0x8(%rsi), %rsi
leaq 0xe8(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x8a8a
leaq 0x10(%rsp), %rdi
leaq 0xe8(%rsp), %r14
movq %r14, %rsi
callq 0x6420
movq (%r14), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x10ecc
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x6390
cmpl $0x2, %ebp
jne 0x10ed6
xorl %r15d, %r15d
jmp 0x10ee9
movq 0x10(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x6110
movq %rax, %r15
movq 0xa0d0(%rip), %rbx      # 0x1afc0
leaq 0x24eb(%rip), %r12      # 0x133e2
movq 0xa0d2(%rip), %r14      # 0x1afd0
leaq 0x10(%rsp), %r13
cmpq $0x0, 0x18(%rsp)
jne 0x10f66
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 0x10f03
testw %r15w, %r15w
jne 0x1103a
leaq 0xf8(%rsp), %rbp
leaq 0x2495(%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 0x11030
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x6390
testw %r15w, %r15w
je 0x10f87
leaq 0x23f8(%rip), %r12      # 0x13439
leaq 0x30(%rsp), %r13
cmpq $0x0, 0x38(%rsp)
jne 0x110a9
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 0x11046
movq %rsp, %rdi
callq 0x1150c
xorps %xmm0, %xmm0
leaq 0x80(%rsp), %r8
movaps %xmm0, (%r8)
leaq 0x2bd(%rip), %rax       # 0x11384
movq %rax, 0x18(%r8)
leaq 0x356(%rip), %rax       # 0x11428
movq %rax, 0x10(%r8)
leaq 0x60(%rsp), %r9
movaps %xmm0, (%r9)
movaps %xmm0, 0x10(%r9)
leaq 0xe8(%rsp), %rdi
movq %rdi, (%r9)
leaq 0x34a(%rip), %rax       # 0x11440
movq %rax, 0x18(%r9)
leaq 0x3e5(%rip), %rax       # 0x114e6
movq %rax, 0x10(%r9)
movzwl %r15w, %edx
movq %rsp, %rsi
leaq 0x10(%rsp), %rcx
callq 0x68fc
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0x1112f
leaq 0x60(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x90(%rsp), %rax
testq %rax, %rax
je 0x1114e
leaq 0x80(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0xe8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x6cc0
leaq 0x50(%rsp), %rsi
movl $0x0, (%rsi)
movb $0x0, 0x4(%rsi)
leaq 0x8caa(%rip), %rax      # 0x19e20
movq %rax, 0x8(%rsi)
movq 0x8(%rsp), %rdi
callq 0xce92
cmpb $0x1, 0x54(%rsp)
je 0x11246
leaq 0xe8(%rsp), %rdi
callq 0x6c0c
movq (%rsp), %rax
movq 0x38(%rax), %rbx
testq %rbx, %rbx
je 0x111b8
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x20(%rbx), %rbx
jmp 0x111a4
movq (%rsp), %rbx
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x111db
movq (%rdi), %rax
movq 0x20(%rdi), %r14
callq *0x8(%rax)
movq %r14, 0x38(%rbx)
movq %r14, %rdi
testq %r14, %r14
jne 0x111c5
movq (%rsp), %rbx
testq %rbx, %rbx
je 0x111fa
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 0x11216
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x6390
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x11232
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
movq 0x50(%rsp), %rbx
movq 0x58(%rsp), %r14
leaq 0xe17(%rip), %rsi       # 0x1206e
leaq 0xa8(%rsp), %rdi
callq 0x6680
leaq 0x8b85(%rip), %rax      # 0x19df0
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 0xa7be
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x8a40
jmp 0x112fc
jmp 0x11341
jmp 0x11313
jmp 0x11313
movq %rax, %rbx
movq 0x70(%rsp), %rax
testq %rax, %rax
je 0x112d2
leaq 0x60(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x90(%rsp), %rax
testq %rax, %rax
je 0x11309
leaq 0x80(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x11309
jmp 0x11313
jmp 0x11313
jmp 0x11341
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x6c0c
movq %rsp, %rdi
callq 0x116ac
jmp 0x11344
movq %rax, %rdi
callq 0x83b5
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x11344
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x6390
jmp 0x11344
jmp 0x11341
jmp 0x11341
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x11360
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x6390
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x1137c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6390
movq %rbx, %rdi
callq 0x65e0