-O3

turns on all optimizations.

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html gives all information about gcc optimizations.