Extract a diagonal unitary from a 3-CNOT two-qubit unitary.

Returns a 2-CNOT unitary D that is diagonal, so that U @ D needs only two CNOT gates in case the original unitary is a 3-CNOT unitary.

See Proposition V.2 in Minimal Universal Two-Qubit CNOT-based Circuits.

u three-CNOT two-qubit unitary

diagonal extracted from U