Reversible and irreversible magnetocaloric effect: The cases of rare-earth intermetallics YbPt2Sn and Ce0.5La0.5B6