// File: Teris45[P]Maze-Game/Engine.cpp
// Function: Engine::moveCheck(int, int)
void Engine::moveCheck(int py,int px){

    if(maze[py][px] == GEM){
        this->cntEatenGems++;
        this->poterakos.setPoint(px,py);
        this->maze[py][px] = POTERAKOS;
        if(cntEatenGems == NUMGEMS){
            this->setAvailablePoints();
            this->Pergamini.setPoint(available_points);
            maze[Pergamini.getY()][Pergamini.getX()] = PERGAMINI;
            mvaddch(Pergamini.getY(),Pergamini.getX(),'#');
        }
    }
    else if(maze[py][px] == PERGAMINI){
        this->winner = true;
        this->poterakos.setPoint(px,py);
        this->maze[py][px] = POTERAKOS;

    }
    else if(maze[py][px] == GOBLINAKOS || maze[py][px] == TRAALINAKOS){
        this->poterAlive = false;
    }
    else if(maze[py][px] == DIADROMOS){
        this->poterakos.setPoint(px,py);
        this->maze[py][px] = POTERAKOS;

    }


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movslq -0xc(%rbp), %rsi
callq 0x58b0
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x58d0
cmpl $0x6, (%rax)
jne 0x54ee
movq -0x18(%rbp), %rdi
movl 0x198(%rdi), %eax
addl $0x1, %eax
movl %eax, 0x198(%rdi)
addq $0x38, %rdi
movl -0x10(%rbp), %esi
movl -0xc(%rbp), %edx
callq 0xa5d0
movq -0x18(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0x58b0
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x58d0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movl $0x3, (%rcx)
cmpl $0xa, 0x198(%rax)
jne 0x54e9
movq -0x18(%rbp), %rdi
callq 0x5610
movq -0x18(%rbp), %rsi
movq %rsi, %rdi
addq $0x120, %rdi            # imm = 0x120
addq $0x18, %rsi
callq 0xc3b0
movq -0x18(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
callq 0xc480
movq -0x18(%rbp), %rdi
movslq %eax, %rsi
callq 0x58b0
movq -0x18(%rbp), %rdi
movq %rax, -0x30(%rbp)
addq $0x120, %rdi            # imm = 0x120
callq 0xc4a0
movq -0x30(%rbp), %rdi
movslq %eax, %rsi
callq 0x58d0
movq -0x18(%rbp), %rdi
movl $0x7, (%rax)
movq 0xeb36(%rip), %rax      # 0x13fd0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
addq $0x120, %rdi            # imm = 0x120
callq 0xc480
movq -0x18(%rbp), %rdi
movl %eax, -0x1c(%rbp)
addq $0x120, %rdi            # imm = 0x120
callq 0xc4a0
movq -0x28(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl %eax, %edx
callq 0x3260
cmpl $-0x1, %eax
jne 0x54d5
jmp 0x54e9
movq 0xeaf4(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
movl $0x23, %esi
callq 0x30a0
jmp 0x55e9
movq -0x18(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0x58b0
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x58d0
cmpl $0x7, (%rax)
jne 0x554a
movq -0x18(%rbp), %rdi
movb $0x1, 0x19d(%rdi)
addq $0x38, %rdi
movl -0x10(%rbp), %esi
movl -0xc(%rbp), %edx
callq 0xa5d0
movq -0x18(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0x58b0
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x58d0
movl $0x3, (%rax)
jmp 0x55e7
movq -0x18(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0x58b0
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x58d0
cmpl $0x4, (%rax)
je 0x5586
movq -0x18(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0x58b0
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x58d0
cmpl $0x5, (%rax)
jne 0x5593
movq -0x18(%rbp), %rax
movb $0x0, 0x19c(%rax)
jmp 0x55e5
movq -0x18(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0x58b0
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x58d0
cmpl $0x2, (%rax)
jne 0x55e3
movq -0x18(%rbp), %rdi
addq $0x38, %rdi
movl -0x10(%rbp), %esi
movl -0xc(%rbp), %edx
callq 0xa5d0
movq -0x18(%rbp), %rdi
movslq -0xc(%rbp), %rsi
callq 0x58b0
movq %rax, %rdi
movslq -0x10(%rbp), %rsi
callq 0x58d0
movl $0x3, (%rax)
jmp 0x55e5
jmp 0x55e7
jmp 0x55e9
addq $0x30, %rsp
popq %rbp
retq
nop