doEntireArrayStore ::
  (Crucible.IsSymBackend sym bak) =>
  bak ->
  Crucible.SymGlobalState sym ->
  Crucible.RegValue sym CJ.JVMRefType ->
  [Crucible.RegValue sym CJ.JVMValueType] ->
  IO (Crucible.SymGlobalState sym)
doEntireArrayStore bak glob ref vs = foldM store glob (zip [0..] vs)
  where store g (i, v) = CJ.doArrayStore bak g ref i v

-- | Given a 'TypedTerm' with a vector type, return the element type
-- along with a list of its projected components. Return 'Nothing' if
-- the 'TypedTerm' does not have a vector type.
doEntireArrayStore ::
  (Crucible.IsSymBackend sym bak) =>
  bak ->
  Crucible.SymGlobalState sym ->
  Crucible.RegValue sym CJ.JVMRefType ->
  [Crucible.RegValue sym CJ.JVMValueType] ->
  IO (Crucible.SymGlobalState sym)
doEntireArrayStore bak glob ref vs = foldM store glob (zip [0..] vs)
  where store g (i, v) = CJ.doArrayStore bak g ref i v

-- | Given a 'TypedTerm' with a vector type, return the element type
-- along with a list of its projected components. Return 'Nothing' if
-- the 'TypedTerm' does not have a vector type.
doEntireArrayStore bak glob ref vs = foldM store glob (zip [0..] vs)
  where store g (i, v) = CJ.doArrayStore bak g ref i v

-- | Given a 'TypedTerm' with a vector type, return the element type
-- along with a list of its projected components. Return 'Nothing' if
-- the 'TypedTerm' does not have a vector type.