// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RNBasics/json.cpp
// Function: Json::valueToQuotedStringN[abi:cxx11](char const*, unsigned int)
static std::string valueToQuotedStringN(const char* value, unsigned length) {
  if (value == NULL)
    return "";
  // Not sure how to handle unicode...
  if (strnpbrk(value, "\"\\\b\f\n\r\t", length) == NULL &&
      !containsControlCharacter0(value, length))
    return std::string("\"") + value + "\"";
  // We have to walk value and escape any special characters.
  // Appending to std::string is not efficient, but this should be rare.
  // (Note: forward slashes are *not* rare, but I am not escaping them.)
  std::string::size_type maxsize =
      length * 2 + 3; // allescaped+quotes+NULL
  std::string result;
  result.reserve(maxsize); // to avoid lots of mallocs
  result += "\"";
  char const* end = value + length;
  for (const char* c = value; c != end; ++c) {
    switch (*c) {
    case '\"':
      result += "\\\"";
      break;
    case '\\':
      result += "\\\\";
      break;
    case '\b':
      result += "\\b";
      break;
    case '\f':
      result += "\\f";
      break;
    case '\n':
      result += "\\n";
      break;
    case '\r':
      result += "\\r";
      break;
    case '\t':
      result += "\\t";
      break;
    // case '/':
    // Even though \/ is considered a legal escape in JSON, a bare
    // slash is also legal, so I see no reason to escape it.
    // (I hope I am not misunderstanding something.)
    // blep notes: actually escaping \/ may be useful in javascript to avoid </
    // sequence.
    // Should add a flag to allow this compatibility mode and prevent this
    // sequence from occurring.
    default:
      if ((isControlCharacter(*c)) || (*c == 0)) {
        std::ostringstream oss;
        oss << "\\u" << std::hex << std::uppercase << std::setfill('0')
            << std::setw(4) << static_cast<int>(*c);
        result += oss.str();
      } else {
        result += *c;
      }
      break;
    }
  }
  result += "\"";
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, %rbx
testq %rsi, %rsi
je 0x775a6
movq %rsi, %r14
movl %edx, %r13d
leaq (%rsi,%r13), %rax
leaq 0x353c1(%rip), %rcx     # 0xac942
cmpq %rax, %rsi
jae 0x775bf
movb (%rsi), %dil
xorl %r8d, %r8d
cmpq $0x7, %r8
je 0x775a1
leaq 0x1(%r8), %r9
cmpb %dil, (%r8,%rcx)
movq %r9, %r8
jne 0x7758c
jmp 0x775d5
incq %rsi
jmp 0x77581
leaq 0x31fb7(%rip), %rsi     # 0xa9564
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x196d0
jmp 0x77746
xorl %eax, %eax
cmpq %rax, %r13
je 0x7775b
cmpb $0x20, (%r14,%rax)
leaq 0x1(%rax), %rax
jae 0x775c1
leal 0x3(,%rdx,2), %esi
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rbx, %rdi
callq 0x11960
leaq 0x35350(%rip), %rsi     # 0xac94b
movq %rbx, %rdi
callq 0x11b70
xorl %ebp, %ebp
leaq 0x347bc(%rip), %r15     # 0xabdc8
cmpq %rbp, %r13
je 0x77737
movb (%r14,%rbp), %al
movzbl %al, %ecx
leal -0x8(%rcx), %edx
cmpl $0x5, %edx
ja 0x77639
movslq (%r15,%rdx,4), %rcx
addq %r15, %rcx
jmpq *%rcx
leaq 0x3531c(%rip), %rsi     # 0xac950
jmp 0x7771a
leaq 0x3530d(%rip), %rsi     # 0xac94d
cmpl $0x5c, %ecx
je 0x7771a
cmpl $0x22, %ecx
jne 0x7765a
leaq 0x352f5(%rip), %rsi     # 0xac94a
jmp 0x7771a
cmpb $0x1f, %al
ja 0x7772a
leaq 0x30(%rsp), %r12
movq %r12, %rdi
callq 0x11800
movq %r12, %rdi
leaq 0x352e6(%rip), %rsi     # 0xac95f
callq 0x115a0
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movl 0x18(%rax,%rdx), %esi
andl $-0x4b, %esi
orl $0x8, %esi
movl %esi, 0x18(%rax,%rdx)
movq -0x18(%rcx), %rcx
orl $0x4000, 0x18(%rax,%rcx) # imm = 0x4000
movq %rax, %rdi
pushq $0x30
popq %rsi
callq 0x11970
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x4, 0x10(%rax,%rcx)
movsbl (%r14,%rbp), %esi
movq %rax, %rdi
callq 0x11a50
leaq 0x10(%rsp), %r12
movq %r12, %rdi
leaq 0x38(%rsp), %rsi
callq 0x119a0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x11bd0
movq %r12, %rdi
callq 0x11270
leaq 0x30(%rsp), %rdi
callq 0x11180
jmp 0x77722
leaq 0x3525d(%rip), %rsi     # 0xac95c
jmp 0x7771a
leaq 0x3524e(%rip), %rsi     # 0xac956
jmp 0x7771a
leaq 0x35242(%rip), %rsi     # 0xac953
jmp 0x7771a
leaq 0x3523f(%rip), %rsi     # 0xac959
movq %rbx, %rdi
callq 0x11b70
incq %rbp
jmp 0x7760c
movsbl %al, %esi
movq %rbx, %rdi
callq 0x114e0
jmp 0x77722
leaq 0x3520d(%rip), %rsi     # 0xac94b
movq %rbx, %rdi
callq 0x11b70
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x351e9(%rip), %rsi     # 0xac94b
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x196d0
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %r14, %rdx
callq 0x1970b
leaq 0x351c1(%rip), %rdx     # 0xac94b
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x1970b
leaq 0x30(%rsp), %rdi
callq 0x11270
leaq 0x10(%rsp), %rdi
callq 0x11270
jmp 0x77746
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x11270
jmp 0x777bf
movq %rax, %r14
leaq 0x10(%rsp), %rdi
jmp 0x777f7
movq %rax, %r14
jmp 0x777fc
jmp 0x777f1
jmp 0x777f1
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x11270
jmp 0x777e5
jmp 0x777e2
jmp 0x777f1
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x11180
jmp 0x777f4
movq %rax, %r14
movq %rbx, %rdi
callq 0x11270
movq %r14, %rdi
callq 0x11a80