// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/third_party/jsoncpp/json_writer.cpp
// Function: Json::valueToQuotedString[abi:cxx11](char const*)
std::string valueToQuotedString( const char *value )
{
   // 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 %rsi, %r14
movq %rdi, %rbx
leaq 0x8896(%rip), %rsi      # 0x77814
movq %r14, %rdi
callq 0x27b00
testq %rax, %rax
jne 0x6efa0
movq %r14, %rax
movb (%rax), %cl
incq %rax
cmpb $0x1f, %cl
ja 0x6ef8e
testb %cl, %cl
je 0x6f175
movq %r14, %rdi
callq 0x272f0
leaq 0x3(,%rax,2), %rsi
leaq 0x10(%rbx), %rax
movq %rax, 0x28(%rsp)
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rbx, %rdi
callq 0x27970
leaq 0x3350(%rip), %rsi      # 0x72327
movq %rbx, %rdi
callq 0x27c10
leaq 0x8836(%rip), %r13      # 0x7781c
leaq 0x30(%rsp), %r12
leaq 0x874a(%rip), %rbp      # 0x7773c
movzbl (%r14), %eax
cmpq $0xd, %rax
ja 0x6f012
movslq (%rbp,%rax,4), %rcx
addq %rbp, %rcx
jmpq *%rcx
leaq 0x8812(%rip), %rsi      # 0x7781f
jmp 0x6f134
cmpl $0x22, %eax
je 0x6f12d
movq %r13, %rsi
cmpl $0x5c, %eax
je 0x6f134
leal -0x1(%rax), %ecx
cmpb $0x1e, %cl
ja 0x6f144
movq %r12, %rdi
callq 0x277e0
movl $0x2, %edx
movq %r12, %rdi
leaq 0x87e4(%rip), %rsi      # 0x7782e
callq 0x276c0
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), %r15
addq $0x30, %r15
cmpb $0x0, 0xe1(%r15)
jne 0x6f0a4
movq %r15, %rdi
movl $0x20, %esi
callq 0x27590
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x30, 0xe0(%r15)
movq 0x30(%rsp), %rax
movq -0x18(%rax), %rax
movq $0x4, 0x40(%rsp,%rax)
movsbl (%r14), %esi
movq %r12, %rdi
callq 0x27ac0
leaq 0x8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x279a0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x27210
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6f0ff
callq 0x27560
movq %r12, %rdi
callq 0x27160
jmp 0x6f13c
leaq 0x8712(%rip), %rsi      # 0x77822
jmp 0x6f134
leaq 0x870f(%rip), %rsi      # 0x77828
jmp 0x6f134
leaq 0x8703(%rip), %rsi      # 0x77825
jmp 0x6f134
leaq 0x8700(%rip), %rsi      # 0x7782b
jmp 0x6f134
leaq 0x326b(%rip), %rsi      # 0x7239f
movq %rbx, %rdi
callq 0x27c10
incq %r14
jmp 0x6eff2
movsbl %al, %esi
movq %rbx, %rdi
callq 0x274e0
jmp 0x6f13c
leaq 0x31cf(%rip), %rsi      # 0x72327
movq %rbx, %rdi
callq 0x27c10
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x31a2(%rip), %rsi      # 0x72327
leaq 0x319c(%rip), %rdx      # 0x72328
leaq 0x8(%rsp), %rdi
callq 0x2f1b2
leaq 0x40(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x2f122
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x27c10
leaq 0x10(%rbx), %r13
movq %r13, (%rbx)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x2f122
leaq 0x3140(%rip), %rsi      # 0x72327
movq %rbx, %rdi
callq 0x27c10
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x6f1fe
callq 0x27560
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x6f160
callq 0x27560
jmp 0x6f160
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r13, %rdi
je 0x6f22d
callq 0x27560
jmp 0x6f22d
jmp 0x6f22a
movq %rax, %r14
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x6f241
callq 0x27560
jmp 0x6f241
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x6f295
jmp 0x6f29a
movq %rax, %r14
jmp 0x6f29a
jmp 0x6f288
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6f274
callq 0x27560
jmp 0x6f274
jmp 0x6f271
jmp 0x6f288
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x27160
jmp 0x6f28b
movq %rax, %rdi
callq 0x2e1ed
movq %rax, %r14
movq (%rbx), %rdi
cmpq 0x28(%rsp), %rdi
je 0x6f29a
callq 0x27560
movq %r14, %rdi
callq 0x27b20