// File: /workspace/github_cpp_makefile_star2_O1/nickgammon[P]tinymudserver/player.cpp
// Function: tPlayer::ProcessRead()
void tPlayer::ProcessRead ()
{
  
  if (closing)
    return;   // once closed, don't handle any pending input
  
  // I make it static to save allocating a buffer each time.
  // Hopefully this function won't be called recursively.
  static vector<char> buf (1000);  // reserve 1000 bytes for reading into
  
  int nRead = read (s, &buf [0], buf.size ());
  
  if (nRead == -1)
    {
    if (errno != EWOULDBLOCK)
      perror ("read from player");
    return;
    }

  if (nRead <= 0)
    {
    close (s);
    cerr << "Connection " << s << " closed" << endl;
    s = NO_SOCKET;
    DoCommand ("quit");  // tell others the s/he has left
    return;
    }

  inbuf += string (&buf [0], nRead);    /* add to input buffer */

  /* try to extract lines from the input buffer */
  for ( ; ; )
    {
    string::size_type i = inbuf.find ('\n');
    if (i == string::npos)
      break;  /* no more at present */

    string sLine = inbuf.substr (0, i);  /* extract first line */
    inbuf = inbuf.substr (i + 1, string::npos); /* get rest of string */

    ProcessPlayerInput (this, Trim (sLine));  /* now, do something with it */        
    }
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, -0x50(%rbp)
cmpb $0x0, 0xd8(%rdi)
jne 0x5f1e
movb 0x107ec(%rip), %al      # 0x164e0
testb %al, %al
je 0x5f2d
movq -0x50(%rbp), %r15
movl (%r15), %edi
movq 0x107be(%rip), %rsi     # 0x164c8
movq 0x107bf(%rip), %rdx     # 0x164d0
subq %rsi, %rdx
callq 0x3400
cmpl $-0x1, %eax
je 0x5e43
testl %eax, %eax
jle 0x5e6b
movq 0x10797(%rip), %rsi     # 0x164c8
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq -0x38(%rbp), %rcx
movq %rcx, -0x10(%rcx)
addq %rsi, %rax
leaq -0x48(%rbp), %rdi
movq %rax, %rdx
callq 0x4bc4
leaq 0x28(%r15), %r14
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %r14, %rdi
callq 0x30f0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5d7a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
leaq -0x60(%rbp), %rbx
leaq -0x48(%rbp), %r15
leaq -0x70(%rbp), %r12
movq %r14, %rdi
movl $0xa, %esi
xorl %edx, %edx
callq 0x33c0
cmpq $-0x1, %rax
je 0x5f1e
movq %rax, %r13
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3320
leaq 0x1(%r13), %rdx
movq %r12, %rdi
movq %r14, %rsi
movq $-0x1, %rcx
callq 0x3320
movq %r14, %rdi
movq %r12, %rsi
callq 0x33a0
movq -0x70(%rbp), %rdi
cmpq %rbx, %rdi
je 0x5de8
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x32f0
movq %r12, %rdi
movq %r15, %rsi
leaq 0x106b3(%rip), %rdx     # 0x164a8
callq 0x4d17
movq -0x50(%rbp), %rdi
movq %r12, %rsi
callq 0xe44e
movq -0x70(%rbp), %rdi
cmpq %rbx, %rdi
je 0x5e1b
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x32f0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5e34
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
cmpq $-0x1, %r13
jne 0x5d86
jmp 0x5f1e
callq 0x3050
cmpl $0xb, (%rax)
je 0x5f1e
leaq 0xa3d2(%rip), %rdi      # 0x1022a
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3270
movl (%r15), %edi
callq 0x35b0
movq 0x1016e(%rip), %r14     # 0x15fe8
leaq 0xa3ba(%rip), %rsi      # 0x1023b
movl $0xb, %edx
movq %r14, %rdi
callq 0x3370
movl (%r15), %esi
movq %r14, %rdi
callq 0x3510
movq %rax, %r14
leaq 0xa3a4(%rip), %rsi      # 0x10247
movl $0x7, %edx
movq %rax, %rdi
callq 0x3370
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3220
movl $0xffffffff, (%r15)     # imm = 0xFFFFFFFF
leaq -0x38(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0xa362(%rip), %rsi      # 0x1024f
leaq 0xa35f(%rip), %rdx      # 0x10253
leaq -0x48(%rbp), %rdi
callq 0x4bc4
leaq -0x48(%rbp), %rsi
movq %r15, %rdi
callq 0x5b44
movq -0x48(%rbp), %rdi
cmpq %rbx, %rdi
je 0x5f1e
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x105ac(%rip), %rdi     # 0x164e0
callq 0x3560
testl %eax, %eax
je 0x5cfc
xorps %xmm0, %xmm0
movups %xmm0, 0x1057d(%rip)    # 0x164c8
movq $0x0, 0x10582(%rip) # 0x164d8
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x32e0
movq %rax, 0x10561(%rip)     # 0x164c8
leaq 0x1055a(%rip), %r14     # 0x164c8
movq %rax, 0x1055b(%rip)     # 0x164d0
movq %rax, %rbx
addq $0x3e8, %rbx            # imm = 0x3E8
movq %rbx, 0x10552(%rip)     # 0x164d8
movl $0x3e8, %edx            # imm = 0x3E8
movq %rax, %rdi
xorl %esi, %esi
callq 0x31b0
movq %rbx, 0x10534(%rip)     # 0x164d0
leaq 0x55d(%rip), %rdi       # 0x6500
leaq 0x1033e(%rip), %rdx     # 0x162e8
movq %r14, %rsi
callq 0x32a0
leaq 0x10527(%rip), %rdi     # 0x164e0
callq 0x3210
jmp 0x5cfc
movq %rax, %r14
leaq 0x10513(%rip), %rdi     # 0x164e0
callq 0x31f0
jmp 0x6023
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %rbx, %rdi
jne 0x6017
jmp 0x6023
jmp 0x5fe6
jmp 0x6007
movq %rax, %r14
jmp 0x6023
jmp 0x6007
movq %rax, %r14
movq -0x70(%rbp), %rdi
cmpq %rbx, %rdi
je 0x600a
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x32f0
jmp 0x600a
movq %rax, %r14
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x6023
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
movq %r14, %rdi
callq 0x3530
nop