Split IfNodes in two nodes, the first node is the header node, the
    second one is only composed of the jump condition.
165275
def split_if_nodes(graph):
    
    node_map = {n: n for n in graph}
    to_update = set()
    for node in graph.nodes[:]:
        if node.type.is_cond:
            if len(node.get_ins()) > 1:
                pre_ins = node.get_ins()[:-1]
                last_ins = node.get_ins()[-1]
                pre_node = StatementBlock('%s-pre' % node.name, pre_ins)
                cond_node = CondBlock('%s-cond' % node.name, [last_ins])
                node_map[node] = pre_node
                node_map[pre_node] = pre_node
                node_map[cond_node] = cond_node

                pre_node.copy_from(node)
                cond_node.copy_from(node)
                for var in node.var_to_declare:
                    pre_node.add_variable_declaration(var)
                pre_node.type.is_stmt = True
                cond_node.true = node.true
                cond_node.false = node.false

                for pred in graph.all_preds(node):
                    pred_node = node_map[pred]
                    # Verify that the link is not an exception link
                    if node not in graph.sucs(pred):
                        graph.add_catch_edge(pred_node, pre_node)
                        continue
                    if pred is node:
                        pred_node = cond_node
                    if pred.type.is_cond:  # and not (pred is node):
                        if pred.true is node:
                            pred_node.true = pre_node
                        if pred.false is node:
                            pred_node.false = pre_node
                    graph.add_edge(pred_node, pre_node)
                for suc in graph.sucs(node):
                    graph.add_edge(cond_node, node_map[suc])

                # We link all the exceptions to the pre node instead of the
                # condition node, which should not trigger any of them.
                for suc in graph.catch_edges.get(node, []):
                    graph.add_catch_edge(pre_node, node_map[suc])

                if node is graph.entry:
                    graph.entry = pre_node

                graph.add_node(pre_node)
                graph.add_node(cond_node)
                graph.add_edge(pre_node, cond_node)
                pre_node.update_attribute_with(node_map)
                cond_node.update_attribute_with(node_map)
                graph.remove_node(node)
        else:
            to_update.add(node)
    for node in to_update:
        node.update_attribute_with(node_map)
1264603
static boolean isBreakStructure(Node n, boolean labeled) {
    switch (n.getToken()) {
      case FOR:
      case FOR_IN:
      case FOR_OF:
      case FOR_AWAIT_OF:
      case DO:
      case WHILE:
      case SWITCH:
        return true;
      case BLOCK:
      case ROOT:
      case IF:
      case TRY:
        return labeled;
      default:
        return false;
    }
  }
1301145
function findNode(firstNode, predicate) {
    let curNode = firstNode;
    while (curNode != null) {
        if (predicate(curNode.value))
            return curNode;
        curNode = curNode.next;
    }
}
779535
private Node<E> _link(Node<E> node1, Node<E> node2) {
	// maybe there is no real unification here
	if(node1 == node2) return node2;
	// from now on, we know that we unify really disjoint trees
	if(node1.rank > node2.rank) {
	    node2.parent = node1;
	    node1.nbElems += node2.nbElems; 
	    return node1;
	}
	else {
	    node1.parent = node2;
	    if (node1.rank == node2.rank) {
		node2.rank++;
	    }
	    node2.nbElems += node1.nbElems;
	    return node2;
	}
    }
1273511
static private void swap(Node[] nodes, int i, int j) {
    Node tempNode;
    tempNode = nodes[j];
    nodes[j] = nodes[i];
    nodes[i] = tempNode;
    
  }
124790
function split(delim, val){
  utils.assertString(delim, 'delimiter');
  utils.assertString(val, 'val');
  var splitted = val.string.split(delim.string);
  var expr = new nodes.Expression();
  var ItemNode = val instanceof nodes.Ident
    ? nodes.Ident
    : nodes.String;
  for (var i = 0, len = splitted.length; i < len; ++i) {
    expr.nodes.push(new ItemNode(splitted[i]));
  }
  return expr;
}
1143099
private N split(N node) {
    // choose the split dimension and the split point
    int minimum = node.isLeaf() ? leafMinimum : dirMinimum;
    long[] split = settings.nodeSplitter.split(node, NodeArrayAdapter.STATIC, minimum);

    // New node
    final N newNode = node.isLeaf() ? createNewLeafNode() : createNewDirectoryNode();
    // do the split
    node.splitByMask(newNode, split);

    // write changes to file
    writeNode(node);
    writeNode(newNode);

    return newNode;
  }
1261609
final Node<E> succ(Node<E> p) {
        // TODO: should we skip deleted nodes here?
        if (p == (p = p.next))
            p = first();
        return p;
    }
913401
function splitOnFirst(str, splitter, callback) {
        var parts = str.split(splitter);
        var first = parts.shift();
        return callback(first, parts.join(splitter));
    }
1125947
def one_to_one(graph, nodes):
    
    edges = itertools.chain.from_iterable(graph.values())
    return len(graph) == len(nodes) and len(set(edges)) == len(nodes)
