The model of the heat pump (above) and the heat engine (below). On the left side is the lower temperature and on the right side the higher temperature environment/reservoir. Shades of red and blue indicate temperature.
For the heat pump, Ⓐ→Ⓑ is isothermal compression, which releases heat; Ⓑ→Ⓒ is adiabatic expansion; Ⓒ→Ⓓ is isothermal expansion, which absorbs heat; and Ⓓ→Ⓐ is adiabatic compression. Note that the total received work is larger than the total delivered work.
For the heat engine, Ⓐ→Ⓑ is isothermal expansion, which delivers work; Ⓑ→Ⓒ is adiabatic expansion, which delivers work ; Ⓒ→Ⓓ is isothermal compression, which receives work; and Ⓓ→Ⓐ is adiabatic compression, which receives work. Note that the total delivered work is larger than the total received work.