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

    // Draw frame
    RenderFrame(frame_bb.Min, frame_bb.Max, window->Color(ImGuiCol_FrameBg), true, style.FrameRounding);

    const bool is_non_linear = fabsf(power - 1.0f) > 0.0001f;

    const float grab_padding = 2.0f;
    const float slider_sz = horizontal ? (frame_bb.GetWidth() - grab_padding * 2.0f) : (frame_bb.GetHeight() - grab_padding * 2.0f);
    float grab_sz;
    if (decimal_precision > 0)
        grab_sz = ImMin(style.GrabMinSize, slider_sz);
    else
        grab_sz = ImMin(ImMax(1.0f * (slider_sz / (v_max-v_min+1.0f)), style.GrabMinSize), slider_sz);  // Integer sliders, if possible have the grab size represent 1 unit
    const float slider_usable_sz = slider_sz - grab_sz;
    const float slider_usable_pos_min = (horizontal ? frame_bb.Min.x : frame_bb.Min.y) + grab_padding + grab_sz*0.5f;
    const float slider_usable_pos_max = (horizontal ? frame_bb.Max.x : frame_bb.Max.y) - grab_padding - grab_sz*0.5f;

    // For logarithmic sliders that cross over sign boundary we want the exponential increase to be symmetric around 0.0f
    float linear_zero_pos = 0.0f;   // 0.0->1.0f
    if (v_min * v_max < 0.0f)
    {
        // Different sign
        const float linear_dist_min_to_0 = powf(fabsf(0.0f - v_min), 1.0f/power);
        const float linear_dist_max_to_0 = powf(fabsf(v_max - 0.0f), 1.0f/power);
        linear_zero_pos = linear_dist_min_to_0 / (linear_dist_min_to_0+linear_dist_max_to_0);
    }
    else
    {
        // Same sign
        linear_zero_pos = v_min < 0.0f ? 1.0f : 0.0f;
    }

    // Process clicking on the slider
    bool value_changed = false;
    if (g.ActiveId == id)
    {
        if (g.IO.MouseDown[0])
        {
            const float mouse_abs_pos = horizontal ? g.IO.MousePos.x : g.IO.MousePos.y;
            float normalized_pos = ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f);
            if (!horizontal)
                normalized_pos = 1.0f - normalized_pos;

            float new_value;
            if (is_non_linear)
            {
                // Account for logarithmic scale on both sides of the zero
                if (normalized_pos < linear_zero_pos)
                {
                    // Negative: rescale to the negative range before powering
                    float a = 1.0f - (normalized_pos / linear_zero_pos);
                    a = powf(a, power);
                    new_value = ImLerp(ImMin(v_max,0.0f), v_min, a);
                }
                else
                {
                    // Positive: rescale to the positive range before powering
                    float a;
                    if (fabsf(linear_zero_pos - 1.0f) > 1.e-6)
                        a = (normalized_pos - linear_zero_pos) / (1.0f - linear_zero_pos);
                    else
                        a = normalized_pos;
                    a = powf(a, power);
                    new_value = ImLerp(ImMax(v_min,0.0f), v_max, a);
                }
            }
            else
            {
                // Linear slider
                new_value = ImLerp(v_min, v_max, normalized_pos);
            }

            // Round past decimal precision
            new_value = RoundScalar(new_value, decimal_precision);
            if (*v != new_value)
            {
                *v = new_value;
                value_changed = true;
            }
        }
        else
        {
            SetActiveID(0);
        }
    }

    // Calculate slider grab positioning
    float grab_t;
    if (is_non_linear)
    {
        float v_clamped = ImClamp(*v, v_min, v_max);
        if (v_clamped < 0.0f)
        {
            const float f = 1.0f - (v_clamped - v_min) / (ImMin(0.0f,v_max) - v_min);
            grab_t = (1.0f - powf(f, 1.0f/power)) * linear_zero_pos;
        }
        else
        {
            const float f = (v_clamped - ImMax(0.0f,v_min)) / (v_max - ImMax(0.0f,v_min));
            grab_t = linear_zero_pos + powf(f, 1.0f/power) * (1.0f - linear_zero_pos);
        }
    }
    else
    {
        // Linear slider
        grab_t = (ImClamp(*v, v_min, v_max) - v_min) / (v_max - v_min);
    }

    // Draw
    if (!horizontal)
        grab_t = 1.0f - grab_t;
    const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t);
    ImRect grab_bb;
    if (horizontal)
        grab_bb = ImRect(ImVec2(grab_pos - grab_sz*0.5f, frame_bb.Min.y + grab_padding), ImVec2(grab_pos + grab_sz*0.5f, frame_bb.Max.y - grab_padding));
    else
        grab_bb = ImRect(ImVec2(frame_bb.Min.x + grab_padding, grab_pos - grab_sz*0.5f), ImVec2(frame_bb.Max.x - grab_padding, grab_pos + grab_sz*0.5f));
    window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, window->Color(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);

    return value_changed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r8d, %r12d
