Phantom
You inherited a motion-sensor event classifier that compiles cleanly but never produces any output when built with -O2. At -O0 it works perfectly. A sensor on PA0 fires rising-edge interrupts; the ISR counts events and signals readiness. Main waits for the signal, classifies the count, and prints a report via UART.
Expected output format (example for 4 events): COUNT:4 LEVEL:MEDIUM
Classification levels: NONE (0), LOW (1-2), MEDIUM (3-5), HIGH (6+). After printing, PA5 pulses once (high then low) to confirm completion.
The code compiles without warnings at -O2 but produces incorrect behavior. Find and fix all the bugs.