I may be misinterpreting your intent, but this seems disingenuous to me. I can't go look at the Linux kernel, then 'rewrite' [the same code] with my fingers and keyboard to escape copyright ownership of Linux kernel contributors.
I can rewrite code that implements a described process. Or code that implements a described interface. If this was your intent, I'll take the blame for misunderstanding. But I caution the use of phrases like "the same code" when you actually mean new code that implements the same process.