// File: /workspace/github_cpp_makefile_star2_O1/lvandeve[P]base256/base256.cpp
// Function: unicode_to_utf8(std::vector<int, std::allocator<int>> const&)
std::vector<uint8_t> unicode_to_utf8(const std::vector<int>& a) {
  std::vector<uint8_t> result;
  for(int i = 0; i < a.size(); i++) {
    int code_point = a[i];
    if(code_point < 128) {
      result.push_back(code_point);
    } else if(code_point <= 2047) {
      result.push_back((code_point >> 6) + 192);
      result.push_back((code_point & 63) + 128);
    } else if(code_point <= 65535) {
      result.push_back((code_point >> 12) + 224);
      result.push_back(((code_point >> 6) & 63) + 128);
      result.push_back((code_point & 63) + 128);
    } else if(code_point <= 1114111) {
      result.push_back((code_point >> 18) + 240);
      result.push_back(((code_point >> 12) & 63) + 128);
      result.push_back(((code_point >> 6) & 63) + 128);
      result.push_back((code_point & 63) + 128);
    } else {
      // error, add replacement character
      result.push_back(239);
      result.push_back(191);
      result.push_back(189);
    }
  }
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq (%rsi), %rax
cmpq %rax, 0x8(%rsi)
je 0x60e5
movq %rsi, %r14
xorl %ebp, %ebp
leaq 0x17(%rsp), %r15
leaq 0x15(%rsp), %r13
movl (%rax,%rbp,4), %r12d
cmpl $0x7f, %r12d
jg 0x5e9f
movb %r12b, 0x17(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
jne 0x60a4
movq %rbx, %rdi
movq %r15, %rdx
callq 0x10056
jmp 0x60ab
cmpl $0x7ff, %r12d           # imm = 0x7FF
jg 0x5ec6
movl %r12d, %eax
shrl $0x6, %eax
addb $-0x40, %al
movb %al, 0x16(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5f22
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x5f2f
cmpl $0xffff, %r12d          # imm = 0xFFFF
jg 0x5ef4
movl %r12d, %eax
shrl $0xc, %eax
addb $-0x20, %al
movb %al, 0x14(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5f79
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x5f86
cmpl $0x10ffff, %r12d        # imm = 0x10FFFF
jg 0x5f5a
movl %r12d, %eax
shrl $0x12, %eax
addb $-0x10, %al
movb %al, 0x11(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5fe0
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x5fed
movq %rbx, %rdi
leaq 0x16(%rsp), %rdx
callq 0x10056
andb $0x3f, %r12b
orb $-0x80, %r12b
movb %r12b, 0x15(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
jne 0x60a4
movq %rbx, %rdi
movq %r13, %rdx
callq 0x10056
jmp 0x60ab
movb $-0x11, 0xd(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x600d
movb $-0x11, (%rsi)
incq 0x8(%rbx)
jmp 0x601a
movq %rbx, %rdi
leaq 0x14(%rsp), %rdx
callq 0x10056
movl %r12d, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x13(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x5fa6
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x5fb3
movq %rbx, %rdi
leaq 0x13(%rsp), %rdx
callq 0x10056
andb $0x3f, %r12b
orb $-0x80, %r12b
movb %r12b, 0x12(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
jne 0x60a4
movq %rbx, %rdi
leaq 0x12(%rsp), %rdx
callq 0x10056
jmp 0x60ab
movq %rbx, %rdi
leaq 0x11(%rsp), %rdx
callq 0x10056
movl %r12d, %eax
shrl $0xc, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x10(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x6032
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x603f
movq %rbx, %rdi
leaq 0xd(%rsp), %rdx
callq 0x10056
movb $-0x41, 0xc(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x605f
movb $-0x41, (%rsi)
incq 0x8(%rbx)
jmp 0x606c
movq %rbx, %rdi
leaq 0x10(%rsp), %rdx
callq 0x10056
movl %r12d, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0xf(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x6080
movb %al, (%rsi)
incq 0x8(%rbx)
jmp 0x608d
movq %rbx, %rdi
leaq 0xc(%rsp), %rdx
callq 0x10056
movb $-0x43, 0xb(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x60c7
movb $-0x43, (%rsi)
jmp 0x60a7
movq %rbx, %rdi
leaq 0xf(%rsp), %rdx
callq 0x10056
andb $0x3f, %r12b
orb $-0x80, %r12b
movb %r12b, 0xe(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x60d6
movb %r12b, (%rsi)
incq 0x8(%rbx)
incq %rbp
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbp, %rcx
ja 0x5e72
jmp 0x60e5
movq %rbx, %rdi
leaq 0xb(%rsp), %rdx
callq 0x10056
jmp 0x60ab
movq %rbx, %rdi
leaq 0xe(%rsp), %rdx
callq 0x10056
jmp 0x60ab
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x610f
jmp 0x610f
jmp 0x610f
jmp 0x610f
jmp 0x610f
jmp 0x610f
jmp 0x610f
jmp 0x610f
jmp 0x610f
jmp 0x610f
jmp 0x610f
jmp 0x610f
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x611f
callq 0x5210
movq %r14, %rdi
callq 0x53e0