// File: donfreiday[P]gb/./imgui/imgui.cpp
// Function: InputTextCalcTextSizeW(unsigned short const*, unsigned short const*, unsigned short const**, ImVec2*, bool)
static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line)
{
    ImFont* font = GImGui->Font;
    const float line_height = GImGui->FontSize;
    const float scale = line_height / font->FontSize;

    ImVec2 text_size = ImVec2(0,0);
    float line_width = 0.0f;

    const ImWchar* s = text_begin;
    while (s < text_end)
    {
        unsigned int c = (unsigned int)(*s++);
        if (c == '\n')
        {
            text_size.x = ImMax(text_size.x, line_width);
            text_size.y += line_height;
            line_width = 0.0f;
            if (stop_on_new_line)
                break;
            continue;
        }
        if (c == '\r')
            continue;

        const float char_width = font->GetCharAdvance((unsigned short)c) * scale;
        line_width += char_width;
    }

    if (text_size.x < line_width)
        text_size.x = line_width;

    if (out_offset)
        *out_offset = ImVec2(line_width, text_size.y + line_height);  // offset allow for the possibility of sitting after a trailing \n

    if (line_width > 0 || text_size.y == 0.0f)                        // whereas size.y will ignore the trailing \n
        text_size.y += line_height;

    if (remaining)
        *remaining = s;

    return text_size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %r8b, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
andb $0x1, %al
movb %al, -0x29(%rbp)
movq 0x53ac9(%rip), %rax     # 0x794c0
movq 0x1710(%rax), %rax
movq %rax, -0x38(%rbp)
movq 0x53ab7(%rip), %rax     # 0x794c0
movss 0x1718(%rax), %xmm0
movss %xmm0, -0x3c(%rbp)
movss -0x3c(%rbp), %xmm0
movq -0x38(%rbp), %rax
divss (%rax), %xmm0
movss %xmm0, -0x40(%rbp)
leaq -0x8(%rbp), %rdi
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x2d280
xorps %xmm0, %xmm0
movss %xmm0, -0x44(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x25ada
movq -0x50(%rbp), %rax
movq %rax, %rcx
addq $0x2, %rcx
movq %rcx, -0x50(%rbp)
movzwl (%rax), %eax
movl %eax, -0x54(%rbp)
cmpl $0xa, -0x54(%rbp)
jne 0x25aa5
movss -0x8(%rbp), %xmm0
movss -0x44(%rbp), %xmm1
callq 0xb7c0
movss %xmm0, -0x8(%rbp)
movss -0x3c(%rbp), %xmm0
addss -0x4(%rbp), %xmm0
movss %xmm0, -0x4(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x44(%rbp)
testb $0x1, -0x29(%rbp)
je 0x25aa3
jmp 0x25ada
jmp 0x25a47
cmpl $0xd, -0x54(%rbp)
jne 0x25aad
jmp 0x25a47
movq -0x38(%rbp), %rdi
movl -0x54(%rbp), %eax
movzwl %ax, %esi
callq 0x30030
mulss -0x40(%rbp), %xmm0
movss %xmm0, -0x58(%rbp)
movss -0x58(%rbp), %xmm0
addss -0x44(%rbp), %xmm0
movss %xmm0, -0x44(%rbp)
jmp 0x25a47
movss -0x8(%rbp), %xmm1
movss -0x44(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x25af3
movss -0x44(%rbp), %xmm0
movss %xmm0, -0x8(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x25b1d
movss -0x44(%rbp), %xmm0
movss -0x4(%rbp), %xmm1
addss -0x3c(%rbp), %xmm1
leaq -0x60(%rbp), %rdi
callq 0x2d280
movq -0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rcx, (%rax)
movss -0x44(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
ja 0x25b39
movss -0x4(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x25b48
jp 0x25b48
movss -0x3c(%rbp), %xmm0
addss -0x4(%rbp), %xmm0
movss %xmm0, -0x4(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x25b5a
movq -0x50(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movsd -0x8(%rbp), %xmm0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)