What does the -O2 option for gcc do?
gcc -O2 file1.c -o file1.o
This question appears to be off-topic. The users who voted to close gave this specific reason:
-O options turn on compiler optimization. From
-O2 Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. As compared to -O, this option increases both compilation time and the performance of the generated code.
For a list of the specific optimizations, refer to the manual pages.