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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Miscompile with different optimization flags
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          cardigan1008
      </td>
    </tr>
</table>

<pre>
    Code:
```c
#include "csmith.h"
uint16_t b = 22439;
int32_t g;
int64_t h = 12735894831255762165;
int16_t i = 3;
uint16_t m = 9488;
int8_t l;
uint8_t n = 239;
int32_t o = 289914936;
int64_t p = 18297755270840430848;
int16_t q = 21301;
uint16_t r = 65535;
uint64_t s;
int16_t u = 34848;
uint16_t v = 38340;
uint32_t w = 1;
uint32_t x = 164578923;
int16_t y = 5663;
int32_t aa[5][4];
int8_t ac = 15;
int16_t ad;
static int16_t *ae = &ad;
int16_t af = 30653;
uint32_t ag = 8;
int8_t ah = -4;
uint32_t ai = 4294967289;
int32_t aj = 0;
int32_t al = 9;
int32_t am = 2246052323;
int32_t an = 2593473990;
int32_t ao = -4;
int32_t ap = 2788123995;
int32_t aq = 1709077939;
int32_t ar = 1865950353;
int32_t as = 2131683363;
int32_t at = 2601024276;
int32_t au = 805396458;
int32_t av = -7;
int32_t aw = -1;
int32_t ax = 2771432716;
int32_t ay = 1;
int32_t az = 3655626890;
int16_t ba = 1;
uint8_t bc;
uint16_t bd[][1] = {52668, 52668, 52668, 52668, 52668, 52668, 52668, 52668};
int8_t be = -3;
int32_t bf = 3;
uint16_t bg = 65535;
uint64_t bh = 18446744073709551615;
uint16_t bk[] = {5, 65535, 65535};
int32_t bl[];
int64_t bm = -1;
uint32_t bn = 4294967295;
static uint16_t bo[][1];
uint8_t bp = 248;
long a(int z) {
  long c = 1, d = 1;
 int e = 1;
  for (; e <= z; e++) {
    c *= e;
    d += e;
 }
  long double bu = e = 1;
  for (; e <= z; e++)
    bu *= e / (long double)(e + 1);
  long f = c / bu;
  f -= d;
  return f;
}
static uint16_t t[][3][6] = {65529, 57332, 65529, 65529, 57332, 65529,
                             65529, 57332, 65529, 65529, 57332, 65529,
                             65529, 57332, 65529, 65529, 57332, 65529};
uint8_t ab[][4][1] = {
    {{}, 255, 90}, 90, 255, {}, 57, {92, 92, 57}, 255, 90, {}, 90,
    255,           {}, 57,  92, 92, 57, {},  255};
uint32_t ak[] = {3309543783, 3309543783, 3309543783, 3309543783, 3309543783,
                 3309543783, 3309543783, 3309543783, 3309543783, 3309543783};
int64_t bb[][3] = {2040698595131593340, 0,
                   2040698595131593340, 1869394211938427790,
                   1869394211938427790, 1869394211938427790,
                   2040698595131593340, 0,
 2040698595131593340};
uint64_t bi[] = {2524866585798799805, 2524866585798799805, 2524866585798799805,
 2524866585798799805, 2524866585798799805, 2524866585798799805,
 2524866585798799805, 2524866585798799805, 2524866585798799805,
 2524866585798799805};
int8_t bj[][6] = {2,   7,  137, -1, -1, 209, 0,   -1,  -1, -1,  -1,  0,
                  -1,  -1, 0,   14, -1, 137, 137, 7,   2,  7,   137, -1,
                  137, -1, 7,   14, 0, 0,   -1,  -1,  -1, -1,  2,   0,
                  0,   0,  7,   -1, 14, -1,  2,   187, 2,  209, 14,  137};
uint16_t bq() {
  uint16_t br;
 if (safe_rshift_func_uint16_t_u_u(b, br)) {
    int32_t *bs = bl;
 *ae = 11441;
    for (; g <= 3; g++) {
      bk[0] = safe_lshift_func_int16_t_s_u(bi[0], 8);
      for (s = 0; s <= 0; s++)
 aa[a(*ae - 11433) + ab[3][0][0] + *ae - 374538 + g + 1][0] = 0;
 for (aj = 0; aj <= 3; aj++) {
        aa[g + 1][aj] = 5 > 0;
 *bs = 0 != r++;
      }
    }
    for (bc = 8; 0;)
      ;
 }
}
int main() {
  int e, j, k, bt;
  crc32_gentab();
 bq();
  transparent_crc(b, "", bt);
  transparent_crc(g, "", bt);
  transparent_crc(h, "", bt);
  transparent_crc(i, "", bt);
  transparent_crc(m, "", bt);
  transparent_crc(l, "", bt);
  transparent_crc(n, "", bt);
  transparent_crc(o, "", bt);
  transparent_crc(p, "", bt);
  transparent_crc(q, "", bt);
  transparent_crc(r, "", bt);
  for (e = 0; e < 2; e++)
 for (j = 0; j < 3; j++)
      for (k = 0; k < 6; k++)
 transparent_crc(t[e][j][k], "", bt);
  transparent_crc(s, "", bt);
 transparent_crc(u, "", bt);
  transparent_crc(v, "", bt);
 transparent_crc(w, "", bt);
  transparent_crc(x, "", bt);
 transparent_crc(y, "", bt);
  for (e = 0; e < 5; e++)
    for (j = 0; j < 4; j++)
      transparent_crc(aa[e][j], "", bt);
  for (e = 0; e < 6; e++)
    for (j = 0; j < 4; j++)
      for (k = 0; k < 1; k++)
 transparent_crc(ab[e][j][k], "", bt);
  transparent_crc(ac, "", bt);
  transparent_crc(ad, "", bt);
  transparent_crc(af, "", bt);
  transparent_crc(ag, "", bt);
  transparent_crc(ah, "", bt);
  transparent_crc(ai, "", bt);
  transparent_crc(aj, "", bt);
  for (e = 0; e < 10; e++)
    transparent_crc(ak[e], "", bt);
  transparent_crc(al, "", bt);
  transparent_crc(am, "", bt);
  transparent_crc(an, "", bt);
  transparent_crc(ao, "", bt);
  transparent_crc(ap, "", bt);
  transparent_crc(aq, "", bt);
  transparent_crc(ar, "", bt);
  transparent_crc(as, "", bt);
  transparent_crc(at, "", bt);
  transparent_crc(au, "", bt);
  transparent_crc(av, "", bt);
  transparent_crc(aw, "", bt);
  transparent_crc(ax, "", bt);
  transparent_crc(ay, "", bt);
  transparent_crc(az, "", bt);
  transparent_crc(ba, "", bt);
  for (e = 0; e < 3; e++)
    for (j = 0; j < 3; j++)
 transparent_crc(bb[e][j], "", bt);
  transparent_crc(bc, "", bt);
 for (e = j = 0; j < 8; j++)
    transparent_crc(bd[e][j], "", bt);
 transparent_crc(be, "", bt);
  transparent_crc(bf, "", bt);
 transparent_crc(bg, "", bt);
  transparent_crc(bh, "", bt);
  for (; e < 10; e++)
    transparent_crc(bi[e], "", bt);
  for (e = 0; e < 8; e++)
    for (j = 0; j < 6; j++)
      transparent_crc(bj[e][j], "", bt);
  for (e = 0; e < 3; e++)
    transparent_crc(bk[e], "", bt);
  for (e = 0; e < 1; e++)
    transparent_crc(bl[e], "", bt);
  transparent_crc(bm, "", bt);
  transparent_crc(bn, "", bt);
  for (e = 0; e < 6; e++)
    for (j = 0; j < 2; j++)
 transparent_crc(bo[e][j], "", bt);
  transparent_crc(bp, "", bt);
 platform_main_end(crc32_context ^ 4294967295, bt);
}
```

