I have a gas transitioning adiabatically between A (P1, V1) and B (P2, V2) where P1>P2 and V2>V1. The question is to determine the net work done on the gas if the gas is first expanded reversibly from A to B (w = dE = Cv(T2-T1)), and then compressed irreversibly from B to A (w = -Pext(V1-V2)) at a constant external pressure defined by A. In this scenario, simply looking at the areas under the graphs the net work should be positive. I am trying to reconcile this with dE for the gas. For the roundtrip transition (A to B to A), dE = 0. And if we take each step as adiabatic, then dE = w for each step, but as I have described above you would end up with two different values for dE for each step, thus dE not equal to zero. My logic is flawed somewhere, can someone help?