// File: /workspace/github_c_makefile_star2_O1/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 $0x58, %rsp
movq %rdi, %rbx
movq 0x820(%rdi), %r14
cmpl $0xc, 0x10(%rdi)
jne 0xe497
movq %rbx, %rdi
callq 0xea77
movl %eax, 0x10(%rbx)
movq %rdx, 0x18(%rbx)
movl 0x10(%rbx), %eax
movsd 0x18(%rbx), %xmm0
movsd %xmm0, 0x48(%rsp)
cmpq $0x9, %rax
ja 0xe77d
leaq 0x86ae(%rip), %rcx      # 0x16b64
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x10, %esi
movl $0x8, %edx
movq %r14, %rdi
callq 0xf030
movq %rax, %r15
movl $0x4, (%rax)
movq 0x48(%rsp), %rax
movq %rax, 0x8(%r15)
jmp 0xe7d8
movl $0xc, 0x10(%rbx)
movq 0x828(%rbx), %rax
movq %rax, 0x28(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x30(%rsp)
leaq 0x420(%rbx), %rax
movq %rax, 0x18(%rsp)
xorl %r15d, %r15d
xorl %r12d, %r12d
movq $0x0, 0x38(%rsp)
movq $0x0, 0x20(%rsp)
xorl %ebp, %ebp
movl $0x0, 0x10(%rsp)
movl $0x0, 0x8(%rsp)
testb $0x1, %bpl
jne 0xe98e
movl 0x10(%rbx), %eax
cmpl $0xc, %eax
jne 0xe556
movq %rbx, %rdi
callq 0xea77
jmp 0xe561
movq 0x18(%rbx), %rdx
movl $0xc, 0x10(%rbx)
movq %rdx, 0x50(%rsp)
cmpl $0x6, %eax
je 0xe5d4
cmpl $0x2, %eax
je 0xe59f
testl %eax, %eax
jne 0xe5df
testb $0x1, 0x8(%rsp)
je 0xe586
testb $0x1, 0x10(%rsp)
je 0xe6ea
movl 0x10(%rbx), %eax
cmpl $0xc, %eax
jne 0xe625
movq %rbx, %rdi
callq 0xea77
jmp 0xe62c
testb $0x1, 0x8(%rsp)
je 0xe602
testb $0x1, 0x10(%rsp)
je 0xe6d7
movl 0x8(%rbx), %ecx
xorl %r13d, %r13d
movl $0x400, %esi            # imm = 0x400
movq 0x18(%rsp), %rdi
leaq 0x87a1(%rip), %rdx      # 0x16d69
leaq 0x876e(%rip), %r8       # 0x16d3d
jmp 0xe708
movb $0x1, %bpl
movb $0x1, %r13b
jmp 0xe70f
movl 0x8(%rbx), %ecx
xorl %r13d, %r13d
movl $0x400, %esi            # imm = 0x400
movq 0x18(%rsp), %rdi
leaq 0x8773(%rip), %rdx      # 0x16d69
leaq 0x8750(%rip), %r8       # 0x16d4d
jmp 0xe708
movl 0x8(%rbx), %ecx
xorl %r13d, %r13d
movl $0x400, %esi            # imm = 0x400
movq 0x18(%rsp), %rdi
leaq 0x8750(%rip), %rdx      # 0x16d69
leaq 0x870b(%rip), %r8       # 0x16d2b
jmp 0xe708
movl $0xc, 0x10(%rbx)
cmpl $0x3, %eax
jne 0xe6b7
movq %rbx, %rdi
callq 0xe46a
movq %rax, %r14
testq %rax, %rax
setne %r13b
je 0xe70f
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x40(%rsp)
testq %rax, %rax
je 0xe71d
movl $0x18, %esi
movl $0x8, %edx
movq 0x28(%rsp), %rdi
callq 0xf030
movq 0x8(%rsp), %rcx
movq %rcx, (%rax)
movq %r14, 0x8(%rax)
movq $0x0, 0x10(%rax)
movq 0x38(%rsp), %rcx
movq %rax, 0x10(%rcx)
movb $0x1, %cl
movl %ecx, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movq %rax, 0x38(%rsp)
jmp 0xe75e
movl 0x8(%rbx), %ecx
xorl %r13d, %r13d
movl $0x400, %esi            # imm = 0x400
movq 0x18(%rsp), %rdi
leaq 0x869b(%rip), %rdx      # 0x16d69
leaq 0x8649(%rip), %r8       # 0x16d1e
jmp 0xe708
movb $0x1, %al
movl %eax, 0x10(%rsp)
movl $0x0, 0x8(%rsp)
jmp 0xe5d7
movl 0x8(%rbx), %ecx
xorl %r13d, %r13d
movl $0x400, %esi            # imm = 0x400
movq 0x18(%rsp), %rdi
leaq 0x8668(%rip), %rdx      # 0x16d69
leaq 0x8609(%rip), %r8       # 0x16d11
xorl %eax, %eax
callq 0x3560
testb %r13b, %r13b
jne 0xe53a
jmp 0xea1c
movl $0x18, %esi
movl $0x8, %edx
movq 0x28(%rsp), %rdi
callq 0xf030
movq %rax, %r12
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq %r14, 0x8(%r12)
movq $0x0, 0x10(%r12)
movb $0x1, %al
movl %eax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movq %r12, 0x38(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
jmp 0xe70f
movl $0xc, 0x10(%rbx)
leaq 0x8498(%rip), %r15      # 0x16c10
jmp 0xea39
movl 0x8(%rbx), %ecx
addq $0x420, %rbx            # imm = 0x420
leaq 0x85db(%rip), %rdx      # 0x16d69
leaq 0x8493(%rip), %r8       # 0x16c28
xorl %r15d, %r15d
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3560
jmp 0xea39
movl $0x10, %esi
movl $0x8, %edx
movq %r14, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0xf030
movq %rax, %r15
movl $0x5, (%rax)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rax)
cmpl $0xc, 0x10(%rbx)
jne 0xe982
movq %rbx, %rdi
callq 0xea77
jmp 0xea39
movl $0xc, 0x10(%rbx)
movq 0x828(%rbx), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x420(%rbx), %rax
movq %rax, 0x18(%rsp)
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %ebp, %ebp
cmpl $0xc, 0x10(%rbx)
jne 0xe834
movq %rbx, %rdi
callq 0xea77
movl %eax, 0x10(%rbx)
movq %rdx, 0x18(%rbx)
movl 0x10(%rbx), %eax
cmpl $0x7, %eax
jne 0xe84d
movl $0xc, 0x10(%rbx)
movl $0x2, %ecx
jmp 0xe8f7
testq %r14, %r14
je 0xe85e
cmpl $0x2, %eax
jne 0xe8a4
movl $0xc, 0x10(%rbx)
movq %rbx, %rdi
callq 0xe46a
movq %rax, %r12
testq %rax, %rax
je 0xe8c6
leaq 0x1(%r14), %r15
testq %r14, %r14
je 0xe8cd
movl $0x10, %esi
movl $0x8, %edx
movq 0x8(%rsp), %rdi
callq 0xf030
movq %r12, (%rax)
movq $0x0, 0x8(%rax)
movq %rax, 0x8(%r13)
xorl %ecx, %ecx
movq %r15, %r14
movq %rax, %r13
jmp 0xe8f7
movl 0x8(%rbx), %ecx
movl $0x400, %esi            # imm = 0x400
movq 0x18(%rsp), %rdi
leaq 0x84b1(%rip), %rdx      # 0x16d69
leaq 0x8452(%rip), %r8       # 0x16d11
xorl %eax, %eax
callq 0x3560
movl $0x1, %ecx
jmp 0xe8f7
movl $0x10, %esi
movl $0x8, %edx
movq 0x8(%rsp), %rdi
callq 0xf030
movq %rax, %r13
movq %r12, (%rax)
movq $0x0, 0x8(%rax)
xorl %ecx, %ecx
movq %r15, %r14
movq %rax, %rbp
testl %ecx, %ecx
je 0xe81f
cmpl $0x2, %ecx
jne 0xea28
movq 0x820(%rbx), %rbx
leaq (,%r14,8), %rsi
movl $0x8, %edx
movq %rbx, %rdi
callq 0xf030
movq %rax, %r12
testq %rbp, %rbp
je 0xe943
movq %r12, %rax
movq (%rbp), %rcx
movq %rcx, (%rax)
movq 0x8(%rbp), %rbp
addq $0x8, %rax
testq %rbp, %rbp
jne 0xe92f
movl $0x18, %esi
movl $0x8, %edx
movq %rbx, %rdi
callq 0xf030
movq %rax, %r15
movl $0x3, (%rax)
movq %r14, 0x8(%rax)
movq %r12, 0x10(%rax)
jmp 0xea2b
leaq 0xecfe(%rip), %rax      # 0x1d670
testb $0x1, 0x48(%rsp)
leaq 0xecfa(%rip), %r15      # 0x1d678
cmovneq %rax, %r15
movl $0xc, 0x10(%rbx)
jmp 0xea39
movq 0x820(%rbx), %rbx
movq 0x20(%rsp), %rax
leaq (,%rax,8), %r14
movl $0x8, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf030
movq %rax, %r13
movl $0x8, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xf030
movq %rax, %rbp
testq %r12, %r12
je 0xe9f0
xorl %eax, %eax
movq (%r12), %rcx
movq %rcx, (%r13,%rax)
movq 0x8(%r12), %rcx
movq %rcx, (%rbp,%rax)
movq 0x10(%r12), %r12
addq $0x8, %rax
testq %r12, %r12
jne 0xe9cf
movl $0x20, %esi
movl $0x8, %edx
movq %rbx, %rdi
callq 0xf030
movq %rax, %r15
movl $0x2, (%rax)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%r15)
movq %r13, 0x10(%r15)
movq %rbp, 0x18(%r15)
movq 0x30(%rsp), %rcx
movq 0x28(%rsp), %rax
jmp 0xea35
xorl %r15d, %r15d
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq %r15, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xea61
jmp 0xea61
jmp 0xea55
jmp 0xea55
jmp 0xea55
movq 0x28(%rsp), %rcx
movq 0x30(%rsp), %rdx
jmp 0xea6b
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rdx
movq %rdx, 0x18(%rcx)
movq %rax, %rdi
callq 0x35e0