At the second and higher levels, decomposers of the available materials function as herbivores or carnivores depending on whether their food is plant or animal material.
(herbivores or carnivores; depending; on whether their food is plant or animal material) (their food; is; plant or animal material)
herbivores or carnivores their food
depending is
on whether their food is plant or animal material
plant or animal material