Function to check if two annotations are the same.
180644
function _is_same_ann(a1, a2){
    	var ret = false;
    	if( a1.key() === a2.key() &&
    	    a1.value() === a2.value() &&
    	    a1.value_type() === a2.value_type() ){
    	    ret = true;
    	}
    	return ret;
    }
767380
def _equal(a, b, identityLong, relicCompare):
    
    # Check for an identity comparison.
    if isinstance(b, (long, int)) and b == identityLong:
        return a.isIdentity()

    # Verify type and fix normalization for a valid comparison.
    assertSameType(a, b)
    a.normalize()
    b.normalize()

    # Compare the elements using the relic function.
    return relicCompare(byref(a), byref(b)) == EQUAL
364208
public static boolean isAnnotationPresent(Annotation[] annotations,
      Class<? extends Annotation> cls) {
    for (Annotation annotation : annotations) {
      if (cls.isInstance(annotation)) {
        return true;
      }
    }
    return false;
  }
253403
function _compareTypes(typeA, typeB, sameTypes, propertyA, propertyB) {
  sameTypes = sameTypes || {}
  if (typeA === typeB) {
    if (typeA === types.class && propertyA && propertyB) {
      return propertyA.constructor.name === propertyB.constructor.name;
    }
    return true;
  }

  if (Object.keys(sameTypes).length === 0) {
    return false;
  }
  let typeKeyA;
  let typeKeyB;
  let foundMatch = false
  Object.keys(sameTypes).forEach((key) => {
    if (foundMatch) { return }
    const similar = sameTypes[key];
    if (similar.indexOf(typeA) > -1) {
      typeKeyA = key;
    }
    if (similar.indexOf(typeB) > -1) {
      typeKeyB = key;
    }
    if (typeKeyA && typeKeyB) { foundMatch = true }
  });
  return foundMatch && typeKeyA === typeKeyB;
}
553101
function replaceThenMergeAnnotations(annos, nannos) {
  var rannos = (annos || []).splice(0);
  var nanno, n, a, anno;
  // Iterate through annos, comparing one nanno at a time. if it's the same and the user doesn't need validation, replace anno with nano.
  for (a = 0; a < rannos.length; a++) {
    anno = rannos[a];
    for (n = nannos.length - 1; n > -1; n--) {
      nanno = nannos[n];
      if (anno.flattened === nanno.flattened) {
        var nuser = GLOBAL.svc.auth.getUserByUsername(nanno.annotatedBy);
        if (!nuser.needsValidation) {
          rannos[a] = nanno;
        }
        nannos.splice(n, 1);
      }
    }
  }
  return rannos.concat(nannos);
}
446138
@Override
    public int compareTo(final AnnotationParameterValue other) {
        if (other == this) {
            return 0;
        }
        final int diff = name.compareTo(other.getName());
        if (diff != 0) {
            return diff;
        }
        if (value.equals(other.value)) {
            return 0;
        }
        // Use toString() order (which can be slow) as a last-ditch effort -- only happens
        // if the annotation has multiple parameters of the same name but different value. 
        final Object p0 = getValue();
        final Object p1 = other.getValue();
        return p0 == null || p1 == null ? (p0 == null ? 0 : 1) - (p1 == null ? 0 : 1)
                : toStringParamValueOnly().compareTo(other.toStringParamValueOnly());
    }
1273817
def _ion_equals(a, b, timestamp_comparison_func, recursive_comparison_func):
    """"""
    for a, b in ((a, b), (b, a)):  # Ensures that operand order does not matter.
        if isinstance(a, _IonNature):
            if isinstance(b, _IonNature):
                # Both operands have _IonNature. Their IonTypes and annotations must be equivalent.
                eq = a.ion_type is b.ion_type and _annotations_eq(a, b)
            else:
                # Only one operand has _IonNature. It cannot be equivalent to the other operand if it has annotations.
                eq = not a.ion_annotations
            if eq:
                if isinstance(a, IonPyList):
                    return _sequences_eq(a, b, recursive_comparison_func)
                elif isinstance(a, IonPyDict):
                    return _structs_eq(a, b, recursive_comparison_func)
                elif isinstance(a, IonPyTimestamp):
                    return timestamp_comparison_func(a, b)
                elif isinstance(a, IonPyNull):
                    return isinstance(b, IonPyNull) or (b is None and a.ion_type is IonType.NULL)
                elif isinstance(a, IonPySymbol) or (isinstance(a, IonPyText) and a.ion_type is IonType.SYMBOL):
                    return _symbols_eq(a, b)
                elif isinstance(a, IonPyDecimal):
                    return _decimals_eq(a, b)
                elif isinstance(a, IonPyFloat):
                    return _floats_eq(a, b)
                else:
                    return a == b
            return False
    # Reaching this point means that neither operand has _IonNature.
    for a, b in ((a, b), (b, a)):  # Ensures that operand order does not matter.
        if isinstance(a, list):
            return _sequences_eq(a, b, recursive_comparison_func)
        elif isinstance(a, dict):
            return _structs_eq(a, b, recursive_comparison_func)
        elif isinstance(a, datetime):
            return timestamp_comparison_func(a, b)
        elif isinstance(a, SymbolToken):
            return _symbols_eq(a, b)
        elif isinstance(a, Decimal):
            return _decimals_eq(a, b)
        elif isinstance(a, float):
            return _floats_eq(a, b)
    return a == b
