code: def _cond_dce_rule(
      used_outputs: list[bool],
      eqn: core.JaxprEqn,
  ) -> tuple[list[bool], core.JaxprEqn]:
      closed_branches = eqn.params["branches"]
      branches = [
          closed_jaxpr.jaxpr for closed_jaxpr in closed_branches
      ]
  
      # First, compute which inputs are used in any branch (not including `pred`).
      used_inputs: list[bool] = [False] * (
          len(eqn.invars) - 1
      )  # -1 for pred
      for jaxpr in branches:
          _, used_inputs_ = pe.dce_jaxpr(
              jaxpr, used_outputs, instantiate=False
          )
          used_inputs = map(operator.or_, used_inputs, used_inputs_)
  
      # Next, compute DCEd branches, instantiating according to used_inputs.
      dce_branches_ = [
          pe.dce_jaxpr(jaxpr, used_outputs, instantiate=used_inputs)[0]
          for jaxpr in branches
      ]
      dce_branches = [
          core.ClosedJaxpr(jaxpr, closed_jaxpr.consts)
          for closed_jaxpr, jaxpr in zip(closed_branches, dce_branches_)
      ]
  
      # Finally, update parameters and form the new eqn.
      dce_linear = [
          l
          for l, used in zip(eqn.params["linear"], used_inputs)
          if used
      ]
      new_params = dict(
          eqn.params,
          branches=tuple(dce_branches),
          linear=tuple(dce_linear),
      )
      new_effects = core.join_effects(
          *(b.effects for b in dce_branches)
      )
      new_effects = _join_cond_effects(dce_branches_)
      new_eqn = pe.new_jaxpr_eqn(
          [
              v
              for v, used in zip(eqn.invars, [True, *used_inputs])
              if used
          ],
          [v for v, used in zip(eqn.outvars, used_outputs) if used],
          eqn.primitive,
          new_params,
          new_effects,
          eqn.source_info,
      )
  
      assert all(
          len(new_eqn.invars) == 1 + len(jaxpr.in_avals)
          for jaxpr in new_params["branches"]
      )
      assert all(
          len(new_eqn.outvars) == len(jaxpr.out_avals)
          for jaxpr in new_params["branches"]
      )
      return [True, *used_inputs], new_eqn
  
imports: from __future__ import annotations
  import collections
  from collections.abc import Sequence
  import functools
  from functools import partial
  import inspect
  import itertools
  import operator
  from typing import Any, Callable, TypeVar
  from jax.tree_util import tree_flatten, tree_unflatten
  from jax._src import ad_util
  from jax._src import config
  from jax._src import core
  from jax._src import dispatch
  from jax._src import dtypes
  from jax._src import effects
  from jax._src import linear_util
  from jax._src import source_info_util
  from jax._src import util
  from jax._src.state.discharge import register_discharge_rule, discharge_state
  from jax._src.state.types import AbstractRef, RefEffect
  from jax._src.core import ConcreteArray, raise_to_shaped, replace_jaxpr_effects
  from jax._src.interpreters import ad
  from jax._src.interpreters import batching
  from jax._src.interpreters import mlir
  from jax._src.interpreters import partial_eval
  from jax._src.interpreters import xla
  from jax._src.lax import lax
  from jax._src.traceback_util import api_boundary
  from jax._src.util import safe_map, split_list, partition_list
  from jax._src.lib.mlir import ir
  from jax._src.lib.mlir.dialects import hlo
  import numpy
  from jax._src.lax.control_flow.common import _abstractify, _avals_short, _check_tree_and_avals, _initial_style_jaxprs_with_common_consts, _make_closed_jaxpr, _prune_zeros, _typecheck_param
label_desc: Use image node_id 17 for calling a global function with example usage: _cond_dce_rule(used_outputs, eqn) and returns: list,  new_eqn