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

    <tr>
        <th>Summary</th>
        <td>
            memcmp() returns unexpected value
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          8ss-boop
      </td>
    </tr>
</table>

<pre>
    ```
#include <stdio.h>
#include <string.h>
int foo(const char *a, const char *b)
{
return memcmp(a,b,5);
}
int main()
{
int x=foo("HELLO C23","C23 STD");
int y=memcmp("HELLO C23","C23 STD",5);
printf("%d = %d\n",x, y);
}

```
At -O0 optimization level, when called through function foo(), it incorrectly returns 5 instead of 1.

```
5 = 1
```
Reproduce link:
https://godbolt.org/z/4aqY8x3TT
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEUkGP2ywQ_TXjC0qEBxPbBx-yyVrfYaWVvu6lR4xJTIvBBZxN9tdXONltuq1UCcl45r03M48RIeijVaoB_gB8n4k5Ds43VQirzrkp61x_aWBDb4duAZm20sy9IsB2IfbarQdgj39JeW2P7zltIzk4B1hJZ0MkchCeAG4F4I78HuoA66RWPgDdehVnb8moRjlOgFXCd4A7nkDsYcHtb_qj0Bawuqen8BnY_loaEP97fHp6JjtkgAi4A8QdMvLlZb_83yQT6wJs_1H1n8S7fiavbTxcSYC8J8D2JF2A7-wVfE5DXz5NkM6dz9tIVs-UuCnqUb-JqJ0lRp2USdzXQVkihTGqJ3Hwbj4O5DBbuaDeZ60TUkeirXTeKxnNhVztDIQTbUNUoifuQPL1n-X50nb-Kfq_mrzrZ6mI0fY7sMQaYpxCumIL2B5d3zkT184fAds3wLYQP75WZ_bykvUN62tWi0w1eclpWdKcFdnQ0FKUoizqTc0E531VHHJktK9z7Kikhch0gxQ53WCRM4p5scayYFxsNlLkdbVBCQVVo9BmbcxpTLUzHcKsmrzgnFaZEZ0yYVlxRKteyZJNb8H3mW8SadXNxwAFNTrE8Esm6mhUc7cH9YeFs1XnScmoenISZlbZ7E3zyQwdh7lbSzcCtknz9llN3n1TMgK2SycBsL21emrwZwAAAP__0UsJIA">