It's clearly a derived work, since the apparatus that has produced the work (the AI model) can only function when supplied with copyrighted works - in fact it cannot exists without copious amounts of such works. If there is even a passing semblance between a source work and the output, such as, for example, similar code structure and different variable names, then you are legally fucked.
I'm sure courts will clear this mess up really soon, and I'm betting money the rulings won't subscribe to the "it's mine now" mantra of the AI crowd.