// File: nickgammon[P]tinymudserver/states.cpp
// Function: ProcessPlayerPassword(tPlayer*, std::istream&)
void ProcessPlayerPassword (tPlayer * p, istream & sArgs)
{
  try
    {
    string password;
    sArgs >> password;

    /* password can't be blank */
    if (password.empty ())
      throw runtime_error ("Password cannot be blank.");
        
    if (password != p->password)
      throw runtime_error ("That password is incorrect.");

    // check for "blocked" flag on this player
    if (p->HaveFlag ("blocked"))
      {
      p->ClosePlayer ();
      p->prompt = "Goodbye.\n";
      throw runtime_error ("You are not permitted to connect.");
      }
      
    // OK, they're in!
    PlayerEnteredGame (p, messagemap ["existing_player"]);
 
    } // end of try block
    
  // detect too many password attempts
  catch (runtime_error & e)
    {
    if (++p->badPasswordCount >= MAX_PASSWORD_ATTEMPTS)
      {
      *p << "Too many attempts to guess the password!\n";
      p->Init ();
      }
      throw;
    }
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x45b0
movq -0xa0(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x4550
jmp 0x172a5
leaq -0x30(%rbp), %rdi
callq 0x4660
testb $0x1, %al
jne 0x172b4
jmp 0x17326
movl $0x10, %edi
callq 0x4250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xa8(%rbp)
leaq 0x5568(%rip), %rsi      # 0x1c83a
callq 0x41c0
jmp 0x172d9
movq -0xa8(%rbp), %rdi
movq 0x11d09(%rip), %rsi     # 0x28ff0
movq 0x11cca(%rip), %rdx     # 0x28fb8
callq 0x46a0
jmp 0x17616
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x17584
movq -0xa8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x4350
jmp 0x17584
movq -0x8(%rbp), %rsi
addq $0xb0, %rsi
leaq -0x30(%rbp), %rdi
callq 0x17880
testb $0x1, %al
jne 0x17340
jmp 0x173a1
movl $0x10, %edi
callq 0x4250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xb0(%rbp)
leaq 0x554e(%rip), %rsi      # 0x1c8ac
callq 0x41c0
jmp 0x17365
movq -0xb0(%rbp), %rdi
movq 0x11c7d(%rip), %rsi     # 0x28ff0
movq 0x11c3e(%rip), %rdx     # 0x28fb8
callq 0x46a0
jmp 0x17616
movq -0xb0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x4350
jmp 0x17584
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x46e0
movq -0xb8(%rbp), %rdx
leaq 0x54fe(%rip), %rsi      # 0x1c8c8
leaq -0x60(%rbp), %rdi
callq 0x67d0
jmp 0x173d5
movq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x8250
movb %al, -0xc1(%rbp)
jmp 0x173ed
leaq -0x60(%rbp), %rdi
callq 0x47d8
leaq -0x61(%rbp), %rdi
callq 0x44a0
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0x1740e
jmp 0x174c1
movq -0x8(%rbp), %rdi
callq 0x13a60
jmp 0x17419
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
leaq 0x54a8(%rip), %rsi      # 0x1c8d0
callq 0x45a0
jmp 0x1742f
movl $0x10, %edi
callq 0x4250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xd0(%rbp)
leaq 0x548d(%rip), %rsi      # 0x1c8da
callq 0x41c0
jmp 0x17454
movq -0xd0(%rbp), %rdi
movq 0x11b8e(%rip), %rsi     # 0x28ff0
movq 0x11b4f(%rip), %rdx     # 0x28fb8
callq 0x46a0
jmp 0x17616
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x17496
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x47d8
leaq -0x61(%rbp), %rdi
callq 0x44a0
jmp 0x17584
movq -0xd0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x4350
jmp 0x17584
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0x89(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x46e0
movq -0xd8(%rbp), %rdx
leaq 0x540f(%rip), %rsi      # 0x1c8fc
leaq -0x88(%rbp), %rdi
callq 0x67d0
jmp 0x174fb
leaq 0x124d6(%rip), %rdi     # 0x299d8
leaq -0x88(%rbp), %rsi
callq 0xc500
movq %rax, -0xe8(%rbp)
jmp 0x17517
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdi
callq 0x16270
jmp 0x1752c
leaq -0x88(%rbp), %rdi
callq 0x47d8
leaq -0x89(%rbp), %rdi
callq 0x44a0
leaq -0x30(%rbp), %rdi
callq 0x47d8
jmp 0x175fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x17578
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x47d8
leaq -0x89(%rbp), %rdi
callq 0x44a0
leaq -0x30(%rbp), %rdi
callq 0x47d8
movl -0x3c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x17605
movq -0x38(%rbp), %rdi
callq 0x41d0
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rcx
movl 0xd0(%rcx), %eax
addl $0x1, %eax
movl %eax, 0xd0(%rcx)
cmpl $0x3, %eax
jl 0x175f3
movq -0x8(%rbp), %rdi
leaq 0x5340(%rip), %rsi      # 0x1c90c
callq 0x178b0
jmp 0x175d3
movq -0x8(%rbp), %rdi
callq 0x179b0
jmp 0x175de
jmp 0x175f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x4650
jmp 0x175fa
callq 0x45e0
jmp 0x17616
jmp 0x17605
addq $0xf0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x46d0
movq %rax, %rdi
callq 0x6ae0
nopw %cs:(%rax,%rax)