// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::DragScalar(char const*, int, void*, float, void const*, void const*, char const*, int)
bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, 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 Drag turns it into an InputText
    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]);
        const bool double_clicked = (hovered && g.IO.MouseDoubleClicked[0]);
        if (focus_requested || clicked || double_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) || double_clicked || g.NavInputId == id))
            {
                temp_input_is_active = true;
                FocusableItemUnregister(window);
            }
        }
        // Experimental: simple click (without moving) turns Drag into an InputText
        // FIXME: Currently polling ImGuiConfigFlags_IsTouchScreen, may either poll an hypothetical ImGuiBackendFlags_HasKeyboard and/or an explicit drag settings.
        if (g.IO.ConfigDragClickToInputText && temp_input_allowed && !temp_input_is_active)
            if (g.ActiveId == id && hovered && g.IO.MouseReleased[0] && !IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR))
            {
                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 && (p_min == NULL || p_max == NULL || DataTypeCompare(data_type, p_min, p_max) < 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, style.FrameRounding);

    // Drag behavior
    const bool value_changed = DragBehavior(id, data_type, p_data, v_speed, p_min, p_max, format, flags);
    if (value_changed)
        MarkItemEdited(id);

    // 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 $0xd8, %rsp
leaq 0x663f6(%rip), %rax     # 0xfdcd0
movq (%rax), %rbx
movq 0x1ae0(%rbx), %r14
movb $0x1, 0x90(%r14)
cmpb $0x0, 0x93(%r14)
jne 0x97a21
movq %rdi, %r15
movss %xmm0, -0x80(%rbp)
movq %rcx, -0x70(%rbp)
movq %r8, -0x78(%rbp)
movq %r9, %r13
movl %esi, -0x34(%rbp)
movq %rdx, -0x40(%rbp)
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x46258
movl %eax, -0x30(%rbp)
callq 0x57252
movaps %xmm0, -0x90(%rbp)
movss 0x1f698(%rip), %xmm0    # 0xb6fd0
movq %r15, -0x68(%rbp)
movq %r15, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x4548d
movaps %xmm0, %xmm3
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
movss 0x159c(%rbx), %xmm0
movaps %xmm0, %xmm2
addss %xmm0, %xmm2
addss %xmm1, %xmm2
movaps -0x90(%rbp), %xmm1
addss 0xd8(%r14), %xmm1
addss 0xdc(%r14), %xmm2
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movq 0xd8(%r14), %rax
movq %rax, -0x60(%rbp)
movlps %xmm1, -0x58(%rbp)
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm3
xorps %xmm2, %xmm2
jbe 0x979aa
movss 0x15b0(%rbx), %xmm2
addss %xmm3, %xmm2
movaps %xmm3, -0x90(%rbp)
leaq -0x60(%rbp), %r15
addss 0x8(%r15), %xmm2
addss 0xc(%r15), %xmm1
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
leaq -0xa8(%rbp), %r12
movq %rax, (%r12)
movlps %xmm2, 0x8(%r12)
movq %r12, %rdi
callq 0x56a82
movq %r12, %rdi
movl -0x30(%rbp), %esi
movq %r15, %rdx
callq 0x5346f
testb %al, %al
je 0x97a21
testq %r13, %r13
je 0x97a39
movq %r13, %r12
cmpl $0x4, -0x34(%rbp)
movl -0x30(%rbp), %r13d
jne 0x97a5b
leaq 0x26a7a(%rip), %rsi     # 0xbe482
movq %r12, %rdi
callq 0xc720
testl %eax, %eax
je 0x97a5b
movq %r12, %rdi
callq 0x97ded
movq %rax, %r12
jmp 0x97a5b
xorl %r14d, %r14d
movl %r14d, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x34(%rbp), %eax
cmpl $0xa, %eax
movl -0x30(%rbp), %r13d
jae 0x97dce
movl %eax, %eax
shlq $0x5, %rax
leaq 0x60fba(%rip), %rcx     # 0xf8a10
movq 0x10(%rax,%rcx), %r12
movl 0x10(%rbp), %r15d
leaq -0x60(%rbp), %rdi
movl %r13d, %esi
callq 0x46e45
movl %eax, %ecx
testb %r15b, %r15b
movq %r12, -0x50(%rbp)
js 0x97a96
leaq 0x66253(%rip), %rax     # 0xfdcd0
movq (%rax), %rax
cmpl %r13d, 0x1b30(%rax)
jne 0x97a96
cmpl %r13d, 0x3068(%rax)
sete %r12b
jmp 0x97a99
xorl %r12d, %r12d
testb %r12b, %r12b
jne 0x97bbb
movl 0x10(%rbp), %eax
testb %al, %al
movb %cl, -0x29(%rbp)
js 0x97abf
movq %r14, %rdi
movl %r13d, %esi
callq 0x47129
movb -0x29(%rbp), %cl
movl %eax, %r15d
jmp 0x97ac2
xorl %r15d, %r15d
testb %cl, %cl
je 0x97acf
movb 0x420(%rbx), %sil
jmp 0x97ad1
xorl %esi, %esi
testb %cl, %cl
je 0x97ade
movb 0x425(%rbx), %dil
jmp 0x97ae0
xorl %edi, %edi
movl %r15d, %edx
orb %sil, %dl
orb %dil, %dl
testb $0x1, %dl
movl -0x30(%rbp), %r13d
jne 0x97b04
cmpl %r13d, 0x1ca0(%rbx)
je 0x97b04
cmpl %r13d, 0x1cac(%rbx)
jne 0x97b58
movl %edi, -0x44(%rbp)
movl %esi, -0x7c(%rbp)
movl %r13d, %edi
movq %r14, %rsi
callq 0x46b95
movl %r13d, %edi
movq %r14, %rsi
callq 0x58de3
movq %r14, %rdi
callq 0x47d9b
movl $0x3, 0x1b44(%rbx)
movl 0x10(%rbp), %eax
testb %al, %al
js 0x97b55
testb %r15b, %r15b
movb -0x29(%rbp), %cl
je 0x97d97
movq %r14, %rdi
callq 0x471ff
movb -0x29(%rbp), %cl
movb $0x1, %r12b
jmp 0x97b58
movb -0x29(%rbp), %cl
testb %r12b, %r12b
jne 0x97bb7
movl 0x10(%rbp), %eax
andl $0x80, %eax
jne 0x97bb7
cmpb $0x0, 0xcb(%rbx)
movl -0x30(%rbp), %r13d
je 0x97bbb
cmpl %r13d, 0x1b30(%rbx)
setne %al
xorb $0x1, %cl
orb %al, %cl
jne 0x97bbb
cmpb $0x1, 0x42a(%rbx)
jne 0x97bbb
movss 0x38(%rbx), %xmm0
mulss 0x1f469(%rip), %xmm0    # 0xb7004
xorl %edi, %edi
callq 0x52739
testb %al, %al
jne 0x97bbb
movl %r13d, 0x1cac(%rbx)
movq %r14, %rdi
callq 0x471ff
jmp 0x97bc0
movl -0x30(%rbp), %r13d
testb %r12b, %r12b
je 0x97bea
movl 0x10(%rbp), %eax
testb $0x10, %al
jne 0x97d26
xorl %eax, %eax
movq -0x68(%rbp), %rbx
movq -0x40(%rbp), %r8
movl -0x34(%rbp), %r15d
movq -0x50(%rbp), %r12
movq -0x78(%rbp), %r13
movq -0x70(%rbp), %r14
jmp 0x97d65
movl $0x9, %edi
cmpl %r13d, 0x1b30(%rbx)
je 0x97c08
xorl %edi, %edi
cmpl %r13d, 0x1b1c(%rbx)
sete %dil
addl $0x7, %edi
leaq -0x58(%rbp), %r15
movss 0x1f3d0(%rip), %xmm0    # 0xb6fe4
callq 0x445bd
movl %eax, %r14d
leaq -0x60(%rbp), %r12
movq %r12, %rdi
movl %r13d, %esi
movl $0x1, %edx
callq 0x45ca4
movsd (%r12), %xmm0
movsd 0x8(%r12), %xmm1
movss 0x15a0(%rbx), %xmm2
movl %r14d, %edi
movl $0x1, %esi
callq 0x459e5
movl 0x10(%rbp), %eax
movl %eax, (%rsp)
movl %r13d, %edi
movl -0x34(%rbp), %esi
movq -0x40(%rbp), %rdx
movss -0x80(%rbp), %xmm0
movq -0x70(%rbp), %rcx
movq -0x78(%rbp), %r8
movq -0x50(%rbp), %r9
callq 0x97489
movl %eax, %r14d
testb %al, %al
je 0x97c87
movl %r13d, %edi
callq 0x46ca4
leaq -0xf0(%rbp), %r12
movq %r12, %rdi
movl $0x40, %esi
movl -0x34(%rbp), %edx
movq -0x40(%rbp), %rcx
movq -0x50(%rbp), %r8
callq 0x968ed
cltq
leaq (%rax,%rbp), %rcx
addq $-0xf0, %rcx
movabsq $0x3f0000003f000000, %rax # imm = 0x3F0000003F000000
leaq -0x98(%rbp), %r9
movq %rax, (%r9)
movq $0x0, (%rsp)
leaq -0x60(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %r8d, %r8d
callq 0x45527
xorps %xmm0, %xmm0
movaps -0x90(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x97a24
movss -0x58(%rbp), %xmm0
addss 0x15b0(%rbx), %xmm0
movss -0x5c(%rbp), %xmm1
addss 0x159c(%rbx), %xmm1
unpcklps %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movq -0x68(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x44ec4
jmp 0x97a24
movq -0x70(%rbp), %r14
testq %r14, %r14
sete %al
movq -0x78(%rbp), %r13
testq %r13, %r13
sete %cl
orb %al, %cl
movb $0x1, %al
movq -0x68(%rbp), %rbx
movq -0x40(%rbp), %r8
movl -0x34(%rbp), %r15d
movq -0x50(%rbp), %r12
jne 0x97d65
movl %r15d, %edi
movq %r14, %rsi
movq %r13, %rdx
callq 0x97229
movq -0x40(%rbp), %r8
shrl $0x1f, %eax
xorl %ecx, %ecx
testb %al, %al
cmoveq %rcx, %r14
cmoveq %rcx, %r13
movq %r13, 0x8(%rsp)
movq %r14, (%rsp)
leaq -0x60(%rbp), %rdi
movl -0x30(%rbp), %esi
movq %rbx, %rdx
movl %r15d, %ecx
movq %r12, %r9
callq 0x97ec7
movl %eax, %r14d
jmp 0x97a24
cmpb $0x0, -0x7c(%rbp)
je 0x97db0
movl -0x44(%rbp), %eax
orb 0x140(%rbx), %al
testb $0x1, %al
jne 0x97b45
jmp 0x97dba
cmpb $0x0, -0x44(%rbp)
jne 0x97b45
movl -0x30(%rbp), %eax
cmpl %eax, 0x1cac(%rbx)
je 0x97b45
jmp 0x97b58
leaq 0x1f61f(%rip), %rdi     # 0xb73f4
leaq 0x3b36c(%rip), %rsi     # 0xd3148
leaq 0x3b85a(%rip), %rcx     # 0xd363d
movl $0x70d, %edx            # imm = 0x70D
callq 0xc140