The idea is that specifications are not copyrightable, but implementations are. So, the first team reverse engineers the work and writes a spec for the second team to work from. That way, you guarantee that the second implementation is free of copyrighted code.
https://en.wikipedia.org/wiki/Clean-room_design