// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::SliderScalar(char const*, int, void*, void const*, void const*, char const*, int)
bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags)
{
    ImGuiWindow* window = GetCurrentWindow();
    if (window->SkipItems)
        return false;

    ImGuiContext& g = *GImGui;
    const ImGuiStyle& style = g.Style;
    const ImGuiID id = window->GetID(label);
    const float w = CalcItemWidth();

    const ImVec2 label_size = CalcTextSize(label, NULL, true);
    const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));
    const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));

    ItemSize(total_bb, style.FramePadding.y);
    if (!ItemAdd(total_bb, id, &frame_bb))
        return false;

    // Default format string when passing NULL
    if (format == NULL)
        format = DataTypeGetInfo(data_type)->PrintFmt;
    else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.)
        format = PatchFormatStringFloatToInt(format);

    // Tabbing or CTRL-clicking on Slider turns it into an input box
    const bool hovered = ItemHoverable(frame_bb, id);
    const bool temp_input_allowed = (flags & ImGuiSliderFlags_NoInput) == 0;
    bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
    if (!temp_input_is_active)
    {
        const bool focus_requested = temp_input_allowed && FocusableItemRegister(window, id);
        const bool clicked = (hovered && g.IO.MouseClicked[0]);
        if (focus_requested || clicked || g.NavActivateId == id || g.NavInputId == id)
        {
            SetActiveID(id, window);
            SetFocusID(id, window);
            FocusWindow(window);
            g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right);
            if (temp_input_allowed && (focus_requested || (clicked && g.IO.KeyCtrl) || g.NavInputId == id))
            {
                temp_input_is_active = true;
                FocusableItemUnregister(window);
            }
        }
    }

    if (temp_input_is_active)
    {
        // Only clamp CTRL+Click input when ImGuiSliderFlags_AlwaysClamp is set
        const bool is_clamp_input = (flags & ImGuiSliderFlags_AlwaysClamp) != 0;
        return TempInputScalar(frame_bb, id, label, data_type, p_data, format, is_clamp_input ? p_min : NULL, is_clamp_input ? p_max : NULL);
    }

    // Draw frame
    const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
    RenderNavHighlight(frame_bb, id);
    RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, g.Style.FrameRounding);

    // Slider behavior
    ImRect grab_bb;
    const bool value_changed = SliderBehavior(frame_bb, id, data_type, p_data, p_min, p_max, format, flags, &grab_bb);
    if (value_changed)
        MarkItemEdited(id);

    // Render grab
    if (grab_bb.Max.x > grab_bb.Min.x)
        window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);

    // Display value using user-provided display format so user can add prefix/suffix/decorations to the value.
    char value_buf[64];
    const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, p_data, format);
    RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.5f));

    if (label_size.x > 0.0f)
        RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);

    IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags);
    return value_changed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
