// File: tomfunkhouser[P]gaps/pkgs/RNBasics/json.cpp
// Function: Json::Reader::decodeString(Json::Reader::Token&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool Reader::decodeString(Token& token, std::string& decoded) {
  decoded.reserve(static_cast<size_t>(token.end_ - token.start_ - 2));
  Location current = token.start_ + 1; // skip '"'
  Location end = token.end_ - 1;       // do not include '"'
  while (current != end) {
    Char c = *current++;
    if (c == '"')
      break;
    else if (c == '\\') {
      if (current == end)
        return addError("Empty escape sequence in string", token, current);
      Char escape = *current++;
      switch (escape) {
      case '"':
        decoded += '"';
        break;
      case '/':
        decoded += '/';
        break;
      case '\\':
        decoded += '\\';
        break;
      case 'b':
        decoded += '\b';
        break;
      case 'f':
        decoded += '\f';
        break;
      case 'n':
        decoded += '\n';
        break;
      case 'r':
        decoded += '\r';
        break;
      case 't':
        decoded += '\t';
        break;
      case 'u': {
        unsigned int unicode;
        if (!decodeUnicodeCodePoint(token, current, end, unicode))
          return false;
        decoded += codePointToUTF8(unicode);
      } break;
      default:
        return addError("Bad escape sequence in string", token, current);
      }
    } else {
      decoded += c;
    }
  }
  return true;
}

// Assembly:
subq $0xf8, %rsp
movq %rdi, 0xe8(%rsp)
movq %rsi, 0xe0(%rsp)
movq %rdx, 0xd8(%rsp)
movq 0xe8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xd8(%rsp), %rdi
movq 0xe0(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0xe0(%rsp), %rax
movq 0x8(%rax), %rax
subq %rax, %rsi
subq $0x2, %rsi
callq 0x12af0
movq 0xe0(%rsp), %rax
movq 0x8(%rax), %rax
addq $0x1, %rax
movq %rax, 0xd0(%rsp)
movq 0xe0(%rsp), %rax
movq 0x10(%rax), %rax
addq $-0x1, %rax
movq %rax, 0xc8(%rsp)
movq 0xd0(%rsp), %rax
cmpq 0xc8(%rsp), %rax
je 0xe29ee
movq 0xd0(%rsp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0xd0(%rsp)
movb (%rax), %al
movb %al, 0xc7(%rsp)
movsbl 0xc7(%rsp), %eax
cmpl $0x22, %eax
jne 0xe2690
jmp 0xe29ee
movsbl 0xc7(%rsp), %eax
cmpl $0x5c, %eax
jne 0xe29d0
movq 0xd0(%rsp), %rax
cmpq 0xc8(%rsp), %rax
jne 0xe2781
leaq 0x9f(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x12c30
movq 0x28(%rsp), %rdx
leaq 0x87cd3(%rip), %rsi     # 0x16a3a8
leaq 0xa0(%rsp), %rdi
callq 0x22830
jmp 0xe26e4
movq 0x30(%rsp), %rdi
movq 0xe0(%rsp), %rdx
movq 0xd0(%rsp), %rcx
leaq 0xa0(%rsp), %rsi
callq 0xe0aa0
movb %al, 0x27(%rsp)
jmp 0xe270c
movb 0x27(%rsp), %al
andb $0x1, %al
movb %al, 0xf7(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x12430
leaq 0x9f(%rsp), %rdi
callq 0x12760
jmp 0xe29f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
jmp 0xe276f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x12430
leaq 0x9f(%rsp), %rdi
callq 0x12760
jmp 0xe2a07
movq 0xd0(%rsp), %rax
movq %rax, %rcx
incq %rcx
movq %rcx, 0xd0(%rsp)
movb (%rax), %al
movb %al, 0x8b(%rsp)
movsbl 0x8b(%rsp), %eax
addl $-0x22, %eax
movl %eax, %ecx
movq %rcx, 0x18(%rsp)
subl $0x53, %eax
ja 0xe291f
movq 0x18(%rsp), %rax
leaq 0x87279(%rip), %rcx     # 0x169a40
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xd8(%rsp), %rdi
movl $0x22, %esi
callq 0x12450
jmp 0xe29ce
movq 0xd8(%rsp), %rdi
movl $0x2f, %esi
callq 0x12450
jmp 0xe29ce
movq 0xd8(%rsp), %rdi
movl $0x5c, %esi
callq 0x12450
jmp 0xe29ce
movq 0xd8(%rsp), %rdi
movl $0x8, %esi
callq 0x12450
jmp 0xe29ce
movq 0xd8(%rsp), %rdi
movl $0xc, %esi
callq 0x12450
jmp 0xe29ce
movq 0xd8(%rsp), %rdi
movl $0xa, %esi
callq 0x12450
jmp 0xe29ce
movq 0xd8(%rsp), %rdi
movl $0xd, %esi
callq 0x12450
jmp 0xe29ce
movq 0xd8(%rsp), %rdi
movl $0x9, %esi
callq 0x12450
jmp 0xe29ce
movq 0x30(%rsp), %rdi
movq 0xe0(%rsp), %rsi
movq 0xc8(%rsp), %rcx
leaq 0xd0(%rsp), %rdx
leaq 0x84(%rsp), %r8
callq 0xe3880
testb $0x1, %al
jne 0xe28c3
movb $0x0, 0xf7(%rsp)
jmp 0xe29f6
movl 0x84(%rsp), %esi
leaq 0x60(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0xe3b60
movq 0x10(%rsp), %rsi
movq 0xd8(%rsp), %rdi
callq 0x12910
jmp 0xe28ed
leaq 0x60(%rsp), %rdi
callq 0x12430
jmp 0xe29ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x12430
jmp 0xe2a07
leaq 0x3f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x12c30
movq 0x8(%rsp), %rdx
leaq 0x87a8e(%rip), %rsi     # 0x16a3c8
leaq 0x40(%rsp), %rdi
callq 0x22830
jmp 0xe2946
movq 0x30(%rsp), %rdi
movq 0xe0(%rsp), %rdx
movq 0xd0(%rsp), %rcx
leaq 0x40(%rsp), %rsi
callq 0xe0aa0
movb %al, 0x7(%rsp)
jmp 0xe296b
movb 0x7(%rsp), %al
andb $0x1, %al
movb %al, 0xf7(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x12430
leaq 0x3f(%rsp), %rdi
callq 0x12760
jmp 0xe29f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
jmp 0xe29c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x12430
leaq 0x3f(%rsp), %rdi
callq 0x12760
jmp 0xe2a07
jmp 0xe29e7
movb 0xc7(%rsp), %al
movq 0xd8(%rsp), %rdi
movsbl %al, %esi
callq 0x12450
jmp 0xe29e9
jmp 0xe2648
movb $0x1, 0xf7(%rsp)
movb 0xf7(%rsp), %al
andb $0x1, %al
addq $0xf8, %rsp
retq
movq 0x90(%rsp), %rdi
callq 0x12c20
nopw %cs:(%rax,%rax)