// File: Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::VSliderScalar(char const*, ImVec2 const&, int, void*, void const*, void const*, char const*, int)
bool ImGui::VSliderScalar(const char* label, const ImVec2& size, 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 ImVec2 label_size = CalcTextSize(label, NULL, true);
    const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size);
    const ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));

    ItemSize(bb, style.FramePadding.y);
    if (!ItemAdd(frame_bb, id))
        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);

    const bool hovered = ItemHoverable(frame_bb, id);
    if ((hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || g.NavInputId == id)
    {
        SetActiveID(id, window);
        SetFocusID(id, window);
        FocusWindow(window);
        g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
    }

    // 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 | ImGuiSliderFlags_Vertical, &grab_bb);
    if (value_changed)
        MarkItemEdited(id);

    // Render grab
    if (grab_bb.Max.y > grab_bb.Min.y)
        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.
    // For the vertical slider we allow centered text to overlap the frame padding
    char value_buf[64];
    const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, p_data, format);
    RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.0f));
    if (label_size.x > 0.0f)
        RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);

    return value_changed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%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 0x144ce8
movb $0x0, -0x1(%rbp)
jmp 0x1451e2
leaq 0xce251(%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, -0x150(%rbp)
callq 0xc9910
movq -0x150(%rbp), %rsi
movl %eax, -0x54(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %edx
movss 0x2d249(%rip), %xmm0    # 0x171f80
callq 0xc87e0
movlpd %xmm0, -0x5c(%rbp)
movq -0x40(%rbp), %rdi
addq $0xd8, %rdi
movq %rdi, -0x148(%rbp)
movq -0x18(%rbp), %rsi
callq 0x139090
movq -0x148(%rbp), %rsi
movlpd %xmm0, -0x74(%rbp)
leaq -0x6c(%rbp), %rdi
leaq -0x74(%rbp), %rdx
callq 0xe8660
leaq -0x6c(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq -0x6c(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x138(%rbp)
movss -0x5c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x144db4
movq -0x50(%rbp), %rax
movss 0x50(%rax), %xmm0
addss -0x5c(%rbp), %xmm0
movss %xmm0, -0x154(%rbp)
jmp 0x144dc1
xorps %xmm0, %xmm0
movss %xmm0, -0x154(%rbp)
jmp 0x144dc1
movss -0x154(%rbp), %xmm0
leaq -0x94(%rbp), %rdi
movq %rdi, -0x160(%rbp)
xorps %xmm1, %xmm1
callq 0xbf4c0
movq -0x138(%rbp), %rdi
movq -0x160(%rbp), %rsi
callq 0x139090
movq -0x140(%rbp), %rsi
movlpd %xmm0, -0x8c(%rbp)
leaq -0x84(%rbp), %rdi
leaq -0x8c(%rbp), %rdx
callq 0xe8660
movq -0x50(%rbp), %rax
movss 0x3c(%rax), %xmm0
leaq -0x84(%rbp), %rdi
callq 0xdc300
movl -0x54(%rbp), %esi
leaq -0x6c(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
callq 0xd6250
testb $0x1, %al
jne 0x144e46
movb $0x0, -0x1(%rbp)
jmp 0x1451e2
cmpq $0x0, 0x10(%rbp)
jne 0x144e5f
movl -0x1c(%rbp), %edi
callq 0x13fc60
movq 0x10(%rax), %rax
movq %rax, 0x10(%rbp)
jmp 0x144e89
cmpl $0x4, -0x1c(%rbp)
jne 0x144e87
movq 0x10(%rbp), %rdi
leaq 0x34b57(%rip), %rsi     # 0x1799c7
callq 0xd7e0
cmpl $0x0, %eax
je 0x144e87
movq 0x10(%rbp), %rdi
callq 0x142a80
movq %rax, 0x10(%rbp)
jmp 0x144e89
movl -0x54(%rbp), %esi
leaq -0x6c(%rbp), %rdi
callq 0xca460
andb $0x1, %al
movb %al, -0x95(%rbp)
testb $0x1, -0x95(%rbp)
je 0x144eb3
movq -0x48(%rbp), %rax
testb $0x1, 0x420(%rax)
jne 0x144ed1
movq -0x48(%rbp), %rax
movl 0x1ca0(%rax), %eax
cmpl -0x54(%rbp), %eax
je 0x144ed1
movq -0x48(%rbp), %rax
movl 0x1cac(%rax), %eax
cmpl -0x54(%rbp), %eax
jne 0x144f05
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 $0xc, %ecx
movl %ecx, 0x1b44(%rax)
movq -0x48(%rbp), %rax
movl 0x1b30(%rax), %eax
cmpl -0x54(%rbp), %eax
jne 0x144f21
movl $0x9, %eax
movl %eax, -0x164(%rbp)
jmp 0x144f43
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, -0x164(%rbp)
movl -0x164(%rbp), %edi
movss 0x2bceb(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movl %eax, -0x9c(%rbp)
movl -0x54(%rbp), %esi
leaq -0x6c(%rbp), %rdi
movl $0x1, %edx
callq 0xc91e0
movq -0x6c(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x64(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl -0x9c(%rbp), %edi
movq -0x48(%rbp), %rax
movss 0x15a0(%rax), %xmm2
movsd -0xa8(%rbp), %xmm0
movsd -0xb0(%rbp), %xmm1
movl $0x1, %esi
callq 0xc8f20
leaq -0xc0(%rbp), %rdi
callq 0xe8c60
movl -0x54(%rbp), %esi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
movq 0x10(%rbp), %r11
movl 0x18(%rbp), %r10d
orl $0x100000, %r10d        # imm = 0x100000
leaq -0x6c(%rbp), %rdi
leaq -0xc0(%rbp), %rax
movq %r11, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x143a10
andb $0x1, %al
movb %al, -0xc1(%rbp)
testb $0x1, -0xc1(%rbp)
je 0x145013
movl -0x54(%rbp), %edi
callq 0xca110
movss -0xb4(%rbp), %xmm0
ucomiss -0xbc(%rbp), %xmm0
jbe 0x1450ae
movq -0x40(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x180(%rbp)
leaq -0xc0(%rbp), %rax
movq %rax, -0x178(%rbp)
leaq -0xc0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x170(%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 0x2bbbe(%rip), %xmm0    # 0x170c3c
callq 0xc76e0
movq -0x180(%rbp), %rdi
movq -0x178(%rbp), %rsi
movq -0x170(%rbp), %rdx
movl %eax, %ecx
movq -0x50(%rbp), %rax
movss 0x7c(%rax), %xmm0
movl $0xf, %r8d
callq 0x113090
leaq -0x110(%rbp), %rax
movq %rax, -0x1a0(%rbp)
leaq -0x110(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq 0x10(%rbp), %r8
movl $0x40, %esi
callq 0x13fcd0
movl %eax, %ecx
movq -0x1a0(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x118(%rbp)
movss -0x6c(%rbp), %xmm0
movss -0x68(%rbp), %xmm1
movq -0x50(%rbp), %rax
addss 0x3c(%rax), %xmm1
leaq -0x120(%rbp), %rdi
callq 0xbf4c0
leaq -0x6c(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x198(%rbp)
leaq -0x110(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x118(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x128(%rbp), %rdi
movss 0x2ce91(%rip), %xmm0    # 0x171fd8
xorps %xmm1, %xmm1
callq 0xbf4c0
movq -0x198(%rbp), %rsi
movq -0x190(%rbp), %rdx
movq -0x188(%rbp), %rcx
leaq -0x120(%rbp), %rdi
xorl %eax, %eax
movl %eax, %r8d
leaq -0x128(%rbp), %r9
movq $0x0, (%rsp)
callq 0xc8900
movss -0x5c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x1451d7
movss -0x68(%rbp), %xmm1
movss -0x64(%rbp), %xmm0
movq -0x50(%rbp), %rax
movss 0x3c(%rax), %xmm2
movss 0x50(%rax), %xmm3
addss %xmm3, %xmm0
addss %xmm2, %xmm1
leaq -0x130(%rbp), %rdi
callq 0xbf4c0
movq -0x10(%rbp), %rdi
movsd -0x130(%rbp), %xmm0
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0xc8120
movb -0xc1(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq