// File: /workspace/github_cpp_makefile_star2_O2/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 0x4612
movq 0x6dc9(%rip), %r15      # 0x9fd0
leaq 0x2e32(%rip), %r12      # 0x6040
movq (%r15), %rdi
callq 0x20e0
leal -0x102(%rax), %ecx
cmpl $0x3, %ecx
ja 0x3243
movslq (%r12,%rcx,4), %rax
addq %r12, %rax
jmpq *%rax
movq %r14, %rdi
movq %rbx, %rsi
movl $0x102, %edx            # imm = 0x102
callq 0x4d7e
testb %al, %al
je 0x320e
jmp 0x3329
cmpl $0x1b, %eax
je 0x32df
cmpl $0x20, %eax
jne 0x320e
jmp 0x33b8
movq %r14, %rdi
movq %rbx, %rsi
movl $0x104, %edx            # imm = 0x104
callq 0x4d7e
testb %al, %al
je 0x320e
jmp 0x3368
movq %r14, %rdi
movq %rbx, %rsi
movl $0x105, %edx            # imm = 0x105
callq 0x4d7e
testb %al, %al
je 0x320e
jmp 0x32eb
movq %r14, %rdi
movq %rbx, %rsi
movl $0x103, %edx            # imm = 0x103
callq 0x4d7e
testb %al, %al
je 0x320e
leaq -0x30(%rbp), %rdi
callq 0x4552
movl %eax, %r14d
leaq -0x30(%rbp), %rdi
callq 0x453e
decl %r14d
movq %rbx, %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x3466
leaq -0x30(%rbp), %rdi
callq 0x4552
movl %eax, %r14d
movq (%rbx), %rbx
leaq -0x30(%rbp), %rdi
callq 0x453e
jmp 0x33a4
movb $0x0, 0x19c(%rbx)
jmp 0x33b8
leaq -0x30(%rbp), %rdi
callq 0x4552
movl %eax, %r14d
leaq -0x30(%rbp), %rdi
callq 0x453e
incl %eax
movq %rbx, %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x3466
leaq -0x30(%rbp), %rdi
callq 0x4552
movl %eax, %r14d
movq (%rbx), %rbx
leaq -0x30(%rbp), %rdi
callq 0x453e
jmp 0x33a4
leaq -0x30(%rbp), %rdi
callq 0x4552
movl %eax, %r14d
leaq -0x30(%rbp), %rdi
callq 0x453e
incl %r14d
movq %rbx, %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x3466
leaq -0x30(%rbp), %rdi
callq 0x4552
movl %eax, %r14d
movq (%rbx), %rbx
leaq -0x30(%rbp), %rdi
callq 0x453e
jmp 0x33a4
leaq -0x30(%rbp), %rdi
callq 0x4552
movl %eax, %r14d
leaq -0x30(%rbp), %rdi
callq 0x453e
decl %eax
movq %rbx, %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x3466
leaq -0x30(%rbp), %rdi
callq 0x4552
movl %eax, %r14d
movq (%rbx), %rbx
leaq -0x30(%rbp), %rdi
callq 0x453e
movslq %r14d, %rcx
imulq $0x18, %rcx, %rcx
cltq
movq (%rbx,%rcx), %rcx
movl $0x2, (%rcx,%rax,4)
leaq -0x30(%rbp), %rdi
callq 0x4668
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x33d0
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x4668
movq %rbx, %rdi
callq 0x23b0