// File: /workspace/github_cpp_makefile_star2_O2/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 $0x58, %rsp
movss %xmm3, -0x2c(%rbp)
movl %ecx, %r14d
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r12
movq 0x390a9(%rip), %r13     # 0x50480
movq 0x1758(%r13), %rdi
movb $0x1, 0x72(%rdi)
cmpl %esi, 0x1790(%r13)
movaps %xmm1, -0x60(%rbp)
movaps %xmm2, -0x50(%rbp)
movss %xmm0, -0x40(%rbp)
jne 0x173fd
pushq $0x8
popq %rsi
jmp 0x1740d
xorl %esi, %esi
cmpl %r15d, 0x1788(%r13)
sete %sil
orl $0x6, %esi
movss 0x1ef7b(%rip), %xmm0    # 0x36390
callq 0x1eae4
movsd (%r12), %xmm0
movsd 0x8(%r12), %xmm1
movss 0x1410(%r13), %xmm2
pushq $0x1
popq %rsi
movl %eax, %edi
callq 0xc76b
cmpl %r15d, 0x1790(%r13)
jne 0x174f6
cmpb $0x1, 0xf8(%r13)
jne 0x174d7
cmpb $0x1, 0x1799(%r13)
jne 0x17474
movss (%rbx), %xmm0
movss %xmm0, 0x27c0(%r13)
andq $0x0, 0x27c4(%r13)
xorl %r15d, %r15d
movss 0x1ef11(%rip), %xmm0    # 0x36390
xorl %edi, %edi
callq 0xd02f
movss 0x27c4(%r13), %xmm1
ucomiss %xmm1, %xmm0
je 0x174f9
movaps %xmm0, %xmm5
xorps %xmm2, %xmm2
movss -0x40(%rbp), %xmm6
ucomiss %xmm2, %xmm6
jne 0x1750b
jp 0x1750b
movaps -0x50(%rbp), %xmm4
movaps %xmm4, %xmm0
movaps -0x60(%rbp), %xmm3
subss %xmm3, %xmm0
ucomiss %xmm2, %xmm0
jne 0x174bc
jnp 0x17513
movss 0x1ef10(%rip), %xmm2    # 0x363d4
ucomiss %xmm0, %xmm2
jbe 0x17513
mulss 0x27cc(%r13), %xmm0
movaps %xmm0, %xmm6
jmp 0x17513
movq 0x38fa2(%rip), %rax     # 0x50480
andl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
andq $0x0, 0x17a0(%rax)
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movaps -0x60(%rbp), %xmm3
movaps -0x50(%rbp), %xmm4
cmpb $0x1, 0x106(%r13)
jne 0x17532
movss 0x27d4(%r13), %xmm0
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jb 0x17532
mulss %xmm0, %xmm6
cmpb $0x1, 0x107(%r13)
jne 0x17551
movss 0x27d0(%r13), %xmm0
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jb 0x17551
mulss %xmm0, %xmm6
movss 0x27c0(%r13), %xmm0
movaps %xmm5, %xmm2
subss %xmm1, %xmm2
movss 0x1ee33(%rip), %xmm1    # 0x3639c
addss -0x2c(%rbp), %xmm1
andps 0x1ed6b(%rip), %xmm1    # 0x362e0
mulss %xmm6, %xmm2
ucomiss 0x1ee74(%rip), %xmm1    # 0x363f4
jbe 0x1762e
movaps %xmm2, -0x40(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm0, %xmm1
xorps 0x1ed98(%rip), %xmm1    # 0x36330
xorl %eax, %eax
ucomiss %xmm1, %xmm0
setae %cl
jae 0x175a5
movaps %xmm1, %xmm0
movb %cl, %al
leaq 0x1f09a(%rip), %rcx     # 0x36648
movss (%rcx,%rax,4), %xmm1
movss %xmm1, -0x30(%rbp)
movss 0x1edd0(%rip), %xmm1    # 0x36390
divss -0x2c(%rbp), %xmm1
callq 0x7610
movaps -0x40(%rbp), %xmm2
mulss -0x30(%rbp), %xmm2
addss %xmm0, %xmm2
movaps %xmm2, -0x40(%rbp)
movaps %xmm2, %xmm3
movaps 0x1ed4b(%rip), %xmm0    # 0x36330
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 0x7610
movaps -0x40(%rbp), %xmm1
ucomiss -0x80(%rbp), %xmm1
mulss -0x30(%rbp), %xmm0
jae 0x17620
xorps 0x1ed10(%rip), %xmm0    # 0x36330
movaps -0x60(%rbp), %xmm3
movaps -0x50(%rbp), %xmm4
movaps -0x70(%rbp), %xmm5
jmp 0x17632
addss %xmm2, %xmm0
movss %xmm5, 0x27c4(%r13)
ucomiss %xmm3, %xmm4
jbe 0x17655
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 0x160ec
movss (%rbx), %xmm1
ucomiss %xmm0, %xmm1
jne 0x17675
jnp 0x174f6
movss %xmm0, (%rbx)
movb $0x1, %r15b
jmp 0x174f9