// File: /workspace/github_cpp_makefile_star2_O1/nickgammon[P]tinymudserver/comms.cpp
// Function: ProcessNewConnection()
void ProcessNewConnection ()
  {
  static struct sockaddr_in sa;
  socklen_t sa_len = sizeof sa;   

  int s;    /* incoming socket */

  /* loop until all outstanding connections are accepted */
  while (true)
    {
    s = accept ( iControl, (struct sockaddr *) &sa, &sa_len);

    /* a bad socket probably means no more connections are outstanding */
    if (s == NO_SOCKET)
      {

      /* blocking is OK - we have accepted all outstanding connections */
      if ( errno == EWOULDBLOCK )
        return;

      perror ("accept");
      return;
      }
        
    /* here on successful accept - make sure socket doesn't block */
    
    if (fcntl (s, F_SETFL, FNDELAY) == -1)
      {
      perror ("fcntl on player socket");
      return;
      }

    string address = inet_ntoa ( sa.sin_addr);
    int port = ntohs (sa.sin_port);
            
    // immediately close connections from blocked IP addresses
    if (blockedIP.find (address) != blockedIP.end ())
      {
      cerr << "Rejected connection from " << address << endl;
      close (s);
      continue;      
      }
      
    tPlayer * p = new tPlayer (s, port, address);
    playerlist.push_back (p);
    
    cout << "New player accepted on socket " << s << 
            ", from address " << address << 
            ", port " << port << endl;
      
    *p << "\nWelcome to the Tiny MUD Server version " << VERSION << "\n"; 
    *p << messagemap ["welcome"];   // message from message file
    *p << p->prompt;    // initial prompt (Enter your name ...)
    
    } /* end of processing *all* new connections */

  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
leaq -0x2c(%rbp), %rdx
movl $0x10, (%rdx)
leaq 0x82ad(%rip), %rax      # 0x16300
movl (%rax), %edi
leaq 0x89e4(%rip), %rsi      # 0x16a40
callq 0x3100
cmpl $-0x1, %eax
je 0xe335
movl %eax, %r13d
leaq 0x88d4(%rip), %rax      # 0x16948
addq $0x8, %rax
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %r15
movl %r13d, %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
xorl %eax, %eax
callq 0x31c0
cmpl $-0x1, %eax
je 0xe357
movl 0x899b(%rip), %edi      # 0x16a44
callq 0x3160
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
leaq -0x70(%rbp), %rdx
callq 0xe748
movzwl 0x8979(%rip), %r12d     # 0x16a42
leaq 0x8878(%rip), %rdi      # 0x16948
movq %rbx, %rsi
callq 0xed9e
cmpq -0x98(%rbp), %rax
je 0xe144
movl $0x19, %edx
movq 0x7efb(%rip), %rdi      # 0x15fe8
leaq 0x297f(%rip), %rsi      # 0x10a73
callq 0x3370
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq 0x7ee0(%rip), %rdi      # 0x15fe8
callq 0x3370
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3220
movl %r13d, %edi
callq 0x35b0
jmp 0xe2f7
movl $0x110, %edi            # imm = 0x110
callq 0x32e0
movq %rax, %rbx
leaq -0x80(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
movq %r15, %r14
movq %r15, %rdi
callq 0x5192
rolw $0x8, %r12w
movzwl %r12w, %r12d
movq %rbx, %rdi
movl %r13d, %esi
movl %r12d, %edx
movq %r14, %rcx
callq 0xe810
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xe1a8
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x32f0
movl $0x18, %edi
callq 0x32e0
movq %rbx, 0x10(%rax)
movq %rax, %rdi
leaq 0x8650(%rip), %r14      # 0x16810
movq %r14, %rsi
callq 0x3060
incq 0x10(%r14)
movl $0x1e, %edx
movq 0x7de8(%rip), %rdi      # 0x15fc0
leaq 0x28ae(%rip), %rsi      # 0x10a8d
callq 0x3370
movq 0x7dd5(%rip), %rdi      # 0x15fc0
movl %r13d, %esi
callq 0x3510
movq %rax, %r13
movl $0xf, %edx
movq %rax, %rdi
leaq 0x28a7(%rip), %rsi      # 0x10aac
callq 0x3370
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %r13, %rdi
callq 0x3370
movq %rax, %r13
movl $0x7, %edx
movq %rax, %rdi
leaq 0x2890(%rip), %rsi      # 0x10abc
callq 0x3370
movq %r13, %rdi
movl %r12d, %esi
callq 0x3510
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x32d0
movsbl %al, %esi
movq %r12, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3220
movq %rbx, %rdi
leaq 0x2854(%rip), %rsi      # 0x10ac4
callq 0xe9f8
movq %rax, %rdi
leaq 0x8701(%rip), %rsi      # 0x16980
callq 0x6a44
movq %rax, %rdi
leaq 0x1e3e(%rip), %rsi      # 0x100cc
callq 0xb0b0
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x70(%rbp), %r12
movq %r12, %rdi
leaq 0x2844(%rip), %rsi      # 0x10aed
leaq 0x2844(%rip), %rdx      # 0x10af4
callq 0x4bc4
leaq 0x85fc(%rip), %rdi      # 0x168b8
movq %r12, %rsi
callq 0x79b2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6a44
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xe2e8
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x32f0
movq %rbx, %rsi
addq $0x70, %rsi
movq %rbx, %rdi
callq 0x6a44
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xe310
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x32f0
leaq 0x7fe9(%rip), %rax      # 0x16300
movl (%rax), %edi
leaq 0x8720(%rip), %rsi      # 0x16a40
leaq -0x2c(%rbp), %rdx
callq 0x3100
movl %eax, %r13d
cmpl $-0x1, %eax
jne 0xe086
callq 0x3050
cmpl $0xb, (%rax)
jne 0xe34e
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2700(%rip), %rdi      # 0x10a55
jmp 0xe35e
leaq 0x26fe(%rip), %rdi      # 0x10a5c
callq 0x3270
jmp 0xe33f
movq %rax, %r14
jmp 0xe38b
jmp 0xe3b7
movq %rax, %r14
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xe38b
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x32f0
movl $0x110, %esi            # imm = 0x110
movq %rbx, %rdi
jmp 0xe3ac
movq %rax, %r14
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xe3ba
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x32f0
jmp 0xe3ba
jmp 0xe3b7
jmp 0xe3b7
movq %rax, %r14
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xe3d3
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x32f0
movq %r14, %rdi
callq 0x3530