// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]tundra/src/JsonParse.cpp
// Function: t2::GetStringLexeme(t2::JsonLexerState*)
static JsonLexeme GetStringLexeme(JsonLexerState* state)
{
  JsonLexeme result;

  char *rptr = state->m_Cursor;
  char *wptr = rptr;
  ++rptr; // skip quote

  result.m_Type   = kJsonLexString;
  result.m_String = wptr;

  for (;;)
  {
    char ch = *rptr++;
    if (0 == ch)
      return JsonLexerError(state, "end of file inside string");

    if ('"' == ch)
    {
      *wptr = '\0';
      break;
    }
    else if ('\\' == ch)
    {
      char next = *rptr++;
      switch (next)
      {
        case '\\': *wptr++ = '\\'; break;
        case '"': *wptr++ = '"'; break;
        case '/': *wptr++ = '/'; break;
        case 'b': *wptr++ = '\b'; break;
        case 'f': *wptr++ = '\f'; break;
        case 'n': *wptr++ = '\n'; break;
        case 'r': *wptr++ = '\r'; break;
        case 't': *wptr++ = '\t'; break;
        case 'u':
        {
          uint32_t hex_code = 0;
          for (int i = 0; i < 4; ++i)
          {
            char code = *rptr++;
            if (0 == code)
            {
              return JsonLexerError(state, "end of file inside escape");
            }
            else if (isxdigit(code))
            {
              int lc = tolower(code);
              hex_code <<= 4;
              if (lc >= 'a' && lc <= 'f')
                hex_code |= lc - 'a' + 10;
              else
                hex_code |= lc - '0';
            }
            else
            {
              return JsonLexerError(state, "expected hex number in \\u escape");
            }
          }

          if (hex_code > 127)
            return JsonLexerError(state, "we currently only support ASCII");

          *wptr++ = (char) hex_code;
          break;
        }

        default:
          return JsonLexerError(state, "unsupported escape code");
      }
    }
    else
    {
      *wptr++ = ch;
    }
  }

  state->m_Cursor = rptr;
  return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %al
movb %al, -0x39(%rbp)
movsbl -0x39(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x18134
movq -0x18(%rbp), %rdi
leaq 0xcead(%rip), %rsi      # 0x24fd0
callq 0x18520
movl %eax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x183a9
movsbl -0x39(%rbp), %ecx
movl $0x22, %eax
cmpl %ecx, %eax
jne 0x1814d
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
jmp 0x1838e
movsbl -0x39(%rbp), %ecx
movl $0x5c, %eax
cmpl %ecx, %eax
jne 0x18373
movq -0x30(%rbp), %rax
movq %rax, %rcx
incq %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %al
movb %al, -0x3a(%rbp)
movsbl -0x3a(%rbp), %eax
addl $-0x22, %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x53, %eax
ja 0x18358
movq -0x58(%rbp), %rax
leaq 0xcc06(%rip), %rcx      # 0x24d98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0x5c, (%rax)
jmp 0x18371
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0x22, (%rax)
jmp 0x18371
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0x2f, (%rax)
jmp 0x18371
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0x8, (%rax)
jmp 0x18371
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0xc, (%rax)
jmp 0x18371
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0xa, (%rax)
jmp 0x18371
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0xd, (%rax)
jmp 0x18371
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb $0x9, (%rax)
jmp 0x18371
movl $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
cmpl $0x4, -0x44(%rbp)
jge 0x18321
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %al
movb %al, -0x45(%rbp)
movsbl -0x45(%rbp), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x182a5
movq -0x18(%rbp), %rdi
leaq 0xcd56(%rip), %rsi      # 0x24fea
callq 0x18520
movl %eax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x183a9
movsbl -0x45(%rbp), %edi
callq 0x3090
cmpl $0x0, %eax
je 0x182f3
movsbl -0x45(%rbp), %edi
callq 0x3490
movl %eax, -0x4c(%rbp)
movl -0x40(%rbp), %eax
shll $0x4, %eax
movl %eax, -0x40(%rbp)
cmpl $0x61, -0x4c(%rbp)
jl 0x182e5
cmpl $0x66, -0x4c(%rbp)
jg 0x182e5
movl -0x4c(%rbp), %eax
subl $0x61, %eax
addl $0xa, %eax
orl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x182f1
movl -0x4c(%rbp), %eax
subl $0x30, %eax
orl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x1830f
movq -0x18(%rbp), %rdi
leaq 0xcd06(%rip), %rsi      # 0x25004
callq 0x18520
movl %eax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x183a9
jmp 0x18311
jmp 0x18313
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x18261
cmpl $0x7f, -0x40(%rbp)
jbe 0x18340
movq -0x18(%rbp), %rdi
leaq 0xccf3(%rip), %rsi      # 0x25025
callq 0x18520
movl %eax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x183a9
movl -0x40(%rbp), %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movb %cl, (%rax)
jmp 0x18371
movq -0x18(%rbp), %rdi
leaq 0xcce2(%rip), %rsi      # 0x25045
callq 0x18520
movl %eax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x183a9
jmp 0x18387
movb -0x39(%rbp), %cl
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movb %cl, (%rax)
jmp 0x18389
jmp 0x180fa
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rdx
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)