// File: /workspace/github_cpp_makefile_star2_O3/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 0x8364e
movq %rsi, %r14
leaq 0x3c5d9(%rip), %rsi     # 0xbfa32
movq %r14, %rdi
callq 0x11a50
testq %rax, %rax
jne 0x8347b
movq %r14, %rax
movb (%rax), %cl
incq %rax
cmpb $0x1f, %cl
ja 0x83469
testb %cl, %cl
je 0x8367c
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 0x11950
leaq 0x3c589(%rip), %rsi     # 0xbfa3b
movq %rbx, %rdi
callq 0x11b50
leaq 0x3c57c(%rip), %r15     # 0xbfa3d
leaq 0x30(%rsp), %r13
leaq 0x3b993(%rip), %r12     # 0xbee60
movzbl (%r14), %eax
cmpq $0xd, %rax
ja 0x834ec
movslq (%r12,%rax,4), %rcx
addq %r12, %rcx
jmpq *%rcx
leaq 0x3c559(%rip), %rsi     # 0xbfa40
jmp 0x83620
cmpl $0x22, %eax
je 0x83619
movq %r15, %rsi
cmpl $0x5c, %eax
je 0x83620
leal -0x1(%rax), %ecx
cmpb $0x1e, %cl
ja 0x83630
movq %r13, %rdi
callq 0x117f0
movl $0x2, %edx
movq %r13, %rdi
leaq 0x3c52b(%rip), %rsi     # 0xbfa4f
callq 0x116c0
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), %rcx
leaq (%rsp,%rcx), %rbp
addq $0x30, %rbp
cmpb $0x0, 0xe1(%rbp)
jne 0x8357a
movq %rbp, %rdi
movl $0x20, %esi
callq 0x11560
movb $0x1, 0xe1(%rbp)
movq 0x30(%rsp), %rax
movb $0x30, 0xe0(%rbp)
movq -0x18(%rax), %rax
movq $0x4, 0x40(%rsp,%rax)
movsbl (%r14), %esi
movq %r13, %rdi
callq 0x11a30
leaq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x11980
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 0x835d7
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x115c0
movq %r13, %rdi
movq 0x809bf(%rip), %rsi     # 0x103fa0
callq 0x112f0
leaq 0xa0(%rsp), %rdi
callq 0x111f0
jmp 0x83628
leaq 0x3c447(%rip), %rsi     # 0xbfa43
jmp 0x83620
leaq 0x3c444(%rip), %rsi     # 0xbfa49
jmp 0x83620
leaq 0x3c438(%rip), %rsi     # 0xbfa46
jmp 0x83620
leaq 0x3c435(%rip), %rsi     # 0xbfa4c
jmp 0x83620
leaq 0x3c41a(%rip), %rsi     # 0xbfa3a
movq %rbx, %rdi
callq 0x11b50
incq %r14
jmp 0x834cd
movsbl %al, %esi
movq %rbx, %rdi
callq 0x114e0
jmp 0x83628
leaq 0x3c3f7(%rip), %rsi     # 0xbfa3b
movq %rbx, %rdi
callq 0x11b50
jmp 0x83667
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x38fd8(%rip), %rdx     # 0xbc634
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x1a88c
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 0x3c3af(%rip), %rsi     # 0xbfa3b
leaq 0x3c3a9(%rip), %rdx     # 0xbfa3c
leaq 0x10(%rsp), %rdi
callq 0x1a88c
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x11b50
leaq 0x40(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x836d2
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0x836da
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 0x3c33e(%rip), %rsi     # 0xbfa3b
callq 0x11b50
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x83724
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x8372a
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 0x83758
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x115c0
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x83667
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x115c0
jmp 0x83667
movq %rax, %r14
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x83797
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x115c0
jmp 0x83797
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x83812
movq 0x20(%rsp), %rsi
jmp 0x8380a
movq %rax, %r14
jmp 0x83812
jmp 0x837f7
movq %rax, %r14
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x837d7
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x115c0
jmp 0x837d7
jmp 0x837d4
jmp 0x837f7
movq %rax, %r14
movq 0x807c2(%rip), %rsi     # 0x103fa0
leaq 0x30(%rsp), %rdi
callq 0x112f0
leaq 0xa0(%rsp), %rdi
callq 0x111f0
jmp 0x837fa
movq %rax, %r14
movq 0x8(%rsp), %rax
movq (%rbx), %rdi
cmpq %rax, %rdi
je 0x83812
movq (%rax), %rsi
incq %rsi
callq 0x115c0
movq %r14, %rdi
callq 0x11a60