Search notes:

gcc -fverbose-asm

If compiling with -S to produce assembly output, adding the -fverbose-asm flag adds extra inline-commentary to the produced file to make it more readable.

prog.c

A simple program:
//
//  gcc -S -fverbose-asm verbose-asm.c
//    or
//  gcc -S -fverbose-asm verbose-asm.c -Os -o
//
#include <stdio.h>

int main() {

  int i = 6;
  int j = 7;
  int k = 6*7;

  printf("i=%d, j=%d, i*j=%d\n", i, j, k);

}
Github repository about-gcc, path: /options/f/verbose-asm/prog.c

Makefile

This is the makefile that creates proc.s with additional comments:
a.out: prog.s
	gcc $<

prog.s: prog.c Makefile
	gcc -S -fverbose-asm $< -o $@
Github repository about-gcc, path: /options/f/verbose-asm/Makefile

See also

GCC options

Index