// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/RNBasics/json.cpp
// Function: Json::OurReader::decodeNumber(Json::OurReader::Token&, Json::Value&)
bool OurReader::decodeNumber(Token& token, Value& decoded) {
  // Attempts to parse the number as an integer. If the number is
  // larger than the maximum supported value of an integer then
  // we decode the number as a double.
  Location current = token.start_;
  bool isNegative = *current == '-';
  if (isNegative)
    ++current;
  // TODO: Help the compiler do the div and mod at compile time or get rid of them.
  Value::LargestUInt maxIntegerValue =
      isNegative ? Value::LargestUInt(-Value::minLargestInt)
                 : Value::maxLargestUInt;
  Value::LargestUInt threshold = maxIntegerValue / 10;
  Value::LargestUInt value = 0;
  while (current < token.end_) {
    Char c = *current++;
    if (c < '0' || c > '9')
      return decodeDouble(token, decoded);
    Value::UInt digit(static_cast<Value::UInt>(c - '0'));
    if (value >= threshold) {
      // We've hit or exceeded the max value divided by 10 (rounded down). If
      // a) we've only just touched the limit, b) this is the last digit, and
      // c) it's small enough to fit in that rounding delta, we're okay.
      // Otherwise treat this number as a double to avoid overflow.
      if (value > threshold || current != token.end_ ||
          digit > maxIntegerValue % 10) {
        return decodeDouble(token, decoded);
      }
    }
    value = value * 10 + digit;
  }
  if (isNegative)
    decoded = -Value::LargestInt(value);
  else if (value <= Value::LargestUInt(Value::maxInt))
    decoded = Value::LargestInt(value);
  else
    decoded = value;
  return true;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rcx
movq 0x8(%rsi), %rax
movq 0x10(%rsi), %r10
movb (%rax), %r9b
xorl %r11d, %r11d
xorl %r8d, %r8d
cmpb $0x2d, %r9b
sete %r11b
setne %r8b
negq %r8
btsq $0x3f, %r8
addq %rax, %r11
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
movq %r8, %rax
mulq %rdx
cmpq %r10, %r11
jae 0x7d006
shrq $0x3, %rdx
leaq (%rdx,%rdx), %rax
leaq (%rax,%rax,4), %rax
subq %rax, %r8
xorl %eax, %eax
movzbl (%r11), %ebx
leal -0x3a(%rbx), %ebp
cmpb $-0xb, %bpl
jbe 0x7d022
incq %r11
addl $-0x30, %ebx
movl %ebx, %ebx
cmpq %rdx, %rax
jb 0x7cfcf
ja 0x7d022
cmpq %r10, %r11
jne 0x7d022
cmpq %rbx, %r8
jb 0x7d022
leaq (%rax,%rax,4), %rax
leaq (%rbx,%rax,2), %rax
cmpq %r10, %r11
jb 0x7cfa9
cmpb $0x2d, %r9b
je 0x7d00e
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
jbe 0x7d030
movzwl 0x8(%rcx), %edx
movq (%rcx), %rsi
movq %rax, (%rcx)
movq %rsp, %rdi
movq %rsi, (%rdi)
movl %edx, %eax
andl $0xfe00, %eax           # imm = 0xFE00
orl $0x2, %eax
jmp 0x7d04b
xorl %eax, %eax
cmpb $0x2d, %r9b
jne 0x7d030
negq %rax
movzwl 0x8(%rcx), %edx
movq (%rcx), %rsi
movq %rax, (%rcx)
leaq 0x50(%rsp), %rdi
jmp 0x7d03f
movq %rcx, %rdx
addq $0x78, %rsp
popq %rbx
popq %rbp
jmp 0x7d0c6
movzwl 0x8(%rcx), %edx
movq (%rcx), %rsi
movq %rax, (%rcx)
leaq 0x28(%rsp), %rdi
movq %rsi, (%rdi)
movl %edx, %eax
andl $0xfe00, %eax           # imm = 0xFE00
incl %eax
movw %ax, 0x8(%rcx)
andl $0x1ff, %edx            # imm = 0x1FF
movw %dx, 0x8(%rdi)
movq 0x10(%rcx), %rax
movq $0x0, 0x10(%rcx)
movq %rax, 0x10(%rdi)
movups 0x18(%rcx), %xmm0
xorps %xmm1, %xmm1
movups %xmm1, 0x18(%rcx)
movups %xmm0, 0x18(%rdi)
callq 0x80736
movb $0x1, %al
addq $0x78, %rsp
popq %rbx
popq %rbp
retq