// File: /workspace/github_cpp_makefile_star2_O2/Ciaxur[P]yagb-emu/include/imgui/imgui_widgets.cpp
// Function: InputTextFilterCharacter(unsigned int*, int, int (*)(ImGuiInputTextCallbackData*), void*)
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
{
    unsigned int c = *p_char;

    // Filter non-printable (NB: isprint is unreliable! see #2467)
    if (c < 0x20)
    {
        bool pass = false;
        pass |= (c == '\n' && (flags & ImGuiInputTextFlags_Multiline));
        pass |= (c == '\t' && (flags & ImGuiInputTextFlags_AllowTabInput));
        if (!pass)
            return false;
    }

    // We ignore Ascii representation of delete (emitted from Backspace on OSX, see #2578, #2817)
    if (c == 127)
        return false;

    // Filter private Unicode range. GLFW on OSX seems to send private characters for special keys like arrow keys (FIXME)
    if (c >= 0xE000 && c <= 0xF8FF)
        return false;

    // Filter Unicode ranges we are not handling in this build.
    if (c > IM_UNICODE_CODEPOINT_MAX)
        return false;

    // Generic named filters
    if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsScientific))
    {
        // The libc allows overriding locale, with e.g. 'setlocale(LC_NUMERIC, "de_DE.UTF-8");' which affect the output/input of printf/scanf.
        // The standard mandate that programs starts in the "C" locale where the decimal point is '.'.
        // We don't really intend to provide widespread support for it, but out of empathy for people stuck with using odd API, we support the bare minimum aka overriding the decimal point.
        // Change the default decimal_point with:
        //   ImGui::GetCurrentContext()->PlatformLocaleDecimalPoint = *localeconv()->decimal_point;
        ImGuiContext& g = *GImGui;
        const unsigned c_decimal_point = (unsigned int)g.PlatformLocaleDecimalPoint;

        // Allow 0-9 . - + * /
        if (flags & ImGuiInputTextFlags_CharsDecimal)
            if (!(c >= '0' && c <= '9') && (c != c_decimal_point) && (c != '-') && (c != '+') && (c != '*') && (c != '/'))
                return false;

        // Allow 0-9 . - + * / e E
        if (flags & ImGuiInputTextFlags_CharsScientific)
            if (!(c >= '0' && c <= '9') && (c != c_decimal_point) && (c != '-') && (c != '+') && (c != '*') && (c != '/') && (c != 'e') && (c != 'E'))
                return false;

        // Allow 0-9 a-F A-F
        if (flags & ImGuiInputTextFlags_CharsHexadecimal)
            if (!(c >= '0' && c <= '9') && !(c >= 'a' && c <= 'f') && !(c >= 'A' && c <= 'F'))
                return false;

        // Turn a-z into A-Z
        if (flags & ImGuiInputTextFlags_CharsUppercase)
            if (c >= 'a' && c <= 'z')
                *p_char = (c += (unsigned int)('A' - 'a'));

        if (flags & ImGuiInputTextFlags_CharsNoBlank)
            if (ImCharIsBlankW(c))
                return false;
    }

    // Custom callback filter
    if (flags & ImGuiInputTextFlags_CallbackCharFilter)
    {
        ImGuiInputTextCallbackData callback_data;
        memset(&callback_data, 0, sizeof(ImGuiInputTextCallbackData));
        callback_data.EventFlag = ImGuiInputTextFlags_CallbackCharFilter;
        callback_data.EventChar = (ImWchar)c;
        callback_data.Flags = flags;
        callback_data.UserData = user_data;
        if (callback(&callback_data) != 0)
            return false;
        *p_char = callback_data.EventChar;
        if (!callback_data.EventChar)
            return false;
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movl (%rdi), %r8d
cmpl $0x1f, %r8d
ja 0x84ddf
cmpl $0xa, %r8d
sete %r9b
movl %esi, %r10d
shrl $0x14, %r10d
cmpl $0x9, %r8d
setne %al
btl $0xa, %esi
setae %dil
testb %r9b, %r10b
jne 0x84de5
orb %al, %dil
jne 0x84e04
jmp 0x84de5
cmpl $0x7f, %r8d
je 0x84e04
leal -0xe000(%r8), %eax
cmpl $0x1900, %eax           # imm = 0x1900
setb %al
cmpl $0x10000, %r8d          # imm = 0x10000
setae %dil
orb %al, %dil
je 0x84e0d
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
testl $0x2000f, %esi          # imm = 0x2000F
je 0x84ed5
leaq 0x5eec0(%rip), %rax     # 0xe3ce0
movq (%rax), %rax
movsbl 0x30e0(%rax), %edi
testb $0x1, %sil
sete %al
leal -0x30(%r8), %r9d
cmpl $0xa, %r9d
setb %r10b
orb %al, %r10b
jne 0x84e64
cmpl %edi, %r8d
je 0x84e64
xorl %eax, %eax
cmpw $0x2f, %r8w
ja 0x84e06
movzwl %r8w, %r10d
movabsq $0xac0000000000, %r11   # imm = 0xAC0000000000
btq %r10, %r11
jae 0x84e06
cmpl $0xa, %r9d
setb %al
btl $0x11, %esi
setae %r10b
orb %al, %r10b
je 0x84ee2
cmpl $0xa, %r9d
setb %dil
testb $0x2, %sil
sete %r9b
leal -0x61(%r8), %eax
cmpl $0x6, %eax
setb %r10b
orb %dil, %r10b
leal -0x41(%r8), %edi
cmpl $0x6, %edi
setb %dil
orb %r9b, %dil
orb %r10b, %dil
cmpb $0x1, %dil
jne 0x84e04
movl %esi, %edi
shrb $0x2, %dil
cmpl $0x1a, %eax
setb %al
andb %dil, %al
cmpb $0x1, %al
jne 0x84ecb
addl $-0x20, %r8d
movl %r8d, (%rbx)
testb $0x8, %sil
jne 0x84f59
btl $0x9, %esi
jb 0x84f1a
movb $0x1, %al
jmp 0x84e06
movl %r8d, %eax
andl $0xffdf, %eax           # imm = 0xFFDF
cmpl $0x45, %eax
je 0x84e78
cmpl $0x2f, %r8d
je 0x84e78
leal -0x2c(%r8), %eax
cmpl $-0x3, %eax
ja 0x84e78
cmpl $0x2d, %r8d
je 0x84e78
cmpl %edi, %r8d
jne 0x84e04
jmp 0x84e78
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rdi
movups %xmm0, 0x10(%rdi)
movups %xmm0, 0x20(%rdi)
andq $0x0, 0x30(%rdi)
movl $0x200, (%rdi)          # imm = 0x200
movw %r8w, 0x10(%rdi)
movl %esi, 0x4(%rdi)
movq %rcx, 0x8(%rdi)
callq *%rdx
testl %eax, %eax
jne 0x84e04
movzwl -0x30(%rbp), %eax
movl %eax, (%rbx)
testl %eax, %eax
jne 0x84edb
jmp 0x84e04
xorl %eax, %eax
cmpl $0x9, %r8d
je 0x84e06
cmpl $0x20, %r8d
je 0x84e06
cmpl $0x3000, %r8d           # imm = 0x3000
je 0x84e06
jmp 0x84ed5