// File: tomfunkhouser[P]gaps/pkgs/RNBasics/json.cpp
// Function: Json::Value::operator==(Json::Value const&) const
bool Value::operator==(const Value& other) const {
  // if ( type_ != other.type_ )
  // GCC 2.95.3 says:
  // attempt to take address of bit-field structure member `Json::Value::type_'
  // Beats me, but a temp solves the problem.
  int temp = other.type_;
  if (type_ != temp)
    return false;
  switch (type_) {
  case nullValue:
    return true;
  case intValue:
    return value_.int_ == other.value_.int_;
  case uintValue:
    return value_.uint_ == other.value_.uint_;
  case realValue:
    return value_.real_ == other.value_.real_;
  case booleanValue:
    return value_.bool_ == other.value_.bool_;
  case stringValue:
  {
    if ((value_.string_ == 0) || (other.value_.string_ == 0)) {
      return (value_.string_ == other.value_.string_);
    }
    unsigned this_len;
    unsigned other_len;
    char const* this_str;
    char const* other_str;
    decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
    decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str);
    if (this_len != other_len) return false;
    int comp = memcmp(this_str, other_str, this_len);
    return comp == 0;
  }
  case arrayValue:
  case objectValue:
    return value_.map_->size() == other.value_.map_->size() &&
           (*value_.map_) == (*other.value_.map_);
  default:
    JSON_ASSERT_UNREACHABLE;
  }
  return false; // unreachable
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x50(%rsp), %rcx
movw 0x8(%rcx), %cx
andw $0xff, %cx
movzwl %cx, %ecx
movl %ecx, 0x4c(%rsp)
movw 0x8(%rax), %ax
andw $0xff, %ax
movzwl %ax, %eax
cmpl 0x4c(%rsp), %eax
je 0xedbc8
movb $0x0, 0x67(%rsp)
jmp 0xeddc4
movq 0x20(%rsp), %rax
movzbl 0x8(%rax), %eax
movzwl %ax, %ecx
movq %rcx, 0x18(%rsp)
subw $0x7, %ax
ja 0xeddbd
movq 0x18(%rsp), %rax
leaq 0x7c3a5(%rip), %rcx     # 0x169f94
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x1, 0x67(%rsp)
jmp 0xeddc4
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq 0x50(%rsp), %rcx
cmpq (%rcx), %rax
sete %al
andb $0x1, %al
movb %al, 0x67(%rsp)
jmp 0xeddc4
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq 0x50(%rsp), %rcx
cmpq (%rcx), %rax
sete %al
andb $0x1, %al
movb %al, 0x67(%rsp)
jmp 0xeddc4
movq 0x20(%rsp), %rax
movsd (%rax), %xmm0
movq 0x50(%rsp), %rax
ucomisd (%rax), %xmm0
sete %al
setnp %cl
andb %cl, %al
andb $0x1, %al
movb %al, 0x67(%rsp)
jmp 0xeddc4
movq 0x20(%rsp), %rax
movb (%rax), %al
andb $0x1, %al
movzbl %al, %eax
movq 0x50(%rsp), %rcx
movb (%rcx), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movb %al, 0x67(%rsp)
jmp 0xeddc4
movq 0x20(%rsp), %rax
cmpq $0x0, (%rax)
je 0xedca2
movq 0x50(%rsp), %rax
cmpq $0x0, (%rax)
jne 0xedcc0
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq 0x50(%rsp), %rcx
cmpq (%rcx), %rax
sete %al
andb $0x1, %al
movb %al, 0x67(%rsp)
jmp 0xeddc4
movq 0x20(%rsp), %rcx
movw 0x8(%rcx), %ax
shrw $0x8, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
setne %al
movq (%rcx), %rsi
movzbl %al, %edi
andl $0x1, %edi
leaq 0x48(%rsp), %rdx
leaq 0x38(%rsp), %rcx
callq 0xed560
movq 0x50(%rsp), %rax
movw 0x8(%rax), %ax
shrw $0x8, %ax
andw $0x1, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
setne %al
movq 0x50(%rsp), %rcx
movq (%rcx), %rsi
movzbl %al, %edi
andl $0x1, %edi
leaq 0x44(%rsp), %rdx
leaq 0x30(%rsp), %rcx
callq 0xed560
movl 0x48(%rsp), %eax
cmpl 0x44(%rsp), %eax
je 0xedd3d
movb $0x0, 0x67(%rsp)
jmp 0xeddc4
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
movl 0x48(%rsp), %eax
movl %eax, %edx
callq 0x122d0
movl %eax, 0x2c(%rsp)
cmpl $0x0, 0x2c(%rsp)
sete %al
andb $0x1, %al
movb %al, 0x67(%rsp)
jmp 0xeddc4
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0xfa1e0
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rax
movq (%rax), %rdi
callq 0xfa1e0
movq 0x8(%rsp), %rcx
movq %rax, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, 0x17(%rsp)
jne 0xeddb1
movq 0x20(%rsp), %rax
movq (%rax), %rdi
movq 0x50(%rsp), %rax
movq (%rax), %rsi
callq 0xfa220
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
andb $0x1, %al
movb %al, 0x67(%rsp)
jmp 0xeddc4
jmp 0xeddbf
movb $0x0, 0x67(%rsp)
movb 0x67(%rsp), %al
andb $0x1, %al
addq $0x68, %rsp
retq
nop