475886
def is_same_function(ea1, ea2):
    """"""
    func1 = idaapi.get_func(ea1)
    func2 = idaapi.get_func(ea2)
    # This is bloated code. `None in (func1, func2)` will not work because of a
    # bug in IDAPython in the way functions are compared.
    if any(func is None for func in (func1, func2)):
        return False

    return func1.startEA == func2.startEA
3842
function hasDuplicates(arr, fn) {
  var obj = {};
  var i, l, elem;
  for (i = 0, l = arr.length; i < l; i++) {
    elem = arr[i];
    if (fn) {
      elem = fn(elem);
    }
    if (obj[elem]) {
      return true;
    }
    obj[elem] = true;
  }
  return false;
}
632742
function (a, b) {
        if (a === b) {
            return true;
        }
        if (typeof a !== typeof b) {
            return this._alike(a, b);
        }
        return this._objectLike(a, b);
    }
1162898
function isDeepEqual(obj1, obj2, isStrict) {
      if (typeof obj1 !== typeof obj2) return false;
      if (isArr(obj1) && isArr(obj2)) {
        if (obj1.length !== obj2.length) return false;
        for (var i = 0; i < obj1.length; i++) {
          if (!isDeepEqual(obj1[i], obj2[i], isStrict)) return false;
        }
        return true;
      }
      else if (isObj(obj1) && isObj(obj2)) {
        if (len(obj1) !== len(obj2)) return false;
        var ks = keys(obj1);
        if (isStrict && !isDeepEqual(ks, keys(obj2))) return false;
        for (var i = 0; i < ks.length; i++) {
          if (
            !has(obj2, ks[i]) || !isDeepEqual(obj1[ks[i]], obj2[ks[i]], isStrict)
          ) return false;
        }
        return true;
      }
      else return obj1 === obj2;
    }
1043
private JCTree matchAnnoToTree(AnnotationMirror findme,
                                   Element e, JCTree tree) {
        Symbol sym = cast(Symbol.class, e);
        class Vis extends JCTree.Visitor {
            List<JCAnnotation> result = null;
            public void visitPackageDef(JCPackageDecl tree) {
                result = tree.annotations;
            }
            public void visitClassDef(JCClassDecl tree) {
                result = tree.mods.annotations;
            }
            public void visitMethodDef(JCMethodDecl tree) {
                result = tree.mods.annotations;
            }
            public void visitVarDef(JCVariableDecl tree) {
                result = tree.mods.annotations;
            }
            @Override
            public void visitTypeParameter(JCTypeParameter tree) {
                result = tree.annotations;
            }
        }
        Vis vis = new Vis();
        tree.accept(vis);
        if (vis.result == null)
            return null;

        List<Attribute.Compound> annos = sym.getAnnotationMirrors();
        return matchAnnoToTree(cast(Attribute.Compound.class, findme),
                               annos,
                               vis.result);
    }
237007
private JCTree matchAnnoToTree(Attribute.Compound findme,
                                   List<Attribute.Compound> annos,
                                   List<JCAnnotation> trees) {
        for (Attribute.Compound anno : annos) {
            for (JCAnnotation tree : trees) {
                JCTree match = matchAnnoToTree(findme, anno, tree);
                if (match != null)
                    return match;
            }
        }
        return null;
    }
497582
public static boolean samePackageName(ClassNode first, ClassNode second) {
        return Objects.equals(first.getPackageName(), second.getPackageName());
    }
923066
def identical(self, other):
        
        try:
            return (self.name == other.name and
                    self._all_compat(other, 'identical'))
        except (TypeError, AttributeError):
            return False
633725
def Or(a: Bool, b: Bool) -> Bool:
    
    union = a.annotations + b.annotations
    return Bool(z3.Or(a.raw, b.raw), annotations=union)
758293
def identical(self, other):
        
        try:
            return (utils.dict_equiv(self.attrs, other.attrs) and
                    self.equals(other))
        except (TypeError, AttributeError):
            return False