// File: /workspace/github_cpp_makefile_star2_O1/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 0xcc89
movq 0x9d86(%rip), %rsi      # 0x16720
movq 0x9d87(%rip), %rcx      # 0x16728
leaq -0x88(%rbp), %rdi
xorl %edx, %edx
callq 0x34e0
cmpq $-0x1, %rax
jne 0xcca7
leaq 0x9f58(%rip), %r14      # 0x16918
leaq -0x88(%rbp), %rsi
movq %r14, %rdi
callq 0x695c
addq $0x8, %r14
cmpq %r14, %rax
jne 0xccc5
leaq -0xa8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x4e91
movq 0x9cea(%rip), %rcx      # 0x166e0
movq 0x9ceb(%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 0xca31
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0xca39
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 0x9ca5(%rip), %rsi      # 0x16700
movq 0x9ca6(%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 0xca8c
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0xca94
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 0xcad5
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xcaea
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x32f0
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcb09
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x32f0
movq -0x2b0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x290(%rbp,%rax)
je 0xcc57
leaq -0x88(%rbp), %rdi
callq 0x527c
testq %rax, %rax
jne 0xcc57
leaq -0x48(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x4e91
leaq 0x90(%rbx), %r14
leaq -0x48(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x33a0
movq (%r15), %rdi
cmpq %r12, %rdi
je 0xcb71
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
movl $0x3, 0x68(%rbx)
leaq 0x3cb6(%rip), %rsi      # 0x10835
leaq -0x68(%rbp), %rdi
movq %r14, %rdx
callq 0xae25
leaq 0x3c49(%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 0xcbbb
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0xcbc3
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 0xcbfe
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xcc13
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 0xcc45
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 0x3b92(%rip), %rsi      # 0x107fd
movq %rax, %rdi
callq 0x3130
movq 0x9376(%rip), %rsi      # 0x15ff0
movq 0x932f(%rip), %rdx      # 0x15fb0
movq %r14, %rdi
callq 0x3500
movl $0x10, %edi
callq 0x3180
movq %rax, %r14
leaq 0x3a98(%rip), %rsi      # 0x10735
movq %rax, %rdi
callq 0x3130
jmp 0xcce1
movl $0x10, %edi
callq 0x3180
movq %rax, %r14
leaq 0x3aa7(%rip), %rsi      # 0x10762
movq %rax, %rdi
callq 0x3130
jmp 0xcce1
movl $0x10, %edi
callq 0x3180
movq %rax, %r14
leaq 0x3b08(%rip), %rsi      # 0x107e1
movq %rax, %rdi
callq 0x3130
movq 0x9308(%rip), %rsi      # 0x15ff0
movq 0x92c1(%rip), %rdx      # 0x15fb0
movq %r14, %rdi
callq 0x3500
jmp 0xccfb
jmp 0xccfb
movq %rax, %rbx
movq %r14, %rdi
callq 0x3250
jmp 0xcda6
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xcd95
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x32f0
jmp 0xcd95
jmp 0xcd92
jmp 0xcd92
movq %rax, %rbx
movq %r14, %rdi
callq 0x3250
jmp 0xcd95
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xcd53
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x32f0
jmp 0xcd53
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xcd6d
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x32f0
jmp 0xcd6d
movq %rax, %rbx
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcda6
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x32f0
jmp 0xcda6
jmp 0xcda3
jmp 0xcda3
movq %rax, %rbx
leaq -0x2b0(%rbp), %rdi
callq 0x30c0
jmp 0xcda6
movq %rax, %rbx
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0xcdc2
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3530