Understanding this comparator circuit for AC voltage protection
Note that the whole shown circuit (so, +3.3V, +12V, ZC_IN, etc) should be considered live and thus dangerous).


The shown picture has cut off the name of the output that gives an important hint: ZC_IN, which stands for Zero Crossing in.  

D19 and D20 clamp the floating line voltage to a floating 0.7V volt, where R35 and R40 limit the current through D19 or D20. I mean floating with respect to the circuit's ground. R36 and R38 'align' this floating 0.7V with respect to ground. So, the comparator will see a sine wave which matches the line voltage at the zero crossing, but will be clamped between -0.35V and 0.35V. 

This zero crossing is required to make a good PFC.  

Below a picture of the (clamped) voltages the comparator sees at its input terminals.