When compiled with `clang -Ofast`, its output is: checksum = C713BCEB. 
When compiled with other flags like `clang -O2`, its output is: checksum = 8D3F27FD
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUWklz6j4S_zTKRUVK-3LgEMI_t6k5zpGSjQ1OjJ1nm7fk009Jso1X8pT3DjMpCiP19pO61d0imLrOTkWSbAHfAb5_MNfmXFbb2FTH7GQKjJB6iMrjr-1zeUwAfQJoD9ATEMi_4nZMaFbE-fWYQEBIXF-y5vx4BoR48jUrGiwODYwgoHtICKMa0J0nZkVDyaGBp-GMYIcGnh03JpJypZmimHAuBcGCD1md4syx0n6-t3hxBM2UGsqoQwPzEbOdKTy6BWylpyitMdNUzJC-e6SKaCk5JxIphhhFiqkZ0m9eFaYIz9FWjig4p3xEdEbqma6rXzUb2ul1ffdERRkaEd2CfnjAc8JPTxCMS6UJnZn85ehcCDrbJGMA33HA94DvmH1MNtzEXvfce-bYT9WNabIYdhRAnkzixAARA7ZeMvWrRILT-WLMyVFnrjc-sjZsQcRHEiOaaSGJmseCeXUcaE7IfazNCZcu7AXihJKFrWtDj2vKJNV6QXk5hdxTfPARqRQmVGs-5_AxhyXSSEq9EN-magNYcM0R5QsI6y5usVCULrm_8RwCYUQYkWLO4eNVIU61YFzNGXzMbuSc4gN2g-eUn-3yJWaUSLxg9tck2HvChw8ewbkgQo133ecrs3BObARF8fzARUefQwHfYcD3Pmrlj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