Abstract : Most operating systems heavily rely on intermediate data structures for modularity or portability reasons. This paper extends program specialization to eliminate these intermediate data structures in a uniform manner. Our transformation process is fully automatic and is based on a specializer for C programs, named Tempo. The key advantage of our approach is that the degree of safety of the source program is preserved by the optimization. As a result, mature system code can be reused without requiring additional verification. Our preliminary results on the automatically optimized RPC code are very promising in that they are identical to the results we obtained by manual specialization of the same code. In this last experiment, performance measurement of the specialized RPC fragments shows a minimal speedup of 30% compared to the non-specialized code. Elimination of intermediate data structures is part of our research effort towards optimizing operating system components via program specialization. It improves on our previous work in that optimizations are now carried out automatically using our specialization tool. Furthermore, it shows how generic subsystems can be automatically specialized into specific system extensions by exploiting application constraints.