// File: /workspace/github_cpp_makefile_star2_O3/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 0x3ad79(%rip), %rbx     # 0x55480
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 0x8c82
movss 0x1410(%rbx), %xmm2
movaps -0x60(%rbp), %xmm0
movaps -0x50(%rbp), %xmm1
movl %eax, %edi
movl $0x1, %esi
callq 0xe58d
movss 0x22c21(%rip), %xmm10   # 0x3d39c
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 0x22c6a(%rip), %xmm2    # 0x3d418
movl %r15d, -0xa4(%rbp)
testl %r15d, %r15d
jle 0x1a7cf
movss 0x1440(%rbx), %xmm5
movaps -0x70(%rbp), %xmm4
movaps -0x90(%rbp), %xmm7
jmp 0x1a809
movaps -0x70(%rbp), %xmm4
movaps %xmm4, %xmm0
movaps -0x90(%rbp), %xmm7
subss %xmm7, %xmm0
addss 0x22ba7(%rip), %xmm0    # 0x3d390
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 0x22acf(%rip), %xmm10   # 0x3d2e0
minss %xmm2, %xmm5
leaq 0x4(%r14), %rcx
movl %esi, %r15d
testb %r15b, %r15b
cmovneq %r14, %rcx
movss (%rcx), %xmm3
addss 0x22ba5(%rip), %xmm3    # 0x3d3d4
movss 0x22b94(%rip), %xmm8    # 0x3d3cc
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 0x1a903
subss %xmm7, %xmm0
andps 0x22a70(%rip), %xmm0    # 0x3d2e0
movss 0x22b18(%rip), %xmm1    # 0x3d390
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 0x7630
movaps %xmm0, -0x80(%rbp)
movaps 0x22a31(%rip), %xmm0    # 0x3d2e0
andps -0x70(%rbp), %xmm0
movss -0x9c(%rbp), %xmm1
callq 0x7630
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 0x1a918
movaps %xmm7, %xmm1
cmpltss %xmm0, %xmm1
movss 0x22a7c(%rip), %xmm9    # 0x3d390
andps %xmm1, %xmm9
addss %xmm8, %xmm3
movl -0x34(%rbp), %eax
cmpl %eax, 0x1790(%rbx)
jne 0x1a9f1
cmpb $0x1, 0xf8(%rbx)
jne 0x1a9cc
subss %xmm5, %xmm2
movss 0xf0(%rbx,%r12,4), %xmm0
movss %xmm3, -0x50(%rbp)
subss %xmm3, %xmm0
divss %xmm2, %xmm0
movss 0x22a34(%rip), %xmm1    # 0x3d390
movaps %xmm1, %xmm2
minss %xmm0, %xmm2
xorps %xmm3, %xmm3
cmpltss %xmm3, %xmm0
andnps %xmm2, %xmm0
testb %r15b, %r15b
jne 0x1a97d
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
movaps %xmm2, %xmm0
ucomiss 0x22ac7(%rip), %xmm10   # 0x3d44c
movss %xmm6, -0x60(%rbp)
movaps %xmm9, -0x80(%rbp)
movaps %xmm10, -0xd0(%rbp)
jbe 0x1aa00
ucomiss %xmm0, %xmm9
jbe 0x1aa11
divss %xmm9, %xmm0
subss %xmm0, %xmm1
movaps %xmm1, %xmm0
movss -0x2c(%rbp), %xmm1
callq 0x7630
xorps %xmm1, %xmm1
movaps -0x70(%rbp), %xmm2
minss %xmm1, %xmm2
movaps -0x90(%rbp), %xmm1
jmp 0x1aa61
movq 0x3aaad(%rip), %rax     # 0x55480
movl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
movq $0x0, 0x17a0(%rax)
xorl %r13d, %r13d
movq -0x98(%rbp), %rax
jmp 0x1aac8
movaps %xmm4, %xmm1
subss %xmm7, %xmm1
mulss %xmm0, %xmm1
addss %xmm7, %xmm1
jmp 0x1aa6d
movss 0x22983(%rip), %xmm2    # 0x3d39c
addss %xmm9, %xmm2
andps 0x228bb(%rip), %xmm2    # 0x3d2e0
cvtss2sd %xmm2, %xmm2
ucomisd 0x22c57(%rip), %xmm2    # 0x3d688
jbe 0x1aa41
subss %xmm9, %xmm0
subss %xmm9, %xmm1
divss %xmm1, %xmm0
movss -0x2c(%rbp), %xmm1
callq 0x7630
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 0x1a622
movq -0x98(%rbp), %rax
movss (%rax), %xmm1
ucomiss %xmm0, %xmm1
jne 0x1aa8d
jnp 0x1aa96
movss %xmm0, (%rax)
movb $0x1, %r13b
jmp 0x1aa99
xorl %r13d, %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 0x2294c(%rip), %xmm6    # 0x3d41c
ucomiss 0x22974(%rip), %xmm10   # 0x3d44c
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 0x1ab4f
movaps %xmm9, -0x80(%rbp)
movss %xmm3, -0x50(%rbp)
movss %xmm6, -0x60(%rbp)
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1ab60
subss %xmm7, %xmm0
minss %xmm4, %xmm1
subss %xmm7, %xmm1
divss %xmm1, %xmm0
movss 0x2286b(%rip), %xmm1    # 0x3d390
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
divss -0x2c(%rbp), %xmm1
movaps %xmm2, %xmm0
callq 0x7630
movss 0x2284f(%rip), %xmm1    # 0x3d390
subss %xmm0, %xmm1
movaps -0x80(%rbp), %xmm2
mulss %xmm1, %xmm2
jmp 0x1aba1
subss %xmm7, %xmm0
subss %xmm7, %xmm4
divss %xmm4, %xmm0
movaps %xmm0, %xmm2
jmp 0x1abb8
movaps %xmm7, %xmm2
cmpless %xmm1, %xmm2
andnps %xmm7, %xmm2
subss %xmm2, %xmm0
subss %xmm2, %xmm4
divss %xmm4, %xmm0
movss 0x22811(%rip), %xmm1    # 0x3d390
divss -0x2c(%rbp), %xmm1
callq 0x7630
movaps -0x80(%rbp), %xmm2
movss 0x227fb(%rip), %xmm1    # 0x3d390
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 0x22771(%rip), %xmm0    # 0x3d330
xorps %xmm5, %xmm0
subss %xmm8, %xmm6
testb %r15b, %r15b
jne 0x1abdb
movss 0x227bc(%rip), %xmm1    # 0x3d390
subss %xmm2, %xmm1
movaps %xmm1, %xmm2
subss %xmm3, %xmm6
mulss %xmm2, %xmm6
addss %xmm3, %xmm6
je 0x1ac1f
movss 0x227db(%rip), %xmm3    # 0x3d3cc
mulss %xmm3, %xmm0
addss %xmm6, %xmm0
movss 0x4(%r14), %xmm1
movss 0xc(%r14), %xmm2
addss 0x227c7(%rip), %xmm1    # 0x3d3d4
mulss %xmm3, %xmm5
addss %xmm6, %xmm5
addss 0x227ff(%rip), %xmm2    # 0x3d41c
jmp 0x1ac5e
movss (%r14), %xmm3
addss 0x227a8(%rip), %xmm3    # 0x3d3d4
movss 0x8(%r14), %xmm4
movss 0x22792(%rip), %xmm2    # 0x3d3cc
mulss %xmm2, %xmm0
movaps %xmm0, %xmm1
addss %xmm6, %xmm1
addss 0x227cf(%rip), %xmm4    # 0x3d41c
mulss %xmm2, %xmm5
movaps %xmm5, %xmm2
addss %xmm6, %xmm2
movaps %xmm3, %xmm0
movaps %xmm4, %xmm5
leaq -0xf8(%rbp), %r14
movss %xmm0, -0x8(%r14)
movss %xmm1, -0x4(%r14)
movss %xmm5, (%r14)
movss %xmm2, 0x4(%r14)
movq -0xd8(%rbp), %rax
movq 0x270(%rax), %r15
xorl %eax, %eax
movl -0x34(%rbp), %ecx
cmpl %ecx, 0x1790(%rbx)
sete %al
movq 0x3a7e1(%rip), %rcx     # 0x55480
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 0x8c82
movss 0x1444(%rbx), %xmm0
leaq -0x100(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
movl %eax, %ecx
movl $0xf, %r8d
callq 0x2f984
movl %r13d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq