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

// Assembly:
subq $0x6b8, %rsp            # imm = 0x6B8
movq %rdi, 0x6a8(%rsp)
movq 0x6a8(%rsp), %rax
movq %rax, 0x28(%rsp)
movzbl 0x8(%rax), %eax
movzwl %ax, %ecx
movq %rcx, 0x30(%rsp)
subw $0x5, %ax
ja 0xea38a
movq 0x30(%rsp), %rax
leaq 0x7fe5e(%rip), %rcx     # 0x169f3c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x28(%rsp), %rdi
callq 0xee1c0
testb $0x1, %al
jne 0xea19f
leaq 0x530(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x12980
movq 0x20(%rsp), %rdi
leaq 0x80608(%rip), %rsi     # 0x16a71f
callq 0x126b0
jmp 0xea11e
leaq 0x500(%rsp), %rdi
leaq 0x530(%rsp), %rsi
callq 0x12700
jmp 0xea135
leaq 0x500(%rsp), %rdi
callq 0xec480
jmp 0xea144
leaq 0x500(%rsp), %rdi
callq 0x12430
callq 0x12380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x528(%rsp)
movl %eax, 0x524(%rsp)
jmp 0xea18d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x528(%rsp)
movl %eax, 0x524(%rsp)
leaq 0x500(%rsp), %rdi
callq 0x12430
leaq 0x530(%rsp), %rdi
callq 0x121a0
jmp 0xea429
movq 0x28(%rsp), %rax
movq (%rax), %rax
movl %eax, 0x6b4(%rsp)
jmp 0xea41a
movq 0x28(%rsp), %rdi
callq 0xee1c0
testb $0x1, %al
jne 0xea26b
leaq 0x388(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x12980
movq 0x18(%rsp), %rdi
leaq 0x80558(%rip), %rsi     # 0x16a73b
callq 0x126b0
jmp 0xea1ea
leaq 0x368(%rsp), %rdi
leaq 0x388(%rsp), %rsi
callq 0x12700
jmp 0xea201
leaq 0x368(%rsp), %rdi
callq 0xec480
jmp 0xea210
leaq 0x368(%rsp), %rdi
callq 0x12430
callq 0x12380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x528(%rsp)
movl %eax, 0x524(%rsp)
jmp 0xea259
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x528(%rsp)
movl %eax, 0x524(%rsp)
leaq 0x368(%rsp), %rdi
callq 0x12430
leaq 0x388(%rsp), %rdi
callq 0x121a0
jmp 0xea429
movq 0x28(%rsp), %rax
movq (%rax), %rax
movl %eax, 0x6b4(%rsp)
jmp 0xea41a
movq 0x28(%rsp), %rax
movsd (%rax), %xmm0
movl $0x80000000, %edi       # imm = 0x80000000
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
callq 0xee2b0
testb $0x1, %al
jne 0xea345
leaq 0x1f0(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x12980
movq 0x10(%rsp), %rdi
leaq 0x8049b(%rip), %rsi     # 0x16a758
callq 0x126b0
jmp 0xea2c4
leaq 0x1d0(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x12700
jmp 0xea2db
leaq 0x1d0(%rsp), %rdi
callq 0xec480
jmp 0xea2ea
leaq 0x1d0(%rsp), %rdi
callq 0x12430
callq 0x12380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x528(%rsp)
movl %eax, 0x524(%rsp)
jmp 0xea333
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x528(%rsp)
movl %eax, 0x524(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x12430
leaq 0x1f0(%rsp), %rdi
callq 0x121a0
jmp 0xea429
movq 0x28(%rsp), %rax
cvttsd2si (%rax), %eax
movl %eax, 0x6b4(%rsp)
jmp 0xea41a
movl $0x0, 0x6b4(%rsp)
jmp 0xea41a
movq 0x28(%rsp), %rax
movb (%rax), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, 0x6b4(%rsp)
jmp 0xea41a
jmp 0xea38c
leaq 0x58(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x12980
movq 0x8(%rsp), %rdi
leaq 0x803c9(%rip), %rsi     # 0x16a770
callq 0x126b0
jmp 0xea3ae
leaq 0x38(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x12700
jmp 0xea3bf
leaq 0x38(%rsp), %rdi
callq 0xec480
jmp 0xea3cb
leaq 0x38(%rsp), %rdi
callq 0x12430
callq 0x12380
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x528(%rsp)
movl %eax, 0x524(%rsp)
jmp 0xea40e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x528(%rsp)
movl %eax, 0x524(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x12430
leaq 0x58(%rsp), %rdi
callq 0x121a0
jmp 0xea429
movl 0x6b4(%rsp), %eax
addq $0x6b8, %rsp            # imm = 0x6B8
retq
movq 0x528(%rsp), %rdi
callq 0x12c20
nopw %cs:(%rax,%rax)