// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
leaq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x582a
movq 0x5bf1(%rip), %r15      # 0x9fd0
leaq 0x2c5a(%rip), %r12      # 0x7040
movq (%r15), %rdi
callq 0x30f0
leal -0x102(%rax), %ecx
cmpl $0x3, %ecx
ja 0x441b
movslq (%r12,%rcx,4), %rax
addq %r12, %rax
jmpq *%rax
movq %r14, %rdi
movq %rbx, %rsi
movl $0x102, %edx            # imm = 0x102
callq 0x600a
testb %al, %al
je 0x43e6
jmp 0x4501
cmpl $0x1b, %eax
je 0x44b7
cmpl $0x20, %eax
jne 0x43e6
jmp 0x4590
movq %r14, %rdi
movq %rbx, %rsi
movl $0x104, %edx            # imm = 0x104
callq 0x600a
testb %al, %al
je 0x43e6
jmp 0x4540
movq %r14, %rdi
movq %rbx, %rsi
movl $0x105, %edx            # imm = 0x105
callq 0x600a
testb %al, %al
je 0x43e6
jmp 0x44c3
movq %r14, %rdi
movq %rbx, %rsi
movl $0x103, %edx            # imm = 0x103
callq 0x600a
testb %al, %al
je 0x43e6
leaq -0x30(%rbp), %rdi
callq 0x5766
movl %eax, %r14d
leaq -0x30(%rbp), %rdi
callq 0x5752
decl %r14d
movq %rbx, %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x4638
leaq -0x30(%rbp), %rdi
callq 0x5766
movl %eax, %r14d
movq (%rbx), %rbx
leaq -0x30(%rbp), %rdi
callq 0x5752
jmp 0x457c
movb $0x0, 0x19c(%rbx)
jmp 0x4590
leaq -0x30(%rbp), %rdi
callq 0x5766
movl %eax, %r14d
leaq -0x30(%rbp), %rdi
callq 0x5752
incl %eax
movq %rbx, %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x4638
leaq -0x30(%rbp), %rdi
callq 0x5766
movl %eax, %r14d
movq (%rbx), %rbx
leaq -0x30(%rbp), %rdi
callq 0x5752
jmp 0x457c
leaq -0x30(%rbp), %rdi
callq 0x5766
movl %eax, %r14d
leaq -0x30(%rbp), %rdi
callq 0x5752
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x4638
leaq -0x30(%rbp), %rdi
callq 0x5766
movl %eax, %r14d
movq (%rbx), %rbx
leaq -0x30(%rbp), %rdi
callq 0x5752
jmp 0x457c
leaq -0x30(%rbp), %rdi
callq 0x5766
movl %eax, %r14d
leaq -0x30(%rbp), %rdi
callq 0x5752
decl %eax
movq %rbx, %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x4638
leaq -0x30(%rbp), %rdi
callq 0x5766
movl %eax, %r14d
movq (%rbx), %rbx
leaq -0x30(%rbp), %rdi
callq 0x5752
movslq %r14d, %rcx
leaq (%rcx,%rcx,2), %rcx
cltq
movq (%rbx,%rcx,8), %rcx
movl $0x2, (%rcx,%rax,4)
leaq -0x30(%rbp), %rdi
callq 0x587c
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x45a8
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x587c
movq %rbx, %rdi
callq 0x33e0