// File: /workspace/github_cpp_makefile_star2_O3/nickgammon[P]tinymudserver/states.cpp
// Function: ProcessNewPlayerName(tPlayer*, std::istream&)
void ProcessNewPlayerName (tPlayer * p, istream & sArgs)
{
  string playername;
  sArgs >> playername;
  
  /* name can't be blank */
  if (playername.empty ())
    throw runtime_error ("Name cannot be blank.");

  if (playername.find_first_not_of (valid_player_name) != string::npos)
    throw runtime_error ("That player name contains disallowed characters.");
        
  // check for bad names here (from list in control file)
  if (badnameset.find (playername) != badnameset.end ())
    throw runtime_error ("That name is not permitted.");
    
  ifstream f ((PLAYER_DIR + tocapitals (playername) + PLAYER_EXT).c_str (), ios::in);
  if (f || FindPlayer (playername))  // player file on disk, or playing without saving yet
    throw runtime_error ("That player already exists, please choose another name.");
  
  p->playername = tocapitals (playername);
  
  p->connstate = eAwaitingNewPassword;
  p->prompt = "Choose a password for " + p->playername + " ... ";  
  p->badPasswordCount = 0;
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rsi, %rax
movq %rdi, %rbx
leaq -0x78(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x33b0
cmpq $0x0, -0x80(%rbp)
je 0xcc13
movq 0x9dfc(%rip), %rsi      # 0x16720
movq 0x9dfd(%rip), %rcx      # 0x16728
leaq -0x88(%rbp), %rdi
xorl %edx, %edx
callq 0x34e0
cmpq $-0x1, %rax
jne 0xcc31
leaq 0x9fce(%rip), %r14      # 0x16918
leaq -0x88(%rbp), %rsi
movq %r14, %rdi
callq 0x6922
addq $0x8, %r14
cmpq %r14, %rax
jne 0xcc4f
leaq -0xa8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x4e93
movq 0x9d60(%rip), %rcx      # 0x166e0
movq 0x9d61(%rip), %r8       # 0x166e8
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3360
leaq -0x58(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc9bb
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0xc9c3
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq -0x68(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x9d1b(%rip), %rsi      # 0x16700
movq 0x9d1c(%rip), %rdx      # 0x16708
callq 0x30f0
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xca16
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0xca1e
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x48(%rbp), %rsi
leaq -0x2b0(%rbp), %rdi
movl $0x8, %edx
callq 0x3570
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xca5f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xca74
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x32f0
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xca93
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x32f0
movq -0x2b0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x290(%rbp,%rax)
je 0xcbe1
leaq -0x88(%rbp), %rdi
callq 0x5260
testq %rax, %rax
jne 0xcbe1
leaq -0x48(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x4e93
leaq 0x90(%rbx), %r14
leaq -0x48(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x33a0
movq (%r15), %rdi
cmpq %r12, %rdi
je 0xcafb
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
movl $0x3, 0x68(%rbx)
leaq 0x3d2c(%rip), %rsi      # 0x10835
leaq -0x68(%rbp), %rdi
movq %r14, %rdx
callq 0xadba
leaq 0x3cbf(%rip), %rsi      # 0x107db
leaq -0x68(%rbp), %rdi
callq 0x35a0
movq %r12, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xcb45
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0xcb4d
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq -0x48(%rbp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x70(%rbx), %rdi
movq %r14, %rsi
callq 0x33a0
movq (%r14), %rdi
cmpq %r12, %rdi
je 0xcb88
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xcb9d
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x32f0
movl $0x0, 0xd0(%rbx)
leaq -0x2b0(%rbp), %rdi
callq 0x30c0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0xcbcf
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x32f0
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x3180
movq %rax, %r14
leaq 0x3c08(%rip), %rsi      # 0x107fd
movq %rax, %rdi
callq 0x3130
movq 0x93ec(%rip), %rsi      # 0x15ff0
movq 0x93a5(%rip), %rdx      # 0x15fb0
movq %r14, %rdi
callq 0x3500
movl $0x10, %edi
callq 0x3180
movq %rax, %r14
leaq 0x3b0e(%rip), %rsi      # 0x10735
movq %rax, %rdi
callq 0x3130
jmp 0xcc6b
movl $0x10, %edi
callq 0x3180
movq %rax, %r14
leaq 0x3b1d(%rip), %rsi      # 0x10762
movq %rax, %rdi
callq 0x3130
jmp 0xcc6b
movl $0x10, %edi
callq 0x3180
movq %rax, %r14
leaq 0x3b7e(%rip), %rsi      # 0x107e1
movq %rax, %rdi
callq 0x3130
movq 0x937e(%rip), %rsi      # 0x15ff0
movq 0x9337(%rip), %rdx      # 0x15fb0
movq %r14, %rdi
callq 0x3500
jmp 0xcc85
jmp 0xcc85
movq %rax, %rbx
movq %r14, %rdi
callq 0x3250
jmp 0xcd30
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xcd1f
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x32f0
jmp 0xcd1f
jmp 0xcd1c
jmp 0xcd1c
movq %rax, %rbx
movq %r14, %rdi
callq 0x3250
jmp 0xcd1f
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xccdd
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
jmp 0xccdd
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xccf7
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x32f0
jmp 0xccf7
movq %rax, %rbx
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcd30
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x32f0
jmp 0xcd30
jmp 0xcd2d
jmp 0xcd2d
movq %rax, %rbx
leaq -0x2b0(%rbp), %rdi
callq 0x30c0
jmp 0xcd30
movq %rax, %rbx
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0xcd4c
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3530