The second stage of the circuit is an inverting amplifier circuit, which works in an open-loop state, and its function is to invert the signal of the first stage into a rectangular wave with an amplitude of 5V.
The third stage of the circuit is an inverse shaping circuit composed of Schmidt inverter, which is used to make the signal waveform quality higher and eliminate tiny burrs.