// File: tomfunkhouser[P]gaps/pkgs/RNBasics/json.cpp
// Function: Json::OurReader::readValue()
bool OurReader::readValue() {
  if (stackDepth_ >= features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue().");
  ++stackDepth_;
  Token token;
  skipCommentTokens(token);
  bool successful = true;

  if (collectComments_ && !commentsBefore_.empty()) {
    currentValue().setComment(commentsBefore_, commentBefore);
    commentsBefore_ = "";
  }

  switch (token.type_) {
  case tokenObjectBegin:
    successful = readObject(token);
    currentValue().setOffsetLimit(current_ - begin_);
    break;
  case tokenArrayBegin:
    successful = readArray(token);
    currentValue().setOffsetLimit(current_ - begin_);
    break;
  case tokenNumber:
    successful = decodeNumber(token);
    break;
  case tokenString:
    successful = decodeString(token);
    break;
  case tokenTrue:
    {
    Value v(true);
    currentValue().swapPayload(v);
    currentValue().setOffsetStart(token.start_ - begin_);
    currentValue().setOffsetLimit(token.end_ - begin_);
    }
    break;
  case tokenFalse:
    {
    Value v(false);
    currentValue().swapPayload(v);
    currentValue().setOffsetStart(token.start_ - begin_);
    currentValue().setOffsetLimit(token.end_ - begin_);
    }
    break;
  case tokenNull:
    {
    Value v;
    currentValue().swapPayload(v);
    currentValue().setOffsetStart(token.start_ - begin_);
    currentValue().setOffsetLimit(token.end_ - begin_);
    }
    break;
  case tokenNaN:
    {
    Value v(std::numeric_limits<double>::quiet_NaN());
    currentValue().swapPayload(v);
    currentValue().setOffsetStart(token.start_ - begin_);
    currentValue().setOffsetLimit(token.end_ - begin_);
    }
    break;
  case tokenPosInf:
    {
    Value v(std::numeric_limits<double>::infinity());
    currentValue().swapPayload(v);
    currentValue().setOffsetStart(token.start_ - begin_);
    currentValue().setOffsetLimit(token.end_ - begin_);
    }
    break;
  case tokenNegInf:
    {
    Value v(-std::numeric_limits<double>::infinity());
    currentValue().swapPayload(v);
    currentValue().setOffsetStart(token.start_ - begin_);
    currentValue().setOffsetLimit(token.end_ - begin_);
    }
    break;
  case tokenArraySeparator:
  case tokenObjectEnd:
  case tokenArrayEnd:
    if (features_.allowDroppedNullPlaceholders_) {
      // "Un-read" the current token and mark the current value as a null
      // token.
      current_--;
      Value v;
      currentValue().swapPayload(v);
      currentValue().setOffsetStart(current_ - begin_ - 1);
      currentValue().setOffsetLimit(current_ - begin_);
      break;
    } // else, fall through ...
  default:
    currentValue().setOffsetStart(token.start_ - begin_);
    currentValue().setOffsetLimit(token.end_ - begin_);
    return addError("Syntax error: value, object or array expected.", token);
  }

  if (collectComments_) {
    lastValueEnd_ = current_;
    lastValue_ = &currentValue();
  }

  --stackDepth_;
  return successful;
}

// Assembly:
subq $0x278, %rsp            # imm = 0x278
movq %rdi, 0x268(%rsp)
movq 0x268(%rsp), %rcx
movq %rcx, 0xc8(%rsp)
movl 0x108(%rcx), %eax
cmpl 0x114(%rcx), %eax
jl 0xe51f8
leaq 0x247(%rsp), %rdi
movq %rdi, 0xc0(%rsp)
callq 0x12c30
movq 0xc0(%rsp), %rdx
leaq 0x85135(%rip), %rsi     # 0x16a2aa
leaq 0x248(%rsp), %rdi
callq 0x22830
jmp 0xe5184
leaq 0x248(%rsp), %rdi
callq 0xe0b60
jmp 0xe5193
leaq 0x248(%rsp), %rdi
callq 0x12430
leaq 0x247(%rsp), %rdi
callq 0x12760
jmp 0xe51f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
jmp 0xe51e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0x248(%rsp), %rdi
callq 0x12430
leaq 0x247(%rsp), %rdi
callq 0x12760
jmp 0xe5beb
movq 0xc8(%rsp), %rdi
movl 0x108(%rdi), %eax
addl $0x1, %eax
movl %eax, 0x108(%rdi)
leaq 0x218(%rsp), %rsi
callq 0xe5c00
movq 0xc8(%rsp), %rax
movb $0x1, 0x217(%rsp)
testb $0x1, 0x118(%rax)
je 0xe528e
movq 0xc8(%rsp), %rdi
addq $0xe8, %rdi
callq 0x12ba0
testb $0x1, %al
jne 0xe528e
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq 0xc8(%rsp), %rsi
movq %rax, %rdi
addq $0xe8, %rsi
xorl %edx, %edx
callq 0xe0a10
movq 0xc8(%rsp), %rdi
addq $0xe8, %rdi
leaq 0x82376(%rip), %rsi     # 0x1675ff
callq 0x129a0
movl 0x218(%rsp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, 0xb8(%rsp)
subl $0xc, %eax
ja 0xe5a51
movq 0xb8(%rsp), %rax
leaq 0x848ef(%rip), %rcx     # 0x169ba8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xc8(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0xe5d30
movq 0xc8(%rsp), %rdi
andb $0x1, %al
movb %al, 0x217(%rsp)
callq 0xe5d10
movq %rax, %rdi
movq 0xc8(%rsp), %rax
movq 0xd0(%rax), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1390
jmp 0xe5b75
movq 0xc8(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0xe6710
movq 0xc8(%rsp), %rdi
andb $0x1, %al
movb %al, 0x217(%rsp)
callq 0xe5d10
movq %rax, %rdi
movq 0xc8(%rsp), %rax
movq 0xd0(%rax), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1390
jmp 0xe5b75
movq 0xc8(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0xe6a90
andb $0x1, %al
movb %al, 0x217(%rsp)
jmp 0xe5b75
movq 0xc8(%rsp), %rdi
leaq 0x218(%rsp), %rsi
callq 0xe6be0
andb $0x1, %al
movb %al, 0x217(%rsp)
jmp 0xe5b75
leaq 0x1e8(%rsp), %rdi
movl $0x1, %esi
callq 0xed1c0
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0xb0(%rsp)
jmp 0xe53d3
movq 0xb0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0xe1a10
jmp 0xe53ea
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0xa8(%rsp)
jmp 0xe5401
movq 0xa8(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x220(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1b00
jmp 0xe542a
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0xa0(%rsp)
jmp 0xe5441
movq 0xa0(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x228(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1390
jmp 0xe546a
leaq 0x1e8(%rsp), %rdi
callq 0xed680
jmp 0xe5b75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0x1e8(%rsp), %rdi
callq 0xed680
jmp 0xe5beb
leaq 0x1c0(%rsp), %rdi
xorl %esi, %esi
callq 0xed1c0
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x98(%rsp)
jmp 0xe54c8
movq 0x98(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0xe1a10
jmp 0xe54df
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x90(%rsp)
jmp 0xe54f6
movq 0x90(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x220(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1b00
jmp 0xe551f
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x88(%rsp)
jmp 0xe5536
movq 0x88(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x228(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1390
jmp 0xe555f
leaq 0x1c0(%rsp), %rdi
callq 0xed680
jmp 0xe5b75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0xed680
jmp 0xe5beb
leaq 0x198(%rsp), %rdi
xorl %esi, %esi
callq 0xecc20
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x80(%rsp)
jmp 0xe55bd
movq 0x80(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0xe1a10
jmp 0xe55d4
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x78(%rsp)
jmp 0xe55e8
movq 0x78(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x220(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1b00
jmp 0xe560e
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x70(%rsp)
jmp 0xe5622
movq 0x70(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x228(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1390
jmp 0xe5648
leaq 0x198(%rsp), %rdi
callq 0xed680
jmp 0xe5b75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0x198(%rsp), %rdi
callq 0xed680
jmp 0xe5beb
callq 0xf98b0
leaq 0x170(%rsp), %rdi
callq 0xece60
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x68(%rsp)
jmp 0xe56a6
movq 0x68(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0xe1a10
jmp 0xe56ba
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x60(%rsp)
jmp 0xe56ce
movq 0x60(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x220(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1b00
jmp 0xe56f4
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x58(%rsp)
jmp 0xe5708
movq 0x58(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x228(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1390
jmp 0xe572e
leaq 0x170(%rsp), %rdi
callq 0xed680
jmp 0xe5b75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0x170(%rsp), %rdi
callq 0xed680
jmp 0xe5beb
callq 0xf98c0
leaq 0x148(%rsp), %rdi
callq 0xece60
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x50(%rsp)
jmp 0xe578c
movq 0x50(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0xe1a10
jmp 0xe57a0
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x48(%rsp)
jmp 0xe57b4
movq 0x48(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x220(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1b00
jmp 0xe57da
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x40(%rsp)
jmp 0xe57ee
movq 0x40(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x228(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1390
jmp 0xe5814
leaq 0x148(%rsp), %rdi
callq 0xed680
jmp 0xe5b75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0x148(%rsp), %rdi
callq 0xed680
jmp 0xe5beb
callq 0xf98c0
movaps 0x80d18(%rip), %xmm1    # 0x166570
pxor %xmm1, %xmm0
leaq 0x120(%rsp), %rdi
callq 0xece60
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x38(%rsp)
jmp 0xe587d
movq 0x38(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0xe1a10
jmp 0xe5891
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x30(%rsp)
jmp 0xe58a5
movq 0x30(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x220(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1b00
jmp 0xe58cb
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x28(%rsp)
jmp 0xe58df
movq 0x28(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0x228(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1390
jmp 0xe5905
leaq 0x120(%rsp), %rdi
callq 0xed680
jmp 0xe5b75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0x120(%rsp), %rdi
callq 0xed680
jmp 0xe5beb
movq 0xc8(%rsp), %rax
testb $0x1, 0x10e(%rax)
je 0xe5a4f
movq 0xc8(%rsp), %rax
movq 0xd0(%rax), %rcx
decq %rcx
movq %rcx, 0xd0(%rax)
leaq 0xf8(%rsp), %rdi
xorl %esi, %esi
callq 0xecc20
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x20(%rsp)
jmp 0xe598e
movq 0x20(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0xe1a10
jmp 0xe59a2
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x18(%rsp)
jmp 0xe59b6
movq 0x18(%rsp), %rdi
movq 0xc8(%rsp), %rax
movq 0xc0(%rax), %rsi
movq 0xd0(%rax), %rax
notq %rsi
addq %rax, %rsi
callq 0xe1b00
jmp 0xe59de
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, 0x10(%rsp)
jmp 0xe59f2
movq 0x10(%rsp), %rdi
movq 0xc8(%rsp), %rcx
movq 0xc0(%rcx), %rax
movq 0xd0(%rcx), %rsi
subq %rax, %rsi
callq 0xe1390
jmp 0xe5a17
leaq 0xf8(%rsp), %rdi
callq 0xed680
jmp 0xe5b75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xed680
jmp 0xe5beb
jmp 0xe5a51
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, %rdi
movq 0xc8(%rsp), %rax
movq 0x220(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1b00
movq 0xc8(%rsp), %rdi
callq 0xe5d10
movq %rax, %rdi
movq 0xc8(%rsp), %rax
movq 0x228(%rsp), %rsi
movq 0xc0(%rax), %rax
subq %rax, %rsi
callq 0xe1390
leaq 0xd7(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x12c30
movq 0x8(%rsp), %rdx
leaq 0x84801(%rip), %rsi     # 0x16a2ce
leaq 0xd8(%rsp), %rdi
callq 0x22830
jmp 0xe5adc
movq 0xc8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %ecx
leaq 0xd8(%rsp), %rsi
leaq 0x218(%rsp), %rdx
callq 0xe5c50
movb %al, 0x7(%rsp)
jmp 0xe5b03
movb 0x7(%rsp), %al
andb $0x1, %al
movb %al, 0x277(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x12430
leaq 0xd7(%rsp), %rdi
callq 0x12760
jmp 0xe5bda
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
jmp 0xe5b66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x238(%rsp)
movl %eax, 0x234(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x12430
leaq 0xd7(%rsp), %rdi
callq 0x12760
jmp 0xe5beb
movq 0xc8(%rsp), %rax
testb $0x1, 0x118(%rax)
je 0xe5bb3
movq 0xc8(%rsp), %rdi
movq 0xd0(%rdi), %rax
movq %rax, 0xd8(%rdi)
callq 0xe5d10
movq %rax, %rcx
movq 0xc8(%rsp), %rax
movq %rcx, 0xe0(%rax)
movq 0xc8(%rsp), %rax
movl 0x108(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x108(%rax)
movb 0x217(%rsp), %al
andb $0x1, %al
movb %al, 0x277(%rsp)
movb 0x277(%rsp), %al
andb $0x1, %al
addq $0x278, %rsp            # imm = 0x278
retq
movq 0x238(%rsp), %rdi
callq 0x12c20
nopl (%rax,%rax)