AI has sucked in knowledge of the entire humanity, so I'm pretty sure this is fine, especially if you claim you did the "clean room reimplementation" using two AI agents.
That line of defence will do wonders in court.
That line of defence will do wonders in court.