// File: Teris45[P]Maze-Game/Moving.cpp
// Function: MyMoving::checkMove(Poter&, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>&, int)
bool MyMoving::checkMove(Poter& poter, vector<vector<int>> &maze, int i) {

    int py = poter.getPoint().getY();
    int px = poter.getPoint().getX();
    if(i==KEY_UP){
        int maze_el = maze[py-1][px];
        if(maze_el == DIADROMOS || maze_el == GEM || maze_el == PERGAMINI) {
            mvaddch(py,px,' ');
            mvaddch(py-1,px,'P');
            return true;

        }
        else if(maze_el == TRAALINAKOS || maze_el == GOBLINAKOS){
            mvaddch(py,px,' ');
            return true;
        }
    }
    else if(i == KEY_DOWN){
        int maze_el = maze[py+1][px];
        if(maze_el == DIADROMOS || maze_el == GEM || maze_el == PERGAMINI) {
            mvaddch(py,px,' ');
            mvaddch(py+1,px,'P');
            return true;

        }
        else if(maze_el == TRAALINAKOS || maze_el == GOBLINAKOS){
            mvaddch(py,px,' ');
            return true;

        }
    }
    else if(i==KEY_RIGHT){
        int maze_el = maze[py][px+1];
        if(maze_el == DIADROMOS || maze_el == GEM || maze_el == PERGAMINI) {
            mvaddch(py,px,' ');
            mvaddch(py,px+1,'P');
            return true;

        }
        else if(maze_el == TRAALINAKOS || maze_el == GOBLINAKOS){
            mvaddch(py,px,' ');
            return true;
        }
    }
    else if(i==KEY_LEFT){
        int maze_el = maze[py][px-1];
        if(maze_el == DIADROMOS || maze_el == GEM || maze_el == PERGAMINI) {
            mvaddch(py,px,' ');
            mvaddch(py,px-1,'P');
            return true;
        }
        else if(maze_el == TRAALINAKOS || maze_el == GOBLINAKOS){
            mvaddch(py,px,' ');
            return true;
        }
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0xa840
movq -0x70(%rbp), %rdi
callq 0xa5b0
movl %eax, -0x64(%rbp)
jmp 0xbb45
leaq -0x30(%rbp), %rdi
callq 0xa900
movl -0x64(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x50(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0xa840
movq -0x80(%rbp), %rdi
callq 0xa570
movl %eax, -0x74(%rbp)
jmp 0xbb73
leaq -0x50(%rbp), %rdi
callq 0xa900
movl -0x74(%rbp), %eax
movl %eax, -0x40(%rbp)
cmpl $0x103, -0x1c(%rbp)     # imm = 0x103
jne 0xbcb4
movq -0x18(%rbp), %rdi
movl -0x20(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x58b0
movq %rax, %rdi
movslq -0x40(%rbp), %rsi
callq 0x58d0
movl (%rax), %eax
movl %eax, -0x54(%rbp)
cmpl $0x2, -0x54(%rbp)
je 0xbbc8
cmpl $0x6, -0x54(%rbp)
je 0xbbc8
cmpl $0x7, -0x54(%rbp)
jne 0xbc68
movq 0x8401(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x40(%rbp), %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbbe4
jmp 0xbbf8
movq 0x83e5(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x20, %esi
callq 0x30a0
movq 0x83d1(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
subl $0x1, %esi
movl -0x40(%rbp), %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbc17
jmp 0xbc2b
movq 0x83b2(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x50, %esi
callq 0x30a0
movb $0x1, -0x1(%rbp)
jmp 0xbfa3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xa900
jmp 0xbfb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xa900
jmp 0xbfb1
cmpl $0x5, -0x54(%rbp)
je 0xbc74
cmpl $0x4, -0x54(%rbp)
jne 0xbcad
movq 0x8355(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x40(%rbp), %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbc90
jmp 0xbca4
movq 0x8339(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x20, %esi
callq 0x30a0
movb $0x1, -0x1(%rbp)
jmp 0xbfa3
jmp 0xbcaf
jmp 0xbf9f
cmpl $0x102, -0x1c(%rbp)     # imm = 0x102
jne 0xbdae
movq -0x18(%rbp), %rdi
movl -0x20(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x58b0
movq %rax, %rdi
movslq -0x40(%rbp), %rsi
callq 0x58d0
movl (%rax), %eax
movl %eax, -0x58(%rbp)
cmpl $0x2, -0x58(%rbp)
je 0xbcf6
cmpl $0x6, -0x58(%rbp)
je 0xbcf6
cmpl $0x7, -0x58(%rbp)
jne 0xbd62
movq 0x82d3(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x40(%rbp), %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbd12
jmp 0xbd26
movq 0x82b7(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x20, %esi
callq 0x30a0
movq 0x82a3(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
addl $0x1, %esi
movl -0x40(%rbp), %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbd45
jmp 0xbd59
movq 0x8284(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x50, %esi
callq 0x30a0
movb $0x1, -0x1(%rbp)
jmp 0xbfa3
cmpl $0x5, -0x58(%rbp)
je 0xbd6e
cmpl $0x4, -0x58(%rbp)
jne 0xbda7
movq 0x825b(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x40(%rbp), %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbd8a
jmp 0xbd9e
movq 0x823f(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x20, %esi
callq 0x30a0
movb $0x1, -0x1(%rbp)
jmp 0xbfa3
jmp 0xbda9
jmp 0xbf9d
cmpl $0x105, -0x1c(%rbp)     # imm = 0x105
jne 0xbea8
movq -0x18(%rbp), %rdi
movslq -0x20(%rbp), %rsi
callq 0x58b0
movq %rax, %rdi
movl -0x40(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0x58d0
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
cmpl $0x2, -0x5c(%rbp)
je 0xbdf0
cmpl $0x6, -0x5c(%rbp)
je 0xbdf0
cmpl $0x7, -0x5c(%rbp)
jne 0xbe5c
movq 0x81d9(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x40(%rbp), %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbe0c
jmp 0xbe20
movq 0x81bd(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x20, %esi
callq 0x30a0
movq 0x81a9(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x40(%rbp), %edx
addl $0x1, %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbe3f
jmp 0xbe53
movq 0x818a(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x50, %esi
callq 0x30a0
movb $0x1, -0x1(%rbp)
jmp 0xbfa3
cmpl $0x5, -0x5c(%rbp)
je 0xbe68
cmpl $0x4, -0x5c(%rbp)
jne 0xbea1
movq 0x8161(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x40(%rbp), %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbe84
jmp 0xbe98
movq 0x8145(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x20, %esi
callq 0x30a0
movb $0x1, -0x1(%rbp)
jmp 0xbfa3
jmp 0xbea3
jmp 0xbf9b
cmpl $0x104, -0x1c(%rbp)     # imm = 0x104
jne 0xbf99
movq -0x18(%rbp), %rdi
movslq -0x20(%rbp), %rsi
callq 0x58b0
movq %rax, %rdi
movl -0x40(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x58d0
movl (%rax), %eax
movl %eax, -0x60(%rbp)
cmpl $0x2, -0x60(%rbp)
je 0xbeea
cmpl $0x6, -0x60(%rbp)
je 0xbeea
cmpl $0x7, -0x60(%rbp)
jne 0xbf53
movq 0x80df(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x40(%rbp), %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbf06
jmp 0xbf1a
movq 0x80c3(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x20, %esi
callq 0x30a0
movq 0x80af(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x40(%rbp), %edx
subl $0x1, %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbf39
jmp 0xbf4d
movq 0x8090(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x50, %esi
callq 0x30a0
movb $0x1, -0x1(%rbp)
jmp 0xbfa3
cmpl $0x5, -0x60(%rbp)
je 0xbf5f
cmpl $0x4, -0x60(%rbp)
jne 0xbf95
movq 0x806a(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x40(%rbp), %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0xbf7b
jmp 0xbf8f
movq 0x804e(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x20, %esi
callq 0x30a0
movb $0x1, -0x1(%rbp)
jmp 0xbfa3
jmp 0xbf97
jmp 0xbf99
jmp 0xbf9b
jmp 0xbf9d
jmp 0xbf9f
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3430
nopw (%rax,%rax)