// File: JacobLCarter[P]2D-Portal/main.cpp
// Function: main
int main()
{
    //get user's choice at the main menu
    int menuChoice = mainMenu();

    //executes if the user chooses to play
    if (menuChoice == 1)
    {
        //loop repeats until the user chooses not to replay
        do
        {
            //make a new game
            Game *currentGame = new Game;
      
            //show the introduction and wait for the user to press enter to continue
            std::cout << currentGame->gameIntroduction();
            std::cin.get();

            //show the starting map
            currentGame->getMap()->showMap();

            //show the map legend
            std::cout << currentGame->getMap()->getMapLegend();

            //display the game's controls
            std::cout << currentGame->displayHelpMenu();

            //play another round while it is not true that the game is over
            while (!currentGame->getGameOver())
            {
                currentGame->playRound();
            }
           
            //free memory allocated for the game
            delete currentGame;
        }
        while (replay() != 'n');
    }
    else
    {
        std::cout << "Exiting the program" << std::endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movl $0x0, -0x4(%rbp)
callq 0xa730
movl %eax, -0x8(%rbp)
cmpl $0x1, -0x8(%rbp)
jne 0xb1d6
jmp 0xb026
movl $0x20, %edi
callq 0x3220
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x88(%rbp)
callq 0x3740
jmp 0xb044
movq -0x88(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x3a50
movq -0x90(%rbp), %rsi
movq 0x7f5f(%rip), %rdi      # 0x12fd0
callq 0x31f0
jmp 0xb078
leaq -0x40(%rbp), %rdi
callq 0x3140
movq 0x7f58(%rip), %rdi      # 0x12fe0
callq 0x32c0
movq -0x10(%rbp), %rdi
callq 0x39d0
movq %rax, %rdi
callq 0x9880
movq -0x10(%rbp), %rdi
callq 0x39d0
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x88b0
movq -0x98(%rbp), %rsi
movq 0x7f08(%rip), %rdi      # 0x12fd0
callq 0x31f0
jmp 0xb0cf
leaq -0x60(%rbp), %rdi
callq 0x3140
movq -0x10(%rbp), %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x4690
movq -0xa0(%rbp), %rsi
movq 0x7ed6(%rip), %rdi      # 0x12fd0
callq 0x31f0
jmp 0xb101
leaq -0x80(%rbp), %rdi
callq 0x3140
movq -0x10(%rbp), %rdi
callq 0x3a10
xorb $-0x1, %al
testb $0x1, %al
jne 0xb11b
jmp 0xb193
movq -0x10(%rbp), %rdi
callq 0x5390
jmp 0xb10a
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x20, %esi
callq 0x3230
jmp 0xb204
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3140
jmp 0xb204
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3140
jmp 0xb204
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x3140
jmp 0xb204
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
cmpq $0x0, %rax
je 0xb1c1
movq -0xa8(%rbp), %rdi
callq 0x38b0
movq -0xa8(%rbp), %rdi
movl $0x20, %esi
callq 0x3230
jmp 0xb1c3
callq 0xa980
movsbl %al, %eax
cmpl $0x6e, %eax
jne 0xb026
jmp 0xb1f8
movq 0x7df3(%rip), %rdi      # 0x12fd0
leaq 0x2c62(%rip), %rsi      # 0xde46
callq 0x3210
movq %rax, %rdi
movq 0x7dcd(%rip), %rsi      # 0x12fc0
callq 0x3240
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x33b0