title: Simple C++ code to PEP8
body: <p>I am trying to translate this simple C++ program to PEP8, but for some strange reason my code seems to be malfunctioning. I would really appreciate it if someone could point out my mistake.</p>
  
  <pre><code>C++:
  
  int func(int n)
  {
      return n;
  }
  
  
  int main()
  {
      cout &lt;&lt; "Num: ";
  
      int num;
  
      cin &gt;&gt; num;
  
      cout &lt;&lt; func(num) &lt;&lt; endl;
  
      return 0;
  }
  
  
  PEP8:
  
           BR      main
  retVal:  .EQUATE 2           ;returned value #2d
  n:       .EQUATE 0           ;formal parameter #2d
  func:    LDA     n,s
           STA     retVal,s
           RET0                ;pop retAddr
  
  num:     .EQUATE 0           ;local variable #2d
  main:    SUBSP   2,i         ;allocate #num
           STRO    msg,d       ;cout &lt;&lt; "Num: "
           DECI    num,s       ;cin &gt;&gt; num
           LDA     num,s       ;push #num
           STA     -4,s
           SUBSP   4,i         ;push #n #retVal
           CALL    func        ;push retAddr
           ADDSP   4,i         ;pop #n #retVal 
           DECO    -2,s        ;cout &lt;&lt; func(num)
           CHARO   '\n',i      ;&lt;&lt; endl
           STOP
  msg:     .ASCII  "Num: \x00"
           .END
  </code></pre>