/*
Binary operators: checking for return type priority.
963169
@Override
	public RandomVariable add(RandomVariable randomVariable) {
		if(randomVariable.getTypePriority() > this.getTypePriority()) {
			// Check type priority
			return randomVariable.add(this);
		}

		// Set time of this random variable to maximum of time with respect to which measurability is known.
		double newTime = Math.max(time, randomVariable.getFiltrationTime());

		if(isDeterministic() && randomVariable.isDeterministic()) {
			double newValueIfNonStochastic = valueIfNonStochastic + randomVariable.get(0);
			return new RandomVariableFromDoubleArray(newTime, newValueIfNonStochastic);
		}
		else if(isDeterministic()) {
			double[] newRealizations = new double[Math.max(size(), randomVariable.size())];
			for(int i=0; i<newRealizations.length; i++) {
				newRealizations[i]		 = valueIfNonStochastic + randomVariable.get(i);
			}
			return new RandomVariableFromDoubleArray(newTime, newRealizations);
		} else {
			double[] newRealizations = new double[Math.max(size(), randomVariable.size())];
			for(int i=0; i<newRealizations.length; i++) {
				newRealizations[i]		 = realizations[i] + randomVariable.get(i);
			}
			return new RandomVariableFromDoubleArray(newTime, newRealizations);
		}
	}
1292861
def tco_return_handle(tokens):
    """"""
    internal_assert(len(tokens) == 2, "invalid tail-call-optimizable return statement tokens", tokens)
    if tokens[1].startswith("()"):
        return "return _coconut_tail_call(" + tokens[0] + ")" + tokens[1][2:]  # tokens[1] contains \n
    else:
        return "return _coconut_tail_call(" + tokens[0] + ", " + tokens[1][1:]
681173
function bin_val() {
    var ret = this.seq(
        this.istringf('b'),
        bitChar,
        this.mightf(
            this.choicef(
                bit_string,
                bit_range)));
    var r3 = ret[3];
    if (r3) {
        if (typeof(r3) === "string") {
            // series of concatenated bit values
            return ret[2] + r3;
        } else {
            // range
            r3.setFirst(ret[2]);
            return r3;
        }
    }
    return ret[2];
}
509535
function getBinaryExpressionStarts(binaryExpression, starts) {
  function getStartsFromOneSide(side, starts) {
    starts.push(side.loc.start);
    if (side.type === 'BinaryExpression') {
      starts = getBinaryExpressionStarts(side, starts);
    }
    return starts;
  }

  starts = getStartsFromOneSide(binaryExpression.left, starts);
  starts = getStartsFromOneSide(binaryExpression.right, starts);
  return starts;
}
688342
private static int binarySearch(int[] arr, int value) {
		int found = 0;
		int left = 0;
		int right = arr.length - 1;
		while (left < right) {
			if (right - left == 1) {
				found = value < arr[left] ? left : right;
				break;
			}

			int middle = left + (right - left) / 2;
			if (value < arr[middle]) {
				right = middle;
			} else {
				left = middle;
			}
		}
		return found;
	}
948762
function B(iid, op, left, right, flags) {
        var bFlags = decodeBitPattern(flags, 3); // [isComputed, isOpAssign, isSwitchCaseComparison]
        var result, aret, skip = false;

        if (sandbox.analysis && sandbox.analysis.binaryPre) {
            aret = sandbox.analysis.binaryPre(iid, op, left, right, bFlags[1], bFlags[2], bFlags[0]);
            if (aret) {
                op = aret.op;
                left = aret.left;
                right = aret.right;
                skip = aret.skip;
            }
        }


        if (!skip) {
            switch (op) {
                case "+":
                    result = left + right;
                    break;
                case "-":
                    result = left - right;
                    break;
                case "*":
                    result = left * right;
                    break;
                case "/":
                    result = left / right;
                    break;
                case "%":
                    result = left % right;
                    break;
                case "<<":
                    result = left << right;
                    break;
                case ">>":
                    result = left >> right;
                    break;
                case ">>>":
                    result = left >>> right;
                    break;
                case "<":
                    result = left < right;
                    break;
                case ">":
                    result = left > right;
                    break;
                case "<=":
                    result = left <= right;
                    break;
                case ">=":
                    result = left >= right;
                    break;
                case "==":
                    result = left == right;
                    break;
                case "!=":
                    result = left != right;
                    break;
                case "===":
                    result = left === right;
                    break;
                case "!==":
                    result = left !== right;
                    break;
                case "&":
                    result = left & right;
                    break;
                case "|":
                    result = left | right;
                    break;
                case "^":
                    result = left ^ right;
                    break;
                case "delete":
                    result = delete left[right];
                    break;
                case "instanceof":
                    result = left instanceof right;
                    break;
                case "in":
                    result = left in right;
                    break;
                default:
                    throw new Error(op + " at " + iid + " not found");
                    break;
            }
        }

        if (sandbox.analysis && sandbox.analysis.binary) {
            aret = sandbox.analysis.binary(iid, op, left, right, result, bFlags[1], bFlags[2], bFlags[0]);
            if (aret) {
                result = aret.result;
            }
        }
        return (lastComputedValue = result);
    }
1361193
function binop() {
		var left = primary();

		var m = str.match(/^ *(OR|AND) */i);
		if (!m) return left;

		str = str.slice(m[0].length);

		var right = binop();

		return {
			type: 'op',
			op: m[1].toLowerCase(),
			left: left,
			right: right
		}
	}
