There are two classes of argument flags for controlling optimization, which controls how the compiler generates machine code from your C code, as well as how it rewrites your code to behave more optimally. You can use -O with a number or letter to control the optimization level.
Do no optimizations.
Do some optimization (also what’s used if you use -O without a number).
-O2 and -O3
Use yet more aggressive optimization.
Optimize for size. It does the same optimizations as -O2 but doesn’t do function inlining.
Higher optimization levels can make code unstable as more and more mechanical operations happen to it, so be sure to test when changing levels. Sometimes failures that happen at higher optimization levels ...