∀ {m : Type u_1 → Type u_2} {α : Type u_3} {β : Type u_1} [inst : Monad m] (f : α → β → m β) (init : β) (as : Array α)
  (start stop : ℕ) (h_start : start ≤ as.size) (acc : Array β),
  Array.scanrM.loop f init as start stop h_start acc =
    if h_gt : stop < start then
      let i := start - 1;
      do
      let next ← f as[i] init
      Array.scanrM.loop f next as i stop ⋯ (acc.push init)
    else pure (acc.push init).reverse