I think I understand what it does. But i can't agree with output for sertain inputs. For example: if a=1 and b=1 then how the output on 4 line could be xor(a, b). Because as far as I know xor(1,1)=0 and also 1+1=1. It's not consistent.
Note that the first CNOT gives you
$$ CNOT |a\rangle |0\rangle = |a\rangle |a \oplus 0 \rangle = |a\rangle |a \rangle$$
and then the second CNOT gives you
$$ CNOT |b\rangle |a\rangle = |b\rangle |b \oplus a\rangle$$
Thus the target qubit state is now in $|b \oplus a\rangle$