// File: tomfunkhouser[P]gaps/pkgs/RNBasics/json.cpp
// Function: Json::Value::asUInt64() const
Value::UInt64 Value::asUInt64() const {
  switch (type_) {
  case intValue:
    JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range");
    return UInt64(value_.int_);
  case uintValue:
    return UInt64(value_.uint_);
  case realValue:
    JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64),
                        "double out of UInt64 range");
    return UInt64(value_.real_);
  case nullValue:
    return 0;
  case booleanValue:
    return value_.bool_ ? 1 : 0;
  default:
    break;
  }
  JSON_FAIL_MESSAGE("Value is not convertible to UInt64.");
}

// Assembly:
subq $0x518, %rsp            # imm = 0x518
movq %rdi, 0x508(%rsp)
movq 0x508(%rsp), %rax
movq %rax, 0x20(%rsp)
movzbl 0x8(%rax), %eax
movzwl %ax, %ecx
movq %rcx, 0x28(%rsp)
subw $0x5, %ax
ja 0xeee5e
movq 0x28(%rsp), %rax
leaq 0x7b3a6(%rip), %rcx     # 0x169fe4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x20(%rsp), %rdi
callq 0xeef10
testb $0x1, %al
jne 0xeecff
leaq 0x390(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x12980
movq 0x18(%rsp), %rdi
leaq 0x7bbec(%rip), %rsi     # 0x16a863
callq 0x126b0
jmp 0xeec7e
leaq 0x360(%rsp), %rdi
leaq 0x390(%rsp), %rsi
callq 0x12700
jmp 0xeec95
leaq 0x360(%rsp), %rdi
callq 0xec480
jmp 0xeeca4
leaq 0x360(%rsp), %rdi
callq 0x12430
callq 0x12380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x388(%rsp)
movl %eax, 0x384(%rsp)
jmp 0xeeced
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x388(%rsp)
movl %eax, 0x384(%rsp)
leaq 0x360(%rsp), %rdi
callq 0x12430
leaq 0x390(%rsp), %rdi
callq 0x121a0
jmp 0xeeefe
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x510(%rsp)
jmp 0xeeeee
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x510(%rsp)
jmp 0xeeeee
movq 0x20(%rsp), %rax
movsd (%rax), %xmm0
xorl %edi, %edi
movq $-0x1, %rsi
callq 0xeefd0
testb $0x1, %al
jne 0xeedee
leaq 0x1e8(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x12980
movq 0x10(%rsp), %rdi
leaq 0x7bb1c(%rip), %rsi     # 0x16a882
callq 0x126b0
jmp 0xeed6d
leaq 0x1c8(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0x12700
jmp 0xeed84
leaq 0x1c8(%rsp), %rdi
callq 0xec480
jmp 0xeed93
leaq 0x1c8(%rsp), %rdi
callq 0x12430
callq 0x12380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x388(%rsp)
movl %eax, 0x384(%rsp)
jmp 0xeeddc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x388(%rsp)
movl %eax, 0x384(%rsp)
leaq 0x1c8(%rsp), %rdi
callq 0x12430
leaq 0x1e8(%rsp), %rdi
callq 0x121a0
jmp 0xeeefe
movq 0x20(%rsp), %rax
movsd (%rax), %xmm0
movsd 0x7a6c1(%rip), %xmm2    # 0x1694c0
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rcx
cvttsd2si %xmm0, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, 0x510(%rsp)
jmp 0xeeeee
movq $0x0, 0x510(%rsp)
jmp 0xeeeee
movq 0x20(%rsp), %rax
movb (%rax), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cltq
movq %rax, 0x510(%rsp)
jmp 0xeeeee
jmp 0xeee60
leaq 0x50(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x12980
movq 0x8(%rsp), %rdi
leaq 0x7ba22(%rip), %rsi     # 0x16a89d
callq 0x126b0
jmp 0xeee82
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x12700
jmp 0xeee93
leaq 0x30(%rsp), %rdi
callq 0xec480
jmp 0xeee9f
leaq 0x30(%rsp), %rdi
callq 0x12430
callq 0x12380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x388(%rsp)
movl %eax, 0x384(%rsp)
jmp 0xeeee2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x388(%rsp)
movl %eax, 0x384(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x12430
leaq 0x50(%rsp), %rdi
callq 0x121a0
jmp 0xeeefe
movq 0x510(%rsp), %rax
addq $0x518, %rsp            # imm = 0x518
retq
movq 0x388(%rsp), %rdi
callq 0x12c20
nopl (%rax,%rax)