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

    ImGuiContext& g = *GImGui;
    ImGuiStyle& style = g.Style;

    if (format == NULL)
        format = DataTypeGetInfo(data_type)->PrintFmt;

    char buf[64];
    DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, p_data, format);

    bool value_changed = false;
    if ((flags & (ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsScientific)) == 0)
        flags |= ImGuiInputTextFlags_CharsDecimal;
    flags |= ImGuiInputTextFlags_AutoSelectAll;
    flags |= ImGuiInputTextFlags_NoMarkEdited;  // We call MarkItemEdited() ourselves by comparing the actual data rather than the string.

    if (p_step != NULL)
    {
        const float button_size = GetFrameHeight();

        BeginGroup(); // The only purpose of the group here is to allow the caller to query item data e.g. IsItemActive()
        PushID(label);
        SetNextItemWidth(ImMax(1.0f, CalcItemWidth() - (button_size + style.ItemInnerSpacing.x) * 2));
        if (InputText("", buf, IM_ARRAYSIZE(buf), flags)) // PushId(label) + "" gives us the expected ID from outside point of view
            value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialTextA.Data, data_type, p_data, format);

        // Step buttons
        const ImVec2 backup_frame_padding = style.FramePadding;
        style.FramePadding.x = style.FramePadding.y;
        ImGuiButtonFlags button_flags = ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups;
        if (flags & ImGuiInputTextFlags_ReadOnly)
            button_flags |= ImGuiButtonFlags_Disabled;
        SameLine(0, style.ItemInnerSpacing.x);
        if (ButtonEx("-", ImVec2(button_size, button_size), button_flags))
        {
            DataTypeApplyOp(data_type, '-', p_data, p_data, g.IO.KeyCtrl && p_step_fast ? p_step_fast : p_step);
            value_changed = true;
        }
        SameLine(0, style.ItemInnerSpacing.x);
        if (ButtonEx("+", ImVec2(button_size, button_size), button_flags))
        {
            DataTypeApplyOp(data_type, '+', p_data, p_data, g.IO.KeyCtrl && p_step_fast ? p_step_fast : p_step);
            value_changed = true;
        }

        const char* label_end = FindRenderedTextEnd(label);
        if (label != label_end)
        {
            SameLine(0, style.ItemInnerSpacing.x);
            TextEx(label, label_end);
        }
        style.FramePadding = backup_frame_padding;

        PopID();
        EndGroup();
    }
    else
    {
        if (InputText(label, buf, IM_ARRAYSIZE(buf), flags))
            value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialTextA.Data, data_type, p_data, format);
    }
    if (value_changed)
        MarkItemEdited(window->DC.LastItemId);

    return value_changed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
