// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/imgui_impl_sdl.cpp
// Function: ImGui_ImplSdl_NewFrame(SDL_Window*)
void ImGui_ImplSdl_NewFrame(SDL_Window *window)
{
    if (!g_FontTexture)
        ImGui_ImplSdl_CreateDeviceObjects();

    ImGuiIO& io = ImGui::GetIO();

    // Setup display size (every frame to accommodate for window resizing)
    int w, h;
    SDL_GetWindowSize(window, &w, &h);
    io.DisplaySize = ImVec2((float)w, (float)h);

    // Setup time step
    Uint32	time = SDL_GetTicks();
    double current_time = time / 1000.0;
    io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f/60.0f);
    g_Time = current_time;

    // Setup inputs
    // (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents())
    int mx, my;
    Uint32 mouseMask = SDL_GetMouseState(&mx, &my);
    if (SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_FOCUS)
    	io.MousePos = ImVec2((float)mx, (float)my);   // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.)
    else
    	io.MousePos = ImVec2(-1,-1);
   
    io.MouseDown[0] = g_MousePressed[0] || (mouseMask & SDL_BUTTON(SDL_BUTTON_LEFT)) != 0;		// If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
    io.MouseDown[1] = g_MousePressed[1] || (mouseMask & SDL_BUTTON(SDL_BUTTON_RIGHT)) != 0;
    io.MouseDown[2] = g_MousePressed[2] || (mouseMask & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
    g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;

    io.MouseWheel = g_MouseWheel;
    g_MouseWheel = 0.0f;

    // Hide OS mouse cursor if ImGui is drawing it
    SDL_ShowCursor(io.MouseDrawCursor ? 0 : 1);

    // Start the frame
    ImGui::NewFrame();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
cmpl $0x0, 0x29c42(%rip)     # 0x5add8
jne 0x3119d
callq 0x30db7
callq 0xa0f5
movq %rax, %rbx
leaq -0x30(%rbp), %r15
leaq -0x2c(%rbp), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x75d0
cvtsi2ssl (%r15), %xmm0
cvtsi2ssl (%r12), %xmm1
movss %xmm0, (%rbx)
movss %xmm1, 0x4(%rbx)
callq 0x7830
movl %eax, %eax
cvtsi2sd %rax, %xmm0
divsd 0xffed(%rip), %xmm0     # 0x411d0
movsd 0x29bf5(%rip), %xmm1    # 0x5ade0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
ja 0x311ff
movss 0x76f7(%rip), %xmm1     # 0x388f4
jmp 0x3120b
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm1
movss %xmm1, 0x8(%rbx)
movsd %xmm0, 0x29bc8(%rip)    # 0x5ade0
leaq -0x28(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x76d0
movl %eax, %r15d
movq %r14, %rdi
callq 0x7680
btl $0xa, %eax
jae 0x31242
cvtsi2ssl -0x28(%rbp), %xmm0
cvtsi2ssl -0x24(%rbp), %xmm1
jmp 0x3124d
movss 0x5152(%rip), %xmm0     # 0x3639c
movaps %xmm0, %xmm1
movss %xmm0, 0xe8(%rbx)
movss %xmm1, 0xec(%rbx)
movb 0x29b69(%rip), %al      # 0x5adcc
orb %r15b, %al
andb $0x1, %al
movb %al, 0xf0(%rbx)
movl %r15d, %eax
shrb $0x2, %al
orb 0x29b53(%rip), %al      # 0x5adcd
andb $0x1, %al
movb %al, 0xf1(%rbx)
shrb %r15b
orb 0x29b42(%rip), %r15b    # 0x5adce
andb $0x1, %r15b
movb %r15b, 0xf2(%rbx)
xorl %eax, %eax
movb %al, 0x29b2f(%rip)      # 0x5adce
movb %al, 0x29b28(%rip)      # 0x5adcd
movb %al, 0x29b21(%rip)      # 0x5adcc
movss 0x29b15(%rip), %xmm0    # 0x5adc8
movss %xmm0, 0xf8(%rbx)
andl $0x0, 0x29b06(%rip)     # 0x5adc8
movzbl 0xfc(%rbx), %edi
xorl $0x1, %edi
callq 0x75f0
callq 0xa161
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop