// File: /workspace/github_cpp_makefile_star2_O3/donfreiday[P]gb/./imgui/imgui.cpp
// Function: ImGui::DragBehavior(ImRect const&, unsigned int, float*, float, float, float, int, float)
bool ImGui::DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_speed, float v_min, float v_max, int decimal_precision, float power)
{
    ImGuiState& g = *GImGui;
    ImGuiWindow* window = GetCurrentWindow();
    const ImGuiStyle& style = g.Style;

    // Draw frame
    const ImU32 frame_col = window->Color(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
    RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, style.FrameRounding);

    bool value_changed = false;

    // Process clicking on the drag
    if (g.ActiveId == id)
    {
        if (g.IO.MouseDown[0])
        {
            if (g.ActiveIdIsJustActivated)
            {
                // Lock current value on click
                g.DragCurrentValue = *v;
                g.DragLastMouseDelta = ImVec2(0.f, 0.f);
            }

            const ImVec2 mouse_drag_delta = ImGui::GetMouseDragDelta(0, 1.0f);
            if (fabsf(mouse_drag_delta.x - g.DragLastMouseDelta.x) > 0.0f)
            {
                float speed = v_speed;
                if (speed == 0.0f && (v_max - v_min) != 0.0f && (v_max - v_min) < FLT_MAX)
                    speed = (v_max - v_min) * g.DragSpeedDefaultRatio;
                if (g.IO.KeyShift && g.DragSpeedScaleFast >= 0.0f)
                    speed = speed * g.DragSpeedScaleFast;
                if (g.IO.KeyAlt && g.DragSpeedScaleSlow >= 0.0f)
                    speed = speed * g.DragSpeedScaleSlow;

                float v_cur = g.DragCurrentValue;
                float delta = (mouse_drag_delta.x - g.DragLastMouseDelta.x) * speed;
                if (fabsf(power - 1.0f) > 0.001f)
                {
                    // Logarithmic curve on both side of 0.0
                    float v0_abs = v_cur >= 0.0f ? v_cur : -v_cur;
                    float v0_sign = v_cur >= 0.0f ? 1.0f : -1.0f;
                    float v1 = powf(v0_abs, 1.0f / power) + (delta * v0_sign);
                    float v1_abs = v1 >= 0.0f ? v1 : -v1;
                    float v1_sign = v1 >= 0.0f ? 1.0f : -1.0f;          // Crossed sign line
                    v_cur = powf(v1_abs, power) * v0_sign * v1_sign;    // Reapply sign
                }
                else
                {
                    v_cur += delta;
                }
                g.DragLastMouseDelta.x = mouse_drag_delta.x;

                // Clamp
                if (v_min < v_max)
                    v_cur = ImClamp(v_cur, v_min, v_max);
                g.DragCurrentValue = v_cur;

                // Round to user desired precision, then apply
                v_cur = RoundScalar(v_cur, decimal_precision);
                if (*v != v_cur)
                {
                    *v = v_cur;
                    value_changed = true;
                }
            }
        }
        else
        {
            SetActiveID(0);
        }
    }

    return value_changed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movss %xmm3, -0x2c(%rbp)
movl %ecx, %r14d
movaps %xmm2, -0x50(%rbp)
movaps %xmm1, -0x60(%rbp)
movss %xmm0, -0x40(%rbp)
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r12
movq 0x396db(%rip), %r13     # 0x55480
movq 0x1758(%r13), %rax
movb $0x1, 0x72(%rax)
movl $0x8, %eax
cmpl %esi, 0x1790(%r13)
je 0x1bdce
xorl %eax, %eax
cmpl %r15d, 0x1788(%r13)
sete %al
orq $0x6, %rax
shll $0x4, %eax
movups 0x1460(%r13,%rax), %xmm0
leaq -0x90(%rbp), %rdi
movaps %xmm0, (%rdi)
movss 0x13e8(%r13), %xmm0
mulss 0xc(%rdi), %xmm0
movss %xmm0, 0xc(%rdi)
callq 0x8c82
movsd (%r12), %xmm0
movsd 0x8(%r12), %xmm1
movss 0x1410(%r13), %xmm2
movl %eax, %edi
movl $0x1, %esi
callq 0xe58d
cmpl %r15d, 0x1790(%r13)
jne 0x1c032
cmpb $0x1, 0xf8(%r13)
jne 0x1c00d
cmpb $0x1, 0x1799(%r13)
jne 0x1be5b
movss (%rbx), %xmm0
movss %xmm0, 0x27c0(%r13)
movq $0x0, 0x27c4(%r13)
movq 0x3961e(%rip), %rax     # 0x55480
xorps %xmm5, %xmm5
cmpb $0x1, 0xf8(%rax)
movaps -0x60(%rbp), %xmm3
movaps -0x50(%rbp), %xmm4
movss -0x40(%rbp), %xmm6
jne 0x1beaf
movss 0x3d0(%rax), %xmm0
ucomiss 0x21506(%rip), %xmm0    # 0x3d390
jb 0x1beaf
movss 0xf0(%rax), %xmm5
subss 0x35c(%rax), %xmm5
movss 0xf4(%rax), %xmm0
subss 0x360(%rax), %xmm0
unpcklps %xmm0, %xmm5            # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1]
movss 0x27c4(%r13), %xmm1
ucomiss %xmm1, %xmm5
je 0x1c032
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm6
jne 0x1bef2
jp 0x1bef2
movaps %xmm4, %xmm0
subss %xmm3, %xmm0
ucomiss %xmm2, %xmm0
jne 0x1bed9
jnp 0x1bef2
movss 0x214ef(%rip), %xmm2    # 0x3d3d0
ucomiss %xmm0, %xmm2
jbe 0x1bef2
mulss 0x27cc(%r13), %xmm0
movaps %xmm0, %xmm6
cmpb $0x1, 0x106(%r13)
jne 0x1bf11
movss 0x27d4(%r13), %xmm0
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jb 0x1bf11
mulss %xmm0, %xmm6
cmpb $0x1, 0x107(%r13)
jne 0x1bf30
movss 0x27d0(%r13), %xmm0
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jb 0x1bf30
mulss %xmm0, %xmm6
movss 0x27c0(%r13), %xmm0
movaps %xmm5, %xmm2
subss %xmm1, %xmm2
movss 0x21454(%rip), %xmm1    # 0x3d39c
addss -0x2c(%rbp), %xmm1
andps 0x2138c(%rip), %xmm1    # 0x3d2e0
mulss %xmm6, %xmm2
ucomiss 0x21495(%rip), %xmm1    # 0x3d3f4
jbe 0x1c043
movaps %xmm2, -0x40(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm0, %xmm1
xorps 0x213b9(%rip), %xmm1    # 0x3d330
xorl %eax, %eax
ucomiss %xmm1, %xmm0
setae %cl
jae 0x1bf84
movaps %xmm1, %xmm0
movb %cl, %al
leaq 0x21703(%rip), %rcx     # 0x3d690
movss (%rcx,%rax,4), %xmm1
movss %xmm1, -0x30(%rbp)
movss 0x213f1(%rip), %xmm1    # 0x3d390
divss -0x2c(%rbp), %xmm1
callq 0x7630
movaps -0x40(%rbp), %xmm2
mulss -0x30(%rbp), %xmm2
addss %xmm0, %xmm2
movaps %xmm2, -0x40(%rbp)
movaps %xmm2, %xmm3
movaps 0x2136c(%rip), %xmm0    # 0x3d330
xorps %xmm0, %xmm3
movaps %xmm3, -0x80(%rbp)
movaps %xmm3, %xmm0
cmpless %xmm2, %xmm0
movaps %xmm0, %xmm1
andps %xmm2, %xmm1
andnps %xmm3, %xmm0
orps %xmm1, %xmm0
movss -0x2c(%rbp), %xmm1
callq 0x7630
movaps -0x40(%rbp), %xmm1
ucomiss -0x80(%rbp), %xmm1
mulss -0x30(%rbp), %xmm0
jae 0x1bfff
xorps 0x21331(%rip), %xmm0    # 0x3d330
movaps -0x60(%rbp), %xmm3
movaps -0x50(%rbp), %xmm4
movaps -0x70(%rbp), %xmm5
jmp 0x1c047
movq 0x3946c(%rip), %rax     # 0x55480
movl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
movq $0x0, 0x17a0(%rax)
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addss %xmm2, %xmm0
movss %xmm5, 0x27c4(%r13)
ucomiss %xmm3, %xmm4
jbe 0x1c06a
minss %xmm0, %xmm4
cmpltss %xmm3, %xmm0
movaps %xmm0, %xmm1
andnps %xmm4, %xmm1
andps %xmm3, %xmm0
orps %xmm1, %xmm0
movss %xmm0, 0x27c0(%r13)
movl %r14d, %edi
callq 0x1a622
movss (%rbx), %xmm1
ucomiss %xmm0, %xmm1
jne 0x1c086
jnp 0x1c032
movss %xmm0, (%rbx)
movb $0x1, %al
jmp 0x1c034