// File: 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
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
cmpl $0x0, 0x35d15(%rip)     # 0x83e18
jne 0x4e10a
callq 0x4dc20
callq 0xca90
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x14(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0x7640
cvtsi2ssl -0x14(%rbp), %xmm0
cvtsi2ssl -0x18(%rbp), %xmm1
leaq -0x20(%rbp), %rdi
callq 0x2d280
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, (%rax)
callq 0x78b0
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x17c06(%rip), %xmm1    # 0x65d60
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd 0x35cb5(%rip), %xmm0    # 0x83e20
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4e18c
movsd -0x30(%rbp), %xmm0
subsd 0x35c9f(%rip), %xmm0    # 0x83e20
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x50(%rbp)
jmp 0x4e19b
movss 0xcef0(%rip), %xmm0     # 0x5b084
movss %xmm0, -0x50(%rbp)
jmp 0x4e19b
movss -0x50(%rbp), %xmm0
movq -0x10(%rbp), %rax
movss %xmm0, 0x8(%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x35c6a(%rip)    # 0x83e20
leaq -0x34(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x7740
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
callq 0x76e0
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x4e1fd
cvtsi2ssl -0x34(%rbp), %xmm0
cvtsi2ssl -0x38(%rbp), %xmm1
leaq -0x44(%rbp), %rdi
callq 0x2d280
movq -0x10(%rbp), %rax
movq -0x44(%rbp), %rcx
movq %rcx, 0xe8(%rax)
jmp 0x4e220
leaq -0x4c(%rbp), %rdi
movss 0xce73(%rip), %xmm1     # 0x5b07c
movaps %xmm1, %xmm0
callq 0x2d280
movq -0x10(%rbp), %rax
movq -0x4c(%rbp), %rcx
movq %rcx, 0xe8(%rax)
movb $0x1, %al
testb $0x1, 0x35be3(%rip)     # 0x83e0c
movb %al, -0x51(%rbp)
jne 0x4e23d
movl -0x3c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %cl
movq -0x10(%rbp), %rax
andb $0x1, %cl
movb %cl, 0xf0(%rax)
movb $0x1, %al
testb $0x1, 0x35bb7(%rip)     # 0x83e0d
movb %al, -0x52(%rbp)
jne 0x4e26a
movl -0x3c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %cl
movq -0x10(%rbp), %rax
andb $0x1, %cl
movb %cl, 0xf1(%rax)
movb $0x1, %al
testb $0x1, 0x35b8b(%rip)     # 0x83e0e
movb %al, -0x53(%rbp)
jne 0x4e297
movl -0x3c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x53(%rbp)
movb -0x53(%rbp), %cl
movq -0x10(%rbp), %rax
andb $0x1, %cl
movb %cl, 0xf2(%rax)
movb $0x0, 0x35b60(%rip)     # 0x83e0e
movb $0x0, 0x35b58(%rip)     # 0x83e0d
movb $0x0, 0x35b50(%rip)     # 0x83e0c
movss 0x35b44(%rip), %xmm0    # 0x83e08
movq -0x10(%rbp), %rax
movss %xmm0, 0xf8(%rax)
xorps %xmm0, %xmm0
movss %xmm0, 0x35b2d(%rip)    # 0x83e08
movq -0x10(%rbp), %rax
movb 0xfc(%rax), %cl
movl $0x1, %edi
xorl %eax, %eax
testb $0x1, %cl
cmovnel %eax, %edi
callq 0x7660
callq 0xcb50
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)