// File: /workspace/github_cpp_makefile_star2_O1/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 0x1a9a
cmpb $0x0, (%rsi)
js 0x1a9a
movq $0x1, (%rdx)
movsbq (%rsi), %rax
jmp 0x1b4f
cmpq $0x2, %rdi
jb 0x1ac7
testb $0x20, (%rsi)
jne 0x1ac7
testb $0x40, 0x1(%rsi)
jne 0x1ac7
movq $0x2, (%rdx)
movzbl (%rsi), %ecx
andl $0x1f, %ecx
shll $0x6, %ecx
movzbl 0x1(%rsi), %eax
andl $0x3f, %eax
jmp 0x1b4c
cmpq $0x3, %rdi
jb 0x1b00
testb $0x10, (%rsi)
jne 0x1b00
testb $0x40, 0x1(%rsi)
jne 0x1b00
testb $0x40, 0x2(%rsi)
jne 0x1b00
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 0x1b49
cmpq $0x4, %rdi
jb 0x1b56
testb $0x8, (%rsi)
jne 0x1b56
testb $0x40, 0x1(%rsi)
jne 0x1b56
testb $0x40, 0x2(%rsi)
jne 0x1b56
testb $0x40, 0x3(%rsi)
jne 0x1b56
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
movl $0x1, %ecx
jmp 0x1b5a
xorl %ecx, %ecx
xorl %eax, %eax
shlq $0x20, %rax
orq %rcx, %rax
popq %rbp
retq
nop