// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: ImGui::TempInputScalar(ImRect const&, unsigned int, char const*, int, void*, char const*, void const*, void const*)
bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min, const void* p_clamp_max)
{
    ImGuiContext& g = *GImGui;

    char fmt_buf[32];
    char data_buf[32];
    format = ImParseFormatTrimDecorations(format, fmt_buf, IM_ARRAYSIZE(fmt_buf));
    DataTypeFormatString(data_buf, IM_ARRAYSIZE(data_buf), data_type, p_data, format);
    ImStrTrimBlanks(data_buf);

    ImGuiInputTextFlags flags = ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoMarkEdited;
    flags |= ((data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) ? ImGuiInputTextFlags_CharsScientific : ImGuiInputTextFlags_CharsDecimal);
    bool value_changed = false;
    if (TempInputText(bb, id, label, data_buf, IM_ARRAYSIZE(data_buf), flags))
    {
        // Backup old value
        size_t data_type_size = DataTypeGetInfo(data_type)->Size;
        ImGuiDataTypeTempStorage data_backup;
        memcpy(&data_backup, p_data, data_type_size);

        // Apply new value (or operations) then clamp
        DataTypeApplyOpFromText(data_buf, g.InputTextState.InitialTextA.Data, data_type, p_data, NULL);
        if (p_clamp_min || p_clamp_max)
        {
            if (DataTypeCompare(data_type, p_clamp_min, p_clamp_max) > 0)
                ImSwap(p_clamp_min, p_clamp_max);
            DataTypeClamp(data_type, p_data, p_clamp_min, p_clamp_max);
        }

        // Only mark as edited if new value is different
        value_changed = memcmp(&data_backup, p_data, data_type_size) != 0;
        if (value_changed)
            MarkItemEdited(id);
    }
    return value_changed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, %r12
movl %ecx, %r15d
movq %rdx, -0x48(%rbp)
movl %esi, %r14d
movq %rdi, %r13
leaq 0x64a30(%rip), %rax     # 0xe3ce0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
leaq -0x90(%rbp), %rsi
pushq $0x20
popq %rdx
movq %r9, %rdi
callq 0x80a64
leaq -0x70(%rbp), %rbx
pushq $0x20
popq %rsi
movq %rbx, %rdi
movl %r15d, %edx
movq %r12, -0x40(%rbp)
movq %r12, %rcx
movq %rax, %r8
callq 0x7de35
movq %rbx, %rdi
callq 0x345fc
movl %r15d, %eax
andl $-0x2, %eax
cmpl $0x8, %eax
movl $0x220010, %eax         # imm = 0x220010
movl $0x200011, %r9d         # imm = 0x200011
cmovel %eax, %r9d
movq %r13, %rdi
movl %r14d, -0x2c(%rbp)
movl %r14d, %esi
movq -0x48(%rbp), %rdx
movq %rbx, %rcx
pushq $0x20
popq %r8
callq 0x80ba4
testb %al, %al
je 0x7f3bc
movq 0x18(%rbp), %r13
movq 0x10(%rbp), %r14
movl %r15d, %edi
callq 0x7ddfc
movq (%rax), %r12
leaq -0x50(%rbp), %rdi
movq -0x40(%rbp), %rbx
movq %rbx, %rsi
movq %r12, %rdx
callq 0xc080
movq -0x38(%rbp), %rax
movq 0x2198(%rax), %rsi
leaq -0x70(%rbp), %rdi
movl %r15d, %edx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x7e2e3
movq %r14, %rax
orq %r13, %rax
je 0x7f39b
movl %r15d, %edi
movq %r14, %rsi
movq %r13, %rdx
callq 0x7e706
testl %eax, %eax
movq %r14, %rdx
cmovgq %r13, %rdx
cmovgq %r14, %r13
movl %r15d, %edi
movq %rbx, %rsi
movq %r13, %rcx
callq 0x7e7ba
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0xc5f0
testl %eax, %eax
setne %r14b
je 0x7f3bf
movl -0x2c(%rbp), %edi
callq 0x3749e
jmp 0x7f3bf
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq