<?xml version="1.0" encoding="UTF-8"?>

<compiler_spec>
  <global>
    <range space="ram"/>
  </global>
  <stackpointer register="ESP" space="ram"/>
  <default_proto>
    <prototype name="__register" extrapop="unknown" stackshift="4">
      <input>
        <pentry minsize="1" maxsize="4">
          <register name="EAX"/>
        </pentry>
        <pentry minsize="1" maxsize="4">
          <register name="EDX"/>
        </pentry>
        <pentry minsize="1" maxsize="4">
          <register name="ECX"/>
        </pentry>
        <pentry minsize="1" maxsize="500" align="4">
          <addr offset="4" space="stack"/>
        </pentry>
      </input>
      <output>
        <pentry minsize="1" maxsize="4">
          <register name="EAX"/>
        </pentry>
      </output>
      <unaffected>
        <register name="ESP"/>
        <register name="EBP"/>
        <register name="ESI"/>
        <register name="EDI"/>
        <register name="EBX"/>
      </unaffected>
      <killedbycall>
        <register name="ECX"/>
        <register name="EDX"/>
      </killedbycall>
    </prototype>
  </default_proto>
  <!--there is also a "pascal" calling convention, which is the same as stdcall except that arguments are pushed left-to-right-->
  <prototype name="__stdcall" extrapop="unknown" stackshift="4">
    <input>
      <pentry minsize="1" maxsize="500" align="4">
        <addr offset="4" space="stack"/>
      </pentry>
    </input>
    <output>
      <pentry minsize="1" maxsize="4">
        <register name="EAX"/>
      </pentry>
    </output>
    <unaffected>
      <varnode space="ram" offset="0" size="4"/>
      <register name="ESP"/>
      <register name="EBP"/>
      <register name="ESI"/>
      <register name="EDI"/>
      <register name="EBX"/>
      <register name="DF"/>
    </unaffected>
    <killedbycall>
      <register name="ECX"/>
  	<register name="EDX"/>
    </killedbycall>
    <likelytrash>
      <register name="ECX"/>
    </likelytrash>
  </prototype>
  <prototype name="__cdecl" extrapop="4" stackshift="4">
    <input>
      <pentry minsize="1" maxsize="500" align="4">
        <addr offset="4" space="stack"/>
      </pentry>
    </input>
    <output>
      <pentry minsize="1" maxsize="4">
        <register name="EAX"/>
      </pentry>
    </output>
    <unaffected>
      <varnode space="ram" offset="0" size="4"/>
      <register name="ESP"/>
      <register name="EBP"/>
      <register name="ESI"/>
      <register name="EDI"/>
      <register name="EBX"/>
      <register name="DF"/>
    </unaffected>
    <killedbycall>
      <register name="ECX"/>
      <register name="EDX"/>
    </killedbycall>
    <likelytrash>
      <register name="ECX"/>
    </likelytrash>
  </prototype>
</compiler_spec>
