// File: JacobLCarter[P]2D-Portal/game.cpp
// Function: Game::isObstacle(char)
bool Game::isObstacle(char intendedInput)
{
    switch (intendedInput)
    {
        //case if the player would move onto an obstacle upwards
        case 'w': if (playerSpace->getSpaceUp()->getSpaceTypeIdentifier() == 'X'
                      || playerSpace->getSpaceUp()->getSpaceTypeIdentifier() == '[')
                  {
                      return true;
                  }
                  break;
        //case if the player would move onto an obstacle downwards
        case 's': if (playerSpace->getSpaceBottom()->getSpaceTypeIdentifier() == 'X'
                      || playerSpace->getSpaceBottom()->getSpaceTypeIdentifier() == '[')
                  {
                      return true;
                  }
                  break;
        //case if the player would move onto an obstacle to the left
        case 'a': if (playerSpace->getSpaceLeft()->getSpaceTypeIdentifier() == 'X'
                      || playerSpace->getSpaceLeft()->getSpaceTypeIdentifier() == '[')
                  {
                      return true;
                  }
                  break;
        //case if the player would move onto an obstacle to the right
        case 'd': if (playerSpace->getSpaceRight()->getSpaceTypeIdentifier() == 'X'
                      || playerSpace->getSpaceRight()->getSpaceTypeIdentifier() == '[')
                  {
                      return true;
                  }
                  break;
        //case if the player chooses not to move 
        case 'x': return false;
    }

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movsbl -0x11(%rbp), %eax
addl $-0x61, %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x17, %eax
ja 0x4b2e
movq -0x20(%rbp), %rax
leaq 0x7655(%rip), %rcx      # 0xc060
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5520
movq %rax, %rdi
callq 0x54e0
movsbl %al, %eax
cmpl $0x58, %eax
je 0x4a4e
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5520
movq %rax, %rdi
callq 0x54e0
movsbl %al, %eax
cmpl $0x5b, %eax
jne 0x4a57
movb $0x1, -0x1(%rbp)
jmp 0x4b32
jmp 0x4b2e
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5540
movq %rax, %rdi
callq 0x54e0
movsbl %al, %eax
cmpl $0x58, %eax
je 0x4a96
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5540
movq %rax, %rdi
callq 0x54e0
movsbl %al, %eax
cmpl $0x5b, %eax
jne 0x4a9f
movb $0x1, -0x1(%rbp)
jmp 0x4b32
jmp 0x4b2e
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5560
movq %rax, %rdi
callq 0x54e0
movsbl %al, %eax
cmpl $0x58, %eax
je 0x4ade
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5560
movq %rax, %rdi
callq 0x54e0
movsbl %al, %eax
cmpl $0x5b, %eax
jne 0x4ae4
movb $0x1, -0x1(%rbp)
jmp 0x4b32
jmp 0x4b2e
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5580
movq %rax, %rdi
callq 0x54e0
movsbl %al, %eax
cmpl $0x58, %eax
je 0x4b20
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5580
movq %rax, %rdi
callq 0x54e0
movsbl %al, %eax
cmpl $0x5b, %eax
jne 0x4b26
movb $0x1, -0x1(%rbp)
jmp 0x4b32
jmp 0x4b2e
movb $0x0, -0x1(%rbp)
jmp 0x4b32
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)