// File: /workspace/github_cpp_makefile_star2_O3/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 0x2b6b
leaq 0x10(%rbx), %r15
leaq -0x58(%rbp), %r12
movl (%r14), %eax
cmpl $0x200, %eax            # imm = 0x200
je 0x2a0a
cmpl $0x100, %eax            # imm = 0x100
jne 0x2a2d
movb $0x0, 0xd8(%rbx)
jmp 0x2b5b
cmpb $0xd, 0xec(%rbx)
jne 0x2b5b
movl $0x200, -0x58(%rbp)     # imm = 0x200
movb $0xc, -0x4c(%rbp)
movq %r12, %rdi
callq 0x2340
movl (%r14), %eax
cmpl $0x300, %eax            # imm = 0x300
jne 0x2ac0
movl 0xf0(%rbx), %eax
cmpl $0x52, %eax
je 0x2a48
cmpl $0x1a, %eax
jne 0x2a65
movl $0x0, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x3276
movl 0xf0(%rbx), %eax
cmpl $0x4e, %eax
jg 0x2a76
cmpl $0x4, %eax
je 0x2a80
cmpl $0x7, %eax
je 0x2a89
jmp 0x2aa0
cmpl $0x4f, %eax
je 0x2a89
cmpl $0x50, %eax
jne 0x2aa0
movl $0x1, -0x58(%rbp)
jmp 0x2a90
movl $0x2, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x3276
cmpl $0x2c, 0xf0(%rbx)
jne 0x2ac0
movl $0x3, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x3276
cmpl $0x301, (%r14)          # imm = 0x301
jne 0x2b5b
movl 0xf0(%rbx), %eax
cmpl $0x52, %eax
je 0x2add
cmpl $0x1a, %eax
jne 0x2af7
movl $0x0, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3276
movl 0xf0(%rbx), %eax
leal -0x4f(%rax), %ecx
cmpl $0x2, %ecx
jb 0x2b09
cmpl $0x7, %eax
je 0x2b09
cmpl $0x4, %eax
jne 0x2b23
movl $0x1, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3276
movl 0xf0(%rbx), %eax
cmpl $0x15, %eax
jne 0x2b42
movl $0x4, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3276
movl 0xf0(%rbx), %eax
cmpl $0x2c, %eax
jne 0x2b5b
movl $0x3, -0x58(%rbp)
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3276
movq %r14, %rdi
callq 0x2180
testl %eax, %eax
jne 0x29ed
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq