// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movq %rdi, %r14
movq 0x820(%rdi), %rbx
movl 0x10(%rdi), %eax
cmpl $0xc, %eax
jne 0xdfc1
movq %r14, %rdi
callq 0xe465
movq %rdx, %r15
movl %eax, 0x10(%r14)
movq %rdx, 0x18(%r14)
jmp 0xdfc5
movq 0x18(%r14), %r15
cmpl $0x9, %eax
ja 0xe142
movl %eax, %eax
leaq 0x8b8d(%rip), %rcx      # 0x16b64
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x10, %esi
movl $0x8, %edx
movq %rbx, %rdi
callq 0xe950
movq %rax, %rbx
movl $0x4, (%rax)
jmp 0xe18c
movl $0xc, 0x10(%r14)
movq 0x828(%r14), %rax
movq %rax, (%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
xorl %ebx, %ebx
xorl %r15d, %r15d
movq $0x0, 0x10(%rsp)
xorl %r12d, %r12d
movb $0x1, %bpl
movl 0x10(%r14), %eax
cmpl $0xc, %eax
jne 0xe046
movq %r14, %rdi
callq 0xe465
movq %rdx, %r13
jmp 0xe052
movq 0x18(%r14), %r13
movl $0xc, 0x10(%r14)
cmpl $0x2, %eax
jne 0xe072
testb $0x1, %bl
je 0xe3c5
xorl %ebx, %ebx
testb $0x1, %bpl
movl $0x0, %ebp
jne 0xe030
jmp 0xe3e0
cmpl $0x6, %eax
je 0xe30a
testl %eax, %eax
jne 0xe38f
andb %bl, %bpl
testb $0x1, %bpl
jne 0xe3aa
movl 0x10(%r14), %eax
cmpl $0xc, %eax
jne 0xe0a3
movq %r14, %rdi
callq 0xe465
jmp 0xe0ab
movl $0xc, 0x10(%r14)
cmpl $0x3, %eax
jne 0xe429
movq %r14, %rdi
callq 0xdf8c
movq %rax, %rbp
testq %rax, %rax
je 0xe303
testq %r15, %r15
je 0xe0f9
movl $0x18, %esi
movl $0x8, %edx
movq (%rsp), %rdi
callq 0xe950
movq %r13, (%rax)
movq %rbp, 0x8(%rax)
movq $0x0, 0x10(%rax)
movq %rax, %rcx
movq 0x10(%rsp), %rdx
jmp 0xe11b
movl $0x18, %esi
movl $0x8, %edx
movq (%rsp), %rdi
callq 0xe950
movq %rax, %r12
movq %r13, (%rax)
movq %rbp, 0x8(%rax)
movq %rax, %rdx
xorl %ecx, %ecx
incq %r15
movq %rcx, 0x10(%rdx)
movb $0x1, %bl
movq %rax, 0x10(%rsp)
jmp 0xe02d
movl $0xc, 0x10(%r14)
leaq 0x8ad3(%rip), %rbx      # 0x16c10
jmp 0xe417
movl 0x8(%r14), %ecx
addq $0x420, %r14            # imm = 0x420
leaq 0x8c15(%rip), %rdx      # 0x16d69
leaq 0x8acd(%rip), %r8       # 0x16c28
xorl %ebx, %ebx
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdi
xorl %eax, %eax
callq 0x3560
jmp 0xe417
movl $0x10, %esi
movl $0x8, %edx
movq %rbx, %rdi
callq 0xe950
movq %rax, %rbx
movl $0x5, (%rax)
movq %r15, 0x8(%rax)
cmpl $0xc, 0x10(%r14)
jne 0xe291
movq %r14, %rdi
callq 0xe465
jmp 0xe417
movl $0xc, 0x10(%r14)
movq 0x828(%r14), %rax
movq %rax, (%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
movl $0xc, %eax
xorl %r12d, %r12d
xorl %ebp, %ebp
xorl %r15d, %r15d
xorl %ebx, %ebx
cmpl $0xc, %eax
jne 0xe1e8
movq %r14, %rdi
callq 0xe465
movl %eax, 0x10(%r14)
movq %rdx, 0x18(%r14)
cmpl $0x7, %eax
je 0xe29e
testq %rbp, %rbp
je 0xe207
cmpl $0x2, %eax
jne 0xe3aa
movl $0xc, 0x10(%r14)
movq %r14, %rdi
callq 0xdf8c
movq %rax, %r13
testq %rax, %rax
je 0xe303
testq %rbp, %rbp
je 0xe243
movl $0x10, %esi
movl $0x8, %edx
movq (%rsp), %rdi
callq 0xe950
movq %rax, %rcx
movq %r13, (%rax)
movq $0x0, 0x8(%rax)
jmp 0xe264
movl $0x10, %esi
movl $0x8, %edx
movq (%rsp), %rdi
callq 0xe950
movq %rax, %rcx
movq %r13, (%rax)
movq %rax, %rbx
movq %rax, %r15
xorl %eax, %eax
movq %rax, 0x8(%r15)
movl 0x10(%r14), %eax
addq $0x8, %r12
incq %rbp
movq %rcx, %r15
jmp 0xe1d3
leaq 0xf3ee(%rip), %rax      # 0x1d670
leaq 0xf3ef(%rip), %rbx      # 0x1d678
testb $0x1, %r15b
cmovneq %rax, %rbx
movl $0xc, 0x10(%r14)
jmp 0xe417
movl $0xc, 0x10(%r14)
movq 0x820(%r14), %r13
movl $0x8, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0xe950
movq %rax, %r14
testq %rbx, %rbx
je 0xe2db
movq %r14, %rax
movq (%rbx), %rcx
movq %rcx, (%rax)
movq 0x8(%rbx), %rbx
addq $0x8, %rax
testq %rbx, %rbx
jne 0xe2c8
movl $0x18, %esi
movl $0x8, %edx
movq %r13, %rdi
callq 0xe950
movq %rax, %rbx
movl $0x3, (%rax)
movq %rbp, 0x8(%rax)
movq %r14, 0x10(%rax)
jmp 0xe40a
xorl %ebx, %ebx
jmp 0xe40a
movq 0x820(%r14), %rbx
leaq (,%r15,8), %r13
movl $0x8, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe950
movq %rax, %r14
movl $0x8, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe950
movq %rax, %r13
testq %r12, %r12
je 0xe366
xorl %eax, %eax
movq (%r12), %rcx
movq %rcx, (%r14,%rax)
movq 0x8(%r12), %rcx
movq %rcx, (%r13,%rax)
movq 0x10(%r12), %r12
addq $0x8, %rax
testq %r12, %r12
jne 0xe346
movl $0x20, %esi
movl $0x8, %edx
movq %rbx, %rdi
callq 0xe950
movq %rax, %rbx
movl $0x2, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %r13, 0x18(%rax)
jmp 0xe40a
movl 0x8(%r14), %ecx
addq $0x420, %r14            # imm = 0x420
leaq 0x89c8(%rip), %rdx      # 0x16d69
leaq 0x89a5(%rip), %r8       # 0x16d4d
jmp 0xe3f9
movl 0x8(%r14), %ecx
addq $0x420, %r14            # imm = 0x420
leaq 0x89ad(%rip), %rdx      # 0x16d69
leaq 0x894e(%rip), %r8       # 0x16d11
jmp 0xe3f9
movl 0x8(%r14), %ecx
addq $0x420, %r14            # imm = 0x420
leaq 0x8992(%rip), %rdx      # 0x16d69
leaq 0x894d(%rip), %r8       # 0x16d2b
jmp 0xe3f9
movl 0x8(%r14), %ecx
addq $0x420, %r14            # imm = 0x420
leaq 0x8977(%rip), %rdx      # 0x16d69
leaq 0x8944(%rip), %r8       # 0x16d3d
xorl %ebx, %ebx
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdi
xorl %eax, %eax
callq 0x3560
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x8(%r14), %ecx
addq $0x420, %r14            # imm = 0x420
leaq 0x892e(%rip), %rdx      # 0x16d69
leaq 0x88dc(%rip), %r8       # 0x16d1e
jmp 0xe3f9
jmp 0xe450
jmp 0xe450
jmp 0xe450
jmp 0xe450
jmp 0xe450
jmp 0xe450
movq (%rsp), %rcx
movq 0x8(%rsp), %rdx
movq %rdx, 0x18(%rcx)
movq %rax, %rdi
callq 0x35e0