155903
function processOperators (ops) {
    if (!ops) return {};
    var operators = {};
    for (var i=0,k,prec;prec=ops[i]; i++) {
        for (k=1;k < prec.length;k++) {
            operators[prec[k]] = {precedence: i+1, assoc: prec[0]};
        }
    }
    return operators;
}
489109
private static int binarySearch(int[] a, int fromIndex, int length, int key)
    {
        int low = fromIndex;
        int high = fromIndex + length - 1;

        while (low <= high)
        {
            int mid = (low + high) >>> 1;
            int midVal = a[mid << 1];

            if (midVal < key)
                low = mid + 1;
            else if (midVal > key)
                high = mid - 1;
            else
                return mid; // key found
        }
        return -(low + 1);  // key not found.
    }
698658
function matchBinaries (input, binary) {
  const regExp = bytecodeToBytecodeRegex(binary);
  return (input.match(regExp) !== null);
}
549017
function() {
        var test = gobbleBinaryExpression(),
          consequent,
          alternate;
        gobbleSpaces();
        if (exprICode(index) === QUMARK_CODE) {
          // Ternary expression: test ? consequent : alternate
          index++;
          consequent = gobbleExpression();
          if (!consequent) {
            throwError("Expected expression", index);
          }
          gobbleSpaces();
          if (exprICode(index) === COLON_CODE) {
            index++;
            alternate = gobbleExpression();
            if (!alternate) {
              throwError("Expected expression", index);
            }
            return {
              type: code.CONDITIONAL_EXP,
              test: test,
              consequent: consequent,
              alternate: alternate
            };
          } else {
            throwError("Expected :", index);
          }
        } else {
          return test;
        }
      }
114072
private static <T> int binarySearch0(Sortable<T> a, int fromIndex, int toIndex, T key, Comparator<? super T> c) {
        if (c == null) {
            throw new NullPointerException();
        }
        int low = fromIndex;
        int high = toIndex - 1;

        while (low <= high) {
            int mid = (low + high) >>> 1;
            T midVal = a.at(mid);
            int cmp = c.compare(midVal, key);
            if (cmp < 0)
                low = mid + 1;
            else if (cmp > 0)
                high = mid - 1;
            else
                return mid; // key found
        }
        return -(low + 1); // key not found.
    }
1067820
function Types() {
    this.binary = specs.ABinary;
    this.string = specs.AString;
    this.bool = specs.ABoolean;
    this.byte = specs.AByte;
    this.i16 = specs.AInt16;
    this.i32 = specs.AInt32;
    this.i64 = specs.AInt64;
    this.double = specs.ADouble;
}
242725
function(a, b) {
                var as = a.specificity;
                var bs = b.specificity;

                if (as[0] != bs[0]) return bs[0] - as[0];
                if (as[1] != bs[1]) return bs[1] - as[1];
                if (as[2] != bs[2]) return bs[2] - as[2];
                return bs[3] - as[3];
            }
630103
function checkBinary(node) {
            const leftNode = (node.left.typeAnnotation) ? node.left.typeAnnotation : node.left;
            const rightNode = node.right;

            // search for = in AssignmentPattern nodes
            const operator = node.operator || "=";

            const nonSpacedNode = getFirstNonSpacedToken(leftNode, rightNode, operator);

            if (nonSpacedNode) {
                if (!(int32Hint && sourceCode.getText(node).endsWith("|0"))) {
                    report(node, nonSpacedNode);
                }
            }
        }
293139
function isNullOrUndefined(node) {
    return (
        module.exports.isNullLiteral(node) ||
        (node.type === "Identifier" && node.name === "undefined") ||
        (node.type === "UnaryExpression" && node.operator === "void")
    );
}
197677
void expectBitwiseable(Node n, JSType type, String msg) {
    if (!type.matchesNumberContext() && !type.isSubtypeOf(allBitwisableValueTypes)) {
      mismatch(n, msg, type, allBitwisableValueTypes);
    } else {
      expectNumberStrict(n, type, msg);
    }
  }