How does one do this?
If I want to analyze how something is getting compiled, how would I get the emitted assembly code?
As everyone has pointed out, use the -S
option to GCC. I would also like to add that the results may vary (wildly!) depending on whether or not you add optimization options (-O0
for none, -O2
for agressive optimization).
On RISC architectures in particular, the compiler will often transform the code almost beyond recognition in doing optimization. It's impressive and fascinating to look at the results!