// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RNBasics/json.cpp
// Function: Json::valueToQuotedString[abi:cxx11](char const*)
std::string valueToQuotedString(const char* value) {
  if (value == NULL)
    return "";
  // Not sure how to handle unicode...
  if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL &&
      !containsControlCharacter(value))
    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 =
      strlen(value) * 2 + 3; // allescaped+quotes+NULL
  std::string result;
  result.reserve(maxsize); // to avoid lots of mallocs
  result += "\"";
  for (const char* c = value; *c != 0; ++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)) {
        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 0x8569c
movq %rsi, %r14
leaq 0x3c584(%rip), %rsi     # 0xc1a25
movq %r14, %rdi
callq 0x11a60
testq %rax, %rax
jne 0x854c3
movq %r14, %rax
movb (%rax), %cl
incq %rax
cmpb $0x1f, %cl
ja 0x854b1
testb %cl, %cl
je 0x856ca
movq %r14, %rdi
callq 0x11260
leaq 0x3(,%rax,2), %rsi
leaq 0x10(%rbx), %rax
movq %rax, 0x8(%rsp)
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rbx, %rdi
callq 0x11960
leaq 0x3c534(%rip), %rsi     # 0xc1a2e
movq %rbx, %rdi
callq 0x11b60
leaq 0x3c527(%rip), %r15     # 0xc1a30
leaq 0x30(%rsp), %r13
leaq 0x3b93b(%rip), %r12     # 0xc0e50
movzbl (%r14), %eax
cmpq $0xd, %rax
ja 0x85534
movslq (%r12,%rax,4), %rcx
addq %r12, %rcx
jmpq *%rcx
leaq 0x3c504(%rip), %rsi     # 0xc1a33
jmp 0x8566e
cmpl $0x22, %eax
je 0x85667
movq %r15, %rsi
cmpl $0x5c, %eax
je 0x8566e
leal -0x1(%rax), %ecx
cmpb $0x1e, %cl
ja 0x8567e
movq %r13, %rdi
callq 0x11800
movl $0x2, %edx
movq %r13, %rdi
leaq 0x3c4d6(%rip), %rsi     # 0xc1a42
callq 0x116d0
movq 0x30(%rsp), %rax
movq -0x18(%rax), %rcx
movl 0x48(%rsp,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x48(%rsp,%rcx)
movq -0x18(%rax), %rcx
orl $0x4000, 0x48(%rsp,%rcx) # imm = 0x4000
movq -0x18(%rax), %rax
leaq (%rsp,%rax), %rbp
addq $0x30, %rbp
cmpb $0x0, 0xe1(%rbp)
jne 0x855c3
movq %rbp, %rdi
movl $0x20, %esi
callq 0x11560
movb %al, 0xe0(%rbp)
movb $0x1, 0xe1(%rbp)
movb $0x30, 0xe0(%rbp)
movq 0x30(%rsp), %rax
movq -0x18(%rax), %rax
movq $0x4, 0x40(%rsp,%rax)
movsbl (%r14), %esi
movq %r13, %rdi
callq 0x11a40
leaq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x11990
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %rbx, %rdi
callq 0x111e0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x85625
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x115c0
movq %r13, %rdi
movq 0x80971(%rip), %rsi     # 0x105fa0
callq 0x112f0
leaq 0xa0(%rsp), %rdi
callq 0x111f0
jmp 0x85676
leaq 0x3c3ec(%rip), %rsi     # 0xc1a36
jmp 0x8566e
leaq 0x3c3e9(%rip), %rsi     # 0xc1a3c
jmp 0x8566e
leaq 0x3c3dd(%rip), %rsi     # 0xc1a39
jmp 0x8566e
leaq 0x3c3da(%rip), %rsi     # 0xc1a3f
jmp 0x8566e
leaq 0x3c3bf(%rip), %rsi     # 0xc1a2d
movq %rbx, %rdi
callq 0x11b60
incq %r14
jmp 0x85515
movsbl %al, %esi
movq %rbx, %rdi
callq 0x114e0
jmp 0x85676
leaq 0x3c39c(%rip), %rsi     # 0xc1a2e
movq %rbx, %rdi
callq 0x11b60
jmp 0x856b5
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x38f8d(%rip), %rdx     # 0xbe637
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x1ab58
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x3c354(%rip), %rsi     # 0xc1a2e
leaq 0x3c34e(%rip), %rdx     # 0xc1a2f
leaq 0x10(%rsp), %rdi
callq 0x1ab58
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x11b60
leaq 0x40(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x85720
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0x85728
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x30(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x3c2e3(%rip), %rsi     # 0xc1a2e
callq 0x11b60
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x85772
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x85778
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x857a6
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x115c0
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x856b5
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x115c0
jmp 0x856b5
movq %rax, %r14
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x857e5
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x115c0
jmp 0x857e5
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x85860
movq 0x20(%rsp), %rsi
jmp 0x85858
movq %rax, %r14
jmp 0x85860
jmp 0x85845
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x85825
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x115c0
jmp 0x85825
jmp 0x85822
jmp 0x85845
movq %rax, %r14
movq 0x80774(%rip), %rsi     # 0x105fa0
leaq 0x30(%rsp), %rdi
callq 0x112f0
leaq 0xa0(%rsp), %rdi
callq 0x111f0
jmp 0x85848
movq %rax, %r14
movq 0x8(%rsp), %rax
movq (%rbx), %rdi
cmpq %rax, %rdi
je 0x85860
movq (%rax), %rsi
incq %rsi
callq 0x115c0
movq %r14, %rdi
callq 0x11a70