// File: /workspace/github_cpp_makefile_star2_O1/tkaczenko[P]asteroids-clone/src/App.cpp
// Function: App::inputs()
void App::inputs()
{
    while (SDL_PollEvent(&event)) {
        if (event.type == SDL_QUIT) {
            this->exit();
        } else if (event.type == SDL_WINDOWEVENT) {
            if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
                SDL_Event focus;
                focus.type = SDL_WINDOWEVENT;
                focus.window.event = SDL_WINDOWEVENT_FOCUS_GAINED;
                SDL_WaitEvent(&focus);
            }
        }
        if (event.type == SDL_KEYDOWN) {
            if (event.key.keysym.scancode == SDL_SCANCODE_UP ||
                event.key.keysym.scancode == SDL_SCANCODE_W) {
                game.actionShip(GameEngine::UP, true);
            }
            if (event.key.keysym.scancode == SDL_SCANCODE_LEFT ||
                event.key.keysym.scancode == SDL_SCANCODE_A) {
                game.actionShip(GameEngine::LEFT, true);
            } else if (event.key.keysym.scancode == SDL_SCANCODE_RIGHT ||
                        event.key.keysym.scancode == SDL_SCANCODE_D) {
                game.actionShip(GameEngine::RIGHT, true);
            }
            if (event.key.keysym.scancode == SDL_SCANCODE_SPACE) {
                game.actionShip(GameEngine::FIRE, true);
            }
        }
        if (event.type == SDL_KEYUP) {
            if (event.key.keysym.scancode == SDL_SCANCODE_UP ||
                event.key.keysym.scancode == SDL_SCANCODE_W) {
                game.actionShip(GameEngine::UP, false);
            }
            if (event.key.keysym.scancode == SDL_SCANCODE_LEFT ||
                event.key.keysym.scancode == SDL_SCANCODE_RIGHT ||
                event.key.keysym.scancode == SDL_SCANCODE_A ||
                event.key.keysym.scancode == SDL_SCANCODE_D) {
                game.actionShip(GameEngine::LEFT, false);
            }
            if (event.key.keysym.scancode == SDL_SCANCODE_R) {
                game.actionShip(GameEngine::ALIVE, false);
            }
            if (event.key.keysym.scancode == SDL_SCANCODE_SPACE) {
                game.actionShip(GameEngine::FIRE, false);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0xe0(%rdi), %r14
movq %r14, %rdi
callq 0x2180
testl %eax, %eax
je 0x2b5f
leaq 0x10(%rbx), %r15
leaq -0x58(%rbp), %r12
movl (%r14), %eax
cmpl $0x200, %eax            # imm = 0x200
je 0x2a07
cmpl $0x100, %eax            # imm = 0x100
jne 0x2a23
movb $0x0, 0xd8(%rbx)
jmp 0x2a23
cmpb $0xd, 0xec(%rbx)
jne 0x2a23
movl $0x200, -0x58(%rbp)     # imm = 0x200
movb $0xc, -0x4c(%rbp)
movq %r12, %rdi
callq 0x2340
cmpl $0x300, (%r14)          # imm = 0x300
jne 0x2ab8
movl 0xf0(%rbx), %eax
cmpl $0x52, %eax
je 0x2a40
cmpl $0x1a, %eax
jne 0x2a57
movl $0x0, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x32ca
movl 0xf0(%rbx), %eax
cmpl $0x4e, %eax
jg 0x2a6e
cmpl $0x4, %eax
je 0x2a78
cmpl $0x7, %eax
je 0x2a81
jmp 0x2a98
cmpl $0x4f, %eax
je 0x2a81
cmpl $0x50, %eax
jne 0x2a98
movl $0x1, -0x58(%rbp)
jmp 0x2a88
movl $0x2, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x32ca
cmpl $0x2c, 0xf0(%rbx)
jne 0x2ab8
movl $0x3, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x32ca
cmpl $0x301, (%r14)          # imm = 0x301
jne 0x2b4f
movl 0xf0(%rbx), %eax
cmpl $0x52, %eax
je 0x2ad5
cmpl $0x1a, %eax
jne 0x2ae9
movl $0x0, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x32ca
movl 0xf0(%rbx), %eax
leal -0x4f(%rax), %ecx
cmpl $0x2, %ecx
jb 0x2b01
cmpl $0x7, %eax
je 0x2b01
cmpl $0x4, %eax
jne 0x2b15
movl $0x1, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x32ca
cmpl $0x15, 0xf0(%rbx)
jne 0x2b32
movl $0x4, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x32ca
cmpl $0x2c, 0xf0(%rbx)
jne 0x2b4f
movl $0x3, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x32ca
movq %r14, %rdi
callq 0x2180
testl %eax, %eax
jne 0x29ed
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq