Please fix the optimized code to match the behaviour of the original code, while trying to keep the optimization logic intact.

### The original source code:

{original_source_code}

### The optimized source code

{modified_source_code}

### The test result details

{test_details}
