Quantum circuit debugging and sensitivity analysis via local inversions