// File: /workspace/github_cpp_makefile_star2_O1/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 0x392e3(%rip), %r13     # 0x55490
movq 0x1758(%r13), %rax
movb $0x1, 0x72(%rax)
movl $0x8, %eax
cmpl %esi, 0x1790(%r13)
je 0x1c1d6
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 0x8cce
movsd (%r12), %xmm0
movsd 0x8(%r12), %xmm1
movss 0x1410(%r13), %xmm2
movl %eax, %edi
movl $0x1, %esi
callq 0xe7a8
cmpl %r15d, 0x1790(%r13)
jne 0x1c43a
cmpb $0x1, 0xf8(%r13)
jne 0x1c415
cmpb $0x1, 0x1799(%r13)
jne 0x1c263
movss (%rbx), %xmm0
movss %xmm0, 0x27c0(%r13)
movq $0x0, 0x27c4(%r13)
movq 0x39226(%rip), %rax     # 0x55490
xorps %xmm5, %xmm5
cmpb $0x1, 0xf8(%rax)
movaps -0x60(%rbp), %xmm3
movaps -0x50(%rbp), %xmm4
movss -0x40(%rbp), %xmm6
jne 0x1c2b7
movss 0x3d0(%rax), %xmm0
ucomiss 0x210ee(%rip), %xmm0    # 0x3d380
jb 0x1c2b7
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 0x1c43a
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm6
jne 0x1c2fa
jp 0x1c2fa
movaps %xmm4, %xmm0
subss %xmm3, %xmm0
ucomiss %xmm2, %xmm0
jne 0x1c2e1
jnp 0x1c2fa
movss 0x210d7(%rip), %xmm2    # 0x3d3c0
ucomiss %xmm0, %xmm2
jbe 0x1c2fa
mulss 0x27cc(%r13), %xmm0
movaps %xmm0, %xmm6
cmpb $0x1, 0x106(%r13)
jne 0x1c319
movss 0x27d4(%r13), %xmm0
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jb 0x1c319
mulss %xmm0, %xmm6
cmpb $0x1, 0x107(%r13)
jne 0x1c338
movss 0x27d0(%r13), %xmm0
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jb 0x1c338
mulss %xmm0, %xmm6
movss 0x27c0(%r13), %xmm0
movaps %xmm5, %xmm2
subss %xmm1, %xmm2
movss 0x2103c(%rip), %xmm1    # 0x3d38c
addss -0x2c(%rbp), %xmm1
andps 0x20f74(%rip), %xmm1    # 0x3d2d0
mulss %xmm6, %xmm2
ucomiss 0x21079(%rip), %xmm1    # 0x3d3e0
jbe 0x1c44b
movaps %xmm2, -0x40(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm0, %xmm1
xorps 0x20fa1(%rip), %xmm1    # 0x3d320
xorl %eax, %eax
ucomiss %xmm1, %xmm0
setae %cl
jae 0x1c38c
movaps %xmm1, %xmm0
movb %cl, %al
leaq 0x212c3(%rip), %rcx     # 0x3d658
movss (%rcx,%rax,4), %xmm1
movss %xmm1, -0x30(%rbp)
movss 0x20fd9(%rip), %xmm1    # 0x3d380
divss -0x2c(%rbp), %xmm1
callq 0x7640
movaps -0x40(%rbp), %xmm2
mulss -0x30(%rbp), %xmm2
addss %xmm0, %xmm2
movaps %xmm2, -0x40(%rbp)
movaps %xmm2, %xmm3
movaps 0x20f54(%rip), %xmm0    # 0x3d320
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 0x7640
movaps -0x40(%rbp), %xmm1
ucomiss -0x80(%rbp), %xmm1
mulss -0x30(%rbp), %xmm0
jae 0x1c407
xorps 0x20f19(%rip), %xmm0    # 0x3d320
movaps -0x60(%rbp), %xmm3
movaps -0x50(%rbp), %xmm4
movaps -0x70(%rbp), %xmm5
jmp 0x1c44f
movq 0x39074(%rip), %rax     # 0x55490
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 0x1c472
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 0x1a9e1
movss (%rbx), %xmm1
ucomiss %xmm0, %xmm1
jne 0x1c48e
jnp 0x1c496
movss %xmm0, (%rbx)
movb $0x1, %al
jmp 0x1c43c
cmpneqss %xmm1, %xmm0
movd %xmm0, %eax
andl $0x1, %eax
jmp 0x1c43c