// File: /workspace/github_cpp_makefile_star2_O3/eatonphil[P]cpp-json/json.cpp
// Function: json::lex_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
std::tuple<JSONToken, int, std::string> lex_string(std::string raw_json,
                                                   int original_index) {
  int index = original_index;
  JSONToken token{"", JSONTokenType::String, index};
  std::string value = "";
  auto c = raw_json[index];
  if (c != '"') {
    return {token, original_index, ""};
  }
  index++;

  // TODO: handle nested quotes
  while (c = raw_json[index], c != '"') {
    if (index == raw_json.length()) {
      return {
          token, index,
          format_error("Unexpected EOF while lexing string", raw_json, index)};
    }

    token.value += c;
    index++;
  }
  index++;

  return {token, index, ""};
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movl %edx, -0x30(%rbp)
movl %edx, -0x2c(%rbp)
leaq -0xd8(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x8823(%rip), %r12      # 0xb207
leaq -0xe8(%rbp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r12, %rdx
callq 0x8c32
movl $0x0, 0x20(%r13)
movl %r15d, 0x24(%r13)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%r13)
leaq -0xa0(%rbp), %r13
movq %r13, -0x10(%r13)
leaq -0xb0(%rbp), %rdi
movq %r12, %rsi
movq %r12, %rdx
callq 0x8c32
movslq %r15d, %rax
movq (%r14), %rcx
cmpb $0x22, (%rcx,%rax)
jne 0x2a6b
leaq -0xe8(%rbp), %r15
movslq -0x2c(%rbp), %rax
leaq 0x1(%rax), %rdx
movl %edx, -0x2c(%rbp)
movq (%r14), %rcx
movb 0x1(%rcx,%rax), %cl
cmpb $0x22, %cl
je 0x2a71
cmpq %rdx, 0x8(%r14)
je 0x2af3
movsbl %cl, %esi
movq %r15, %rdi
callq 0x8cd0
jmp 0x2a3d
leaq -0x30(%rbp), %rdx
jmp 0x2a7a
addl $0x2, %eax
leaq -0x2c(%rbp), %rdx
movl %eax, (%rdx)
leaq 0x8786(%rip), %rcx      # 0xb207
leaq -0xe8(%rbp), %rsi
movq %rbx, %rdi
callq 0x6d9a
movq -0xb0(%rbp), %rdi
cmpq %r13, %rdi
je 0x2aab
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0x2abc
callq 0x6fa2
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x2ade
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq %rbx, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x60(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x8599(%rip), %rsi      # 0xb09b
leaq 0x85b4(%rip), %rdx      # 0xb0bd
leaq -0x70(%rbp), %rdi
callq 0x8c32
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rdi
callq 0x84f0
movl -0x2c(%rbp), %ecx
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x24ae
leaq -0xe8(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
leaq -0x90(%rbp), %rcx
movq %rbx, %rdi
callq 0x6e6c
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b78
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x2b8d
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x2a90
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2a90
movq %rax, %rbx
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2bcc
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2bcc
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x2be6
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2be6
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x2c09
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x2c09
jmp 0x2c06
jmp 0x2c06
movq %rax, %rbx
jmp 0x2c24
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r13, %rdi
je 0x2c24
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0xe8(%rbp), %rdi
callq 0x6734
movq %rbx, %rdi
callq 0x2290