// File: /workspace/github_cpp_makefile_star2_O1/Teris45[P]Maze-Game/Engine.cpp
// Function: Engine::GetInput()
void Engine::GetInput() {
    bool flag = true;
    Point oldPoter = poterakos.getPoint();
    while(flag) {
        int ch = getch();
        switch (ch) {
            bool n;
            case KEY_UP:
                n = MyMoving::checkMove(poterakos,maze,ch);
                if(n){
                    flag = false;
                    this->moveCheck(oldPoter.getY()-1,oldPoter.getX());
                    this->maze[oldPoter.getY()][oldPoter.getX()] = DIADROMOS;
                }
                break;
            case KEY_DOWN:
                n = MyMoving::checkMove(poterakos,maze,ch);
                if(n) {
                    flag = false;
                    this->moveCheck(oldPoter.getY() + 1, oldPoter.getX());
                    this->maze[oldPoter.getY()][oldPoter.getX()] = DIADROMOS;

                }
                break;
            case KEY_RIGHT:
                n = MyMoving::checkMove(poterakos,maze,ch);
                if(n){
                    flag = false;
                    this->moveCheck(oldPoter.getY(), oldPoter.getX()+1);
                    this->maze[oldPoter.getY()][oldPoter.getX()] = DIADROMOS;

                }
                break;
            case KEY_LEFT:
                n = MyMoving::checkMove(poterakos,maze,ch);
                if(n){
                    flag = false;
                    this->moveCheck(oldPoter.getY(), oldPoter.getX()-1);
                    this->maze[oldPoter.getY()][oldPoter.getX()] = DIADROMOS;
                }
                break;
            case 27: //ESCAPE
                this->poterAlive = false;
//                cout<<"MPika edw?\n";
                flag = false;
                break;
            case ' ':
                flag = false;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
leaq -0x38(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x57e0
movb $0x1, %r12b
movq 0x5beb(%rip), %rax      # 0x9fd0
movq (%rax), %rdi
callq 0x30f0
leal -0x102(%rax), %ecx
cmpl $0x3, %ecx
ja 0x445e
leaq 0x2c41(%rip), %rdx      # 0x7040
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq %r14, %rdi
movq %rbx, %rsi
movl $0x102, %edx            # imm = 0x102
callq 0x5ffc
testb %al, %al
je 0x4589
movq %r15, %rdi
callq 0x571c
movl %eax, %r12d
movq %r15, %rdi
callq 0x5708
incl %r12d
movq %rbx, %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x463c
movq %r15, %rdi
callq 0x571c
movl %eax, %r12d
movq (%rbx), %r13
movq %r15, %rdi
callq 0x5708
jmp 0x4571
cmpl $0x1b, %eax
je 0x4471
cmpl $0x20, %eax
je 0x4586
jmp 0x4589
movb $0x0, 0x19c(%rbx)
jmp 0x4586
movq %r14, %rdi
movq %rbx, %rsi
movl $0x104, %edx            # imm = 0x104
callq 0x5ffc
testb %al, %al
je 0x4589
movq %r15, %rdi
callq 0x571c
movl %eax, %r12d
movq %r15, %rdi
callq 0x5708
decl %eax
movq %rbx, %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x463c
movq %r15, %rdi
callq 0x571c
movl %eax, %r12d
movq (%rbx), %r13
movq %r15, %rdi
callq 0x5708
jmp 0x4571
movq %r14, %rdi
movq %rbx, %rsi
movl $0x105, %edx            # imm = 0x105
callq 0x5ffc
testb %al, %al
je 0x4589
movq %r15, %rdi
callq 0x571c
movl %eax, %r12d
movq %r15, %rdi
callq 0x5708
incl %eax
movq %rbx, %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x463c
movq %r15, %rdi
callq 0x571c
movl %eax, %r12d
movq (%rbx), %r13
movq %r15, %rdi
callq 0x5708
jmp 0x4571
movq %r14, %rdi
movq %rbx, %rsi
movl $0x103, %edx            # imm = 0x103
callq 0x5ffc
testb %al, %al
je 0x4589
movq %r15, %rdi
callq 0x571c
movl %eax, %r12d
movq %r15, %rdi
callq 0x5708
decl %r12d
movq %rbx, %rdi
movl %r12d, %esi
movl %eax, %edx
callq 0x463c
movq %r15, %rdi
callq 0x571c
movl %eax, %r12d
movq (%rbx), %r13
movq %r15, %rdi
callq 0x5708
movslq %r12d, %rcx
leaq (%rcx,%rcx,2), %rcx
cltq
movq (%r13,%rcx,8), %rcx
movl $0x2, (%rcx,%rax,4)
xorl %r12d, %r12d
testb $0x1, %r12b
jne 0x43de
leaq -0x38(%rbp), %rdi
callq 0x583c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x583c
movq %rbx, %rdi
callq 0x33f0
nop