// File: /workspace/github_cpp_makefile_star2_O2/tsoding[P]wcc/src/./aids.hpp
// Function: aids::utf8_get_code(aids::String_View, unsigned long*)
Maybe<uint32_t> utf8_get_code(String_View view, size_t *size)
    {
        const uint8_t UTF8_1BYTE_MASK      = 1 << 7;
        const uint8_t UTF8_2BYTES_MASK     = 1 << 5;
        const uint8_t UTF8_3BYTES_MASK     = 1 << 4;
        const uint8_t UTF8_4BYTES_MASK     = 1 << 3;
        const uint8_t UTF8_EXTRA_BYTE_MASK = 1 << 6;

        if (view.count >= 1 &&
            (*view.data & UTF8_1BYTE_MASK) == 0)
        {
            *size = 1;
            return {true, static_cast<uint32_t>(*view.data)};
        }

        if (view.count >= 2 &&
            (view.data[0] & UTF8_2BYTES_MASK) == 0 &&
            (view.data[1] & UTF8_EXTRA_BYTE_MASK) == 0)
        {
            *size = 2;
            const auto byte1 = static_cast<uint32_t>((view.data[0] & (UTF8_2BYTES_MASK - 1)) << 6);
            const auto byte2 = static_cast<uint32_t>(view.data[1] & (UTF8_EXTRA_BYTE_MASK - 1));
            return {true, byte1 | byte2};
        }

        if (view.count >= 3 &&
            (view.data[0] & UTF8_3BYTES_MASK) == 0 &&
            (view.data[1] & UTF8_EXTRA_BYTE_MASK) == 0 &&
            (view.data[2] & UTF8_EXTRA_BYTE_MASK) == 0)
        {
            *size = 3;
            const auto byte1 = static_cast<uint32_t>((view.data[0] & (UTF8_3BYTES_MASK - 1)) << (6 * 2));
            const auto byte2 = static_cast<uint32_t>((view.data[1] & (UTF8_EXTRA_BYTE_MASK - 1)) << 6);
            const auto byte3 = static_cast<uint32_t>(view.data[2] & (UTF8_EXTRA_BYTE_MASK - 1));
            return {true, byte1 | byte2 | byte3};
        }

        if (view.count >= 4 &&
            (view.data[0] & UTF8_4BYTES_MASK) == 0 &&
            (view.data[1] & UTF8_EXTRA_BYTE_MASK) == 0 &&
            (view.data[2] & UTF8_EXTRA_BYTE_MASK) == 0 &&
            (view.data[3] & UTF8_EXTRA_BYTE_MASK) == 0)
        {
            *size = 4;
            const auto byte1 = static_cast<uint32_t>((view.data[0] & (UTF8_3BYTES_MASK - 1)) << (6 * 3));
            const auto byte2 = static_cast<uint32_t>((view.data[1] & (UTF8_EXTRA_BYTE_MASK - 1)) << (6 * 2));
            const auto byte3 = static_cast<uint32_t>((view.data[2] & (UTF8_EXTRA_BYTE_MASK - 1)) << 6);
            const auto byte4 = static_cast<uint32_t>(view.data[3] & (UTF8_EXTRA_BYTE_MASK - 1));
            return {true, byte1 | byte2 | byte3 | byte4};
        }

        return {};
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x1a33
movb (%rsi), %al
testb %al, %al
js 0x196e
movq $0x1, (%rdx)
movsbq (%rsi), %rax
movabsq $0x1, %rcx
jmp 0x1a37
cmpq $0x1, %rdi
je 0x1a33
testb $0x20, %al
jne 0x199e
testb $0x40, 0x1(%rsi)
jne 0x199e
movq $0x2, (%rdx)
movzbl (%rsi), %ecx
andl $0x1f, %ecx
shll $0x6, %ecx
movzbl 0x1(%rsi), %eax
andl $0x3f, %eax
jmp 0x1a2b
cmpq $0x3, %rdi
jb 0x1a33
testb $0x10, %al
jne 0x19da
testb $0x40, 0x1(%rsi)
jne 0x19da
testb $0x40, 0x2(%rsi)
jne 0x19da
movq $0x3, (%rdx)
movzbl (%rsi), %ecx
andl $0xf, %ecx
shll $0xc, %ecx
movzbl 0x1(%rsi), %eax
andl $0x3f, %eax
shll $0x6, %eax
orl %ecx, %eax
movzbl 0x2(%rsi), %ecx
jmp 0x1a28
cmpq $0x3, %rdi
sete %cl
andb $0x8, %al
shrb $0x3, %al
orb %cl, %al
jne 0x1a33
testb $0x40, 0x1(%rsi)
jne 0x1a33
testb $0x40, 0x2(%rsi)
jne 0x1a33
testb $0x40, 0x3(%rsi)
jne 0x1a33
movq $0x4, (%rdx)
movzbl (%rsi), %eax
andl $0xf, %eax
shll $0x12, %eax
movzbl 0x1(%rsi), %ecx
andl $0x3f, %ecx
shll $0xc, %ecx
orl %eax, %ecx
movzbl 0x2(%rsi), %eax
andl $0x3f, %eax
shll $0x6, %eax
orl %ecx, %eax
movzbl 0x3(%rsi), %ecx
andl $0x3f, %ecx
orq %rcx, %rax
jmp 0x195f
xorl %ecx, %ecx
xorl %eax, %eax
shlq $0x20, %rax
orq %rcx, %rax
popq %rbp
retq