// File: justinjo[P]Pacman/pacman.cpp
// Function: Pacman::move(char (*) [61], char)
bool Pacman::move(char board[ROWS][COLS], char command)
{
        bool ate_dot = false;
        rotate_head(command);
        num_moves++;
        if (!boulder_ahead(board, command)){
                board[row][col] = SPACE;
                if (command == CMD_UP){         // move, wrap if needed
                        if (row == 0) {row = ROWS-1;} else {row--;}
                } else if (command == CMD_DWN){
                        if (row == ROWS-1) {row = 0;} else {row++;}
                } else if (command == CMD_RGT){
                        if (col == COLS-1) {col = 0;} else {col++;}
                } else if (command == CMD_LFT){
                        if (col == 0) {col = COLS-1;} else {col--;}
                }
        }
        if (board[row][col] == GHOST)
                die();
        if (board[row][col] == DOT){
                ate_dot = true;
                dots_eaten++;
        }
        return ate_dot;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movb $0x0, -0x12(%rbp)
movsbl -0x11(%rbp), %esi
callq 0x2820
movq -0x20(%rbp), %rdi
movl 0xc(%rdi), %eax
addl $0x1, %eax
movl %eax, 0xc(%rdi)
movq -0x10(%rbp), %rsi
movsbl -0x11(%rbp), %edx
callq 0x2890
testb $0x1, %al
jne 0x27ae
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movslq 0x4(%rcx), %rdx
imulq $0x3d, %rdx, %rdx
addq %rdx, %rax
movslq 0x8(%rcx), %rcx
movb $0x20, (%rax,%rcx)
movsbl -0x11(%rbp), %eax
cmpl $0x77, %eax
jne 0x2719
movq -0x20(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x2707
movq -0x20(%rbp), %rax
movl $0x14, 0x4(%rax)
jmp 0x2714
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x4(%rax)
jmp 0x27ac
movsbl -0x11(%rbp), %eax
cmpl $0x73, %eax
jne 0x2748
movq -0x20(%rbp), %rax
cmpl $0x14, 0x4(%rax)
jne 0x2739
movq -0x20(%rbp), %rax
movl $0x0, 0x4(%rax)
jmp 0x2746
movq -0x20(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
jmp 0x27aa
movsbl -0x11(%rbp), %eax
cmpl $0x64, %eax
jne 0x2777
movq -0x20(%rbp), %rax
cmpl $0x3c, 0x8(%rax)
jne 0x2768
movq -0x20(%rbp), %rax
movl $0x0, 0x8(%rax)
jmp 0x2775
movq -0x20(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x27a8
movsbl -0x11(%rbp), %eax
cmpl $0x61, %eax
jne 0x27a6
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x2797
movq -0x20(%rbp), %rax
movl $0x3c, 0x8(%rax)
jmp 0x27a4
movq -0x20(%rbp), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x27a6
jmp 0x27a8
jmp 0x27aa
jmp 0x27ac
jmp 0x27ae
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movslq 0x4(%rcx), %rdx
imulq $0x3d, %rdx, %rdx
addq %rdx, %rax
movslq 0x8(%rcx), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x6d, %eax
jne 0x27d7
movq -0x20(%rbp), %rdi
callq 0x2a50
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movslq 0x4(%rcx), %rdx
imulq $0x3d, %rdx, %rdx
addq %rdx, %rax
movslq 0x8(%rcx), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x6f, %eax
jne 0x2808
movq -0x20(%rbp), %rax
movb $0x1, -0x12(%rbp)
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
movb -0x12(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)