// File: /workspace/github_cpp_makefile_star2_O3/IncredibleHannes[P]QMUL-ChessGame/src/View/View.cpp
// Function: View::getUserAction() const
UserAction* View::getUserAction() const {
  std::cout << "Please select a figure: ";
  std::string origin, target;
  std::cin >> origin;
  if(origin[0] == ':') {
    switch (toupper(origin[1])) {
      case 'S':
        return new UserAction(UserAction::Save);
      case 'L':
        return new UserAction(UserAction::Load);
      case 'Q':
        return new UserAction(UserAction::Quit);
      case 'U':
        return new UserAction(UserAction::Undo);
      default:
        return new UserAction(UserAction::Invalid);
    }
  }
  std::cout << std::endl << "Please select a target: ";
  std::cin >> target;
  if(origin.length() == 2 && target.length() == 2
     && toupper(origin[0]) - 'A' >= 0 &&  toupper(origin[0]) - 'A' < 8
     && origin[1] - '0' > 0 &&  origin[1] - '0' <= 8
     && toupper(target[0]) - 'A' >= 0 &&  toupper(target[0]) - 'A' < 8
     && target[1] - '0' > 0 &&  target[1] - '0' <= 8) {
    return new UserAction(new Move(Position(origin), Position(target)));
  }
  return new UserAction(UserAction::Invalid);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq 0x51eb(%rip), %rbx      # 0xafd0
leaq 0x1535(%rip), %rsi      # 0x7321
movl $0x18, %edx
movq %rbx, %rdi
callq 0x2150
leaq -0xb0(%rbp), %r12
movq %r12, -0x10(%r12)
xorl %eax, %eax
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq -0x70(%rbp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
movq 0x51b9(%rip), %rdi      # 0xafe0
leaq -0xc0(%rbp), %rsi
callq 0x2160
movq -0xc0(%rbp), %rax
cmpb $0x3a, (%rax)
jne 0x5e83
movsbl 0x1(%rax), %edi
callq 0x2210
addl $-0x4c, %eax
cmpl $0x9, %eax
ja 0x609d
leaq 0x1245(%rip), %rcx      # 0x70a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x10, %edi
callq 0x2120
movq %rax, %rbx
movq %rax, %rdi
movl $0x1, %esi
callq 0x57bc
jmp 0x6012
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq 0x512f(%rip), %rdi      # 0xafd0
callq 0x2040
movq %rax, %rdi
callq 0x20b0
leaq 0x1485(%rip), %rsi      # 0x733a
movl $0x18, %edx
movq %rax, %rdi
callq 0x2150
movq 0x5117(%rip), %rdi      # 0xafe0
leaq -0x80(%rbp), %rsi
callq 0x2160
cmpq $0x2, -0xb8(%rbp)
jne 0x5ff8
cmpq $0x2, -0x78(%rbp)
jne 0x5ff8
movq -0xc0(%rbp), %r15
movsbl (%r15), %edi
callq 0x2210
addl $-0x41, %eax
cmpl $0x7, %eax
ja 0x5ff8
movb 0x1(%r15), %al
addb $-0x31, %al
cmpb $0x7, %al
ja 0x5ff8
movq -0x80(%rbp), %rbx
movsbl (%rbx), %edi
callq 0x2210
addl $-0x41, %eax
cmpl $0x7, %eax
ja 0x5ff8
movb 0x1(%rbx), %al
addb $-0x31, %al
cmpb $0x7, %al
ja 0x5ff8
movl $0x10, %edi
callq 0x2120
movq %rax, %rbx
movl $0x20, %edi
callq 0x2120
movq %rax, %r14
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2(%r15), %rdx
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x6872
leaq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x2936
leaq -0x90(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
leaq -0xa0(%rbp), %rdi
callq 0x6872
movb $0x1, %r15b
leaq -0x58(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2936
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %r14, %rdi
callq 0x4040
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57cc
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x5fe4
callq 0x2100
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x6012
callq 0x2100
jmp 0x6012
movl $0x10, %edi
callq 0x2120
movq %rax, %rbx
movq %rax, %rdi
movl $0x5, %esi
callq 0x57bc
movq -0x80(%rbp), %rdi
cmpq %r13, %rdi
je 0x6020
callq 0x2100
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x6031
callq 0x2100
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x2120
movq %rax, %rbx
movq %rax, %rdi
movl $0x2, %esi
callq 0x57bc
jmp 0x6012
movl $0x10, %edi
callq 0x2120
movq %rax, %rbx
movq %rax, %rdi
movl $0x3, %esi
callq 0x57bc
jmp 0x6012
movl $0x10, %edi
callq 0x2120
movq %rax, %rbx
movq %rax, %rdi
movl $0x4, %esi
callq 0x57bc
jmp 0x6012
movl $0x10, %edi
callq 0x2120
movq %rax, %rbx
movq %rax, %rdi
movl $0x5, %esi
callq 0x57bc
jmp 0x6012
movq %rax, -0x30(%rbp)
jmp 0x610f
jmp 0x6123
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x610f
callq 0x2100
jmp 0x610f
movq %rax, -0x30(%rbp)
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x60f8
callq 0x2100
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x610a
callq 0x2100
testb %r15b, %r15b
je 0x6127
movq %r14, %rdi
callq 0x2100
jmp 0x6127
jmp 0x6123
jmp 0x6123
jmp 0x6123
jmp 0x6123
jmp 0x6123
movq %rax, -0x30(%rbp)
movq %rbx, %rdi
callq 0x2100
jmp 0x6135
movq %rax, -0x30(%rbp)
movq -0x80(%rbp), %rdi
cmpq %r13, %rdi
je 0x6143
callq 0x2100
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x6154
callq 0x2100
movq -0x30(%rbp), %rdi
callq 0x21d0
nop