function _VirtualDom_addDomNodesHelp(domNode, vNode, patches, i, low, high, eventNode)
{
	var patch = patches[i];
	var index = patch.r;

	while (index === low)
	{
		var patchType = patch.$;

		if (patchType === 1)
		{
			_VirtualDom_addDomNodes(domNode, vNode.k, patch.s, eventNode);
		}
		else if (patchType === 8)
		{
			patch.t = domNode;
			patch.u = eventNode;

			var subPatches = patch.s.v;
			if (subPatches.length > 0)
			{
				_VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode);
			}
		}
		else if (patchType === 9)
		{
			patch.t = domNode;
			patch.u = eventNode;

			var data = patch.s;
			if (data)
			{
				data.z.s = domNode;
				var subPatches = data.v;
				if (subPatches.length > 0)
				{
					_VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode);
				}
			}
		}
		else
		{
			patch.t = domNode;
			patch.u = eventNode;
		}

		i++;

		if (!(patch = patches[i]) || (index = patch.r) > high)
		{
			return i;
		}
	}

	var tag = vNode.$;

	if (tag === 4)
	{
		var subNode = vNode.k;

		while (subNode.$ === 4)
		{
			subNode = subNode.k;
		}

		return _VirtualDom_addDomNodesHelp(domNode, subNode, patches, i, low + 1, high, domNode.elm_event_node_ref);
	}

	// tag must be 1 or 2 at this point

	var vKids = vNode.e;
	var childNodes = domNode.childNodes;
	for (var j = 0; j < vKids.length; j++)
	{
		low++;
		var vKid = tag === 1 ? vKids[j] : vKids[j].b;
		var nextLow = low + (vKid.b || 0);
		if (low <= index && index <= nextLow)
		{
			i = _VirtualDom_addDomNodesHelp(childNodes[j], vKid, patches, i, low, nextLow, eventNode);
			if (!(patch = patches[i]) || (index = patch.r) > high)
			{
				return i;
			}
		}
		low = nextLow;
	}
	return i;
}
// assumes `patches` is non-empty and indexes increase monotonically.
assumes `patches` is non-empty and indexes increase monotonically.
assumes ` patches ` is non - empty and indexes increase monotonically .
function _VirtualDom_addDomNodesHelp(domNode, vNode, patches, i, low, high, eventNode)
{
	var patch = patches[i];
	var index = patch.r;
	while (index === low)
	{
		var patchType = patch.$;
		if (patchType === 1)
		{
			_VirtualDom_addDomNodes(domNode, vNode.k, patch.s, eventNode);
		}
		else if (patchType === 8)
		{
			patch.t = domNode;
			patch.u = eventNode;
			var subPatches = patch.s.v;
			if (subPatches.length > 0)
			{
				_VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode);
			}
		}
		else if (patchType === 9)
		{
			patch.t = domNode;
			patch.u = eventNode;
			var data = patch.s;
			if (data)
			{
				data.z.s = domNode;
				var subPatches = data.v;
				if (subPatches.length > 0)
				{
					_VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode);
				}
			}
		}
		else
		{
			patch.t = domNode;
			patch.u = eventNode;
		}
		i++;
		if (!(patch = patches[i]) || (index = patch.r) > high)
		{
			return i;
		}
	}
	var tag = vNode.$;
	if (tag === 4)
	{
		var subNode = vNode.k;
		while (subNode.$ === 4)
		{
			subNode = subNode.k;
		}
		return _VirtualDom_addDomNodesHelp(domNode, subNode, patches, i, low + 1, high, domNode.elm_event_node_ref);
	}
	var vKids = vNode.e;
	var childNodes = domNode.childNodes;
	for (var j = 0; j < vKids.length; j++)
	{
		low++;
		var vKid = tag === 1 ? vKids[j] : vKids[j].b;
		var nextLow = low + (vKid.b || 0);
		if (low <= index && index <= nextLow)
		{
			i = _VirtualDom_addDomNodesHelp(childNodes[j], vKid, patches, i, low, nextLow, eventNode);
			if (!(patch = patches[i]) || (index = patch.r) > high)
			{
				return i;
			}
		}
		low = nextLow;
	}
	return i;
}
function _VirtualDom_addDomNodesHelp ( domNode , vNode , patches , i , low , high , eventNode ) { var patch = patches [ i ] ; var index = patch . r ; while ( index === low ) { var patchType = patch . $ ; if ( patchType === 1 ) { _VirtualDom_addDomNodes ( domNode , vNode . k , patch . s , eventNode ) ; } else if ( patchType === 8 ) { patch . t = domNode ; patch . u = eventNode ; var subPatches = patch . s . v ; if ( subPatches . length > 0 ) { _VirtualDom_addDomNodesHelp ( domNode , vNode , subPatches , 0 , low , high , eventNode ) ; } } else if ( patchType === 9 ) { patch . t = domNode ; patch . u = eventNode ; var data = patch . s ; if ( data ) { data . z . s = domNode ; var subPatches = data . v ; if ( subPatches . length > 0 ) { _VirtualDom_addDomNodesHelp ( domNode , vNode , subPatches , 0 , low , high , eventNode ) ; } } } else { patch . t = domNode ; patch . u = eventNode ; } i ++ ; if ( ! ( patch = patches [ i ] ) || ( index = patch . r ) > high ) { return i ; } } var tag = vNode . $ ; if ( tag === 4 ) { var subNode = vNode . k ; while ( subNode . $ === 4 ) { subNode = subNode . k ; } return _VirtualDom_addDomNodesHelp ( domNode , subNode , patches , i , low + 1 , high , domNode . elm_event_node_ref ) ; } var vKids = vNode . e ; var childNodes = domNode . childNodes ; for ( var j = 0 ; j < vKids . length ; j ++ ) { low ++ ; var vKid = tag === 1 ? vKids [ j ] : vKids [ j ] . b ; var nextLow = low + ( vKid . b || 0 ) ; if ( low <= index && index <= nextLow ) { i = _VirtualDom_addDomNodesHelp ( childNodes [ j ] , vKid , patches , i , low , nextLow , eventNode ) ; if ( ! ( patch = patches [ i ] ) || ( index = patch . r ) > high ) { return i ; } } low = nextLow ; } return i ; }
assumes `patches` is non-empty and indexes increase monotonically.
assumes ` patches ` is non - empty and indexes increase monotonically .
// tag must be 1 or 2 at this point