title: Understanding a simple HelloWord.c program built with GCC
body: <p>I am trying to understand how I find the main() function in a trivial HelloWorld.c program I am looking at in both IDA Pro and Ollydbg.  </p>
  
  <p>I have built a simple C program (see below) using gcc (32-bit release using Dev-C++).  I have the EntryPoint from the PE Optional header as 0x14E0, which corresponds to IDA's 'start' label.</p>
  
  <p>What I don't see is a direct route to 0x00401500, which I <em>think</em> is the main() function setting up the stack.</p>
  
  <p>Is there an easy way to find the main() function for a simple c program like this?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(int argc, char *argv[]) {
          printf ("Hello World!");
      return 0;
  }
  </code></pre>
  
  <p>In IDA Pro I see:</p>
  
  <pre><code>.text:004014E0 start           proc near
  .text:004014E0                 sub     esp, 0Ch
  .text:004014E3                 mov     ds:dword_405034, 0
  .text:004014ED                 call    sub_401EA0
  .text:004014F2                 add     esp, 0Ch
  .text:004014F5                 jmp     sub_401180
  .text:004014F5 start           endp
  .text:004014F5
  .text:004014F5 ; ---------------------------------------------------------------------------
  .text:004014FA                 align 10h
  .text:00401500
  .text:00401500 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
  .text:00401500
  .text:00401500 ; Attributes: bp-based frame
  .text:00401500
  .text:00401500 sub_401500      proc near               ; CODE XREF: sub_401180+25Dp
  .text:00401500
  .text:00401500 var_10          = dword ptr -10h
  .text:00401500
  .text:00401500                 push    ebp
  .text:00401501                 mov     ebp, esp
  .text:00401503                 and     esp, 0FFFFFFF0h
  .text:00401506                 sub     esp, 10h        ; char *
  .text:00401509                 call    sub_401E80
  .text:0040150E                 mov     [esp+10h+var_10], offset aHelloWorld ; "Hello World!"
  .text:00401515                 call    printf
  </code></pre>