leaq 0x6038d(%rip), %rax     # 0xe3ce0
movq (%rax), %r14
movq 0x1ae0(%r14), %rax
movb $0x1, 0x90(%rax)
cmpb $0x0, 0x93(%rax)
jne 0x83c07
movq %r9, %rbx
movq %rcx, %r12
movq %rdx, %r15
movl %esi, %ecx
movq %r8, -0x50(%rbp)
movq %rdi, -0x48(%rbp)
movq %rax, -0x58(%rbp)
movl 0x10(%rbp), %r13d
testq %r9, %r9
movl %esi, -0x2c(%rbp)
jne 0x839a2
movl %ecx, %edi
callq 0x7ddfc
movl -0x2c(%rbp), %ecx
movq 0x10(%rax), %rbx
leaq -0xa0(%rbp), %rdi
pushq $0x40
popq %rsi
movl %ecx, %edx
movq %r15, -0x38(%rbp)
movq %r15, %rcx
movq %rbx, %r8
callq 0x7de35
xorl %r15d, %r15d
testl $0x20002, %r13d         # imm = 0x20002
sete %r15b
orl %r13d, %r15d
orl $0x200010, %r15d        # imm = 0x200010
testq %r12, %r12
je 0x83bc3
callq 0x43ec9
movss %xmm0, -0x30(%rbp)
callq 0x43ff2
movq -0x48(%rbp), %rdi
callq 0x42ea4
callq 0x43d17
movss -0x30(%rbp), %xmm1
addss 0x15b0(%r14), %xmm1
addss %xmm1, %xmm1
subss %xmm1, %xmm0
movss 0x185df(%rip), %xmm1    # 0x9bff8
maxss %xmm0, %xmm1
movaps %xmm1, %xmm0
callq 0x35469
leaq 0x184f5(%rip), %rdi     # 0x9bf21
movq $0x0, -0x40(%rbp)
leaq -0xa0(%rbp), %rsi
pushq $0x40
popq %rdx
movl %r15d, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x83c1c
testb %al, %al
je 0x83a71
movq 0x2198(%r14), %rsi
leaq -0xa0(%rbp), %rdi
movl -0x2c(%rbp), %edx
movq -0x38(%rbp), %rcx
movq %rbx, %r8
callq 0x7e2e3
movq %rax, -0x40(%rbp)
movq 0x1598(%r14), %r15
movq %r15, %rax
shrq $0x20, %rax
movl %eax, 0x1598(%r14)
andl $0x4000, %r13d          # imm = 0x4000
orl $0x2400, %r13d          # imm = 0x2400
movss 0x15b0(%r14), %xmm1
xorps %xmm0, %xmm0
callq 0x437ec
leaq -0x60(%rbp), %rsi
movss -0x30(%rbp), %xmm0
movss %xmm0, (%rsi)
movss %xmm0, 0x4(%rsi)
leaq 0x34bf1(%rip), %rdi     # 0xb86af
movl %r13d, %edx
callq 0x7a3f7
testb %al, %al
je 0x83afc
cmpb $0x0, 0x140(%r14)
movq %r12, %r8
movq -0x50(%rbp), %rax
cmovneq %rax, %r8
testq %rax, %rax
cmoveq %r12, %r8
pushq $0x2d
popq %rsi
movl -0x2c(%rbp), %edi
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
callq 0x7ded7
movb $0x1, %al
movq %rax, -0x40(%rbp)
movss 0x15b0(%r14), %xmm1
xorps %xmm0, %xmm0
callq 0x437ec
leaq -0x60(%rbp), %rsi
movss -0x30(%rbp), %xmm0
movss %xmm0, (%rsi)
movss %xmm0, 0x4(%rsi)
leaq 0x221f1(%rip), %rdi     # 0xa5d17
movl %r13d, %edx
callq 0x7a3f7
testb %al, %al
movq -0x40(%rbp), %r13
je 0x83b65
cmpb $0x0, 0x140(%r14)
movq %r12, %r8
movq -0x50(%rbp), %rax
cmovneq %rax, %r8
testq %rax, %rax
cmoveq %r12, %r8
pushq $0x2b
popq %rsi
movl -0x2c(%rbp), %edi
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
callq 0x7ded7
movb $0x1, %r13b
movq -0x48(%rbp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x36123
cmpq %r12, %rax
je 0x83b99
movq %rax, %rbx
movss 0x15b0(%r14), %xmm1
xorps %xmm0, %xmm0
callq 0x437ec
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x7911c
movq %r15, 0x1598(%r14)
callq 0x42fea
callq 0x4352b
testb %r13b, %r13b
je 0x83c07
movq -0x58(%rbp), %rax
movl 0x124(%rax), %edi
callq 0x3749e
movb $0x1, %r12b
jmp 0x83c0a
xorl %r12d, %r12d
leaq -0xa0(%rbp), %rsi
pushq $0x40
popq %rdx
movq -0x48(%rbp), %rdi
movl %r15d, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x83c1c
testb %al, %al
je 0x83c0a
movq 0x2198(%r14), %rsi
leaq -0xa0(%rbp), %rdi
movl -0x2c(%rbp), %edx
movq -0x38(%rbp), %rcx
movq %rbx, %r8
callq 0x7e2e3
testb %al, %al
jne 0x83baf
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq