// File: /workspace/github_cpp_makefile_star2_O1/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), %eax
cmpl $0x1f, %eax
ja 0x9e3c6
cmpl $0xa, %eax
sete %r9b
movl %esi, %r10d
shrl $0x14, %r10d
cmpl $0x9, %eax
setne %dil
btl $0xa, %esi
setae %r8b
testb %r9b, %r10b
jne 0x9e3cf
orb %dil, %r8b
jne 0x9e545
jmp 0x9e3cf
cmpl $0x7f, %eax
je 0x9e545
leal -0xe000(%rax), %edi
cmpl $0x1900, %edi           # imm = 0x1900
setb %dil
cmpl $0x10000, %eax          # imm = 0x10000
setae %r8b
orb %dil, %r8b
jne 0x9e545
testl $0x2000f, %esi          # imm = 0x2000F
je 0x9e50a
leaq 0x5f8cc(%rip), %rdi     # 0xfdcd0
movq (%rdi), %rdi
movsbl 0x30e0(%rdi), %r8d
testb $0x1, %sil
sete %dil
leal -0x30(%rax), %r9d
cmpl $0xa, %r9d
setb %r10b
orb %dil, %r10b
jne 0x9e451
cmpl %r8d, %eax
je 0x9e451
xorl %edi, %edi
cmpw $0x2f, %ax
ja 0x9e505
movzwl %ax, %r10d
movabsq $0xac0000000000, %r11   # imm = 0xAC0000000000
btq %r10, %r11
jae 0x9e505
cmpl $0xa, %r9d
setb %dil
btl $0x11, %esi
setae %r10b
orb %dil, %r10b
je 0x9e4d3
cmpl $0xa, %r9d
setb %r8b
testb $0x2, %sil
sete %r9b
leal -0x61(%rax), %edi
cmpl $0x6, %edi
setb %r10b
orb %r8b, %r10b
leal -0x41(%rax), %r8d
cmpl $0x6, %r8d
setb %r8b
orb %r9b, %r8b
orb %r10b, %r8b
cmpb $0x1, %r8b
jne 0x9e503
movl %esi, %r8d
shrb $0x2, %r8b
cmpl $0x1a, %edi
setb %dil
andb %r8b, %dil
cmpb $0x1, %dil
jne 0x9e4b7
addl $-0x20, %eax
movl %eax, (%rbx)
movb $0x1, %dil
testb $0x8, %sil
je 0x9e505
cmpl $0x9, %eax
je 0x9e503
cmpl $0x20, %eax
je 0x9e503
cmpl $0x3000, %eax           # imm = 0x3000
je 0x9e503
jmp 0x9e505
movl %eax, %edi
andl $0xffdf, %edi           # imm = 0xFFDF
cmpl $0x45, %edi
je 0x9e466
cmpl $0x2f, %eax
je 0x9e466
leal -0x2c(%rax), %edi
cmpl $-0x3, %edi
ja 0x9e466
cmpl $0x2d, %eax
je 0x9e466
cmpl %r8d, %eax
je 0x9e466
xorl %edi, %edi
testb %dil, %dil
je 0x9e545
btl $0x9, %esi
jb 0x9e514
movb $0x1, %al
jmp 0x9e547
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rdi
movaps %xmm0, (%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, 0x20(%rdi)
movq $0x0, 0x30(%rdi)
movl $0x200, (%rdi)          # imm = 0x200
movw %ax, 0x10(%rdi)
movl %esi, 0x4(%rdi)
movq %rcx, 0x8(%rdi)
callq *%rdx
testl %eax, %eax
je 0x9e54e
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
movzwl -0x30(%rbp), %eax
movl %eax, (%rbx)
testl %eax, %eax
jne 0x9e510
jmp 0x9e545