// File: /workspace/github_cpp_makefile_star2_O2/lotuskip[P]yuxtapa/client/client.cpp
// Function: main
int main(int argc, char *argv[])
{
	setlocale(LC_ALL, "");

	string server = "";
	if(argc >= 2) // command line argument should be a server name
	{
		if((server = argv[1]) == "--help" || server == "-h")
		{
			cout << "Flag \'-v\' prints the version. Other than that, any command line"
				<< endl << "argument should be either a server address or a server name"
				<< endl << "defined in the configuration." << endl;
			return 0;
		}
		if(server == "-v" || server == "--version")
		{
			cout << PACKAGE << " client v." << VERSION << endl;
			return 0;
		}
	}
	Config::read_config(server);
	if(!Base::init_ncurses())
		return 1;
	init_msgs();
	// reuse server-string for connection errors:
	if(!Network::connect(server))
	{
		Base::deinit_ncurses();
		cerr << server << endl;
		return 1;
	}
	// If here, we are connected, and 'server' string is unmodified.
	// Print server info, which is constant for the whole session:
	server.insert(0, "Server: ");
	fix_str_to_fit(server);
	Base::print_str(server.c_str(), 7, 0, 3, STAT_WIN, false);
	// an IPv6 address might be too long to fit on one line:
	fix_str_to_fit((server = Config::get_server_ip()));
	Base::print_str(server.c_str(), 7, 0, 4, STAT_WIN, false);
	
	bool server_disconnect = false;
	while(!(server_disconnect = Network::receive_n_handle())
		&& !Input::inputhandle())
		upd_msgs();

	Network::disconnect();
	Base::deinit_ncurses();
	Config::save_msg_memory();
	if(server_disconnect)
		cout << "Server disconnected." << endl;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movl %edi, %r14d
leaq 0x6d83(%rip), %r15      # 0xe489
pushq $0x6
popq %rdi
movq %r15, %rsi
callq 0x4350
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
movq %r15, %rsi
callq 0x69bc
cmpl $0x2, %r14d
jl 0x7802
movq 0x8(%rbx), %rsi
leaq -0x40(%rbp), %rdi
callq 0x46d0
leaq 0x6d6b(%rip), %rsi      # 0xe4aa
movq %rax, %rdi
callq 0x795b
testb %al, %al
jne 0x775f
leaq 0x6d5f(%rip), %rsi      # 0xe4b1
leaq -0x40(%rbp), %rdi
callq 0x795b
testb %al, %al
je 0x779a
movq 0xe862(%rip), %rdi      # 0x15fc8
leaq 0x6d47(%rip), %rsi      # 0xe4b4
callq 0x4390
movq %rax, %rdi
callq 0x41f0
leaq 0x6d73(%rip), %rsi      # 0xe4f4
movq %rax, %rdi
callq 0x4390
movq %rax, %rdi
callq 0x41f0
leaq 0x6d98(%rip), %rsi      # 0xe530
jmp 0x77eb
leaq 0x6dad(%rip), %rsi      # 0xe54e
leaq -0x40(%rbp), %rdi
callq 0x795b
testb %al, %al
jne 0x77c2
leaq 0x6d9c(%rip), %rsi      # 0xe551
leaq -0x40(%rbp), %rdi
callq 0x795b
testb %al, %al
je 0x7802
movq 0xe7ff(%rip), %rdi      # 0x15fc8
leaq 0x6d8b(%rip), %rsi      # 0xe55b
callq 0x4390
leaq 0x6d87(%rip), %rsi      # 0xe563
movq %rax, %rdi
callq 0x4390
leaq 0x6d83(%rip), %rsi      # 0xe56e
movq %rax, %rdi
callq 0x4390
xorl %ebx, %ebx
movq %rax, %rdi
callq 0x41f0
jmp 0x78fc
leaq -0x40(%rbp), %rdi
callq 0xac94
callq 0x5ccc
pushq $0x1
popq %rbx
testb %al, %al
je 0x78fc
callq 0x8685
leaq -0x40(%rbp), %rdi
callq 0x9b90
testb %al, %al
je 0x78ac
leaq 0x6d3d(%rip), %rdx      # 0xe571
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x4100
leaq -0x40(%rbp), %rdi
callq 0x792a
movq -0x40(%rbp), %rdi
pushq $0x7
popq %rsi
pushq $0x3
popq %rcx
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x61ca
callq 0xb9a5
leaq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x4220
leaq -0x40(%rbp), %rdi
callq 0x792a
movq -0x40(%rbp), %rdi
pushq $0x7
popq %rsi
pushq $0x4
popq %rcx
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x61ca
callq 0xa5d1
movl %eax, %r14d
testb %al, %al
jne 0x78cb
callq 0x796c
testb %al, %al
jne 0x78cb
callq 0x8cc3
jmp 0x7890
callq 0x6142
movq 0xe738(%rip), %rdi      # 0x15ff0
leaq -0x40(%rbp), %rsi
callq 0x4340
movq %rax, %rdi
callq 0x41f0
jmp 0x78fc
callq 0xa580
callq 0x6142
callq 0xb88a
xorl %ebx, %ebx
testb %r14b, %r14b
je 0x78fc
movq 0xe6e0(%rip), %rdi      # 0x15fc8
leaq 0x6c8b(%rip), %rsi      # 0xe57a
callq 0x4390
movq %rax, %rdi
callq 0x41f0
leaq -0x40(%rbp), %rdi
callq 0x4748
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7916
jmp 0x7916
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x4748
movq %rbx, %rdi
callq 0x4650