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

// 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 0xeea24
movq 0x28(%rsp), %rax
leaq 0x7b7ae(%rip), %rcx     # 0x169fcc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x510(%rsp)
jmp 0xeeab4
movq 0x20(%rsp), %rdi
callq 0xeeae0
testb $0x1, %al
jne 0xee8f4
leaq 0x390(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x12980
movq 0x18(%rsp), %rdi
leaq 0x7bf9b(%rip), %rsi     # 0x16a807
callq 0x126b0
jmp 0xee873
leaq 0x360(%rsp), %rdi
leaq 0x390(%rsp), %rsi
callq 0x12700
jmp 0xee88a
leaq 0x360(%rsp), %rdi
callq 0xec480
jmp 0xee899
leaq 0x360(%rsp), %rdi
callq 0x12430
callq 0x12380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x388(%rsp)
movl %eax, 0x384(%rsp)
jmp 0xee8e2
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 0xeeac4
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x510(%rsp)
jmp 0xeeab4
movq 0x20(%rsp), %rax
movsd (%rax), %xmm0
movabsq $-0x8000000000000000, %rdi # imm = 0x8000000000000000
movabsq $0x7fffffffffffffff, %rsi # imm = 0x7FFFFFFFFFFFFFFF
callq 0xeebb0
testb $0x1, %al
jne 0xee9d9
leaq 0x1e8(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x12980
movq 0x10(%rsp), %rdi
leaq 0x7bed5(%rip), %rsi     # 0x16a826
callq 0x126b0
jmp 0xee958
leaq 0x1c8(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0x12700
jmp 0xee96f
leaq 0x1c8(%rsp), %rdi
callq 0xec480
jmp 0xee97e
leaq 0x1c8(%rsp), %rdi
callq 0x12430
callq 0x12380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x388(%rsp)
movl %eax, 0x384(%rsp)
jmp 0xee9c7
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 0xeeac4
movq 0x20(%rsp), %rax
cvttsd2si (%rax), %rax
movq %rax, 0x510(%rsp)
jmp 0xeeab4
movq $0x0, 0x510(%rsp)
jmp 0xeeab4
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 0xeeab4
jmp 0xeea26
leaq 0x50(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x12980
movq 0x8(%rsp), %rdi
leaq 0x7bdff(%rip), %rsi     # 0x16a840
callq 0x126b0
jmp 0xeea48
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x12700
jmp 0xeea59
leaq 0x30(%rsp), %rdi
callq 0xec480
jmp 0xeea65
leaq 0x30(%rsp), %rdi
callq 0x12430
callq 0x12380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x388(%rsp)
movl %eax, 0x384(%rsp)
jmp 0xeeaa8
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 0xeeac4
movq 0x510(%rsp), %rax
addq $0x518, %rsp            # imm = 0x518
retq
movq 0x388(%rsp), %rdi
callq 0x12c20
nopw %cs:(%rax,%rax)