// File: /workspace/github_cpp_makefile_star2_O3/Unreality3D[P]Unreality3D/indie-studio/source/Network/sockets/Client.cpp
// Function: Socket::Client::stateChecker()
void Client::stateChecker()
  {
    int fd;
    int nb_fd;
    fd_set read_set, write_set;
    timeval timeout;

    // event loop
    while (_isRunning)
      {
	SLEEPMS(0);
	memcpy(&read_set, &_fd_set, sizeof(_fd_set));
	memcpy(&write_set, &_fd_set, sizeof(_fd_set));

	timeout = _timeout;
	// wait for an event
	nb_fd = select(_fd + 1, &read_set, &write_set, NULL, &timeout);
	if (nb_fd < 0 && errno != EINTR)
	  throw SocketIOError(std::string(strerror(getError())));

	if (FD_ISSET(_fd, &read_set))
	  {
	    // read event
	    if (bytesAvailables() == 0)
	      {
		break;
	      }
	    else if (_OnReadPossible)
	      _OnReadPossible(*this, bytesAvailables());
	  }

	// write event
	if (FD_ISSET(_fd, &write_set))
	  {
	    if (_OnWritePossible)
	      _OnWritePossible(*this);
	  }
      }
    disconnect();
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdi, %rbx
movb 0x168(%rdi), %al
testb $0x1, %al
je 0x12a5d
leaq 0xe8(%rbx), %r14
leaq 0x38(%rbx), %r15
leaq 0x88(%rbx), %rax
movq %rax, 0x10(%rsp)
leaq 0xa8(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0xd8(%rsp), %r13
leaq 0x58(%rsp), %rbp
xorl %edi, %edi
callq 0xba70
movl $0x10, %ecx
movq %r13, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movl $0x10, %ecx
movq %rbp, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movups (%r15), %xmm0
movaps %xmm0, 0x20(%rsp)
movl 0x2c(%rbx), %edi
incl %edi
movq %r13, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
leaq 0x20(%rsp), %r8
callq 0xb740
testl %eax, %eax
jns 0x129b7
callq 0xb070
cmpl $0x4, (%rax)
jne 0x12a90
movl 0x2c(%rbx), %eax
leal 0x3f(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq 0xd8(%rsp,%rcx,8), %rcx
btq %rax, %rcx
jae 0x12a1b
movq %rbx, %rdi
callq 0xb2f0
testq %rax, %rax
je 0x12a5d
cmpq $0x0, 0x98(%rbx)
je 0x12a1b
movq %rbx, %rdi
callq 0xb2f0
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x98(%rbx)
je 0x12a8b
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
leaq 0x8(%rsp), %rdx
callq *0xa0(%rbx)
movl 0x2c(%rbx), %eax
leal 0x3f(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq 0x58(%rsp,%rcx,8), %rcx
btq %rax, %rcx
jae 0x12a4f
cmpq $0x0, 0xb8(%rbx)
je 0x12a4f
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq *0xc0(%rbx)
movb 0x168(%rbx), %al
testb $0x1, %al
jne 0x12962
movl 0x2c(%rbx), %edi
callq 0xbe10
cmpq $0x0, 0x78(%rbx)
je 0x12a79
leaq 0x68(%rbx), %rdi
movq %rbx, %rsi
callq *0x80(%rbx)
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xb230
movq %rax, %r12
movl $0x48, %edi
callq 0xb360
movq %rax, %rbx
movl (%r12), %edi
callq 0xb1e0
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rax, %rsi
callq 0xb290
movb $0x1, %bpl
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0xbb20
xorl %ebp, %ebp
movq 0x84c4(%rip), %rsi      # 0x1af98
movq 0x84b5(%rip), %rdx      # 0x1af90
movq %rbx, %rdi
callq 0xbc70
movq %rax, %r14
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x12af9
callq 0xb730
testb %bpl, %bpl
jne 0x12b03
jmp 0x12b0b
movq %rax, %r14
movq %rbx, %rdi
callq 0xb5b0
movq %r14, %rdi
callq 0xbce0
nop