// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]base256/base256.cpp
// Function: JavaString::encodeChar[abi:cxx11](unsigned char, unsigned char, unsigned char)
std::string encodeChar(unsigned char c, unsigned char prev, unsigned char next) {
    if(c == '\b') return "\\b";
    if(c == '\f') return "\\f";
    if(c == '\n') return "\\n";
    if(c == '\r') return "\\r";
    if(c == '\t') return "\\t";
    if(c == '\\') return "\\\\";
    if(c == '"') return "\\\"";
    if(c >= 32 && c < 127) {
      std::string result;
      result += c;
      return result;
    }
    // octal: we work byte-based, so don't use \u unicode escapes, which are longer
    bool digitnext = (next >= '0' && next <= '7');
    int o0 = (c >> 6) & 7;
    int o1 = (c >> 3) & 7;
    int o2 = (c >> 0) & 7;
    std::string result = "\\";
    // shorten if possible, e.g. many nulls in a row will be \0\0\0\0 instead of \000\\000\000\000
    // using \0 and other less than 3 digit codes is only ok if no real octal digit after it, else the next character becomes part of the code
    if(c < 8 && !digitnext) {
      result += ('0' + o2);
    } else if (c < 64 && !digitnext) {
      result += ('0' + o1);
      result += ('0' + o2);
    } else {
      result += ('0' + o0);
      result += ('0' + o1);
      result += ('0' + o2);
    }
    return result;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %r8d, %ebp
movl %edx, %r14d
movq %rdi, %rbx
leal -0x8(%r14), %eax
cmpl $0x5, %eax
ja 0xb549
leaq 0x1b0d(%rip), %rcx      # 0xd03c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x3118(%rip), %rsi      # 0xe657
leaq 0xf(%rsp), %rdx
jmp 0xb5cd
cmpl $0x22, %r14d
je 0xb5c1
cmpl $0x5c, %r14d
jne 0xb563
leaq 0x310d(%rip), %rsi      # 0xe669
leaq 0xa(%rsp), %rdx
jmp 0xb5cd
leal -0x20(%r14), %eax
cmpb $0x5e, %al
ja 0xb5e5
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movsbl %r14b, %esi
movq %rbx, %rdi
callq 0x41a0
jmp 0xb5d5
leaq 0x30d3(%rip), %rsi      # 0xe663
leaq 0xb(%rsp), %rdx
jmp 0xb5cd
leaq 0x30bf(%rip), %rsi      # 0xe65d
leaq 0xd(%rsp), %rdx
jmp 0xb5cd
leaq 0x30ae(%rip), %rsi      # 0xe65a
leaq 0xe(%rsp), %rdx
jmp 0xb5cd
leaq 0x30a6(%rip), %rsi      # 0xe660
leaq 0xc(%rsp), %rdx
jmp 0xb5cd
leaq 0x30a4(%rip), %rsi      # 0xe66c
leaq 0x9(%rsp), %rdx
movq %rbx, %rdi
callq 0x40c0
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
andb $-0x8, %bpl
cmpb $0x30, %bpl
sete %r15b
leaq 0x3072(%rip), %rsi      # 0xe66a
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x40c0
cmpb $0x8, %r14b
setae %al
orb %r15b, %al
je 0xb66e
movl %r14d, %r12d
shrl $0x3, %r12d
movl %r14d, %r15d
andl $0x7, %r15d
cmpb $0x30, %bpl
sete %al
cmpb $0x40, %r14b
setae %cl
orb %al, %cl
je 0xb65b
shrb $0x6, %r14b
orb $0x30, %r14b
movzbl %r14b, %esi
movq %rbx, %rdi
callq 0x41a0
andb $0x7, %r12b
orb $0x30, %r12b
movzbl %r12b, %esi
movq %rbx, %rdi
callq 0x41a0
jmp 0xb66b
orb $0x30, %r12b
movzbl %r12b, %esi
movq %rbx, %rdi
callq 0x41a0
movl %r15d, %r14d
orb $0x30, %r14b
movsbl %r14b, %esi
movq %rbx, %rdi
callq 0x41a0
jmp 0xb5d5
jmp 0xb685
movq %rax, %r14
movq %rbx, %rdi
callq 0x4408
movq %r14, %rdi
callq 0x43a0