<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/98934>98934</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            x86 CodeGen Question: Why is eax set to zero before function calls?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Toni-Graphics
      </td>
    </tr>
</table>

<pre>
    Hi,
I experimented a little bit with clang in godbold: [https://godbolt.org/z/GnvM4jKxM](https://godbolt.org/z/GnvM4jKxM)
I came across that there is a `xor eax, eax` before each function is called. Why is that?
Eax is no argument register. And the printf function doesn't depend on the content of eax.
Also max optimizations are turned on (-O3)

(In the godbold; the right tab; line 5 and 14)

Note: If i am understanding something here wrong please let me know that
Bye
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMks9upDgQxp_GXErdAkM3cODQnSzZaJVdrTTSnAtcDc4YG9lFmuTpR6bzR8ppLhjb5V9VffVhCHqwRI04nMXhPsGFR-ebH87q3YPHedR9SDqnXpu_tZB3Ir0X6ekRaJ3J64kskwIEo5kNQacZrppH6A3aAbSFwanOGSXyE4jDeWSeg8hPQrZCtrc73js_CNm-Cdk-2Jen4vmf9Ukc7oWs_jxc1h-F9TgRYO9dCMAjMvBInkAHQBDHdHUeCFch77blmEJHF-cJCPsRLovtWTsbw3s0htQefo6vcRtZIm9vaf7CNZ5ZB-iHJaoAngYdmPweTlbFpDB7bfnyxVSOghWyZFA0k1Xg7BbXO8uR4C6xpP0tw8kEBxOu4GbWk37DiAiAnoAXb2l7LWS1-y__bP79K6vHG_hT-_O29XoYGRi7eGC0JTgAWgVZ8Y3wr2OKA3u8gAacYLGKfGC0StsBgpuIx_i3CXv1zg4wG8JAYIhhIvhl3fUm2MY7v1KimlzVeY0JNVkps_Qoq7pKxiY7qkuVZSUqKmR26bEqsv6YZpKyY1mXfaIbmcoiLbNDVqZZXu2rLu9UXuZ5WtZdTakoUppQm70xL1M0R6JDWKipqzovEoMdmbCZW0pLV9guhZTR676Jb3bdMgRRpEYHDl8U1myoWasj3DlFD2Th_4VCHEPU5t0VhCsEYmAHb-Tdh5k-Zx5NFETeJos3zTc7ax6Xbt-7Scg2Zn1fdrN3z9SzkO1WaxCyvfXy0sjfAQAA__9YbjCF">