gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?
gcc -S -masm=intel -Og -fverbose-asm test.c
That works with GCC, and Clang 3.5 and later. GCC manual:
Output asm instructions using selected dialect. Supported choices are intel or att (the default one). Darwin does not support intel.
For macOS, note that by default, the
gcc command actually runs Clang unless you've installed actual GCC (e.g. from Brew). Modern clang supports
-masm=intel as a synonym for this, but this always works with clang:
clang++ -S -mllvm --x86-asm-syntax=intel test.cpp
These are the options used by Matt Godbolt's Compiler Explorer site by default: https://godbolt.org/
See also How to remove "noise" from GCC/clang assembly output? for other options and tips for getting asm output that's interesting to look at.