// File: donfreiday[P]gb/./imgui/imgui.cpp
// Function: InputTextFilterCharacter(unsigned int*, int, int (*)(ImGuiTextEditCallbackData*), void*)
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data)
{
    unsigned int c = *p_char;

    if (c < 128 && c != ' ' && !isprint((int)(c & 0xFF)))
    {
        bool pass = false;
        pass |= (c == '\n' && (flags & ImGuiInputTextFlags_Multiline));
        pass |= (c == '\t' && (flags & ImGuiInputTextFlags_AllowTabInput));
        if (!pass)
            return false;
    }

    if (c >= 0xE000 && c <= 0xF8FF) // Filter private Unicode range. I don't imagine anybody would want to input them. GLFW on OSX seems to send private characters for special keys like arrow keys.
        return false;

    if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank))
    {
        if (flags & ImGuiInputTextFlags_CharsDecimal)
            if (!(c >= '0' && c <= '9') && (c != '.') && (c != '-') && (c != '+') && (c != '*') && (c != '/'))
                return false;

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

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

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

    if (flags & ImGuiInputTextFlags_CallbackCharFilter)
    {
        ImGuiTextEditCallbackData callback_data;
        memset(&callback_data, 0, sizeof(ImGuiTextEditCallbackData));
        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
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x80, -0x2c(%rbp)
jae 0x25755
cmpl $0x20, -0x2c(%rbp)
je 0x25755
movl -0x2c(%rbp), %edi
andl $0xff, %edi
callq 0x74d0
cmpl $0x0, %eax
jne 0x25755
movb $0x0, -0x2d(%rbp)
xorl %eax, %eax
cmpl $0xa, -0x2c(%rbp)
movb %al, -0x69(%rbp)
jne 0x256ee
movl -0x14(%rbp), %eax
andl $0x100000, %eax         # imm = 0x100000
cmpl $0x0, %eax
setne %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movb -0x2d(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
orl %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x2d(%rbp)
xorl %eax, %eax
cmpl $0x9, -0x2c(%rbp)
movb %al, -0x6a(%rbp)
jne 0x25727
movl -0x14(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
setne %al
movb %al, -0x6a(%rbp)
movb -0x6a(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movb -0x2d(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
orl %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x2d(%rbp)
testb $0x1, -0x2d(%rbp)
jne 0x25753
movb $0x0, -0x1(%rbp)
jmp 0x258ac
jmp 0x25755
cmpl $0xe000, -0x2c(%rbp)    # imm = 0xE000
jb 0x25770
cmpl $0xf8ff, -0x2c(%rbp)    # imm = 0xF8FF
ja 0x25770
movb $0x0, -0x1(%rbp)
jmp 0x258ac
movl -0x14(%rbp), %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x25844
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x257bf
cmpl $0x30, -0x2c(%rbp)
jb 0x25796
cmpl $0x39, -0x2c(%rbp)
jbe 0x257bd
cmpl $0x2e, -0x2c(%rbp)
je 0x257bd
cmpl $0x2d, -0x2c(%rbp)
je 0x257bd
cmpl $0x2b, -0x2c(%rbp)
je 0x257bd
cmpl $0x2a, -0x2c(%rbp)
je 0x257bd
cmpl $0x2f, -0x2c(%rbp)
je 0x257bd
movb $0x0, -0x1(%rbp)
jmp 0x258ac
jmp 0x257bf
movl -0x14(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x257f9
cmpl $0x30, -0x2c(%rbp)
jb 0x257d6
cmpl $0x39, -0x2c(%rbp)
jbe 0x257f7
cmpl $0x61, -0x2c(%rbp)
jb 0x257e2
cmpl $0x66, -0x2c(%rbp)
jbe 0x257f7
cmpl $0x41, -0x2c(%rbp)
jb 0x257ee
cmpl $0x46, -0x2c(%rbp)
jbe 0x257f7
movb $0x0, -0x1(%rbp)
jmp 0x258ac
jmp 0x257f9
movl -0x14(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x25821
cmpl $0x61, -0x2c(%rbp)
jb 0x2581f
cmpl $0x7a, -0x2c(%rbp)
ja 0x2581f
movl -0x2c(%rbp), %ecx
addl $-0x20, %ecx
movl %ecx, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
jmp 0x25821
movl -0x14(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x25842
movl -0x2c(%rbp), %edi
callq 0x29b90
testb $0x1, %al
jne 0x2583a
jmp 0x25840
movb $0x0, -0x1(%rbp)
jmp 0x258ac
jmp 0x25842
jmp 0x25844
movl -0x14(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x258a8
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x7240
movl $0x200, -0x68(%rbp)     # imm = 0x200
movl -0x2c(%rbp), %eax
movw %ax, -0x56(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x68(%rbp), %rdi
callq *-0x20(%rbp)
cmpl $0x0, %eax
je 0x2588f
movb $0x0, -0x1(%rbp)
jmp 0x258ac
movzwl -0x56(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
cmpw $0x0, -0x56(%rbp)
jne 0x258a6
movb $0x0, -0x1(%rbp)
jmp 0x258ac
jmp 0x258a8
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)