// File: lvandeve[P]base256/base256.cpp
// Function: PythonString::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 \0 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 0x1c7db
leaq 0x94(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rdx
leaq 0x5a4f(%rip), %rsi      # 0x221eb
callq 0x53d0
jmp 0x1c7a3
leaq 0x94(%rsp), %rdi
callq 0x5300
jmp 0x1cd0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x94(%rsp), %rdi
callq 0x5300
jmp 0x1cd1a
movzbl 0x97(%rsp), %eax
cmpl $0xc, %eax
jne 0x1c84a
leaq 0x83(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x48(%rsp), %rdx
leaq 0x59e3(%rip), %rsi      # 0x221ee
callq 0x53d0
jmp 0x1c812
leaq 0x83(%rsp), %rdi
callq 0x5300
jmp 0x1cd0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x83(%rsp), %rdi
callq 0x5300
jmp 0x1cd1a
movzbl 0x97(%rsp), %eax
cmpl $0xa, %eax
jne 0x1c8b9
leaq 0x82(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x40(%rsp), %rdx
leaq 0x5977(%rip), %rsi      # 0x221f1
callq 0x53d0
jmp 0x1c881
leaq 0x82(%rsp), %rdi
callq 0x5300
jmp 0x1cd0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x82(%rsp), %rdi
callq 0x5300
jmp 0x1cd1a
movzbl 0x97(%rsp), %eax
cmpl $0xd, %eax
jne 0x1c928
leaq 0x81(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x38(%rsp), %rdx
leaq 0x590b(%rip), %rsi      # 0x221f4
callq 0x53d0
jmp 0x1c8f0
leaq 0x81(%rsp), %rdi
callq 0x5300
jmp 0x1cd0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x81(%rsp), %rdi
callq 0x5300
jmp 0x1cd1a
movzbl 0x97(%rsp), %eax
cmpl $0x9, %eax
jne 0x1c997
leaq 0x80(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rdx
leaq 0x589f(%rip), %rsi      # 0x221f7
callq 0x53d0
jmp 0x1c95f
leaq 0x80(%rsp), %rdi
callq 0x5300
jmp 0x1cd0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x5300
jmp 0x1cd1a
movzbl 0x97(%rsp), %eax
cmpl $0x5c, %eax
jne 0x1c9fd
leaq 0x7f(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x28(%rsp), %rdx
leaq 0x5839(%rip), %rsi      # 0x221fd
callq 0x53d0
jmp 0x1c9cb
leaq 0x7f(%rsp), %rdi
callq 0x5300
jmp 0x1cd0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x7f(%rsp), %rdi
callq 0x5300
jmp 0x1cd1a
movzbl 0x97(%rsp), %eax
cmpl $0x27, %eax
jne 0x1ca63
leaq 0x7e(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x20(%rsp), %rdx
leaq 0x5801(%rip), %rsi      # 0x2222b
callq 0x53d0
jmp 0x1ca31
leaq 0x7e(%rsp), %rdi
callq 0x5300
jmp 0x1cd0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x7e(%rsp), %rdi
callq 0x5300
jmp 0x1cd1a
movzbl 0x97(%rsp), %eax
cmpl $0x20, %eax
jl 0x1cae0
movzbl 0x97(%rsp), %eax
cmpl $0x7f, %eax
jge 0x1cae0
movq 0x58(%rsp), %rdi
movb $0x0, 0x7d(%rsp)
callq 0x5400
movq 0x58(%rsp), %rdi
movsbl 0x97(%rsp), %esi
callq 0x51d0
jmp 0x1caa0
movb $0x1, 0x7d(%rsp)
testb $0x1, 0x7d(%rsp)
jne 0x1cadb
jmp 0x1cad1
movq 0x58(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
callq 0x5558
jmp 0x1cd1a
movq 0x58(%rsp), %rdi
callq 0x5558
jmp 0x1cd0d
movzbl 0x95(%rsp), %ecx
xorl %eax, %eax
cmpl $0x30, %ecx
movb %al, 0x1f(%rsp)
jl 0x1cb05
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 0x1cb7c
testb $0x1, 0x7c(%rsp)
jne 0x1cb7c
leaq 0x7b(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq 0x10(%rsp), %rdx
leaq 0x56eb(%rip), %rsi      # 0x2222e
callq 0x53d0
jmp 0x1cb4a
leaq 0x7b(%rsp), %rdi
callq 0x5300
jmp 0x1cd0d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x7b(%rsp), %rdi
callq 0x5300
jmp 0x1cd1a
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, 0x10079(%rip)     # 0x2cc20
jne 0x1cc13
leaq 0x10070(%rip), %rdi     # 0x2cc20
callq 0x5500
cmpl $0x0, %eax
je 0x1cc13
leaq 0x6f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x54f0
movq 0x8(%rsp), %rdx
leaq 0x1002b(%rip), %rdi     # 0x2cc00
leaq 0x55d3(%rip), %rsi      # 0x221af
callq 0x53d0
jmp 0x1cbe3
leaq 0x6f(%rsp), %rdi
callq 0x5300
movq 0xf3c4(%rip), %rdi      # 0x2bfb8
leaq 0x10005(%rip), %rsi     # 0x2cc00
leaq 0xf6b6(%rip), %rdx      # 0x2c2b8
callq 0x5250
leaq 0x10012(%rip), %rdi     # 0x2cc20
callq 0x51f0
movb $0x0, 0x6e(%rsp)
leaq 0x6d(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x54f0
movq 0x58(%rsp), %rdi
movq (%rsp), %rdx
leaq 0x55fb(%rip), %rsi      # 0x22231
callq 0x53d0
jmp 0x1cc3d
leaq 0x6d(%rsp), %rdi
callq 0x5300
movslq 0x74(%rsp), %rsi
leaq 0xffad(%rip), %rdi      # 0x2cc00
callq 0x5320
movq 0x58(%rsp), %rdi
movsbl (%rax), %esi
callq 0x51d0
jmp 0x1cc67
movslq 0x70(%rsp), %rsi
leaq 0xff8d(%rip), %rdi      # 0x2cc00
callq 0x5320
movq 0x58(%rsp), %rdi
movsbl (%rax), %esi
callq 0x51d0
jmp 0x1cc87
movb $0x1, 0x6e(%rsp)
testb $0x1, 0x6e(%rsp)
jne 0x1cd0b
jmp 0x1cd01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x6f(%rsp), %rdi
callq 0x5300
leaq 0xff66(%rip), %rdi      # 0x2cc20
callq 0x51e0
jmp 0x1cd1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x6d(%rsp), %rdi
callq 0x5300
jmp 0x1cd1a
movq 0x58(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
callq 0x5558
jmp 0x1cd1a
movq 0x58(%rsp), %rdi
callq 0x5558
jmp 0x1cd0d
movq 0x60(%rsp), %rax
addq $0xa8, %rsp
retq
movq 0x88(%rsp), %rdi
callq 0x54e0
nopw (%rax,%rax)