// File: /workspace/github_c_makefile_star2_O1/adelciotto[P]scg/examples/../scg.h
// Function: scg_app_process_events
bool scg_app_process_events(scg_app_t *app) {
    // Handle events that need to be polled. This may include
    // text input, mouse events, and game controller events.
    {
        SDL_Event event;
        while (SDL_PollEvent(&event)) {
            switch (event.type) {
            case SDL_QUIT:
                app->running = false;
                return false;
            case SDL_KEYDOWN:
                app->keyboard->current_key_states[event.key.keysym.scancode] =
                    true;
                break;
            case SDL_KEYUP:
                app->keyboard->current_key_states[event.key.keysym.scancode] =
                    false;
                break;
            case SDL_MOUSEBUTTONUP:
            case SDL_MOUSEBUTTONDOWN:
            case SDL_MOUSEMOTION:
                scg__mouse_update(app->mouse, app->draw_target->width,
                                  app->draw_target->height,
                                  app->screen->window_width,
                                  app->screen->window_height);
                break;
            }
        }
    }

    if (scg_keyboard_is_key_triggered(app->keyboard, SCG_KEY_ESCAPE)) {
        app->running = false;
        return false;
    }

    // Calculate the delta time and elapsed time in seconds.
    // This is useful for apps that want some quick consistent animation
    // and don't care about fixed updates.
    {
        uint64_t now = scg_get_performance_counter();
        app->delta_time =
            scg_get_elapsed_time_secs(now, app->delta_time_counter);
        app->delta_time_counter = now;

        app->elapsed_time += app->delta_time;
    }

    return true;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2120
testl %eax, %eax
sete %al
je 0x4a7c
leaq 0x10(%rsp), %r14
movl 0x10(%rsp), %ecx
cmpl $0x3ff, %ecx            # imm = 0x3FF
jle 0x4a35
addl $0xfffffc00, %ecx       # imm = 0xFFFFFC00
cmpl $0x3, %ecx
jae 0x4a6d
movq 0x38(%rbx), %rax
movq 0x48(%rbx), %rdi
movl (%rax), %esi
movl 0x4(%rax), %edx
movq 0x60(%rbx), %rax
movl (%rax), %ecx
movl 0x4(%rax), %r8d
callq 0x4838
jmp 0x4a6d
cmpl $0x300, %ecx            # imm = 0x300
je 0x4a53
cmpl $0x301, %ecx            # imm = 0x301
jne 0x4a61
movq 0x40(%rbx), %rax
movl 0x20(%rsp), %ecx
movb $0x0, (%rax,%rcx)
jmp 0x4a6d
movq 0x40(%rbx), %rax
movl 0x20(%rsp), %ecx
movb $0x1, (%rax,%rcx)
jmp 0x4a6d
cmpl $0x100, %ecx            # imm = 0x100
je 0x4b13
movq %r14, %rdi
callq 0x2120
testl %eax, %eax
sete %al
jne 0x4a00
movq 0x40(%rbx), %rax
cmpb $0x0, 0x229(%rax)
jne 0x4a97
cmpb $0x1, 0x29(%rax)
jne 0x4a97
movb $0x0, (%rbx)
jmp 0x4b1e
callq 0x2300
movq %rax, %r14
subq 0x58(%rbx), %rax
movq %rax, %xmm0
punpckldq 0x1590(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1598(%rip), %xmm0     # 0x6050
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, (%rsp)
callq 0x21f0
movq %rax, %xmm0
punpckldq 0x1565(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x156d(%rip), %xmm0     # 0x6050
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd (%rsp), %xmm0
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4(%rbx)
movq %r14, 0x58(%rbx)
addss 0x8(%rbx), %xmm0
movss %xmm0, 0x8(%rbx)
movb $0x1, %al
jmp 0x4b20
movb $0x0, (%rbx)
testb $0x1, %al
jne 0x4a7c
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq