I compiled this simple C program int main() {}
in gcc in windows 10 with -O3 and -Os options. Then I objdump
ed the text section of generated exe file. It generated whopping 2000 lines of assembly code.
I know, compiler has to do some hidden things like fetching command line args and passing it to main, calling atexit registered function at the end of a program. But other than these two, what else does the standard says, that actually leads to this huge assembly code? Can someone explain this..
I have written some very primitive assembly codes. There a program to print hello world hardly reaches 20 lines of assembly. Obviously this is too naive, but still the difference is huge!!! So I am curious.