// File: yhirose[P]fizzbuzzlang/./peglib.h
// Function: peg::decode_codepoint(char const*, unsigned long, unsigned long&, char32_t&)
inline bool decode_codepoint(const char *s8, size_t l, size_t &bytes,
                             char32_t &cp) {
  if (l) {
    auto b = static_cast<uint8_t>(s8[0]);
    if ((b & 0x80) == 0) {
      bytes = 1;
      cp = b;
      return true;
    } else if ((b & 0xE0) == 0xC0) {
      if (l >= 2) {
        bytes = 2;
        cp = ((static_cast<char32_t>(s8[0] & 0x1F)) << 6) |
             (static_cast<char32_t>(s8[1] & 0x3F));
        return true;
      }
    } else if ((b & 0xF0) == 0xE0) {
      if (l >= 3) {
        bytes = 3;
        cp = ((static_cast<char32_t>(s8[0] & 0x0F)) << 12) |
             ((static_cast<char32_t>(s8[1] & 0x3F)) << 6) |
             (static_cast<char32_t>(s8[2] & 0x3F));
        return true;
      }
    } else if ((b & 0xF8) == 0xF0) {
      if (l >= 4) {
        bytes = 4;
        cp = ((static_cast<char32_t>(s8[0] & 0x07)) << 18) |
             ((static_cast<char32_t>(s8[1] & 0x3F)) << 12) |
             ((static_cast<char32_t>(s8[2] & 0x3F)) << 6) |
             (static_cast<char32_t>(s8[3] & 0x3F));
        return true;
      }
    }
  }
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x48cf0
movq -0x10(%rbp), %rax
movb (%rax), %al
movb %al, -0x29(%rbp)
movzbl -0x29(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x48bd4
movq -0x20(%rbp), %rax
movq $0x1, (%rax)
movzbl -0x29(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x48cf4
movzbl -0x29(%rbp), %eax
andl $0xe0, %eax
cmpl $0xc0, %eax
jne 0x48c24
cmpq $0x2, -0x18(%rbp)
jb 0x48c1f
movq -0x20(%rbp), %rax
movq $0x2, (%rax)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
andl $0x1f, %ecx
shll $0x6, %ecx
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
andl $0x3f, %eax
orl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x48cf4
jmp 0x48cec
movzbl -0x29(%rbp), %eax
andl $0xf0, %eax
cmpl $0xe0, %eax
jne 0x48c7e
cmpq $0x3, -0x18(%rbp)
jb 0x48c7c
movq -0x20(%rbp), %rax
movq $0x3, (%rax)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
andl $0xf, %ecx
shll $0xc, %ecx
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
andl $0x3f, %eax
shll $0x6, %eax
orl %eax, %ecx
movq -0x10(%rbp), %rax
movsbl 0x2(%rax), %eax
andl $0x3f, %eax
orl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x48cf4
jmp 0x48cea
movzbl -0x29(%rbp), %eax
andl $0xf8, %eax
cmpl $0xf0, %eax
jne 0x48ce8
cmpq $0x4, -0x18(%rbp)
jb 0x48ce6
movq -0x20(%rbp), %rax
movq $0x4, (%rax)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
andl $0x7, %ecx
shll $0x12, %ecx
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
andl $0x3f, %eax
shll $0xc, %eax
orl %eax, %ecx
movq -0x10(%rbp), %rax
movsbl 0x2(%rax), %eax
andl $0x3f, %eax
shll $0x6, %eax
orl %eax, %ecx
movq -0x10(%rbp), %rax
movsbl 0x3(%rax), %eax
andl $0x3f, %eax
orl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x48cf4
jmp 0x48ce8
jmp 0x48cea
jmp 0x48cec
jmp 0x48cee
jmp 0x48cf0
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
popq %rbp
retq
nopl (%rax,%rax)