921730
function sortNodes(a, b) {
  if (Node.Type.isConstant(a) && Node.Type.isConstant(b)) {
    return parseFloat(a.value) - parseFloat(b.value);
  }
  else if (Node.Type.isConstant(a)) {
    return -1;
  }
  else if (Node.Type.isConstant(b)) {
    return 1;
  }
  return 0;
}
191845
function append(a,b)
{
	if (a.table.length === 0)
	{
		return b;
	}
	if (b.table.length === 0)
	{
		return a;
	}

	var c = append_(a, b);

	// Check if both nodes can be crunshed together.
	if (c[0].table.length + c[1].table.length <= M)
	{
		if (c[0].table.length === 0)
		{
			return c[1];
		}
		if (c[1].table.length === 0)
		{
			return c[0];
		}

		// Adjust .table and .lengths
		c[0].table = c[0].table.concat(c[1].table);
		if (c[0].height > 0)
		{
			var len = length(c[0]);
			for (var i = 0; i < c[1].lengths.length; i++)
			{
				c[1].lengths[i] += len;
			}
			c[0].lengths = c[0].lengths.concat(c[1].lengths);
		}

		return c[0];
	}

	if (c[0].height > 0)
	{
		var toRemove = calcToRemove(a, b);
		if (toRemove > E)
		{
			c = shuffle(c[0], c[1], toRemove);
		}
	}

	return siblise(c[0], c[1]);
}
298932
function cloneIfElseNodes(element, hasElse) {
      var children = childNodes(element),
          ifNodes = [],
          elseNodes = [],
          target = ifNodes;
        
      for (var i = 0, j = children.length; i < j; ++i) {
          if (hasElse && isElseNode(children[i])) {
              target = elseNodes;
              hasElse = false;
          } else {
              target.push(cleanNode(children[i].cloneNode(true)));
          }
      }
      
      return {
          ifNodes: ifNodes,
          elseNodes: elseNodes
      };
  }
634187
private static int compareNodes(String node1, String node2) {
        assert node1 != null;
        assert node2 != null;
        
        if (node1.equals(node2)) {
            return 0;
        }
        if (node1.length() > 0 && node1.charAt(0) == '{') {
            if (node2.length() > 0 && node2.charAt(0) == '{') {
                return 0;  // Both nodes are parameters; names are irrelevant
            }
            return 1;  // r1 is a parameter but r2 is not, so r2 should come first
        }
        if (node2.length() > 0 && node2.charAt(0) == '{') {
            return -1;   // r2 is a parameter but r1 is not, so r1 should come first
        }
        return node1.compareTo(node2);  // neither node is a parameter
    }
845869
def bsp_split_recursive(
    node: tcod.bsp.BSP,
    randomizer: Optional[tcod.random.Random],
    nb: int,
    minHSize: int,
    minVSize: int,
    maxHRatio: int,
    maxVRatio: int,
) -> None:
    
    node.split_recursive(
        nb, minHSize, minVSize, maxHRatio, maxVRatio, randomizer
    )
435216
private InternalNodeState combineInternalNodeStates(InternalNodeState inState, ExternalNode3 externalNode) {

        ExternalNode3 n1 = inState.getExternalNode();

        ExternalNode3 n = combineExternalNodes(n1, externalNode);

        return new InternalNodeState(n);
    }
936703
@SuppressWarnings("unchecked")
    protected Node<K, V> union(Node<K, V> root1, Node<K, V> root2) {
        if (root1 == null) {
            return root2;
        } else if (root2 == null) {
            return root1;
        }

        Node<K, V> newRoot;
        Node<K, V> cur;

        // find initial
        int c = ((Comparable<? super K>) root1.key).compareTo(root2.key);
        if (c <= 0) {
            newRoot = root1;
            root1 = unlinkRightChild(root1);
        } else {
            newRoot = root2;
            root2 = unlinkRightChild(root2);
        }
        cur = newRoot;

        // merge
        while (root1 != null && root2 != null) {
            c = ((Comparable<? super K>) root1.key).compareTo(root2.key);
            if (c <= 0) {
                // link as left child of cur
                if (cur.o_c == null) {
                    root1.y_s = cur;
                } else {
                    root1.y_s = cur.o_c;
                }
                cur.o_c = root1;
                cur = root1;
                root1 = unlinkRightChild(root1);
            } else {
                // link as left child of cur
                if (cur.o_c == null) {
                    root2.y_s = cur;
                } else {
                    root2.y_s = cur.o_c;
                }
                cur.o_c = root2;
                cur = root2;
                root2 = unlinkRightChild(root2);
            }
        }

        while (root1 != null) {
            // link as left child of cur
            if (cur.o_c == null) {
                root1.y_s = cur;
            } else {
                root1.y_s = cur.o_c;
            }
            cur.o_c = root1;
            cur = root1;
            root1 = unlinkRightChild(root1);
        }

        while (root2 != null) {
            // link as left child of cur
            if (cur.o_c == null) {
                root2.y_s = cur;
            } else {
                root2.y_s = cur.o_c;
            }
            cur.o_c = root2;
            cur = root2;
            root2 = unlinkRightChild(root2);
        }

        return newRoot;
    }