movl %ecx, %r15d
movss %xmm2, -0x2c(%rbp)
movaps %xmm1, -0x70(%rbp)
movaps %xmm0, -0x90(%rbp)
movq %rdx, -0x98(%rbp)
movl %esi, -0x34(%rbp)
movq %rdi, %r14
movq 0x3a9ca(%rip), %rbx     # 0x55490
movq 0x1758(%rbx), %rax
movq %rax, -0xd8(%rbp)
movb $0x1, 0x72(%rax)
leaq 0x8(%rdi), %r13
movsd (%rdi), %xmm0
movaps %xmm0, -0x60(%rbp)
movsd 0x8(%rdi), %xmm0
movaps %xmm0, -0x50(%rbp)
movups 0x14c0(%rbx), %xmm0
leaq -0xf0(%rbp), %rdi
movaps %xmm0, (%rdi)
movss 0x13e8(%rbx), %xmm0
mulss 0xc(%rdi), %xmm0
movss %xmm0, 0xc(%rdi)
callq 0x8cce
movss 0x1410(%rbx), %xmm2
movaps -0x60(%rbp), %xmm0
movaps -0x50(%rbp), %xmm1
movl %eax, %edi
movl $0x1, %esi
callq 0xe7a8
movss 0x22852(%rip), %xmm10   # 0x3d38c
leaq 0xc(%r14), %rax
movl %r12d, %ecx
xorb $0x1, %cl
movl %r12d, %esi
testl %r12d, %r12d
movq %rax, %rdx
cmovneq %r13, %rdx
movzbl %cl, %r12d
movss (%rdx), %xmm2
subss (%r14,%r12,4), %xmm2
addss -0x2c(%rbp), %xmm10
addss 0x2289b(%rip), %xmm2    # 0x3d408
movl %r15d, -0xa4(%rbp)
testl %r15d, %r15d
jle 0x1ab8e
movss 0x1440(%rbx), %xmm5
movaps -0x70(%rbp), %xmm4
movaps -0x90(%rbp), %xmm7
jmp 0x1abc8
movaps -0x70(%rbp), %xmm4
movaps %xmm4, %xmm0
movaps -0x90(%rbp), %xmm7
subss %xmm7, %xmm0
addss 0x227d8(%rip), %xmm0    # 0x3d380
movaps %xmm2, %xmm1
divss %xmm0, %xmm1
movss 0x1440(%rbx), %xmm0
movaps %xmm0, %xmm5
cmpless %xmm1, %xmm5
andps %xmm5, %xmm1
andnps %xmm0, %xmm5
orps %xmm1, %xmm5
andps 0x22700(%rip), %xmm10   # 0x3d2d0
minss %xmm2, %xmm5
leaq 0x4(%r14), %rcx
movl %esi, %r15d
testb %r15b, %r15b
cmovneq %r14, %rcx
movss (%rcx), %xmm3
addss 0x227d6(%rip), %xmm3    # 0x3d3c4
movss 0x227c5(%rip), %xmm8    # 0x3d3bc
mulss %xmm5, %xmm8
cmovneq %r13, %rax
movss (%rax), %xmm6
movaps %xmm7, %xmm1
mulss %xmm4, %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
movaps %xmm5, -0xc0(%rbp)
movss %xmm8, -0x30(%rbp)
jbe 0x1acc2
subss %xmm7, %xmm0
andps 0x226a1(%rip), %xmm0    # 0x3d2d0
movss 0x22749(%rip), %xmm1    # 0x3d380
divss -0x2c(%rbp), %xmm1
movss %xmm1, -0x9c(%rbp)
movss %xmm6, -0x60(%rbp)
movss %xmm3, -0x50(%rbp)
movaps %xmm10, -0xd0(%rbp)
movss %xmm2, -0xa0(%rbp)
callq 0x7640
movaps %xmm0, -0x80(%rbp)
movaps 0x22662(%rip), %xmm0    # 0x3d2d0
andps -0x70(%rbp), %xmm0
movss -0x9c(%rbp), %xmm1
callq 0x7640
movss -0xa0(%rbp), %xmm2
movaps -0xd0(%rbp), %xmm10
movaps -0x80(%rbp), %xmm9
movss -0x30(%rbp), %xmm8
movss -0x50(%rbp), %xmm3
movaps -0x90(%rbp), %xmm7
movaps -0x70(%rbp), %xmm4
movss -0x60(%rbp), %xmm6
movaps -0xc0(%rbp), %xmm5
addss %xmm9, %xmm0
divss %xmm0, %xmm9
jmp 0x1acd7
movaps %xmm7, %xmm1
cmpltss %xmm0, %xmm1
movss 0x226ad(%rip), %xmm9    # 0x3d380
andps %xmm1, %xmm9
addss %xmm8, %xmm3
movl -0x34(%rbp), %eax
cmpl %eax, 0x1790(%rbx)
jne 0x1adb0
cmpb $0x1, 0xf8(%rbx)
jne 0x1ad8b
subss %xmm5, %xmm2
movss 0xf0(%rbx,%r12,4), %xmm0
movss %xmm3, -0x50(%rbp)
subss %xmm3, %xmm0
divss %xmm2, %xmm0
movss 0x22665(%rip), %xmm1    # 0x3d380
movaps %xmm1, %xmm2
minss %xmm0, %xmm2
xorps %xmm3, %xmm3
cmpltss %xmm3, %xmm0
andnps %xmm2, %xmm0
testb %r15b, %r15b
jne 0x1ad3c
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
movaps %xmm2, %xmm0
ucomiss 0x226f8(%rip), %xmm10   # 0x3d43c
movss %xmm6, -0x60(%rbp)
movaps %xmm9, -0x80(%rbp)
movaps %xmm10, -0xd0(%rbp)
jbe 0x1adbf
ucomiss %xmm0, %xmm9
jbe 0x1add0
divss %xmm9, %xmm0
subss %xmm0, %xmm1
movaps %xmm1, %xmm0
movss -0x2c(%rbp), %xmm1
callq 0x7640
xorps %xmm1, %xmm1
movaps -0x70(%rbp), %xmm2
minss %xmm1, %xmm2
movaps -0x90(%rbp), %xmm1
jmp 0x1ae20
movq 0x3a6fe(%rip), %rax     # 0x55490
movl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
movq $0x0, 0x17a0(%rax)
xorl %r13d, %r13d
movq -0x98(%rbp), %rax
jmp 0x1ae92
movaps %xmm4, %xmm1
subss %xmm7, %xmm1
mulss %xmm0, %xmm1
addss %xmm7, %xmm1
jmp 0x1ae2c
movss 0x225b4(%rip), %xmm2    # 0x3d38c
addss %xmm9, %xmm2
andps 0x224ec(%rip), %xmm2    # 0x3d2d0
cvtss2sd %xmm2, %xmm2
ucomisd 0x22860(%rip), %xmm2    # 0x3d650
jbe 0x1ae00
subss %xmm9, %xmm0
subss %xmm9, %xmm1
divss %xmm1, %xmm0
movss -0x2c(%rbp), %xmm1
callq 0x7640
xorps %xmm2, %xmm2
movaps -0x90(%rbp), %xmm1
cmpless %xmm1, %xmm2
andps %xmm1, %xmm2
movaps -0x70(%rbp), %xmm1
subss %xmm2, %xmm1
mulss %xmm0, %xmm1
addss %xmm2, %xmm1
movaps %xmm1, %xmm0
movl -0xa4(%rbp), %edi
callq 0x1a9e1
movq -0x98(%rbp), %rax
movss (%rax), %xmm1
ucomiss %xmm0, %xmm1
jne 0x1ae4c
jnp 0x1ae55
movss %xmm0, (%rax)
movb $0x1, %r13b
jmp 0x1ae63
cmpneqss %xmm1, %xmm0
movd %xmm0, %r13d
andl $0x1, %r13d
movaps -0xc0(%rbp), %xmm5
movss -0x60(%rbp), %xmm6
movaps -0x70(%rbp), %xmm4
movaps -0x90(%rbp), %xmm7
movss -0x50(%rbp), %xmm3
movss -0x30(%rbp), %xmm8
movaps -0x80(%rbp), %xmm9
movaps -0xd0(%rbp), %xmm10
addss 0x22572(%rip), %xmm6    # 0x3d40c
ucomiss 0x2259a(%rip), %xmm10   # 0x3d43c
movss (%rax), %xmm0
movaps %xmm4, %xmm1
minss %xmm0, %xmm1
cmpltss %xmm7, %xmm0
movaps %xmm0, %xmm2
andnps %xmm1, %xmm2
andps %xmm7, %xmm0
orps %xmm2, %xmm0
jbe 0x1af19
movaps %xmm9, -0x80(%rbp)
movss %xmm3, -0x50(%rbp)
movss %xmm6, -0x60(%rbp)
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1af2a
subss %xmm7, %xmm0
minss %xmm4, %xmm1
subss %xmm7, %xmm1
divss %xmm1, %xmm0
movss 0x22491(%rip), %xmm1    # 0x3d380
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
divss -0x2c(%rbp), %xmm1
movaps %xmm2, %xmm0
callq 0x7640
movss 0x22475(%rip), %xmm1    # 0x3d380
subss %xmm0, %xmm1
movaps -0x80(%rbp), %xmm2
mulss %xmm1, %xmm2
jmp 0x1af6b
subss %xmm7, %xmm0
subss %xmm7, %xmm4
divss %xmm4, %xmm0
movaps %xmm0, %xmm2
jmp 0x1af82
movaps %xmm7, %xmm2
cmpless %xmm1, %xmm2
andnps %xmm7, %xmm2
subss %xmm2, %xmm0
subss %xmm2, %xmm4
divss %xmm4, %xmm0
movss 0x22437(%rip), %xmm1    # 0x3d380
divss -0x2c(%rbp), %xmm1
callq 0x7640
movaps -0x80(%rbp), %xmm2
movss 0x22421(%rip), %xmm1    # 0x3d380
subss %xmm2, %xmm1
mulss %xmm0, %xmm1
addss %xmm1, %xmm2
movaps -0xc0(%rbp), %xmm5
movss -0x60(%rbp), %xmm6
movss -0x50(%rbp), %xmm3
movss -0x30(%rbp), %xmm8
movaps 0x22397(%rip), %xmm0    # 0x3d320
xorps %xmm5, %xmm0
subss %xmm8, %xmm6
testb %r15b, %r15b
jne 0x1afa5
movss 0x223e2(%rip), %xmm1    # 0x3d380
subss %xmm2, %xmm1
movaps %xmm1, %xmm2
subss %xmm3, %xmm6
mulss %xmm2, %xmm6
addss %xmm3, %xmm6
movaps 0x22328(%rip), %xmm1    # 0x3d2e0
leaq -0xf8(%rbp), %r15
movups %xmm1, -0x8(%r15)
je 0x1affc
movss 0x223ee(%rip), %xmm3    # 0x3d3bc
mulss %xmm3, %xmm0
addss %xmm6, %xmm0
movss 0x4(%r14), %xmm1
movss 0xc(%r14), %xmm2
addss 0x223da(%rip), %xmm1    # 0x3d3c4
mulss %xmm3, %xmm5
addss %xmm6, %xmm5
addss 0x22412(%rip), %xmm2    # 0x3d40c
jmp 0x1b03b
movss (%r14), %xmm3
addss 0x223bb(%rip), %xmm3    # 0x3d3c4
movss 0x8(%r14), %xmm4
movss 0x223a5(%rip), %xmm2    # 0x3d3bc
mulss %xmm2, %xmm0
movaps %xmm0, %xmm1
addss %xmm6, %xmm1
addss 0x223e2(%rip), %xmm4    # 0x3d40c
mulss %xmm2, %xmm5
movaps %xmm5, %xmm2
addss %xmm6, %xmm2
movaps %xmm3, %xmm0
movaps %xmm4, %xmm5
leaq -0x100(%rbp), %r14
movss %xmm0, (%r14)
movss %xmm1, 0x4(%r14)
movss %xmm5, 0x8(%r14)
movss %xmm2, 0xc(%r14)
movq -0xd8(%rbp), %rax
movq 0x270(%rax), %r12
xorl %eax, %eax
movl -0x34(%rbp), %ecx
cmpl %ecx, 0x1790(%rbx)
sete %al
movq 0x3a414(%rip), %rcx     # 0x55490
shll $0x4, %eax
movups 0x1590(%rax,%rcx), %xmm0
leaq -0xf0(%rbp), %rdi
movaps %xmm0, (%rdi)
movss 0x13e8(%rcx), %xmm0
mulss 0xc(%rdi), %xmm0
movss %xmm0, 0xc(%rdi)
callq 0x8cce
movss 0x1444(%rbx), %xmm0
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %eax, %ecx
movl $0xf, %r8d
callq 0x300c8
movl %r13d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq