function findMatchingIndex(
	childVNode,
	oldChildren,
	skewedIndex,
	remainingOldChildren
) {
	const key = childVNode.key;
	const type = childVNode.type;
	let oldVNode = oldChildren[skewedIndex];

	// We only need to perform a search if there are more children
	// (remainingOldChildren) to search. However, if the oldVNode we just looked
	// at skewedIndex was not already used in this diff, then there must be at
	// least 1 other (so greater than 1) remainingOldChildren to attempt to match
	// against. So the following condition checks that ensuring
	// remainingOldChildren > 1 if the oldVNode is not already used/matched. Else
	// if the oldVNode was null or matched, then there could needs to be at least
	// 1 (aka `remainingOldChildren > 0`) children to find and compare against.
	//
	// If there is an unkeyed functional VNode, that isn't a built-in like our Fragment,
	// we should not search as we risk re-using state of an unrelated VNode. (reverted for now)
	let shouldSearch =
		// (typeof type != 'function' || type === Fragment || key) &&
		remainingOldChildren >
		(oldVNode != NULL && (oldVNode._flags & MATCHED) == 0 ? 1 : 0);

	if (
		(oldVNode === NULL && childVNode.key == null) ||
		(oldVNode &&
			key == oldVNode.key &&
			type == oldVNode.type &&
			(oldVNode._flags & MATCHED) == 0)
	) {
		return skewedIndex;
	} else if (shouldSearch) {
		let x = skewedIndex - 1;
		let y = skewedIndex + 1;
		while (x >= 0 || y < oldChildren.length) {
			if (x >= 0) {
				oldVNode = oldChildren[x];
				if (
					oldVNode &&
					(oldVNode._flags & MATCHED) == 0 &&
					key == oldVNode.key &&
					type == oldVNode.type
				) {
					return x;
				}
				x--;
			}

			if (y < oldChildren.length) {
				oldVNode = oldChildren[y];
				if (
					oldVNode &&
					(oldVNode._flags & MATCHED) == 0 &&
					key == oldVNode.key &&
					type == oldVNode.type
				) {
					return y;
				}
				y++;
			}
		}
	}

	return -1;
}
@param {VNode} childVNode
@param {VNode[]} oldChildren
@param {number} skewedIndex
@param {number} remainingOldChildren
@returns {number}