// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]tundra/src/JsonParse.cpp
// Function: t2::JsonParseValue(t2::JsonState*)
static const JsonValue* JsonParseValue(JsonState* json_state)
{
  MemAllocLinear  *alloc  = json_state->m_Allocator;
  JsonLexerState  *lexer  = &json_state->m_Lexer;
  JsonLexeme       l      = JsonLexerPeek(lexer);

  const JsonValue *result = nullptr;

  switch (l.m_Type)
  {
    case kJsonLexBeginObject:
      result = JsonParseObject(json_state);
      break;

    case kJsonLexBeginArray:
      result = JsonParseArray(json_state);
      break;

    case kJsonLexString:
    {
      JsonStringValue* sv = LinearAllocate<JsonStringValue>(alloc);
      sv->m_Type   = JsonValue::kString;
      sv->m_String = l.m_String;
      result       = sv;
      JsonLexerSkip(lexer);
      break;
    }

    case kJsonLexNumber:
    {
      JsonNumberValue* nv = LinearAllocate<JsonNumberValue>(alloc);
      nv->m_Type   = JsonValue::kNumber;
      nv->m_Number = l.m_Number;
      result       = nv;
      JsonLexerSkip(lexer);
      break;
    }

    case kJsonLexBoolean:
      result = l.m_Boolean ? &s_TrueValue : &s_FalseValue;
      JsonLexerSkip(lexer);
      break;

    case kJsonLexNull:
      result = &s_NullValue;
      JsonLexerSkip(lexer);
      break;

    default:
      result = JsonError(json_state, "invalid document");
      break;
  }

  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x820(%rdi), %r14
callq 0xd385
cmpl $0x9, %eax
ja 0xd103
movq %rdx, %r15
movl %eax, %eax
leaq 0x7b85(%rip), %rcx      # 0x14b44
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %rdi
callq 0xd760
movq %rax, %r14
movl $0x4, (%rax)
jmp 0xd120
movq %rbx, %rdi
callq 0xd72b
cmpl $0x4, %eax
jne 0xd1f5
movq 0x828(%rbx), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
xorl %r14d, %r14d
xorl %r13d, %r13d
movq $0x0, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0xd72b
cmpl $0x2, %eax
jne 0xd04a
testb $0x1, %r15b
je 0xd2d8
xorl %r15d, %r15d
testb $0x1, %r12b
movb $0x1, %r12b
je 0xd022
jmp 0xd2ff
cmpl $0x6, %eax
je 0xd266
testl %eax, %eax
jne 0xd2b0
notb %r15b
orb %r12b, %r15b
testb $0x1, %r15b
je 0xd331
movq %rdx, %rbp
movq %rbx, %rdi
callq 0xd72b
cmpl $0x3, %eax
jne 0xd33a
movq %rbx, %rdi
callq 0xcf8d
movq 0x18(%rsp), %r12
movq %rax, %r15
testq %rax, %rax
je 0xd311
testq %r12, %r12
je 0xd0bd
movq 0x8(%rsp), %rdi
callq 0xd74a
movq %rbp, (%rax)
movq %r15, 0x8(%rax)
andq $0x0, 0x10(%rax)
movq %rax, %rcx
movq 0x20(%rsp), %rdx
jmp 0xd0d6
movq 0x8(%rsp), %rdi
callq 0xd74a
movq %rax, %r13
movq %rbp, (%rax)
movq %r15, 0x8(%rax)
movq %rax, %rdx
xorl %ecx, %ecx
incq %r12
movq %r12, 0x18(%rsp)
movq %rcx, 0x10(%rdx)
movb $0x1, %r15b
movq %rax, 0x20(%rsp)
jmp 0xd01f
movq %rbx, %rdi
callq 0xd3a8
leaq 0x7af2(%rip), %r14      # 0x14bf0
jmp 0xd31f
leaq 0x7afe(%rip), %rsi      # 0x14c08
jmp 0xd205
movq %r14, %rdi
callq 0xd76b
movq %rax, %r14
movl $0x5, (%rax)
movq %r15, 0x8(%rax)
jmp 0xd1e8
movq %rbx, %rdi
callq 0xd72b
cmpl $0x5, %eax
jne 0xd1fe
movq 0x828(%rbx), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
xorl %r14d, %r14d
xorl %r12d, %r12d
xorl %r15d, %r15d
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0xd385
cmpl $0x7, %eax
je 0xd215
testq %r12, %r12
je 0xd181
cmpl $0x2, %eax
jne 0xd2e1
movq %rbx, %rdi
callq 0xd3a8
movq %rbx, %rdi
callq 0xcf8d
movq %rax, %r13
testq %rax, %rax
je 0xd2f3
testq %r12, %r12
je 0xd1b1
movq 0x8(%rsp), %rdi
callq 0xd755
movq %r13, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, %rcx
jmp 0xd1c6
movq 0x8(%rsp), %rdi
callq 0xd755
movq %r13, (%rax)
movq %rax, %rbp
movq %rax, %r15
xorl %ecx, %ecx
movq %rcx, 0x8(%r15)
incq %r12
movq %rax, %r15
jmp 0xd15a
leaq 0x10497(%rip), %rax     # 0x1d670
leaq 0x10498(%rip), %r14     # 0x1d678
testb $0x1, %r15b
cmovneq %rax, %r14
movq %rbx, %rdi
callq 0xd3a8
jmp 0xd31f
leaq 0x7af5(%rip), %rsi      # 0x14cf1
jmp 0xd205
leaq 0x7b51(%rip), %rsi      # 0x14d56
movq %rbx, %rdi
callq 0xd365
xorl %r14d, %r14d
jmp 0xd31f
movq %rbx, %rdi
callq 0xd3a8
movq 0x820(%rbx), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0xd776
movq %rax, %rbx
testq %rbp, %rbp
je 0xd248
movq (%rbp), %rcx
movq %rcx, (%rax)
movq 0x8(%rbp), %rbp
addq $0x8, %rax
jmp 0xd232
movq %r14, %rdi
callq 0xd78d
movq %rax, %r14
movl $0x3, (%rax)
movq %r12, 0x8(%rax)
movq %rbx, 0x10(%rax)
jmp 0xd2f3
movq 0x820(%rbx), %r14
movq %r14, %rdi
movq 0x18(%rsp), %r15
movq %r15, %rsi
callq 0xc1f3
movq %rax, %rbx
movq %r14, %rdi
movq %r15, %rsi
callq 0xd776
movq %rax, %rbp
xorl %eax, %eax
testq %r13, %r13
je 0xd2b9
movq (%r13), %rcx
movq %rcx, (%rbx,%rax)
movq 0x8(%r13), %rcx
movq %rcx, (%rbp,%rax)
movq 0x10(%r13), %r13
addq $0x8, %rax
jmp 0xd290
leaq 0x7a83(%rip), %rsi      # 0x14d3a
jmp 0xd306
movq %r14, %rdi
callq 0xd782
movq %rax, %r14
movl $0x2, (%rax)
movq %r15, 0x8(%rax)
movq %rbx, 0x10(%rax)
movq %rbp, 0x18(%rax)
jmp 0xd311
leaq 0x7a39(%rip), %rsi      # 0x14d18
jmp 0xd306
leaq 0x7a16(%rip), %rsi      # 0x14cfe
movq %rbx, %rdi
callq 0xd365
xorl %r14d, %r14d
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %rax
jmp 0xd31b
leaq 0x7a24(%rip), %rsi      # 0x14d2a
movq %rbx, %rdi
callq 0xd365
xorl %r14d, %r14d
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x79c6(%rip), %rsi      # 0x14cfe
jmp 0xd306
leaq 0x79ca(%rip), %rsi      # 0x14d0b
jmp 0xd306
jmp 0xd34f
jmp 0xd34f
jmp 0xd34f
jmp 0xd34f
jmp 0xd34f
jmp 0xd34f
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rdx
movq %rdx, 0x18(%rcx)
movq %rax, %rdi
callq 0x35e0