// File: /workspace/github_cpp_makefile_star2_O1/lvandeve[P]base256/base256.cpp
// Function: utf8_to_unicode(std::vector<unsigned char, std::allocator<unsigned char>> const&)
std::vector<int> utf8_to_unicode(const std::vector<uint8_t>& a) {
  std::vector<int> result;
  for(int i = 0; i < a.size(); i++) {
    int b0 = a[i];
    int b1 = i + 1 < a.size() ? a[i + 1] : 255;
    int b2 = i + 2 < a.size() ? a[i + 2] : 255;
    int b3 = i + 3 < a.size() ? a[i + 3] : 255;

    if(b0 < 128) {
      result.push_back(b0);
    } else if(b0 < 194) {
      result.push_back(REPL_CHAR);
    } else if(b0 < 224) {
      if((b1 & 192) != 128) { result.push_back(REPL_CHAR); continue; }
      i++;
      result.push_back(((b0 & 31) << 6) + (b1 & 63));
    } else if(b0 < 240) {
      if((b1 & 192) != 128) { result.push_back(REPL_CHAR); continue; }
      if(b0 == 224 && b1 < 160) { result.push_back(REPL_CHAR); continue; };
      i++;
      if((b2 & 192) != 128) { result.push_back(REPL_CHAR); continue; }
      i++;
      result.push_back(((b0 & 15) << 12) + ((b1 & 63) << 6) + (b2 & 63));
    } else if(b0 < 245) {
      if((b1 & 192) != 128) { result.push_back(REPL_CHAR); continue; }
      if(b0 == 240 && b1 < 144) { result.push_back(REPL_CHAR); continue; };
      if(b0 == 244 && b1 >= 144) { result.push_back(REPL_CHAR); continue; };
      i++;
      if((b2 & 192) != 128) { result.push_back(REPL_CHAR); continue; }
      i++;
      if((b3 & 192) != 128) { result.push_back(REPL_CHAR); continue; }
      i++;
      result.push_back(((b0 & 7) << 18) + ((b1 & 63) << 12) + ((b2 & 63) << 6) + (b3 & 63));
    } else {
      result.push_back(REPL_CHAR);
    }
  }
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq (%rsi), %rsi
movq 0x8(%r14), %r8
subq %rsi, %r8
je 0x5e07
xorl %eax, %eax
xorl %ebp, %ebp
movzbl (%rsi,%rax), %edx
movl %edx, 0x4(%rsp)
movslq %ebp, %r13
leaq 0x1(%r13), %r12
movl $0xff, %ecx
movl $0xff, %eax
cmpq %r12, %r8
jbe 0x5bb5
movzbl (%rsi,%r12), %eax
leaq 0x2(%r13), %r15
cmpq %r15, %r8
jbe 0x5bc3
movzbl (%rsi,%r15), %ecx
addq $0x3, %r13
movl $0xff, %edi
cmpq %r13, %r8
jbe 0x5bd6
movzbl (%rsi,%r13), %edi
testb %dl, %dl
js 0x5be8
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5c07
movl %edx, (%rsi)
jmp 0x5bfd
cmpb $-0x3f, %dl
ja 0x5c0e
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5c4b
movl $0xfffd, (%rsi)         # imm = 0xFFFD
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x5c5a
leaq 0x4(%rsp), %rdx
jmp 0x5c52
cmpb $-0x21, %dl
ja 0x5c77
movl %eax, %ecx
andl $-0x40, %ecx
cmpl $0x80, %ecx
jne 0x5bed
andl $0x1f, %edx
shll $0x6, %edx
andl $0x3f, %eax
orl %edx, %eax
movl %eax, (%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5d76
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x5d81
leaq 0xb81e(%rip), %rdx      # 0x11470
movq %rbx, %rdi
callq 0xfe6a
incl %ebp
movslq %ebp, %rax
movq (%r14), %rsi
movq 0x8(%r14), %r8
subq %rsi, %r8
cmpq %rax, %r8
ja 0x5b92
jmp 0x5e07
cmpb $-0x11, %dl
ja 0x5ce4
movl %eax, %esi
andl $-0x40, %esi
cmpl $0x80, %esi
jne 0x5bed
cmpl $0xe0, %edx
jne 0x5ca0
cmpl $0x9f, %eax
jbe 0x5bed
movl %ecx, %esi
andl $-0x40, %esi
cmpl $0x80, %esi
jne 0x5d89
shll $0xc, %edx
movzwl %dx, %edx
andl $0x3f, %eax
shll $0x6, %eax
orl %edx, %eax
andl $0x3f, %ecx
orl %eax, %ecx
movl %ecx, (%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5db5
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x5dc0
cmpb $-0xc, %dl
ja 0x5bed
movl %eax, %esi
andl $-0x40, %esi
cmpl $0x80, %esi
jne 0x5bed
cmpl $0xf0, %edx
jne 0x5d11
cmpl $0x8f, %eax
jbe 0x5bed
cmpl $0xf4, %edx
jne 0x5d24
cmpl $0x90, %eax
jae 0x5bed
movl %ecx, %esi
andl $-0x40, %esi
cmpl $0x80, %esi
jne 0x5d89
movl %edi, %esi
andl $-0x40, %esi
cmpl $0x80, %esi
jne 0x5dc8
andl $0x7, %edx
shll $0x12, %edx
andl $0x3f, %eax
shll $0xc, %eax
orl %edx, %eax
andl $0x3f, %ecx
shll $0x6, %ecx
orl %eax, %ecx
andl $0x3f, %edi
orl %ecx, %edi
movl %edi, (%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5ddd
movl %edi, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x5de8
movq %rbx, %rdi
movq %rsp, %rdx
callq 0xff82
movl %r12d, %ebp
jmp 0x5c5a
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5d9e
movl $0xfffd, (%rsi)         # imm = 0xFFFD
jmp 0x5c3e
movq %rbx, %rdi
leaq 0xb6c8(%rip), %rdx      # 0x11470
callq 0xfe6a
movl %r12d, %ebp
jmp 0x5c5a
movq %rbx, %rdi
movq %rsp, %rdx
callq 0xff82
movl %r15d, %ebp
jmp 0x5c5a
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5df0
movl $0xfffd, (%rsi)         # imm = 0xFFFD
jmp 0x5cd7
movq %rbx, %rdi
movq %rsp, %rdx
callq 0xff82
movl %r13d, %ebp
jmp 0x5c5a
movq %rbx, %rdi
leaq 0xb676(%rip), %rdx      # 0x11470
callq 0xfe6a
movl %r15d, %ebp
jmp 0x5c5a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5e1f
jmp 0x5e1f
jmp 0x5e1f
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x5e2f
callq 0x5210
movq %r14, %rdi
callq 0x53e0