You have to actually figure out what the code is doing, and develop a brand new fast version. Super-low-level optimizations won’t improve the O(N) complexity, AFAICT.