// File: lvandeve[P]base256/base256.cpp
// Function: JSString::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;
    }
    // in JS \0 is different than other octal, and should not have any *decimal* digit after it
    bool digitnext = (next >= '0' && next <= '9');
    if(c == 0 && !digitnext) return "\\0";
    int h0 = (c >> 4) & 15;
    int h1 = (c >> 0) & 15;
    static const std::string hex = "0123456789ABCDEF";
    std::string result = "\\x";
    result += hex[h0];
    result += hex[h1];
    return result;
  }

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0x58(%rsp)
movb %r8b, %al
movq %rdi, %r8
movq %r8, 0x60(%rsp)
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movb %dl, 0x97(%rsp)
movb %cl, 0x96(%rsp)
movb %al, 0x95(%rsp)
movzbl 0x97(%rsp), %eax
cmpl $0x8, %eax
jne 0x1b8fb
leaq 0x94(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rdx
leaq 0x692f(%rip), %rsi      # 0x221eb
callq 0x53d0
jmp 0x1b8c3
leaq 0x94(%rsp), %rdi
callq 0x5300
jmp 0x1be2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x94(%rsp), %rdi
callq 0x5300
jmp 0x1be3a
movzbl 0x97(%rsp), %eax
cmpl $0xc, %eax
jne 0x1b96a
leaq 0x83(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x48(%rsp), %rdx
leaq 0x68c3(%rip), %rsi      # 0x221ee
callq 0x53d0
jmp 0x1b932
leaq 0x83(%rsp), %rdi
callq 0x5300
jmp 0x1be2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x83(%rsp), %rdi
callq 0x5300
jmp 0x1be3a
movzbl 0x97(%rsp), %eax
cmpl $0xa, %eax
jne 0x1b9d9
leaq 0x82(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x40(%rsp), %rdx
leaq 0x6857(%rip), %rsi      # 0x221f1
callq 0x53d0
jmp 0x1b9a1
leaq 0x82(%rsp), %rdi
callq 0x5300
jmp 0x1be2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x82(%rsp), %rdi
callq 0x5300
jmp 0x1be3a
movzbl 0x97(%rsp), %eax
cmpl $0xd, %eax
jne 0x1ba48
leaq 0x81(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x38(%rsp), %rdx
leaq 0x67eb(%rip), %rsi      # 0x221f4
callq 0x53d0
jmp 0x1ba10
leaq 0x81(%rsp), %rdi
callq 0x5300
jmp 0x1be2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x81(%rsp), %rdi
callq 0x5300
jmp 0x1be3a
movzbl 0x97(%rsp), %eax
cmpl $0x9, %eax
jne 0x1bab7
leaq 0x80(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rdx
leaq 0x677f(%rip), %rsi      # 0x221f7
callq 0x53d0
jmp 0x1ba7f
leaq 0x80(%rsp), %rdi
callq 0x5300
jmp 0x1be2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x5300
jmp 0x1be3a
movzbl 0x97(%rsp), %eax
cmpl $0x5c, %eax
jne 0x1bb1d
leaq 0x7f(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x28(%rsp), %rdx
leaq 0x6719(%rip), %rsi      # 0x221fd
callq 0x53d0
jmp 0x1baeb
leaq 0x7f(%rsp), %rdi
callq 0x5300
jmp 0x1be2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x7f(%rsp), %rdi
callq 0x5300
jmp 0x1be3a
movzbl 0x97(%rsp), %eax
cmpl $0x27, %eax
jne 0x1bb83
leaq 0x7e(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x20(%rsp), %rdx
leaq 0x66e1(%rip), %rsi      # 0x2222b
callq 0x53d0
jmp 0x1bb51
leaq 0x7e(%rsp), %rdi
callq 0x5300
jmp 0x1be2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x7e(%rsp), %rdi
callq 0x5300
jmp 0x1be3a
movzbl 0x97(%rsp), %eax
cmpl $0x20, %eax
jl 0x1bc00
movzbl 0x97(%rsp), %eax
cmpl $0x7f, %eax
jge 0x1bc00
movq 0x58(%rsp), %rdi
movb $0x0, 0x7d(%rsp)
callq 0x5400
movq 0x58(%rsp), %rdi
movsbl 0x97(%rsp), %esi
callq 0x51d0
jmp 0x1bbc0
movb $0x1, 0x7d(%rsp)
testb $0x1, 0x7d(%rsp)
jne 0x1bbfb
jmp 0x1bbf1
movq 0x58(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
callq 0x5558
jmp 0x1be3a
movq 0x58(%rsp), %rdi
callq 0x5558
jmp 0x1be2d
movzbl 0x95(%rsp), %ecx
xorl %eax, %eax
cmpl $0x30, %ecx
movb %al, 0x1f(%rsp)
jl 0x1bc25
movzbl 0x95(%rsp), %eax
cmpl $0x39, %eax
setle %al
movb %al, 0x1f(%rsp)
movb 0x1f(%rsp), %al
andb $0x1, %al
movb %al, 0x7c(%rsp)
movzbl 0x97(%rsp), %eax
cmpl $0x0, %eax
jne 0x1bc9c
testb $0x1, 0x7c(%rsp)
jne 0x1bc9c
leaq 0x7b(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x10(%rsp), %rdx
leaq 0x65cb(%rip), %rsi      # 0x2222e
callq 0x53d0
jmp 0x1bc6a
leaq 0x7b(%rsp), %rdi
callq 0x5300
jmp 0x1be2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x7b(%rsp), %rdi
callq 0x5300
jmp 0x1be3a
movzbl 0x97(%rsp), %eax
sarl $0x4, %eax
andl $0xf, %eax
movl %eax, 0x74(%rsp)
movzbl 0x97(%rsp), %eax
sarl $0x0, %eax
andl $0xf, %eax
movl %eax, 0x70(%rsp)
cmpb $0x0, 0x10f09(%rip)     # 0x2cbd0
jne 0x1bd33
leaq 0x10f00(%rip), %rdi     # 0x2cbd0
callq 0x5500
cmpl $0x0, %eax
je 0x1bd33
leaq 0x6f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x54f0
movq 0x8(%rsp), %rdx
leaq 0x10ebb(%rip), %rdi     # 0x2cbb0
leaq 0x64b3(%rip), %rsi      # 0x221af
callq 0x53d0
jmp 0x1bd03
leaq 0x6f(%rsp), %rdi
callq 0x5300
movq 0x102a4(%rip), %rdi     # 0x2bfb8
leaq 0x10e95(%rip), %rsi     # 0x2cbb0
leaq 0x10596(%rip), %rdx     # 0x2c2b8
callq 0x5250
leaq 0x10ea2(%rip), %rdi     # 0x2cbd0
callq 0x51f0
movb $0x0, 0x6e(%rsp)
leaq 0x6d(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq (%rsp), %rdx
leaq 0x64db(%rip), %rsi      # 0x22231
callq 0x53d0
jmp 0x1bd5d
leaq 0x6d(%rsp), %rdi
callq 0x5300
movslq 0x74(%rsp), %rsi
leaq 0x10e3d(%rip), %rdi     # 0x2cbb0
callq 0x5320
movq 0x58(%rsp), %rdi
movsbl (%rax), %esi
callq 0x51d0
jmp 0x1bd87
movslq 0x70(%rsp), %rsi
leaq 0x10e1d(%rip), %rdi     # 0x2cbb0
callq 0x5320
movq 0x58(%rsp), %rdi
movsbl (%rax), %esi
callq 0x51d0
jmp 0x1bda7
movb $0x1, 0x6e(%rsp)
testb $0x1, 0x6e(%rsp)
jne 0x1be2b
jmp 0x1be21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x6f(%rsp), %rdi
callq 0x5300
leaq 0x10df6(%rip), %rdi     # 0x2cbd0
callq 0x51e0
jmp 0x1be3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x6d(%rsp), %rdi
callq 0x5300
jmp 0x1be3a
movq 0x58(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
callq 0x5558
jmp 0x1be3a
movq 0x58(%rsp), %rdi
callq 0x5558
jmp 0x1be2d
movq 0x60(%rsp), %rax
addq $0xa8, %rsp
retq
movq 0x88(%rsp), %rdi
callq 0x54e0
nopw (%rax,%rax)