// File: /workspace/github_cpp_makefile_star2_O2/dnegovan[P]Intruder-On-Donnar-V/Game.cpp
// Function: Game::move()
bool Game::move()
{
    int input = 0;
    int menuNum;
    int up, down, left, right;

    while (input < 1 || input > menuNum)
    {
        menuNum = 1;

        //need to store menu number for each direction then use in switch case
        up = 0, down = 0, left = 0, right = 0;

        std::cout << std::endl;
        //list option that are available
        if (currentSpace->up)  //false if nullptr
        {
            up = menuNum;
            std::cout << menuNum << ". To "
                      << currentSpace->up->getRoomName() << std::endl;
            menuNum++;
        }
        if (currentSpace->right)
        {
            right = menuNum;
            std::cout << menuNum << ". To "
                      << currentSpace->right->getRoomName() << std::endl;
            menuNum++;
        }
        if (currentSpace->down)
        {
            down = menuNum;
            std::cout << menuNum << ". To "
                      << currentSpace->down->getRoomName() << std::endl;
            menuNum++;
        }
        if (currentSpace->left)
        {
            left = menuNum;
            std::cout << menuNum << ". To "
                      << currentSpace->left->getRoomName() << std::endl;
            menuNum++;
        }

        std::cout << menuNum << ". Cancel" << std::endl;

        input = getInteger();
    }

    if (input == up)
    {
            currentSpace = currentSpace->up;
            return true;
    }
    else if (input == down)
    {
            currentSpace = currentSpace->down;
            return true;
    }
    else if (input == left)
    {
            currentSpace = currentSpace->left;
            return true;
    }
    else if (input == right)
    {
            currentSpace = currentSpace->right;
            return true;
    }
    //if we get here they must have hit cancel
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, -0x30(%rbp)
xorl %eax, %eax
testl %eax, %eax
jle 0xcec6
cmpl %r12d, %eax
jle 0xd0d4
movq 0x90fb(%rip), %r12      # 0x15fc8
movq %r12, %rdi
callq 0x30f0
movq -0x30(%rbp), %rbx
movq 0xc0(%rbx), %rax
cmpq $0x0, 0x48(%rax)
pushq $0x1
popq %r15
movl %r15d, %r14d
movl $0x0, -0x34(%rbp)
je 0xcf56
movq %r12, %rdi
movl %r15d, %esi
callq 0x32f0
movq %rax, %rdi
leaq 0x3a81(%rip), %rsi      # 0x1098b
callq 0x31d0
movq %rax, %r14
movq 0xc0(%rbx), %rax
movq 0x48(%rax), %rsi
leaq -0x58(%rbp), %r13
movq %r13, %rdi
callq 0xe34e
movq %r14, %rdi
movq %r13, %rsi
callq 0x31b0
movq %rax, %rdi
callq 0x30f0
leaq -0x58(%rbp), %rdi
callq 0x3368
movq 0xc0(%rbx), %rax
pushq $0x2
popq %rcx
movl %ecx, %r14d
movl %r15d, -0x34(%rbp)
cmpq $0x0, 0x60(%rax)
je 0xcfba
movq %r12, %rdi
movl %r14d, %esi
callq 0x32f0
movq %rax, %rdi
leaq 0x3a19(%rip), %rsi      # 0x1098b
callq 0x31d0
movq %rax, %r15
movq 0xc0(%rbx), %rax
movq 0x60(%rax), %rsi
leaq -0x58(%rbp), %r13
movq %r13, %rdi
callq 0xe34e
movq %r15, %rdi
movq %r13, %rsi
callq 0x31b0
movq %rax, %rdi
callq 0x30f0
leaq -0x58(%rbp), %rdi
callq 0x3368
leal 0x1(%r14), %esi
movq 0xc0(%rbx), %rax
jmp 0xcfc0
movl %r14d, %esi
xorl %r14d, %r14d
cmpq $0x0, 0x50(%rax)
je 0xd032
movq %r12, %r13
movq %r12, %rdi
movq %rsi, %rbx
callq 0x32f0
movq %rax, %rdi
leaq 0x39ac(%rip), %rsi      # 0x1098b
callq 0x31d0
movq %rax, %r15
movq -0x30(%rbp), %rax
movq 0xc0(%rax), %rax
movq 0x50(%rax), %rsi
leaq -0x58(%rbp), %r12
movq %r12, %rdi
callq 0xe34e
movq %r15, %rdi
movq %r12, %rsi
callq 0x31b0
movq %rax, %rdi
callq 0x30f0
leaq -0x58(%rbp), %rdi
callq 0x3368
leal 0x1(%rbx), %r15d
movq -0x30(%rbp), %rax
movq 0xc0(%rax), %rax
movq %r13, %r12
jmp 0xd037
movl %esi, %r15d
xorl %ebx, %ebx
cmpq $0x0, 0x58(%rax)
je 0xd09e
movq %r14, %r13
movq %r12, %rdi
movl %r15d, %esi
callq 0x32f0
movq %rax, %rdi
leaq 0x3935(%rip), %rsi      # 0x1098b
callq 0x31d0
movq %rax, %r12
movq -0x30(%rbp), %rax
movq 0xc0(%rax), %rax
movq 0x58(%rax), %rsi
leaq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0xe34e
movq %r12, %rdi
movq %r14, %rsi
callq 0x31b0
movq %rax, %rdi
callq 0x30f0
leaq -0x58(%rbp), %rdi
callq 0x3368
leal 0x1(%r15), %r12d
movq %r13, %r14
jmp 0xd0a4
movl %r15d, %r12d
xorl %r15d, %r15d
movq 0x8f1d(%rip), %rdi      # 0x15fc8
movl %r12d, %esi
callq 0x32f0
movq %rax, %rdi
leaq 0x38d4(%rip), %rsi      # 0x10991
callq 0x31d0
movq %rax, %rdi
callq 0x30f0
callq 0xaed4
jmp 0xceb9
cmpl -0x34(%rbp), %eax
jne 0xd0dd
pushq $0x48
jmp 0xd0e3
cmpl %ebx, %eax
jne 0xd10b
pushq $0x50
popq %rax
movq -0x30(%rbp), %rdx
movq 0xc0(%rdx), %rcx
movq (%rcx,%rax), %rax
movq %rax, 0xc0(%rdx)
movb $0x1, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl %r15d, %eax
movq -0x30(%rbp), %rdx
jne 0xd118
pushq $0x58
jmp 0xd11f
cmpl %r14d, %eax
jne 0xd122
pushq $0x60
popq %rax
jmp 0xd0e8
xorl %eax, %eax
jmp 0xd0fc
jmp 0xd12c
jmp 0xd12c
jmp 0xd12c
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x3368
movq %rbx, %rdi
callq 0x3300