// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %r14
leaq -0x38(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57e0
movq %rbx, %rdi
callq 0x571c
movl %eax, %ebx
leaq -0x38(%rbp), %rdi
callq 0x583c
leaq -0x38(%rbp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x57e0
movq %r13, %rdi
callq 0x5708
movl %eax, %r14d
leaq -0x38(%rbp), %rdi
callq 0x583c
addl $0xfffffefe, %r12d      # imm = 0xFFFFFEFE
cmpl $0x3, %r12d
ja 0x61bd
leaq 0x1101(%rip), %rax      # 0x7174
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl %ebx, %r12d
incl %r12d
jmp 0x6126
movslq %ebx, %rax
movq (%r15), %rcx
leaq (%rax,%rax,2), %rax
movslq %r14d, %rdx
movq (%rcx,%rax,8), %rax
movl -0x4(%rax,%rdx,4), %eax
cmpl $0x7, %eax
ja 0x619a
movl $0xc4, %ecx
btl %eax, %ecx
jae 0x619a
movl %r14d, %r15d
decl %r15d
jmp 0x60ed
movslq %ebx, %rax
movq (%r15), %rcx
leaq (%rax,%rax,2), %rax
movslq %r14d, %rdx
movq (%rcx,%rax,8), %rax
movl 0x4(%rax,%rdx,4), %eax
cmpl $0x7, %eax
ja 0x619a
movl $0xc4, %ecx
btl %eax, %ecx
jae 0x619a
movl %r14d, %r15d
incl %r15d
movq 0x3edc(%rip), %r12      # 0x9fd0
movq (%r12), %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x3250
cmpl $-0x1, %eax
je 0x6115
movq (%r12), %rdi
movl $0x20, %esi
callq 0x3090
movq (%r12), %rdi
movl %ebx, %esi
movl %r15d, %edx
jmp 0x6178
movl %ebx, %r12d
decl %r12d
movslq %r12d, %rax
movq (%r15), %rcx
leaq (%rax,%rax,2), %rax
movslq %r14d, %rdx
movq (%rcx,%rax,8), %rax
movl (%rax,%rdx,4), %eax
cmpl $0x7, %eax
ja 0x619a
movl $0xc4, %ecx
btl %eax, %ecx
jae 0x619a
movq 0x3e80(%rip), %r15      # 0x9fd0
movq (%r15), %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x3250
cmpl $-0x1, %eax
je 0x616f
movq (%r15), %rdi
movl $0x20, %esi
callq 0x3090
movq (%r15), %rdi
movl %r12d, %esi
movl %r14d, %edx
callq 0x3250
movl $0x50, %esi
cmpl $-0x1, %eax
je 0x6196
movq 0x3e42(%rip), %rax      # 0x9fd0
movq (%rax), %rdi
callq 0x3090
movb $0x1, %al
jmp 0x61bf
andl $-0x2, %eax
cmpl $0x4, %eax
jne 0x61bd
movq 0x3e27(%rip), %rax      # 0x9fd0
movq (%rax), %rdi
movl %ebx, %esi
movl %r14d, %edx
callq 0x3250
movl $0x20, %esi
jmp 0x6182
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x61d0
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x583c
movq %rbx, %rdi
callq 0x33f0