// File: /workspace/github_c_makefile_star2_O3/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
je 0x4ad3
leaq 0x10(%rsp), %r14
movl 0x10(%rsp), %eax
cmpl $0x3ff, %eax            # imm = 0x3FF
jle 0x4a96
addl $0xfffffc00, %eax       # imm = 0xFFFFFC00
cmpl $0x3, %eax
jae 0x4ac7
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 0x48a9
jmp 0x4ac7
cmpl $0x300, %eax            # imm = 0x300
je 0x4ab2
cmpl $0x301, %eax            # imm = 0x301
jne 0x4ac0
movq 0x40(%rbx), %rax
movl 0x20(%rsp), %ecx
movb $0x0, (%rax,%rcx)
jmp 0x4ac7
movq 0x40(%rbx), %rax
movl 0x20(%rsp), %ecx
movb $0x1, (%rax,%rcx)
jmp 0x4ac7
cmpl $0x100, %eax            # imm = 0x100
je 0x4ae6
movq %r14, %rdi
callq 0x2120
testl %eax, %eax
jne 0x4a63
movq 0x40(%rbx), %rax
cmpb $0x0, 0x229(%rax)
jne 0x4aed
cmpb $0x1, 0x29(%rax)
jne 0x4aed
movb $0x0, (%rbx)
xorl %eax, %eax
jmp 0x4b67
callq 0x2300
movq %rax, %r14
subq 0x58(%rbx), %rax
movq %rax, %xmm0
punpckldq 0x153a(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1542(%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 0x150f(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x1517(%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
addq $0x48, %rsp
popq %rbx
popq %r14
retq