// File: /workspace/github_cpp_makefile_star2_O2/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 $0xc8, %rsp
movl %r8d, %r14d
movl %ecx, %r12d
movss %xmm2, -0x2c(%rbp)
movaps %xmm1, -0x70(%rbp)
movaps %xmm0, -0x90(%rbp)
movq %rdx, -0x98(%rbp)
movl %esi, -0x34(%rbp)
movq %rdi, %r15
movq 0x3a2af(%rip), %r13     # 0x50480
movq 0x1758(%r13), %rdi
movb $0x1, 0x72(%rdi)
leaq 0x8(%r15), %rbx
movsd (%r15), %xmm0
movaps %xmm0, -0x60(%rbp)
movsd 0x8(%r15), %xmm0
movaps %xmm0, -0x50(%rbp)
pushq $0x6
popq %rsi
movss 0x20192(%rip), %xmm0    # 0x36390
movq %rdi, -0xd8(%rbp)
callq 0x1eae4
movss 0x1410(%r13), %xmm2
pushq $0x1
popq %rsi
movaps -0x60(%rbp), %xmm0
movaps -0x50(%rbp), %xmm1
movl %eax, %edi
callq 0xc76b
movss 0x2016e(%rip), %xmm10   # 0x3639c
leaq 0xc(%r15), %rax
movl %r14d, %ecx
xorb $0x1, %cl
movl %r14d, %esi
testl %r14d, %r14d
movq %rax, %rdx
cmovneq %rbx, %rdx
movzbl %cl, %r14d
movss (%rdx), %xmm2
subss (%r15,%r14,4), %xmm2
addss -0x2c(%rbp), %xmm10
addss 0x201b7(%rip), %xmm2    # 0x36418
movl %r12d, -0xa4(%rbp)
testl %r12d, %r12d
jle 0x16283
movss 0x1440(%r13), %xmm5
movaps -0x70(%rbp), %xmm3
movaps -0x90(%rbp), %xmm4
jmp 0x162be
movaps -0x70(%rbp), %xmm3
movaps %xmm3, %xmm0
movaps -0x90(%rbp), %xmm4
subss %xmm4, %xmm0
addss 0x200f3(%rip), %xmm0    # 0x36390
movaps %xmm2, %xmm1
divss %xmm0, %xmm1
movss 0x1440(%r13), %xmm0
movaps %xmm0, %xmm5
cmpless %xmm1, %xmm5
andps %xmm5, %xmm1
andnps %xmm0, %xmm5
orps %xmm1, %xmm5
andps 0x2001a(%rip), %xmm10   # 0x362e0
minss %xmm2, %xmm5
leaq 0x4(%r15), %rcx
movl %esi, %r12d
testb %r12b, %r12b
cmovneq %r15, %rcx
movss (%rcx), %xmm7
addss 0x200f4(%rip), %xmm7    # 0x363d8
movss 0x200e3(%rip), %xmm8    # 0x363d0
mulss %xmm5, %xmm8
cmovneq %rbx, %rax
movss (%rax), %xmm6
movaps %xmm4, %xmm1
mulss %xmm3, %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm1, %xmm0
movaps %xmm5, -0xc0(%rbp)
movss %xmm8, -0x30(%rbp)
jbe 0x163b8
subss %xmm4, %xmm0
andps 0x1ffbb(%rip), %xmm0    # 0x362e0
movss 0x20063(%rip), %xmm1    # 0x36390
divss -0x2c(%rbp), %xmm1
movss %xmm1, -0x9c(%rbp)
movss %xmm6, -0x60(%rbp)
movss %xmm7, -0x50(%rbp)
movaps %xmm10, -0xd0(%rbp)
movss %xmm2, -0xa0(%rbp)
callq 0x7610
movaps %xmm0, -0x80(%rbp)
movaps 0x1ff7c(%rip), %xmm0    # 0x362e0
andps -0x70(%rbp), %xmm0
movss -0x9c(%rbp), %xmm1
callq 0x7610
movss -0xa0(%rbp), %xmm2
movaps -0xd0(%rbp), %xmm10
movaps -0x80(%rbp), %xmm9
movss -0x30(%rbp), %xmm8
movss -0x50(%rbp), %xmm7
movaps -0x90(%rbp), %xmm4
movaps -0x70(%rbp), %xmm3
movss -0x60(%rbp), %xmm6
movaps -0xc0(%rbp), %xmm5
addss %xmm9, %xmm0
divss %xmm0, %xmm9
jmp 0x163cd
movaps %xmm4, %xmm1
cmpltss %xmm0, %xmm1
movss 0x1ffc7(%rip), %xmm9    # 0x36390
andps %xmm1, %xmm9
movl -0x34(%rbp), %ebx
movq -0x98(%rbp), %rcx
addss %xmm8, %xmm7
cmpl %ebx, 0x1790(%r13)
jne 0x164b3
cmpb $0x1, 0xf8(%r13)
jne 0x16494
subss %xmm5, %xmm2
movss 0xf0(%r13,%r14,4), %xmm0
subss %xmm7, %xmm0
divss %xmm2, %xmm0
movss 0x1ff7b(%rip), %xmm1    # 0x36390
minss %xmm0, %xmm1
xorps %xmm2, %xmm2
cmpltss %xmm2, %xmm0
andnps %xmm1, %xmm0
testb %r12b, %r12b
jne 0x16438
movss 0x1ff5f(%rip), %xmm1    # 0x36390
subss %xmm0, %xmm1
movaps %xmm1, %xmm0
ucomiss 0x20008(%rip), %xmm10   # 0x36448
movss %xmm6, -0x60(%rbp)
movss %xmm7, -0x50(%rbp)
movaps %xmm9, -0x80(%rbp)
movaps %xmm10, -0xd0(%rbp)
jbe 0x164bb
ucomiss %xmm0, %xmm9
jbe 0x164cc
divss %xmm9, %xmm0
movss 0x1ff24(%rip), %xmm1    # 0x36390
subss %xmm0, %xmm1
movaps %xmm1, %xmm0
movss -0x2c(%rbp), %xmm1
callq 0x7610
xorps %xmm1, %xmm1
movaps -0x70(%rbp), %xmm2
minss %xmm1, %xmm2
movaps -0x90(%rbp), %xmm1
jmp 0x16524
movq 0x39fe5(%rip), %rax     # 0x50480
andl $0x0, 0x1790(%rax)
movw $0x1, 0x1799(%rax)
andq $0x0, 0x17a0(%rax)
xorl %r14d, %r14d
jmp 0x1658b
movaps %xmm3, %xmm1
subss %xmm4, %xmm1
mulss %xmm0, %xmm1
addss %xmm4, %xmm1
jmp 0x16530
movss 0x1fec8(%rip), %xmm1    # 0x3639c
addss %xmm9, %xmm1
andps 0x1fe00(%rip), %xmm1    # 0x362e0
cvtss2sd %xmm1, %xmm1
ucomisd 0x20154(%rip), %xmm1    # 0x36640
jbe 0x16504
subss %xmm9, %xmm0
movss 0x1fe95(%rip), %xmm1    # 0x36390
subss %xmm9, %xmm1
divss %xmm1, %xmm0
movss -0x2c(%rbp), %xmm1
callq 0x7610
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 0x160ec
movq -0x98(%rbp), %rcx
movss (%rcx), %xmm1
ucomiss %xmm0, %xmm1
jne 0x16550
jnp 0x16559
movss %xmm0, (%rcx)
movb $0x1, %r14b
jmp 0x1655c
xorl %r14d, %r14d
movaps -0xc0(%rbp), %xmm5
movss -0x60(%rbp), %xmm6
movaps -0x70(%rbp), %xmm3
movaps -0x90(%rbp), %xmm4
movss -0x50(%rbp), %xmm7
movss -0x30(%rbp), %xmm8
movaps -0x80(%rbp), %xmm9
movaps -0xd0(%rbp), %xmm10
addss 0x1fe89(%rip), %xmm6    # 0x3641c
ucomiss 0x1fead(%rip), %xmm10   # 0x36448
movss (%rcx), %xmm0
movaps %xmm3, %xmm1
minss %xmm0, %xmm1
cmpltss %xmm4, %xmm0
movaps %xmm0, %xmm2
andnps %xmm1, %xmm2
andps %xmm4, %xmm0
orps %xmm2, %xmm0
jbe 0x16612
movaps %xmm9, -0x80(%rbp)
movss %xmm7, -0x50(%rbp)
movss %xmm6, -0x60(%rbp)
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
jbe 0x16623
subss %xmm4, %xmm0
minss %xmm3, %xmm1
subss %xmm4, %xmm1
divss %xmm1, %xmm0
movss 0x1fda8(%rip), %xmm1    # 0x36390
movaps %xmm1, %xmm2
subss %xmm0, %xmm2
divss -0x2c(%rbp), %xmm1
movaps %xmm2, %xmm0
callq 0x7610
movss 0x1fd8c(%rip), %xmm1    # 0x36390
subss %xmm0, %xmm1
movaps -0x80(%rbp), %xmm2
mulss %xmm1, %xmm2
jmp 0x16664
subss %xmm4, %xmm0
subss %xmm4, %xmm3
divss %xmm3, %xmm0
movaps %xmm0, %xmm2
jmp 0x1667b
movaps %xmm4, %xmm2
cmpless %xmm1, %xmm2
andnps %xmm4, %xmm2
subss %xmm2, %xmm0
subss %xmm2, %xmm3
divss %xmm3, %xmm0
movss 0x1fd4e(%rip), %xmm1    # 0x36390
divss -0x2c(%rbp), %xmm1
callq 0x7610
movss 0x1fd3c(%rip), %xmm1    # 0x36390
movaps -0x80(%rbp), %xmm2
subss %xmm2, %xmm1
mulss %xmm0, %xmm1
addss %xmm1, %xmm2
movaps -0xc0(%rbp), %xmm5
movss -0x60(%rbp), %xmm6
movss -0x50(%rbp), %xmm7
movss -0x30(%rbp), %xmm8
movaps 0x1fcae(%rip), %xmm0    # 0x36330
xorps %xmm5, %xmm0
subss %xmm8, %xmm6
testb %r12b, %r12b
jne 0x1669e
movss 0x1fcf9(%rip), %xmm1    # 0x36390
subss %xmm2, %xmm1
movaps %xmm1, %xmm2
subss %xmm7, %xmm6
mulss %xmm2, %xmm6
addss %xmm7, %xmm6
je 0x166e2
movss 0x1fd1c(%rip), %xmm3    # 0x363d0
mulss %xmm3, %xmm0
addss %xmm6, %xmm0
movss 0x4(%r15), %xmm1
movss 0xc(%r15), %xmm2
addss 0x1fd08(%rip), %xmm1    # 0x363d8
mulss %xmm3, %xmm5
addss %xmm6, %xmm5
addss 0x1fd3c(%rip), %xmm2    # 0x3641c
jmp 0x16721
movss (%r15), %xmm3
addss 0x1fce9(%rip), %xmm3    # 0x363d8
movss 0x8(%r15), %xmm4
movss 0x1fcd3(%rip), %xmm2    # 0x363d0
mulss %xmm2, %xmm0
movaps %xmm0, %xmm1
addss %xmm6, %xmm1
addss 0x1fd0c(%rip), %xmm4    # 0x3641c
mulss %xmm2, %xmm5
movaps %xmm5, %xmm2
addss %xmm6, %xmm2
movaps %xmm3, %xmm0
movaps %xmm4, %xmm5
leaq -0xe0(%rbp), %r15
movss %xmm0, -0x8(%r15)
movss %xmm1, -0x4(%r15)
movss %xmm5, (%r15)
movss %xmm2, 0x4(%r15)
movq -0xd8(%rbp), %rdi
movq 0x270(%rdi), %r12
xorl %esi, %esi
cmpl %ebx, 0x1790(%r13)
sete %sil
addl $0x13, %esi
movss 0x1fc2b(%rip), %xmm0    # 0x36390
callq 0x1eae4
movss 0x1444(%r13), %xmm0
leaq -0xe8(%rbp), %rsi
pushq $0xf
popq %r8
movq %r12, %rdi
movq %r15, %rdx
movl %eax, %ecx
callq 0x29a42
movl %r14d, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq