The following code
int _main() {return 0;}
Compiled using the command:
gcc -s -nostdlib -nostartfiles 01-simple.c -o01-simple.exe
gcc version 4.4.1 (TDM-1 mingw32)
OllyDbg produced this output:

Can you explain what happens here?
Analysis so far:
// these two seems to be an idiom:
PUSH EBP // places EBP on stack
MOV EBP, ESP // overwrites EBP with ESP
MOV EAX, 0 // EAX = 0
LEAVE // == mov esp, ebp
// pop ebp
// according to
// http://en.wikipedia.org/wiki/X86_instruction_listings
What is the meaning of all this?
This creates a stack frame.
In the calling convention being used, the return value is sent back via
EAX(so the0is there because you wrotereturn 0;– try changing that toreturn 1;and see how that affects the code).And this tells the processor to clean up the stack frame (it’s the equivalent of
MOV ESP, EBPfollowed byPOP EBPwhich is the opposite of what was done when creating the stack frame):