It sounds like it's not "You made a knockoff, that's 'non-literal copying,'", it's "You made a literal copy, changed a couple of things, and called it yours."
Structure, sequence, and organization of a computer program -- not just code -- is subject to copyright per Whelan v. Jaslow. Note that the Whelan standard became relevant again after Oracle v. Google.
It would be sad if courts accepted a technically ambiguous approach effectively deciding arbitrarily which case is what.
Clean room is a way to prove you couldn't possibly have infringed copyright. It is not mandatory.
I read this as the following example: So KFC has a secret blend of herbs and spices. If you worked there and stole a bag of the mix and sold it, it is pretty obviously theft. If you gave the recipe to someone else and they used it exactly, it is still theft of the secret as you can reproduce it exactly. Let's say instead that you use 5% less paprika in your mix but all other things are the same. This is a non literal copy but is still fully built on the trade secret.
Just my two cents....
if i > 0 then
non-literal copy:
if index > 0 then