// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGuiIO::AddInputCharacterUTF16(unsigned short)
void ImGuiIO::AddInputCharacterUTF16(ImWchar16 c)
{
    if (c == 0 && InputQueueSurrogate == 0)
        return;

    if ((c & 0xFC00) == 0xD800) // High surrogate, must save
    {
        if (InputQueueSurrogate != 0)
            InputQueueCharacters.push_back(IM_UNICODE_CODEPOINT_INVALID);
        InputQueueSurrogate = c;
        return;
    }

    ImWchar cp = c;
    if (InputQueueSurrogate != 0)
    {
        if ((c & 0xFC00) != 0xDC00) // Invalid low surrogate
            InputQueueCharacters.push_back(IM_UNICODE_CODEPOINT_INVALID);
        else if (IM_UNICODE_CODEPOINT_MAX == (0xFFFF)) // Codepoint will not fit in ImWchar (extra parenthesis around 0xFFFF somehow fixes -Wunreachable-code with Clang)
            cp = IM_UNICODE_CODEPOINT_INVALID;
        else
            cp = (ImWchar)(((InputQueueSurrogate - 0xD800) << 10) + (c - 0xDC00) + 0x10000);
        InputQueueSurrogate = 0;
    }
    InputQueueCharacters.push_back(cp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %r14d
movzwl 0x1544(%rdi), %eax
movl %r14d, %ecx
orw %ax, %cx
je 0x4170a
movq %rdi, %rbx
movl %r14d, %ecx
andl $0xfc00, %ecx           # imm = 0xFC00
cmpl $0xd800, %ecx           # imm = 0xD800
jne 0x4147a
testw %ax, %ax
je 0x41571
movl 0x1548(%rbx), %r12d
movl 0x154c(%rbx), %eax
cmpl %eax, %r12d
jne 0x41557
incl %r12d
testl %eax, %eax
je 0x414c7
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
addl %eax, %ecx
jmp 0x414cc
testw %ax, %ax
je 0x41637
movzwl %cx, %ecx
movw $0xfffd, %ax            # imm = 0xFFFD
cmpl $0xdc00, %ecx           # imm = 0xDC00
je 0x4162b
movl 0x1548(%rbx), %r12d
movl 0x154c(%rbx), %eax
cmpl %eax, %r12d
jne 0x4160e
incl %r12d
testl %eax, %eax
je 0x4157e
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
addl %eax, %ecx
jmp 0x41583
movl $0x8, %ecx
cmpl %r12d, %ecx
cmovgl %ecx, %r12d
cmpl %r12d, %eax
jge 0x41557
movslq %r12d, %rdi
addq %rdi, %rdi
movq 0xbc7eb(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x414f0
incl 0x3b4(%rax)
movq 0xbc7e9(%rip), %rsi     # 0xfdce0
callq *0xb8013(%rip)          # 0xf9510
movq %rax, %r15
movq 0x1550(%rbx), %rsi
testq %rsi, %rsi
je 0x41549
movslq 0x1548(%rbx), %rdx
addq %rdx, %rdx
movq %r15, %rdi
callq 0xc080
movq 0x1550(%rbx), %rdi
testq %rdi, %rdi
je 0x4153c
movq 0xbc79f(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x4153c
decl 0x3b4(%rax)
movq 0xbc79d(%rip), %rsi     # 0xfdce0
callq *0xb7fcf(%rip)          # 0xf9518
movq %r15, 0x1550(%rbx)
movl %r12d, 0x154c(%rbx)
movq 0x1550(%rbx), %rax
movslq 0x1548(%rbx), %rcx
movw $0xfffd, (%rax,%rcx,2)  # imm = 0xFFFD
incl 0x1548(%rbx)
movw %r14w, 0x1544(%rbx)
jmp 0x4170a
movl $0x8, %ecx
cmpl %r12d, %ecx
cmovgl %ecx, %r12d
cmpl %r12d, %eax
jge 0x4160e
movslq %r12d, %rdi
addq %rdi, %rdi
movq 0xbc734(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x415a7
incl 0x3b4(%rax)
movq 0xbc732(%rip), %rsi     # 0xfdce0
callq *0xb7f5c(%rip)          # 0xf9510
movq %rax, %r15
movq 0x1550(%rbx), %rsi
testq %rsi, %rsi
je 0x41600
movslq 0x1548(%rbx), %rdx
addq %rdx, %rdx
movq %r15, %rdi
callq 0xc080
movq 0x1550(%rbx), %rdi
testq %rdi, %rdi
je 0x415f3
movq 0xbc6e8(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x415f3
decl 0x3b4(%rax)
movq 0xbc6e6(%rip), %rsi     # 0xfdce0
callq *0xb7f18(%rip)          # 0xf9518
movq %r15, 0x1550(%rbx)
movl %r12d, 0x154c(%rbx)
movq 0x1550(%rbx), %rax
movslq 0x1548(%rbx), %rcx
movw $0xfffd, (%rax,%rcx,2)  # imm = 0xFFFD
incl 0x1548(%rbx)
movl %r14d, %eax
movw $0x0, 0x1544(%rbx)
movl %eax, %r14d
movl 0x1548(%rbx), %r12d
movl 0x154c(%rbx), %eax
cmpl %eax, %r12d
jne 0x416f1
incl %r12d
testl %eax, %eax
je 0x41661
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
addl %eax, %ecx
jmp 0x41666
movl $0x8, %ecx
cmpl %r12d, %ecx
cmovgl %ecx, %r12d
cmpl %r12d, %eax
jge 0x416f1
movslq %r12d, %rdi
addq %rdi, %rdi
movq 0xbc651(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x4168a
incl 0x3b4(%rax)
movq 0xbc64f(%rip), %rsi     # 0xfdce0
callq *0xb7e79(%rip)          # 0xf9510
movq %rax, %r15
movq 0x1550(%rbx), %rsi
testq %rsi, %rsi
je 0x416e3
movslq 0x1548(%rbx), %rdx
addq %rdx, %rdx
movq %r15, %rdi
callq 0xc080
movq 0x1550(%rbx), %rdi
testq %rdi, %rdi
je 0x416d6
movq 0xbc605(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x416d6
decl 0x3b4(%rax)
movq 0xbc603(%rip), %rsi     # 0xfdce0
callq *0xb7e35(%rip)          # 0xf9518
movq %r15, 0x1550(%rbx)
movl %r12d, 0x154c(%rbx)
movq 0x1550(%rbx), %rax
movslq 0x1548(%rbx), %rcx
movw %r14w, (%rax,%rcx,2)
incl 0x1548(%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop