// File: 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
subq $0x220, %rsp            # imm = 0x220
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
callq 0xeb270
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
testb $0x1, 0x93(%rax)
je 0x144064
movb $0x0, -0x1(%rbp)
jmp 0x14476e
leaq 0xceed5(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $0x1560, %rax           # imm = 0x1560
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x160(%rbp)
callq 0xc9910
movl %eax, -0x54(%rbp)
callq 0xdcdc0
movq -0x160(%rbp), %rsi
movss %xmm0, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %edx
movss 0x2dec3(%rip), %xmm0    # 0x171f80
callq 0xc87e0
movlpd %xmm0, -0x60(%rbp)
movq -0x40(%rbp), %rax
addq $0xd8, %rax
movq %rax, -0x150(%rbp)
movss -0x58(%rbp), %xmm0
movss -0x5c(%rbp), %xmm2
movq -0x50(%rbp), %rax
movss 0x3c(%rax), %xmm1
addss %xmm1, %xmm1
addss %xmm2, %xmm1
leaq -0x80(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0xbf4c0
movq -0x158(%rbp), %rsi
movq -0x150(%rbp), %rdi
callq 0x139090
movq -0x150(%rbp), %rsi
movlpd %xmm0, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xe8660
leaq -0x70(%rbp), %rax
movq %rax, -0x148(%rbp)
leaq -0x70(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x140(%rbp)
movss -0x60(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x14416e
movq -0x50(%rbp), %rax
movss 0x50(%rax), %xmm0
addss -0x60(%rbp), %xmm0
movss %xmm0, -0x164(%rbp)
jmp 0x14417b
xorps %xmm0, %xmm0
movss %xmm0, -0x164(%rbp)
jmp 0x14417b
movss -0x164(%rbp), %xmm0
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x170(%rbp)
xorps %xmm1, %xmm1
callq 0xbf4c0
movq -0x140(%rbp), %rdi
movq -0x170(%rbp), %rsi
callq 0x139090
movq -0x148(%rbp), %rsi
movlpd %xmm0, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0xe8660
movq -0x50(%rbp), %rax
movss 0x3c(%rax), %xmm0
leaq -0x90(%rbp), %rdi
callq 0xdc300
movl -0x54(%rbp), %esi
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0xd6250
testb $0x1, %al
jne 0x144203
movb $0x0, -0x1(%rbp)
jmp 0x14476e
cmpq $0x0, -0x38(%rbp)
jne 0x14421c
movl -0x14(%rbp), %edi
callq 0x13fc60
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x144246
cmpl $0x4, -0x14(%rbp)
jne 0x144244
movq -0x38(%rbp), %rdi
leaq 0x3579a(%rip), %rsi     # 0x1799c7
callq 0xd7e0
cmpl $0x0, %eax
je 0x144244
movq -0x38(%rbp), %rdi
callq 0x142a80
movq %rax, -0x38(%rbp)
jmp 0x144246
movl -0x54(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0xca460
andb $0x1, %al
movb %al, -0xa1(%rbp)
movl 0x10(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movb %al, -0xa2(%rbp)
xorl %eax, %eax
testb $0x1, -0xa2(%rbp)
movb %al, -0x171(%rbp)
je 0x14428f
movl -0x54(%rbp), %edi
callq 0x15e5f0
movb %al, -0x171(%rbp)
movb -0x171(%rbp), %al
andb $0x1, %al
movb %al, -0xa3(%rbp)
testb $0x1, -0xa3(%rbp)
jne 0x1443b9
xorl %eax, %eax
testb $0x1, -0xa2(%rbp)
movb %al, -0x172(%rbp)
je 0x1442cd
movq -0x40(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0xca7d0
movb %al, -0x172(%rbp)
movb -0x172(%rbp), %al
andb $0x1, %al
movb %al, -0xa4(%rbp)
xorl %eax, %eax
testb $0x1, -0xa1(%rbp)
movb %al, -0x173(%rbp)
je 0x1442fc
movq -0x48(%rbp), %rax
movb 0x420(%rax), %al
movb %al, -0x173(%rbp)
movb -0x173(%rbp), %al
andb $0x1, %al
movb %al, -0xa5(%rbp)
testb $0x1, -0xa4(%rbp)
jne 0x14433a
testb $0x1, -0xa5(%rbp)
jne 0x14433a
movq -0x48(%rbp), %rax
movl 0x1ca0(%rax), %eax
cmpl -0x54(%rbp), %eax
je 0x14433a
movq -0x48(%rbp), %rax
movl 0x1cac(%rax), %eax
cmpl -0x54(%rbp), %eax
jne 0x1443b7
movl -0x54(%rbp), %edi
movq -0x40(%rbp), %rsi
callq 0xc9ec0
movl -0x54(%rbp), %edi
movq -0x40(%rbp), %rsi
callq 0xdf460
movq -0x40(%rbp), %rdi
callq 0xcb380
movq -0x48(%rbp), %rax
movl 0x1b44(%rax), %ecx
orl $0x3, %ecx
movl %ecx, 0x1b44(%rax)
testb $0x1, -0xa2(%rbp)
je 0x1443b5
testb $0x1, -0xa4(%rbp)
jne 0x1443a5
testb $0x1, -0xa5(%rbp)
je 0x144396
movq -0x48(%rbp), %rax
testb $0x1, 0x140(%rax)
jne 0x1443a5
movq -0x48(%rbp), %rax
movl 0x1cac(%rax), %eax
cmpl -0x54(%rbp), %eax
jne 0x1443b5
movb $0x1, -0xa3(%rbp)
movq -0x40(%rbp), %rdi
callq 0xca950
jmp 0x1443b7
jmp 0x1443b9
testb $0x1, -0xa3(%rbp)
je 0x1444a8
movl 0x10(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0xa6(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x19c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x198(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18c(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x180(%rbp)
testb $0x1, -0xa6(%rbp)
je 0x144423
movq -0x28(%rbp), %rax
movq %rax, -0x1a8(%rbp)
jmp 0x14442e
xorl %eax, %eax
movq %rax, -0x1a8(%rbp)
jmp 0x14442e
movq -0x1a8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
testb $0x1, -0xa6(%rbp)
je 0x144452
movq -0x30(%rbp), %rax
movq %rax, -0x1b8(%rbp)
jmp 0x14445d
xorl %eax, %eax
movq %rax, -0x1b8(%rbp)
jmp 0x14445d
movq -0x1b0(%rbp), %r10
movq -0x180(%rbp), %r9
movq -0x188(%rbp), %r8
movl -0x18c(%rbp), %ecx
movq -0x198(%rbp), %rdx
movl -0x19c(%rbp), %esi
movq -0x1b8(%rbp), %rax
leaq -0x70(%rbp), %rdi
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x142ba0
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x14476e
movq -0x48(%rbp), %rax
movl 0x1b30(%rax), %eax
cmpl -0x54(%rbp), %eax
jne 0x1444c4
movl $0x9, %eax
movl %eax, -0x1bc(%rbp)
jmp 0x1444e6
movq -0x48(%rbp), %rax
movl 0x1b1c(%rax), %edx
movl -0x54(%rbp), %esi
movl $0x7, %eax
movl $0x8, %ecx
cmpl %esi, %edx
cmovel %ecx, %eax
movl %eax, -0x1bc(%rbp)
movl -0x1bc(%rbp), %edi
movss 0x2c748(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0xac(%rbp)
movl -0x54(%rbp), %esi
leaq -0x70(%rbp), %rdi
movl $0x1, %edx
callq 0xc91e0
movq -0x70(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0xc0(%rbp)
movl -0xac(%rbp), %edi
movq -0x48(%rbp), %rax
movss 0x15a0(%rax), %xmm2
movsd -0xb8(%rbp), %xmm0
movsd -0xc0(%rbp), %xmm1
movl $0x1, %esi
callq 0xc8f20
leaq -0xd0(%rbp), %rdi
callq 0xe8c60
movl -0x54(%rbp), %esi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
movq -0x38(%rbp), %r11
movl 0x10(%rbp), %r10d
leaq -0x70(%rbp), %rdi
leaq -0xd0(%rbp), %rax
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x143a10
andb $0x1, %al
movb %al, -0xd1(%rbp)
testb $0x1, -0xd1(%rbp)
je 0x1445af
movl -0x54(%rbp), %edi
callq 0xca110
movss -0xc8(%rbp), %xmm0
ucomiss -0xd0(%rbp), %xmm0
jbe 0x14464a
movq -0x40(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x1d8(%rbp)
leaq -0xd0(%rbp), %rax
movq %rax, -0x1d0(%rbp)
leaq -0xd0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x1c8(%rbp)
movq -0x48(%rbp), %rax
movl 0x1b30(%rax), %ecx
movl -0x54(%rbp), %edx
movl $0x13, %edi
movl $0x14, %eax
cmpl %edx, %ecx
cmovel %eax, %edi
movss 0x2c622(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movq -0x1d8(%rbp), %rdi
movq -0x1d0(%rbp), %rsi
movq -0x1c8(%rbp), %rdx
movl %eax, %ecx
movq -0x50(%rbp), %rax
movss 0x7c(%rax), %xmm0
movl $0xf, %r8d
callq 0x113090
leaq -0x120(%rbp), %rax
movq %rax, -0x200(%rbp)
leaq -0x120(%rbp), %rdi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %r8
movl $0x40, %esi
callq 0x13fcd0
movl %eax, %ecx
movq -0x200(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x128(%rbp)
leaq -0x70(%rbp), %rax
movq %rax, -0x1f8(%rbp)
leaq -0x70(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x1f0(%rbp)
leaq -0x120(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x128(%rbp), %rax
movq %rax, -0x1e0(%rbp)
leaq -0x130(%rbp), %rdi
movss 0x2d909(%rip), %xmm1    # 0x171fd8
movaps %xmm1, %xmm0
callq 0xbf4c0
movq -0x1f8(%rbp), %rdi
movq -0x1f0(%rbp), %rsi
movq -0x1e8(%rbp), %rdx
movq -0x1e0(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
leaq -0x130(%rbp), %r9
movq $0x0, (%rsp)
callq 0xc8900
movss -0x60(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x14475f
movss -0x6c(%rbp), %xmm1
movss -0x68(%rbp), %xmm0
movq -0x50(%rbp), %rax
movss 0x3c(%rax), %xmm2
movss 0x50(%rax), %xmm3
addss %xmm3, %xmm0
addss %xmm2, %xmm1
leaq -0x138(%rbp), %rdi
callq 0xbf4c0
movq -0x10(%rbp), %rdi
movsd -0x138(%rbp), %xmm0
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0xc8120
jmp 0x144761
jmp 0x144763
movb -0xd1(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nopl (%rax)