Free adiabatic expansion is REVERSIBLE. Spot the mistake in this argument So I know for a fact that free adiabatic expansion is irreversible. I thought of the following argument which shows that free adiabatic expansion is reversible and I wanted to know where's the mistake in my argument. 
Assumptions: 


*

*My understanding is that a process is reversible if we can return the system to its original state without affecting its surroundings. By “without affecting its surroundings”, I mean that there's no net energy transfer between the system and the surroundings after we restored the system to its original state.

*The internal energy of the system depends only on its temperature.  
Argument: The system under consideration is a gas in an insulated cylinder with a clamped piston as shown in the figure. It has an initial temperature of $T_i$ with corresponding energy $E_i$. Now the gas expands adiabatically in the vacuum (see figure). There's no heat exchange with the surroundings and no work done by the gas hence it maintains its original energy and temperature. Now, we draw energy from the surroundings to do work $W$ in compressing the gas to its original volume (how/where we draw this energy from should not matter, but for example, it can be achieved by a heat engine that draws heat from a hot reservoir and outputs $W$ as work). Now, the temperature of the compressed gas increases to $T_{\text{compress}}$ with a corresponding change in internal energy equal to $E_{\text{compress}}-E_i=W$. Now we allow the hot gas to come into contact with a heat sink and extract energy from it by heat $Q$ until the gas returns to its original temperature of $T_i$, where now its internal energy changes by $E_{i}-E_{\text{compress}}=Q=-W$. That is, all the energy drawn from the surroundings to the system as work returned back again to the system as heat. All in all, the system returned to its original state and the net energy transfer between the system and the surroundings is zero; therefore the process is reversible. 
Now, where exactly is the mistake in this argument (or assumptions/definitions) that led to this wrong conclusion?

 A: 
By "without affecting its surroundings", I mean that there's no net
  energy transfer between the system and the surroundings after we
  restored the system to its original state.

It's not sufficient to only have no net energy transfer for a process to be reversible. There has to be no net change in entropy. There are two forms of energy transfer: heat and work. Work does not transfer entropy. But heat does. So if a process involves doing work and transferring and equal amount of heat, there is no net energy transfer, but there is a transfer of entropy. I think this is the wrong assumption at the root of your erroneous conclusion, as explained further below. (I will assume an ideal gas, though  you didn't state so, since you indicated internal energy of the system depends only on temperature and that is only true for an ideal gas.)

Argument: The system under consideration is a gas in an insulated
  cylinder with a clamped piston as shown in the figure........

Without going into all the details of the rather circuitous process following this introduction for returning the system to its original state, the bottom line is that in the end when you extracted heat from the gas and transferred it to the surroundings to return the gas to its original state you increased the entropy of the surroundings. The net change in energy is zero, but not the net change in entropy. You may be able to see this more clearly with the following alternative approach:
In order to return the gas to its original state, you return it to its original temperature which means to its original internal energy if it is an ideal gas. To do that you need to remove the insulation from the cylinder and perform a reversible isothermal (constant temperature) compression of the gas to its original volume. This will result in heat transfer to the surroundings. The work done by the surroundings to compress the gas will exactly equal the heat transferred to the surroundings, so there will be no net change in energy of the system + surroundings.  But when you do this you will find that there is an increase in entropy of the surroundings. If the heat transfer occurs isothermally to the surroundings the increase in entropy of the surroundings will be
$$\Delta S=\frac{Q}{T_{surr}}$$.
Since the change in entropy of the gas in returning it to its original state has to be zero, the overall change in entropy is
$$\Delta S_{Total}=\frac{Q}{T_{surr}}>0$$
which proves that the free adiabatic expansion was an irreversible process because it has "affected the surroundings" by increasing its entropy..
Hope this helps.
A: 
Now, we draw energy from the surroundings to do work  in compressing the gas to its original volume (how/where we draw this energy from should not matter, but for example, it can be achieved by a heat engine that draws heat from a hot reservoir and outputs  as work).

[...]

That is, all the energy drawn from the surroundings to the system as work returned back again to the system as heat. All in all, the system returned to its original state and the net energy transfer between the system and the surroundings is zero; therefore the process is reversible. 


The Kelvin-Planck statement of the 2nd Law is

It is impossible to devise a cyclically operating device, the sole effect of which is to absorb energy in the form of heat from a single thermal reservoir and to deliver an equivalent amount of work.

In other words,  your engine, which absorbs heat from some reservoir and does work to compress the gas back to its original volume, will not be 100% efficient - it will exhaust some additional waste heat to the environment, producing entropy and making the process irreversible.
