// File: /workspace/github_cpp_makefile_star2_O2/lvandeve[P]base256/base256.cpp
// Function: Printer::encode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string encode(const std::string& s) {
    size_t lnlen = valtostr(s.size(), linenumbersbase == 16).size();
    std::string result;
    for(int i = 0; i < s.size(); i++) {
      bool wrapped = false;
      if(wrap && numbytes >= wrap) {
        result += n->lineend();
        if(n->allowlinebreaks()) result += "\n";
        numbytes = 0;
        wrapped = true;
      }
      if(printlinenumbers && numbytes == 0) {
        std::string ln = valtostr(i, linenumbersbase == 16);
        while (ln.size() < lnlen) ln = " " + ln;
        result += ln + ": ";
      }
      if(i == 0) result += n->open();
      if(wrapped) result += n->linebeg();
      unsigned char prev = (i > 0) ? s[i - 1] : 0;
      unsigned char next = (i + 1 < s.size()) ? s[i + 1] : 0;
      size_t outwidth = 0;
      std::string temp = encodeChar(s[i], prev, next, &outwidth);
      result += temp;
      if(comma) result += ",";
      if(comma || n->space()) result += " ";
      if(temp == "\n") {
        numbytes = 0;
      }
      if(n->outwidth()) {
        // For C string literals, with variable length characters, align the width
        // based on the output width rather than the input width.
        numbytes += outwidth;
      } else {
        numbytes++;
      }
    }
    result += n->close();
    return result;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %rbp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdx), %rax
leaq 0x38(%rsp), %r12
movq %rax, (%r12)
xorl %edx, %edx
cmpl $0x10, 0x14(%rsi)
sete %dl
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x8b0a
movq 0x8(%r13), %r15
movq %r13, %rdi
callq 0x4408
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movq %rbx, (%rsp)
movb $0x0, 0x10(%rbx)
movq %rbp, %rbx
xorl %eax, %eax
leaq 0x5fc0(%rip), %rbp      # 0xe6ab
movq %rbx, 0x30(%rsp)
movl %eax, 0xc(%rsp)
cltq
cmpq %rax, 0x8(%rbx)
jbe 0x8904
movl 0x8(%r14), %ecx
movl 0xc(%r14), %eax
testl %ecx, %ecx
setne %dl
cmpl %ecx, %eax
setge %bl
andb %dl, %bl
cmpb $0x1, %bl
jne 0x875d
movq (%r14), %rsi
movq (%rsi), %rax
movq %r13, %rdi
callq *0x58(%rax)
movq (%rsp), %rdi
movq %r13, %rsi
callq 0x43f0
movq %r13, %rdi
callq 0x4408
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x60(%rax)
testb %al, %al
je 0x8756
movq (%rsp), %rdi
leaq 0x4f9a(%rip), %rsi      # 0xd6eb
callq 0x43d0
andl $0x0, 0xc(%r14)
xorl %eax, %eax
testl %eax, %eax
sete %al
andb 0x10(%r14), %al
cmpb $0x1, %al
jne 0x87d9
xorl %edx, %edx
cmpl $0x10, 0x14(%r14)
sete %dl
movq %r13, %rdi
leaq 0xc(%rsp), %rsi
callq 0xaef3
cmpq %r15, 0x18(%rsp)
jae 0x87ab
movq %r12, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x8cea
movq %r13, %rdi
movq %r12, %rsi
callq 0x4250
movq %r12, %rdi
callq 0x4408
jmp 0x8781
movq %r12, %rdi
movq %r13, %rsi
leaq 0x5c5e(%rip), %rdx      # 0xe416
callq 0xc3b4
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x43f0
movq %r12, %rdi
callq 0x4408
movq %r13, %rdi
callq 0x4408
cmpl $0x0, 0xc(%rsp)
jne 0x8800
movq (%r14), %rsi
movq (%rsi), %rax
movq %r13, %rdi
callq *0x40(%rax)
movq (%rsp), %rdi
movq %r13, %rsi
callq 0x43f0
movq %r13, %rdi
callq 0x4408
testb %bl, %bl
movq 0x30(%rsp), %rbx
je 0x8829
movq (%r14), %rsi
movq (%rsi), %rax
movq %r13, %rdi
callq *0x50(%rax)
movq (%rsp), %rdi
movq %r13, %rsi
callq 0x43f0
movq %r13, %rdi
callq 0x4408
movslq 0xc(%rsp), %rax
movq (%rbx), %rcx
testq %rax, %rax
jle 0x883d
movb -0x1(%rcx,%rax), %sil
jmp 0x883f
xorl %esi, %esi
movq %rax, %rdx
incq %rdx
cmpq %rdx, 0x8(%rbx)
jbe 0x8851
movb (%rcx,%rdx), %dil
jmp 0x8853
xorl %edi, %edi
andq $0x0, 0x38(%rsp)
movzbl (%rcx,%rax), %edx
movzbl %sil, %ecx
movzbl %dil, %r8d
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %r9
callq 0xbe04
movq (%rsp), %rdi
movq %r13, %rsi
callq 0x43f0
movb 0x19(%r14), %al
cmpb $0x1, %al
jne 0x889b
movq (%rsp), %rdi
leaq 0x5e1f(%rip), %rsi      # 0xe6b1
callq 0x43d0
movb 0x19(%r14), %al
testb $0x1, %al
jne 0x88ac
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
testb %al, %al
je 0x88b8
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x43d0
movq %r13, %rdi
leaq 0x4e29(%rip), %rsi      # 0xd6eb
callq 0x833b
testb %al, %al
je 0x88d0
andl $0x0, 0xc(%r14)
movq (%r14), %rdi
movq (%rdi), %rax
callq *0x68(%rax)
testb %al, %al
je 0x88e7
movl 0xc(%r14), %eax
addl 0x38(%rsp), %eax
jmp 0x88ed
movl 0xc(%r14), %eax
incl %eax
movl %eax, 0xc(%r14)
movq %r13, %rdi
callq 0x4408
movl 0xc(%rsp), %eax
incl %eax
jmp 0x86f0
movq (%r14), %rsi
movq (%rsi), %rax
leaq 0x10(%rsp), %rdi
callq *0x48(%rax)
leaq 0x10(%rsp), %rsi
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x43f0
leaq 0x10(%rsp), %rdi
callq 0x4408
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x896b
jmp 0x8964
jmp 0x896b
jmp 0x8964
jmp 0x896b
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x4408
jmp 0x896e
jmp 0x8964
jmp 0x8964
jmp 0x896b
jmp 0x8964
jmp 0x896b
jmp 0x8964
movq %rax, %r14
jmp 0x8978
jmp 0x896b
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x4408
movq (%rsp), %rdi
callq 0x4408
movq %r14, %rdi
callq 0x43a0
nop