I have a gas transitioning adiabatically between A ($P_1$, $V_1$) and B ($P_2$, $V_2$) where $P_1>P_2$ and $V_2>V_1$. 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 = C_v(T_2-T_1)$), and then compressed irreversibly from B to A ($w = -P_{ext}(V_1-V_2)$) 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. If I compress irreversibly would the transition still be adiabatic? Alternatively, is the original scenario flawed: can I have an irreversible adiabatic transition?