def xif(
    cond: Var, /, *,
    else_branch: Iterable[Var], then_branch: Iterable[Var],
    to_outer_scope: bool = False
) -> Sequence[Var]:
    """
    Simplified constructor for the If operator.

    The return values are equal to those of ``else_branch`` or ``then_branch``, depending on the value of the boolean ``cond`` at runtime.

    Results for both branches should have the same number of elements and their types should be respectively compatible.

    Note that elements of ``else_branch`` and ``then_branch`` may use values from the outer scope,
    but to make sure they defined in the outer scope (instead of inlined in the inner scope) they
    should be marked with ``intro(*outer, loop(...))``.

    For the details of If behaviour, see the docstring for if_.
    """
    if to_outer_scope:
        cond = intro(*else_branch, *then_branch, cond)
    return if_(
        cond,
        else_branch=subgraph((), lambda: else_branch),
        then_branch=subgraph((), lambda: then_branch)
    )
