// File: /workspace/github_cpp_makefile_star2_O3/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 0x7e76(%rip), %rsi      # 0x76810
movq %r14, %rdi
callq 0x27af0
testq %rax, %rax
jne 0x6e9bc
movq %r14, %rax
movb (%rax), %cl
incq %rax
cmpb $0x1f, %cl
ja 0x6e9aa
testb %cl, %cl
je 0x6eb8a
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 0x27960
leaq 0x2934(%rip), %rsi      # 0x71327
movq %rbx, %rdi
callq 0x27c00
leaq 0x7e16(%rip), %r13      # 0x76818
leaq 0x30(%rsp), %r12
leaq 0x7d2a(%rip), %rbp      # 0x76738
movzbl (%r14), %eax
cmpq $0xd, %rax
ja 0x6ea2e
movslq (%rbp,%rax,4), %rcx
addq %rbp, %rcx
jmpq *%rcx
leaq 0x7df2(%rip), %rsi      # 0x7681b
jmp 0x6eb49
cmpl $0x22, %eax
je 0x6eb42
movq %r13, %rsi
cmpl $0x5c, %eax
je 0x6eb49
leal -0x1(%rax), %ecx
cmpb $0x1e, %cl
ja 0x6eb59
movq %r12, %rdi
callq 0x277d0
movl $0x2, %edx
movq %r12, %rdi
leaq 0x7dc4(%rip), %rsi      # 0x7682a
callq 0x276b0
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), %r15
addq $0x30, %r15
cmpb $0x0, 0xe1(%r15)
jne 0x6eabe
movq %r15, %rdi
movl $0x20, %esi
callq 0x27590
movb $0x1, 0xe1(%r15)
movq 0x30(%rsp), %rax
movb $0x30, 0xe0(%r15)
movq -0x18(%rax), %rax
movq $0x4, 0x40(%rsp,%rax)
movsbl (%r14), %esi
movq %r12, %rdi
callq 0x27ab0
leaq 0x8(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x27990
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 0x6eb14
callq 0x27560
movq %r12, %rdi
callq 0x27160
jmp 0x6eb51
leaq 0x7cf9(%rip), %rsi      # 0x7681e
jmp 0x6eb49
leaq 0x7cf6(%rip), %rsi      # 0x76824
jmp 0x6eb49
leaq 0x7cea(%rip), %rsi      # 0x76821
jmp 0x6eb49
leaq 0x7ce7(%rip), %rsi      # 0x76827
jmp 0x6eb49
leaq 0x2856(%rip), %rsi      # 0x7139f
movq %rbx, %rdi
callq 0x27c00
incq %r14
jmp 0x6ea0e
movsbl %al, %esi
movq %rbx, %rdi
callq 0x274e0
jmp 0x6eb51
leaq 0x27ba(%rip), %rsi      # 0x71327
movq %rbx, %rdi
callq 0x27c00
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 0x278d(%rip), %rsi      # 0x71327
leaq 0x2787(%rip), %rdx      # 0x71328
leaq 0x8(%rsp), %rdi
callq 0x2f1a0
leaq 0x40(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x2f10a
leaq 0x30(%rsp), %rdi
movq %r14, %rsi
callq 0x27c00
leaq 0x10(%rbx), %r13
movq %r13, (%rbx)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x2f10a
leaq 0x272b(%rip), %rsi      # 0x71327
movq %rbx, %rdi
callq 0x27c00
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x6ec13
callq 0x27560
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x6eb75
callq 0x27560
jmp 0x6eb75
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r13, %rdi
je 0x6ec42
callq 0x27560
jmp 0x6ec42
jmp 0x6ec3f
movq %rax, %r14
movq 0x30(%rsp), %rdi
cmpq %r12, %rdi
je 0x6ec56
callq 0x27560
jmp 0x6ec56
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x6ecaa
jmp 0x6ecaf
movq %rax, %r14
jmp 0x6ecaf
jmp 0x6ec9d
movq %rax, %r14
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6ec89
callq 0x27560
jmp 0x6ec89
jmp 0x6ec86
jmp 0x6ec9d
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x27160
jmp 0x6eca0
movq %rax, %rdi
callq 0x2e1cd
movq %rax, %r14
movq (%rbx), %rdi
cmpq 0x28(%rsp), %rdi
je 0x6ecaf
callq 0x27560
movq %r14, %rdi
callq 0x27b10
nop