// File: justinjo[P]Pacman/pacman.cpp
// Function: Pacman::boulder_ahead(char (*) [61], char)
bool Pacman::boulder_ahead(char board[ROWS][COLS], char command)
{
        if (command == CMD_UP){
                if (row == 0){
                        return (board[ROWS-1][col] == BOULDER);
                } else {
                        return (board[row-1][col] == BOULDER);
                }
        } else if (command == CMD_DWN){
                if (row == ROWS-1){
                        return (board[0][col] == BOULDER);
                } else {
                        return (board[row+1][col] == BOULDER);
                }
        } else if (command == CMD_RGT){
                if (col == COLS-1){
                        return (board[row][0] == BOULDER);
                } else {
                        return (board[row][col+1] == BOULDER);
                }
        } else if (command == CMD_LFT){
                if (col == 0){
                        return (board[row][COLS-1] == BOULDER);
                } else {
                        return (board[row][col-1] == BOULDER);
                }
        }
        return true;  // error case locks Pacman in place
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movsbl -0x19(%rbp), %eax
cmpl $0x77, %eax
jne 0x2910
movq -0x28(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0x28e0
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movslq 0x8(%rcx), %rcx
movsbl 0x4c4(%rax,%rcx), %eax
cmpl $0x58, %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x2a47
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movl 0x4(%rcx), %edx
subl $0x1, %edx
movslq %edx, %rdx
imulq $0x3d, %rdx, %rdx
addq %rdx, %rax
movslq 0x8(%rcx), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x58, %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x2a47
movsbl -0x19(%rbp), %eax
cmpl $0x73, %eax
jne 0x2973
movq -0x28(%rbp), %rax
cmpl $0x14, 0x4(%rax)
jne 0x2943
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movslq 0x8(%rcx), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x58, %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x2a47
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movl 0x4(%rcx), %edx
addl $0x1, %edx
movslq %edx, %rdx
imulq $0x3d, %rdx, %rdx
addq %rdx, %rax
movslq 0x8(%rcx), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x58, %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x2a47
movsbl -0x19(%rbp), %eax
cmpl $0x64, %eax
jne 0x29d9
movq -0x28(%rbp), %rax
cmpl $0x3c, 0x8(%rax)
jne 0x29ac
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movslq 0x4(%rcx), %rcx
imulq $0x3d, %rcx, %rcx
addq %rcx, %rax
movsbl (%rax), %eax
cmpl $0x58, %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x2a47
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movslq 0x4(%rcx), %rdx
imulq $0x3d, %rdx, %rdx
addq %rdx, %rax
movl 0x8(%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x58, %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x2a47
movsbl -0x19(%rbp), %eax
cmpl $0x61, %eax
jne 0x2a3d
movq -0x28(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x2a10
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movslq 0x4(%rcx), %rcx
imulq $0x3d, %rcx, %rcx
addq %rcx, %rax
movsbl 0x3c(%rax), %eax
cmpl $0x58, %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x2a47
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movslq 0x4(%rcx), %rdx
imulq $0x3d, %rdx, %rdx
addq %rdx, %rax
movl 0x8(%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x58, %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x2a47
jmp 0x2a3f
jmp 0x2a41
jmp 0x2a43
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
popq %rbp
retq
nop