// File: 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
subq $0xa0, %rsp
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
leaq 0xd0370(%rip), %rax     # 0x212f40
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
leaq -0x60(%rbp), %rsi
movl $0x20, %edx
callq 0x145590
movq %rax, -0x30(%rbp)
leaq -0x80(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movl $0x20, %esi
callq 0x13fcd0
leaq -0x80(%rbp), %rdi
callq 0xc4be0
movl $0x200010, -0x84(%rbp)  # imm = 0x200010
movb $0x1, %al
cmpl $0x8, -0x1c(%rbp)
movb %al, -0x99(%rbp)
je 0x142c34
cmpl $0x9, -0x1c(%rbp)
sete %al
movb %al, -0x99(%rbp)
movb -0x99(%rbp), %dl
movl $0x1, %eax
movl $0x20000, %ecx          # imm = 0x20000
testb $0x1, %dl
cmovnel %ecx, %eax
orl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
movb $0x0, -0x85(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
leaq -0x80(%rbp), %rcx
movl -0x84(%rbp), %r9d
movl $0x20, %r8d
callq 0x145850
testb $0x1, %al
jne 0x142c87
jmp 0x142d4c
movl -0x1c(%rbp), %edi
callq 0x13fc60
movq (%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x28(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq -0x98(%rbp), %rdi
callq 0xd0a0
leaq -0x80(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x2198(%rax), %rsi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0x1409d0
cmpq $0x0, 0x10(%rbp)
jne 0x142cde
cmpq $0x0, 0x18(%rbp)
je 0x142d14
movl -0x1c(%rbp), %edi
movq 0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
callq 0x140f90
cmpl $0x0, %eax
jle 0x142d00
leaq 0x10(%rbp), %rdi
leaq 0x18(%rbp), %rsi
callq 0x149860
movl -0x1c(%rbp), %edi
movq -0x28(%rbp), %rsi
movq 0x10(%rbp), %rdx
movq 0x18(%rbp), %rcx
callq 0x1413f0
movq -0x28(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq -0x98(%rbp), %rdi
callq 0xd9f0
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x85(%rbp)
testb $0x1, -0x85(%rbp)
je 0x142d4a
movl -0xc(%rbp), %edi
callq 0xca110
jmp 0x142d4c
movb -0x85(%rbp), %al
andb $0x1, %al
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)