leaq 0x63ea7(%rip), %r15     # 0xe3ce0
movq (%r15), %r12
movq 0x1ae0(%r12), %r14
movb $0x1, 0x90(%r14)
cmpb $0x0, 0x93(%r14)
jne 0x7ff6d
movq %rdi, %rbx
movq %rcx, -0x60(%rbp)
movq %r8, -0x68(%rbp)
movq %r9, -0x38(%rbp)
movl %esi, -0x2c(%rbp)
movq %rdx, -0x50(%rbp)
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3700a
movl %eax, %r13d
callq 0x43d17
movaps %xmm0, -0x90(%rbp)
pushq $0x1
popq %rdx
movss 0x1c159(%rip), %xmm0    # 0x9bff0
movq %rbx, -0x58(%rbp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x365e8
movaps -0x90(%rbp), %xmm5
movaps %xmm0, %xmm4
movaps %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm2     # xmm2 = xmm2[1,1],xmm0[1,1]
movss 0x159c(%r12), %xmm0
movaps %xmm0, %xmm1
addss %xmm0, %xmm1
addss 0xd8(%r14), %xmm5
addss %xmm2, %xmm1
addss 0xdc(%r14), %xmm1
movaps %xmm5, %xmm2
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
movq 0xd8(%r14), %rax
movq %rax, -0x48(%rbp)
movlps %xmm2, -0x40(%rbp)
xorps %xmm3, %xmm3
ucomiss %xmm3, %xmm4
xorps %xmm2, %xmm2
jbe 0x7ff0b
movss 0x15b0(%r12), %xmm2
addss %xmm4, %xmm2
movaps %xmm4, -0x90(%rbp)
addss %xmm5, %xmm2
addss %xmm3, %xmm1
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
leaq -0xa8(%rbp), %rbx
movq %rax, (%rbx)
movlps %xmm2, 0x8(%rbx)
movq %rbx, %rdi
callq 0x4388d
leaq -0x48(%rbp), %rdx
movq %rbx, %rdi
movl %r13d, %esi
callq 0x40ea5
testb %al, %al
je 0x7ff6d
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x7ff85
cmpl $0x4, -0x2c(%rbp)
jne 0x7ff95
cmpb $0x25, (%rdi)
jne 0x7ff66
cmpb $0x64, 0x1(%rdi)
jne 0x7ff66
cmpb $0x0, 0x2(%rdi)
je 0x7ff95
callq 0x7f1ea
jmp 0x7ff91
xorl %r15d, %r15d
movl %r15d, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x2c(%rbp), %edi
callq 0x7ddfc
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
leaq -0x48(%rbp), %rdi
movl %r13d, %esi
callq 0x37658
movl %eax, %ebx
movl 0x10(%rbp), %eax
testb %al, %al
js 0x7ffd3
movq (%r15), %rax
cmpl %r13d, 0x1b30(%rax)
jne 0x7ffc3
cmpl %r13d, 0x3068(%rax)
je 0x8005b
movq %r14, %rdi
movl %r13d, %esi
callq 0x378bb
movl %eax, %r15d
jmp 0x7ffd6
xorl %r15d, %r15d
testb %bl, %bl
je 0x7ffe4
movb 0x420(%r12), %bl
jmp 0x7ffe6
xorl %ebx, %ebx
movl %r15d, %eax
orb %bl, %al
testb $0x1, %al
jne 0x80007
cmpl %r13d, 0x1ca0(%r12)
je 0x80007
cmpl %r13d, 0x1cac(%r12)
jne 0x8009c
movl %r13d, %edi
movq %r14, %rsi
callq 0x3739b
movl %r13d, %edi
movq %r14, %rsi
callq 0x454cc
movq %r14, %rdi
callq 0x37fa1
orb $0x3, 0x1b44(%r12)
movl 0x10(%rbp), %eax
testb %al, %al
js 0x8009c
testb %r15b, %r15b
jne 0x80053
testb %bl, %bl
je 0x80049
cmpb $0x0, 0x140(%r12)
jne 0x80053
cmpl %r13d, 0x1cac(%r12)
jne 0x8009c
movq %r14, %rdi
callq 0x3797e
xorl %eax, %eax
movl 0x10(%rbp), %ecx
testb $0x10, %cl
movq -0x60(%rbp), %r11
cmoveq %rax, %r11
movq -0x68(%rbp), %r10
cmoveq %rax, %r10
leaq -0x48(%rbp), %rdi
movl %r13d, %esi
movq -0x58(%rbp), %rdx
movl -0x2c(%rbp), %ecx
movq -0x50(%rbp), %r8
movq -0x38(%rbp), %r9
pushq %r10
pushq %r11
callq 0x7f288
popq %rcx
popq %rdx
movl %eax, %r15d
jmp 0x7ff70
cmpl %r13d, 0x1b30(%r12)
jne 0x800ab
pushq $0x9
popq %rdi
jmp 0x800bc
xorl %edi, %edi
cmpl %r13d, 0x1b1c(%r12)
sete %dil
addl $0x7, %edi
movss 0x1bf34(%rip), %xmm0    # 0x9bff8
callq 0x35d33
movl %eax, %ebx
leaq -0x48(%rbp), %r15
pushq $0x1
popq %rdx
movq %r15, %rdi
movl %r13d, %esi
callq 0x36c91
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
movss 0x15a0(%r12), %xmm2
movl %ebx, %edi
pushq $0x1
popq %rsi
callq 0x36a6f
xorps %xmm0, %xmm0
leaq -0x80(%rbp), %rax
movaps %xmm0, (%rax)
subq $0x8, %rsp
movq %r15, %rdi
movl %r13d, %esi
movl -0x2c(%rbp), %edx
movq -0x50(%rbp), %rcx
movq -0x60(%rbp), %r8
movq -0x68(%rbp), %r9
pushq %rax
movl 0x10(%rbp), %eax
pushq %rax
pushq -0x38(%rbp)
callq 0x7fa9b
addq $0x20, %rsp
movl %eax, %r15d
testb %al, %al
je 0x8013f
movl %r13d, %edi
callq 0x3749e
movss -0x78(%rbp), %xmm0
ucomiss -0x80(%rbp), %xmm0
jbe 0x80192
leaq -0x78(%rbp), %rbx
movq 0x2b8(%r14), %r14
xorl %edi, %edi
cmpl %r13d, 0x1b30(%r12)
sete %dil
addl $0x13, %edi
movss 0x1be8a(%rip), %xmm0    # 0x9bff8
callq 0x35d33
movss 0x15dc(%r12), %xmm0
leaq -0x80(%rbp), %rsi
pushq $0xf
popq %r8
movq %r14, %rdi
movq %rbx, %rdx
movl %eax, %ecx
callq 0x64020
leaq -0xf0(%rbp), %rbx
pushq $0x40
popq %rsi
movq %rbx, %rdi
movl -0x2c(%rbp), %edx
movq -0x50(%rbp), %rcx
movq -0x38(%rbp), %r8
callq 0x7de35
cltq
leaq (%rax,%rbp), %rcx
addq $-0xf0, %rcx
movabsq $0x3f0000003f000000, %rax # imm = 0x3F0000003F000000
leaq -0x98(%rbp), %r9
movq %rax, (%r9)
subq $0x10, %rsp
andq $0x0, (%rsp)
leaq -0x48(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0x36673
popq %rax
popq %rcx
xorps %xmm0, %xmm0
movaps -0x90(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x7ff70
movss -0x40(%rbp), %xmm0
addss 0x15b0(%r12), %xmm0
movss -0x44(%rbp), %xmm1
addss 0x159c(%r12), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
pushq $0x1
popq %rdx
movq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x36156
jmp 0x7ff70