### Original Baseline Code

{ORIGINAL_CODE}

### Previous Optimization Attempts

{OPTIMIZATION_ATTEMPTS}


### Instructions

* Use all prior attempts to infer which optimizations worked and which did not
* Aim for **higher runtime performance** while keeping the code **cleaner and more reviewable**
* Do not regress performance or readability

Produce the next optimized version.
