Your transformation isn't valid: consider multithreading. One printf will write to a stream as an atomic operation (enforced by internal stdio locks), but the output from discrete output functions may overlap.
Posted Jun 3, 2012 9:23 UTC (Sun) by dgm (subscriber, #49227)
[Link]
That's why a naive coder with a optimizing compiler cannot beat a good coder. The compiler is bound by the precise semantics of the code, even if there are aspects of it that you don't care. The compiler has to care.