Bug type: hang
Component: InstCombine
Bug location: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp: InstCombiner::getFreelyInvertedImpl
Issue title: [InstCombine] InstCombine gets stuck when simplifying icmps 
Labels: llvm:instcombine
llvm:hang
Reported by: dtcxzyw

Reduced test case: https://godbolt.org/z/dc6jnha5q
```
define i64 @func(i32 %p) {
entry:
  %not = xor i32 %p, -1
  br label %for.body

for.body:
  %p0 = phi i32 [ %not, %entry ], [ %conv, %for.body ]
  %p1 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
  %inc = add i32 %p1, 1
  %cmp1 = icmp ne i32 %inc, 0
  %cond = select i1 %cmp1, i32 0, i32 -1231558963
  %xor = xor i32 %cond, %p0
  %cmp2 = icmp ne i32 %xor, -2
  %conv = zext i1 %cmp2 to i32
  br i1 %cmp2, label %for.body, label %for.exit

for.exit:
  ret i64 0
}
```

```
IC: Visiting:   %p0 = phi i32 [ %not, %entry ], [ %conv, %for.body ]
IC: Visiting:   %cmp2 = icmp ne i32 %1, -2
ADD DEFERRED:   %2 = select i1 %cmp1.not, i32 1231558962, i32 -1
ADD DEFERRED:   %3 = xor i32 %2, %p0
IC: Old =   %cmp2 = icmp ne i32 %1, -2
    New =   <badref> = icmp ne i32 %3, 1
ADD:   %cmp2 = icmp ne i32 %3, 1
IC: ERASE   %4 = icmp ne i32 %1, -2
ADD DEFERRED:   %1 = xor i32 %0, %p0
IC: ERASE   %1 = xor i32 %0, %p0
ADD DEFERRED:   %0 = select i1 %cmp1.not, i32 -1231558963, i32 0
ADD DEFERRED:   %p0 = phi i32 [ %not, %entry ], [ %conv, %for.body ]
ADD:   %p0 = phi i32 [ %not, %entry ], [ %conv, %for.body ]
IC: ERASE   %0 = select i1 %cmp1.not, i32 -1231558963, i32 0
ADD DEFERRED:   %cmp1.not = icmp eq i32 %inc, 0
ADD:   %cmp1.not = icmp eq i32 %inc, 0
ADD:   %1 = xor i32 %0, %p0
ADD:   %0 = select i1 %cmp1.not, i32 1231558962, i32 -1
IC: Visiting:   %0 = select i1 %cmp1.not, i32 1231558962, i32 -1
IC: Visiting:   %1 = xor i32 %0, %p0
IC: Visiting:   %cmp1.not = icmp eq i32 %inc, 0
IC: Visiting:   %p0 = phi i32 [ %not, %entry ], [ %conv, %for.body ]
IC: Visiting:   %cmp2 = icmp ne i32 %1, 1
ADD DEFERRED:   %2 = select i1 %cmp1.not, i32 -1231558963, i32 0
ADD DEFERRED:   %3 = xor i32 %2, %p0
IC: Old =   %cmp2 = icmp ne i32 %1, 1
    New =   <badref> = icmp ne i32 %3, -2
ADD:   %cmp2 = icmp ne i32 %3, -2
IC: ERASE   %4 = icmp ne i32 %1, 1
ADD DEFERRED:   %1 = xor i32 %0, %p0
IC: ERASE   %1 = xor i32 %0, %p0
ADD DEFERRED:   %0 = select i1 %cmp1.not, i32 1231558962, i32 -1
ADD DEFERRED:   %p0 = phi i32 [ %not, %entry ], [ %conv, %for.body ]
ADD:   %p0 = phi i32 [ %not, %entry ], [ %conv, %for.body ]
IC: ERASE   %0 = select i1 %cmp1.not, i32 1231558962, i32 -1
ADD DEFERRED:   %cmp1.not = icmp eq i32 %inc, 0
ADD:   %cmp1.not = icmp eq i32 %inc, 0
ADD:   %1 = xor i32 %0, %p0
ADD:   %0 = select i1 %cmp1.not, i32 -1231558963, i32 0
IC: Visiting:   %0 = select i1 %cmp1.not, i32 -1231558963, i32 0
IC: Visiting:   %1 = xor i32 %0, %p0
IC: Visiting:   %cmp1.not = icmp eq i32 %inc, 0

Repeats multiple times...
```

Comments: author: dtcxzyw
body: Another reproducer:
```
/*
 * This is a RANDOMLY GENERATED PROGRAM.
 *
 * Generator: csmith 2.4.0
 * Git version: 0ec6f1b
 * Options:   --max-funcs 3 --max-block-depth 3 --quiet --no-packed-struct --no-bitfields --no-volatiles --no-volatile-pointers --output ./csmith2024-02-24@16:09/test34436.c
 * Seed:      3421191658
 */

#include "csmith.h"


static long __undefined;



static int32_t g_11[2] = {(-1L),(-1L)};
static uint16_t g_12 = 0x5EB7L;
static uint64_t g_31 = 2UL;
static uint64_t g_33[9][1][9] = {{{0x0273394210AB9CA2LL,0x0B9C45D188285970LL,0x0B9C45D188285970LL,0x0273394210AB9CA2LL,18446744073709551611UL,18446744073709551607UL,0x461D90BCC9DF78A4LL,0x0B9C45D188285970LL,18446744073709551607UL}},{{4UL,0x0B9C45D188285970LL,0xF205A4AAC46587A7LL,0x461D90BCC9DF78A4LL,18446744073709551614UL,18446744073709551614UL,0x461D90BCC9DF78A4LL,0xF205A4AAC46587A7LL,0x0B9C45D188285970LL}},{{0x461D90BCC9DF78A4LL,18446744073709551611UL,0xF205A4AAC46587A7LL,0xD17401D8B2D29C61LL,18446744073709551611UL,0x0B9C45D188285970LL,1UL,0xF205A4AAC46587A7LL,0xF205A4AAC46587A7LL}},{{4UL,18446744073709551614UL,0x0B9C45D188285970LL,0xD17401D8B2D29C61LL,0x0B9C45D188285970LL,18446744073709551614UL,4UL,0x0B9C45D188285970LL,0xF205A4AAC46587A7LL}},{{0x0273394210AB9CA2LL,18446744073709551611UL,18446744073709551607UL,0x461D90BCC9DF78A4LL,0x0B9C45D188285970LL,18446744073709551607UL,1UL,18446744073709551607UL,0xDAEE255298A7B986LL}},{{0xF205A4AAC46587A7LL,0xDAEE255298A7B986LL,0xDAEE255298A7B986LL,0xF205A4AAC46587A7LL,18446744073709551606UL,0x68F5B79C14114C53LL,18446744073709551607UL,0xDAEE255298A7B986LL,0x68F5B79C14114C53LL}},{{0x0B9C45D188285970LL,0xDAEE255298A7B986LL,1UL,18446744073709551607UL,18446744073709551609UL,18446744073709551609UL,18446744073709551607UL,1UL,0xDAEE255298A7B986LL}},{{18446744073709551607UL,18446744073709551606UL,1UL,18446744073709551611UL,18446744073709551606UL,0xDAEE255298A7B986LL,18446744073709551614UL,1UL,1UL}},{{0x0B9C45D188285970LL,18446744073709551609UL,0xDAEE255298A7B986LL,18446744073709551611UL,0xDAEE255298A7B986LL,18446744073709551609UL,0x0B9C45D188285970LL,0xDAEE255298A7B986LL,1UL}}};
static const int32_t *g_35 = &g_11[1];
static int64_t g_66[5][4] = {{(-9L),6L,6L,(-9L)},{6L,(-9L),6L,6L},{(-9L),(-9L),3L,(-9L)},{(-9L),6L,6L,(-9L)},{6L,(-9L),6L,6L}};
static uint32_t g_94[3] = {0x3680C6D9L,0x3680C6D9L,0x3680C6D9L};
static uint32_t g_149 = 5UL;
static int64_t g_157[9] = {9L,9L,(-1L),9L,9L,(-1L),9L,9L,(-1L)};
static int8_t g_165 = 8L;
static int16_t g_168 = 0xD32BL;
static int32_t *g_169 = &g_11[0];
static int32_t *g_170 = (void*)0;
static uint8_t g_185 = 246UL;
static int32_t **g_256 = &g_169;
static int32_t *** const g_255 = &g_256;
static uint32_t g_306 = 0xF063AF95L;
static int16_t g_311 = 7L;
static int32_t g_313 = 0x472F43A5L;
static const uint16_t g_341 = 0xB915L;
static uint8_t g_346[6] = {0x3EL,0x3EL,0x3EL,0x3EL,0x3EL,0x3EL};
static uint8_t g_366[6][2] = {{0x39L,0x39L},{0UL,0x39L},{0x39L,0UL},{0x39L,0x39L},{0UL,0x39L},{0x39L,0UL}};
static const int64_t *g_373 = &g_157[0];
static const int64_t **g_372 = &g_373;
static uint32_t g_380 = 4294967293UL;
static uint16_t g_407 = 0UL;
static int8_t g_409 = (-2L);
static int8_t *g_408 = &g_409;
static const int8_t g_412 = 0xF0L;
static const int8_t g_414 = 0x89L;
static const int8_t g_416[5][10] = {{0L,0xDDL,0L,(-1L),(-1L),0L,0xDDL,0L,(-1L),(-1L)},{0L,0xDDL,0L,(-1L),(-1L),0L,0xDDL,0L,(-1L),(-1L)},{0L,0xDDL,0L,(-1L),(-1L),0L,0xDDL,0L,(-1L),(-1L)},{0L,0xDDL,0L,(-1L),(-1L),0L,0xDDL,0L,(-1L),(-1L)},{0L,0xDDL,0L,(-1L),(-1L),0L,0xDDL,0L,(-1L),(-1L)}};
static const int8_t *g_415[9][1] = {{&g_416[2][2]},{&g_416[2][2]},{&g_416[2][2]},{&g_416[2][2]},{&g_416[2][2]},{&g_416[2][2]},{&g_416[2][2]},{&g_416[2][2]},{&g_416[2][2]}};
static int8_t g_426 = (-6L);
static int32_t g_457 = 0x1708815BL;
static int16_t *g_466[10][10][2] = {{{&g_311,&g_168},{&g_311,(void*)0},{&g_311,&g_168},{&g_311,&g_311},{&g_168,&g_311},{(void*)0,&g_311},{&g_168,&g_311},{&g_311,&g_168},{&g_311,(void*)0},{&g_311,&g_168}},{{&g_311,&g_311},{&g_168,&g_311},{(void*)0,&g_311},{&g_168,&g_311},{&g_311,&g_168},{&g_311,(void*)0},{&g_311,&g_168},{&g_311,&g_311},{&g_168,&g_311},{(void*)0,&g_311}},{{&g_168,&g_311},{&g_311,&g_168},{&g_311,&g_168},{&g_168,(void*)0},{(void*)0,(void*)0},{(void*)0,&g_168},{&g_168,&g_168},{(void*)0,(void*)0},{(void*)0,(void*)0},{&g_168,&g_168}},{{&g_168,(void*)0},{(void*)0,(void*)0},{(void*)0,&g_168},{&g_168,&g_168},{(void*)0,(void*)0},{(void*)0,(void*)0},{&g_168,&g_168},{&g_168,(void*)0},{(void*)0,(void*)0},{(void*)0,&g_168}},{{&g_168,&g_168},{(void*)0,(void*)0},{(void*)0,(void*)0},{&g_168,&g_168},{&g_168,(void*)0},{(void*)0,(void*)0},{(void*)0,&g_168},{&g_168,&g_168},{(void*)0,(void*)0},{(void*)0,(void*)0}},{{&g_168,&g_168},{&g_168,(void*)0},{(void*)0,(void*)0},{(void*)0,&g_168},{&g_168,&g_168},{(void*)0,(void*)0},{(void*)0,(void*)0},{&g_168,&g_168},{&g_168,(void*)0},{(void*)0,(void*)0}},{{(void*)0,&g_168},{&g_168,&g_168},{(void*)0,(void*)0},{(void*)0,(void*)0},{&g_168,&g_168},{&g_168,(void*)0},{(void*)0,(void*)0},{(void*)0,&g_168},{&g_168,&g_168},{(void*)0,(void*)0}},{{(void*)0,(void*)0},{&g_168,&g_168},{&g_168,(void*)0},{(void*)0,(void*)0},{(void*)0,&g_168},{&g_168,&g_168},{(void*)0,(void*)0},{(void*)0,(void*)0},{&g_168,&g_168},{&g_168,(void*)0}},{{(void*)0,(void*)0},{(void*)0,&g_168},{&g_168,&g_168},{(void*)0,(void*)0},{(void*)0,(void*)0},{&g_168,&g_168},{&g_168,(void*)0},{(void*)0,(void*)0},{(void*)0,&g_168},{&g_168,&g_168}},{{(void*)0,(void*)0},{(void*)0,(void*)0},{&g_168,&g_168},{&g_168,(void*)0},{(void*)0,(void*)0},{(void*)0,&g_168},{&g_168,&g_168},{(void*)0,(void*)0},{(void*)0,(void*)0},{&g_168,&g_168}}};
static int32_t *g_596[1] = {&g_11[0]};



static uint8_t  func_1(void);
static int32_t  func_8(int32_t  p_9);
static int16_t  func_15(int8_t  p_16, uint32_t  p_17, int32_t  p_18);





static uint8_t  func_1(void)
{ 
    int32_t l_7 = (-8L);
    uint16_t *l_572 = &g_407;
    int32_t *l_573 = &g_11[1];
    int32_t *l_588 = &g_313;
    int8_t *l_595 = (void*)0;
    int32_t **l_597 = &g_596[0];
    (*l_573) = (safe_div_func_uint16_t_u_u(((*l_572) = (0xCDF98A59L && (((0x4EBB0CB8CE3E63E3LL > (safe_lshift_func_uint32_t_u_u(1UL, (~(l_7 , func_8(l_7)))))) > (((safe_mul_func_uint32_t_u_u((l_7 || (safe_add_func_uint8_t_u_u(((g_341 && (-1L)) , 0x01L), g_416[2][6]))), l_7)) & 0xDE15L) , l_7)) >= l_7))), 65527UL));
    (*l_597) = (((((*l_573) ^ (**g_372)) != (safe_div_func_int8_t_s_s((safe_rshift_func_uint64_t_u_u(0x1A63987AF980F8B3LL, (safe_rshift_func_uint8_t_u_u((((g_426 ^= ((safe_add_func_int64_t_s_s(((safe_add_func_uint32_t_u_u(((safe_sub_func_uint16_t_u_u((safe_mod_func_int8_t_s_s(0x95L, (((*l_588) = (*l_573)) ^ ((*l_573) != (safe_rshift_func_int32_t_s_s((*l_573), ((((safe_sub_func_int32_t_s_s(((((safe_mod_func_int8_t_s_s((*g_408), 3UL)) && 0x38L) || g_168) == (*l_573)), (*l_573))) && 249UL) & g_31) , g_457))))))), g_94[0])) , g_341), g_94[2])) ^ g_149), (*g_373))) > 0xF735A181L)) != (*l_573)) != (-1L)), g_185)))), (*l_573)))) ^ (-1L)) , g_596[0]);
    for (g_185 = 0; (g_185 == 37); g_185 = safe_add_func_uint32_t_u_u(g_185, 4))
    { 
        uint32_t l_600 = 0x5F5A8D5BL;
        (**l_597) = l_600;
    }
    return g_426;
}




static int32_t  func_8(int32_t  p_9)
{ 
    int32_t *l_10[7][10][3] = {{{&g_11[0],&g_11[0],&g_11[1]},{&g_11[1],&g_11[0],(void*)0},{&g_11[0],&g_11[0],&g_11[1]},{&g_11[0],&g_11[0],&g_11[1]},{&g_11[0],(void*)0,(void*)0},{&g_11[0],&g_11[1],&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[0],&g_11[0],&g_11[1]},{(void*)0,&g_11[1],(void*)0},{&g_11[1],(void*)0,&g_11[1]}},{{&g_11[1],&g_11[1],&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[0],&g_11[1],(void*)0},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[0],&g_11[0],&g_11[1]},{&g_11[0],&g_11[1],&g_11[0]},{(void*)0,&g_11[1],&g_11[0]},{&g_11[0],&g_11[1],&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]}},{{(void*)0,(void*)0,(void*)0},{&g_11[0],&g_11[1],&g_11[1]},{(void*)0,&g_11[1],(void*)0},{&g_11[0],&g_11[0],&g_11[1]},{(void*)0,&g_11[0],&g_11[1]},{&g_11[1],&g_11[1],&g_11[0]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[0],&g_11[1],&g_11[1]},{(void*)0,(void*)0,&g_11[0]},{&g_11[0],&g_11[1],&g_11[0]}},{{&g_11[0],(void*)0,&g_11[0]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[0],&g_11[1],&g_11[1]},{&g_11[1],&g_11[0],&g_11[0]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[1],&g_11[0],(void*)0},{&g_11[1],&g_11[0],&g_11[1]},{&g_11[1],&g_11[0],(void*)0},{&g_11[1],&g_11[1],&g_11[1]}},{{&g_11[0],&g_11[1],&g_11[1]},{&g_11[1],&g_11[0],&g_11[1]},{&g_11[1],&g_11[1],&g_11[0]},{&g_11[0],&g_11[1],&g_11[0]},{&g_11[1],(void*)0,&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[1],(void*)0,(void*)0},{&g_11[0],&g_11[1],&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]}},{{&g_11[0],&g_11[0],&g_11[1]},{&g_11[1],&g_11[0],&g_11[1]},{&g_11[1],&g_11[1],&g_11[0]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[1],(void*)0,&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[0],&g_11[1],(void*)0},{&g_11[1],&g_11[1],&g_11[1]}},{{&g_11[0],&g_11[0],&g_11[1]},{&g_11[0],&g_11[1],&g_11[0]},{(void*)0,&g_11[1],&g_11[0]},{&g_11[0],&g_11[1],&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]},{&g_11[1],&g_11[1],&g_11[1]},{(void*)0,(void*)0,(void*)0},{&g_11[0],&g_11[1],&g_11[1]},{(void*)0,&g_11[1],(void*)0},{&g_11[0],&g_11[0],&g_11[1]}}};
    int32_t **l_23 = &l_10[6][7][1];
    int32_t l_24[1];
    uint64_t *l_30 = &g_31;
    uint64_t *l_32 = &g_33[8][0][8];
    int16_t *l_310 = &g_311;
    int32_t *l_312 = &g_313;
    uint16_t *l_314 = &g_12;
    uint8_t * const l_319 = &g_185;
    int32_t *l_338[7];
    int8_t l_381 = 0x82L;
    int64_t *l_425 = &g_66[1][0];
    int64_t **l_424[6] = {&l_425,&l_425,&l_425,&l_425,&l_425,&l_425};
    int64_t ***l_423 = &l_424[2];
    int i, j, k;
    for (i = 0; i < 1; i++)
        l_24[i] = 1L;
    for (i = 0; i < 7; i++)
        l_338[i] = &g_313;
    --g_12;
    (*l_312) |= (((*l_310) |= func_15((((((*l_32) = ((*l_30) = (((safe_mod_func_uint64_t_u_u((((p_9 , (void*)0) == ((*l_23) = l_10[5][8][0])) && (g_11[1] <= 0x8543L)), l_24[0])) , (!(safe_div_func_uint16_t_u_u((g_12 , ((((((safe_sub_func_int64_t_s_s(((-1L) && (g_12 >= p_9)), p_9)) > 0xED293E35L) | 0x12CB5DCFL) > g_11[1]) , p_9) , p_9)), g_11[1])))) && g_11[0]))) , 0UL) != 0x52L) || g_12), p_9, g_12)) <= 0xA360L);
    (*l_23) = (void*)0;
    if (((p_9 && (((((*l_312) >= ((*l_314) = 65535UL)) , (safe_div_func_int32_t_s_s((safe_mod_func_uint16_t_u_u(((((l_319 == l_319) >= (safe_rshift_func_int16_t_s_s((((safe_mod_func_uint32_t_u_u(p_9, g_149)) , (void*)0) != l_30), p_9))) , g_31) != p_9), g_31)), p_9))) != g_157[0]) && p_9)) && 0L))
    { 
        int8_t * const l_324[7] = {(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0};
        int8_t *l_326[9] = {&g_165,&g_165,&g_165,&g_165,&g_165,&g_165,&g_165,&g_165,&g_165};
        int8_t **l_325 = &l_326[6];
        int8_t *l_328 = &g_165;
        int8_t **l_327 = &l_328;
        int32_t l_333 = 1L;
        int32_t l_369 = 0x5EBB0ECBL;
        const int8_t *l_413 = &g_414;
        int32_t **l_417 = (void*)0;
        int32_t l_458[9][2][1] = {{{(-5L)},{(-5L)}},{{(-6L)},{(-5L)}},{{(-5L)},{(-6L)}},{{(-5L)},{(-5L)}},{{(-6L)},{(-5L)}},{{(-5L)},{(-6L)}},{{(-5L)},{(-5L)}},{{(-6L)},{(-5L)}},{{(-5L)},{(-6L)}}};
        int32_t l_496[6][7] = {{1L,0xA4F1B851L,0x37A88DA2L,0xA4F1B851L,1L,0L,0L},{1L,0xA4F1B851L,0x37A88DA2L,0xA4F1B851L,1L,0L,0L},{1L,0xA4F1B851L,0x37A88DA2L,0xA4F1B851L,1L,0L,0L},{1L,0xA4F1B851L,0x37A88DA2L,0xA4F1B851L,1L,0L,0L},{1L,0xA4F1B851L,0x37A88DA2L,0xA4F1B851L,1L,0L,0L},{1L,0xA4F1B851L,0x37A88DA2L,0xA4F1B851L,1L,0L,0L}};
        uint8_t l_499 = 4UL;
        int i, j, k;
        if (((((l_324[0] == ((*l_327) = ((*l_325) = &g_165))) , 0x77C2C50F563A9C1DLL) , ((*l_319) = (safe_mul_func_int32_t_s_s(p_9, ((safe_lshift_func_uint64_t_u_u(l_333, (--(*l_32)))) & (safe_mul_func_uint64_t_u_u(((void*)0 != l_338[2]), (safe_sub_func_int64_t_s_s(0x64D8F0F17592A3D5LL, ((0x23L ^ g_313) < g_12)))))))))) , g_341))
        { 
            return p_9;
        }
        else
        { 
            int64_t l_367 = 1L;
            int32_t l_368 = 3L;
            int64_t *l_399 = &g_157[0];
            int64_t **l_398[8] = {&l_399,&l_399,&l_399,&l_399,&l_399,&l_399,&l_399,&l_399};
            int64_t ***l_397 = &l_398[6];
            int32_t **l_420 = (void*)0;
            int32_t l_460[9][4][7] = {{{0x3D2FE6F7L,(-1L),0L,0x6944E926L,(-1L),(-1L),0x2AF43CFEL},{0x77DC1A4FL,7L,0L,0xB5C39BA6L,0x8A6F8D2AL,0x78B5A455L,6L},{0L,3L,0x3D2FE6F7L,0x27A80343L,0x38C9E105L,(-1L),(-1L)},{0xD73C9A77L,0xCE3D98E2L,0x38C9E105L,(-1L),8L,(-1L),0x38C9E105L}},{{6L,6L,0x835FBC13L,5L,0xCCB98A17L,5L,0x651280DBL},{8L,1L,(-1L),0L,(-1L),(-1L),0x571592F3L},{0L,0x10A7A682L,0xB9488037L,6L,0xCCB98A17L,0x2F71711FL,0x27A80343L},{(-1L),0x38C9E105L,1L,4L,8L,7L,(-1L)}},{{0x7639893BL,0L,0x8D6AEC21L,1L,0x38C9E105L,0x541A2144L,0x08FC8D1FL},{0x651280DBL,(-1L),0L,0xD73C9A77L,0x8A6F8D2AL,0x74F12713L,0L},{1L,0x74F12713L,1L,0x52681015L,(-1L),0L,0x34D5741FL},{0x6944E926L,0xB5C39BA6L,0x78B5A455L,0x92017A1BL,(-1L),0L,(-1L)}},{{0x787EDD2CL,0x0AF78BCDL,0xB5C39BA6L,5L,(-1L),0x74F12713L,0L},{0x74F12713L,(-10L),0x10A7A682L,1L,0L,0x541A2144L,3L},{0L,0xCCB98A17L,0x7639893BL,6L,0xA8583C15L,7L,0xA8583C15L},{0x8A6F8D2AL,0xC899F44EL,0xC899F44EL,0x8A6F8D2AL,0x88020F57L,0x2F71711FL,(-1L)}},{{0xA8583C15L,0x835FBC13L,0x2AF43CFEL,0L,0x787EDD2CL,0x77DC1A4FL,1L},{1L,5L,5L,0x73D9572DL,0L,0L,0x77DC1A4FL},{(-1L),0x7639893BL,0x2DCD775DL,2L,0L,0xC899F44EL,(-10L)},{(-1L),0xB9488037L,0x835FBC13L,1L,0x92017A1BL,4L,0xCE3D98E2L}},{{0x7BF1CC1CL,6L,(-1L),0x92017A1BL,0x8A6F8D2AL,(-1L),(-1L)},{4L,0x571592F3L,0xC899F44EL,8L,0L,0x835FBC13L,0L},{2L,0x77DC1A4FL,8L,0x7BF1CC1CL,0xCCB98A17L,0x74F12713L,0x08FC8D1FL},{2L,0x8A6F8D2AL,3L,0x571592F3L,(-1L),0L,1L}},{{4L,3L,0x92017A1BL,0x38C9E105L,0x7BF1CC1CL,0x88020F57L,5L},{0x7BF1CC1CL,(-1L),0L,0x78B5A455L,5L,(-1L),0x835FBC13L},{(-1L),0L,0L,0L,0L,(-1L),0L},{(-1L),0x3D2FE6F7L,1L,3L,0xC14CCFD7L,0L,0x2F71711FL}},{{1L,0x787EDD2CL,1L,0x651280DBL,8L,0x92017A1BL,0x7639893BL},{(-10L),0x3D2FE6F7L,1L,(-1L),0L,(-1L),1L},{0x52681015L,0L,2L,(-1L),0x88020F57L,0x0AF78BCDL,0L},{7L,(-1L),0x0AF78BCDL,1L,0xB9488037L,1L,0L}},{{(-1L),3L,0x2DFF457AL,0x787EDD2CL,1L,0L,0x8D6AEC21L},{0x27A80343L,0x8A6F8D2AL,6L,0x2DFF457AL,1L,8L,(-1L)},{(-1L),0x77DC1A4FL,6L,1L,(-1L),1L,0x34D5741FL},{6L,0x571592F3L,0x2DFF457AL,1L,0x78B5A455L,0x52681015L,0x3D2FE6F7L}}};
            uint8_t l_461 = 0xE6L;
            int i, j, k;
            for (g_185 = 0; (g_185 <= 2); g_185 += 1)
            { 
                int32_t l_358[8][2] = {{0xC6A9D3CAL,(-5L)},{0x33E30AB4L,0x33E30AB4L},{(-5L),0xC6A9D3CAL},{0x356F701CL,0xC6A9D3CAL},{(-5L),0x33E30AB4L},{0x33E30AB4L,(-5L)},{0xC6A9D3CAL,0x356F701CL},{0xC6A9D3CAL,(-5L)}};
                uint8_t *l_364 = (void*)0;
                uint8_t *l_365[9][4][7] = {{{&g_185,&g_366[5][1],(void*)0,&g_185,&g_366[5][1],&g_366[5][1],(void*)0},{&g_185,&g_366[4][1],&g_185,&g_366[2][0],(void*)0,&g_366[5][1],&g_185},{(void*)0,&g_366[5][1],&g_366[1][0],&g_366[5][1],&g_366[1][0],&g_366[5][1],(void*)0},{&g_185,&g_366[5][1],(void*)0,&g_366[2][0],&g_185,&g_366[4][1],&g_185}},{{(void*)0,&g_366[5][1],&g_366[5][1],&g_185,(void*)0,&g_366[5][1],&g_185},{&g_366[5][1],&g_366[5][1],(void*)0,&g_185,&g_366[5][1],&g_366[5][1],&g_366[5][1]},{&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[1][1],&g_185},{&g_366[2][0],&g_185,&g_366[5][1],&g_366[4][1],&g_366[5][1],&g_185,&g_366[5][1]}},{{(void*)0,&g_366[5][1],&g_366[1][1],&g_366[5][1],&g_366[4][0],&g_366[5][1],(void*)0},{&g_366[2][0],&g_366[4][1],&g_366[5][1],&g_185,&g_366[5][1],&g_366[5][1],&g_185},{&g_366[5][1],&g_366[5][0],&g_366[5][1],&g_366[5][1],&g_366[0][1],&g_366[5][1],(void*)0},{&g_185,(void*)0,&g_366[5][1],&g_366[5][1],&g_366[2][0],&g_366[5][1],&g_366[5][1]}},{{&g_366[0][1],&g_185,&g_366[4][0],&g_366[5][1],&g_366[1][0],&g_366[5][1],&g_185},{&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_185,&g_185,&g_366[5][1],&g_366[5][1]},{&g_366[1][1],&g_366[1][1],&g_366[0][1],&g_185,&g_366[1][0],&g_366[5][1],&g_366[5][1]},{&g_366[5][1],&g_185,&g_366[2][0],&g_366[5][1],&g_366[2][0],&g_185,&g_366[5][1]}},{{&g_366[5][1],&g_366[5][1],&g_366[1][0],&g_185,&g_366[0][1],&g_366[1][1],&g_366[1][1]},{&g_366[5][1],&g_366[5][1],&g_185,&g_185,&g_366[5][1],&g_366[5][1],&g_366[5][1]},{&g_185,&g_366[5][1],&g_366[1][0],&g_366[5][1],&g_366[4][0],&g_185,&g_366[0][1]},{&g_366[5][1],&g_366[5][1],&g_366[2][0],&g_366[5][1],&g_366[5][1],(void*)0,&g_185}},{{(void*)0,&g_366[5][1],&g_366[0][1],&g_366[5][1],&g_366[5][1],&g_366[5][0],&g_366[5][1]},{&g_185,&g_366[5][1],&g_366[5][1],&g_185,&g_366[5][1],&g_366[4][1],&g_366[2][0]},{(void*)0,&g_366[5][1],&g_366[4][0],&g_366[5][1],&g_366[1][1],&g_366[5][1],(void*)0},{&g_366[5][1],&g_185,&g_366[5][1],&g_366[4][1],&g_366[5][1],&g_185,&g_366[2][0]}},{{&g_185,&g_366[1][1],&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[5][1]},{&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_185,&g_185},{&g_366[5][1],&g_185,&g_366[1][1],&g_366[5][1],(void*)0,&g_366[5][1],&g_366[0][1]},{&g_366[5][1],(void*)0,&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[4][1],&g_366[5][1]}},{{&g_366[1][1],&g_366[5][0],&g_366[5][1],&g_185,&g_366[5][1],&g_366[5][0],&g_366[1][1]},{&g_366[5][1],&g_366[4][1],&g_366[5][1],&g_366[5][1],&g_366[5][1],(void*)0,&g_366[5][1]},{&g_366[0][1],&g_366[5][1],(void*)0,&g_366[5][1],&g_366[1][1],&g_185,&g_366[5][1]},{&g_185,&g_185,&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[5][1]}},{{&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[5][1],&g_366[5][1],(void*)0,&g_366[5][1]},{&g_366[5][1],&g_366[5][1],&g_366[5][1],(void*)0,&g_185,&g_366[5][1],&g_185},{&g_366[0][1],&g_366[5][1],(void*)0,&g_185,&g_185,&g_366[1][1],&g_366[5][1]},{&g_366[5][1],(void*)0,&g_185,&g_366[5][1],&g_185,&g_185,&g_366[5][1]}}};
                const int64_t ***l_374 = &g_372;
                int32_t l_379 = 1L;
                int i, j, k;
                (***g_255) &= (p_9 , ((((safe_div_func_int32_t_s_s(((*l_312) = (safe_add_func_int16_t_s_s(p_9, (g_346[4] = ((*l_314) = 0x6B72L))))), ((safe_sub_func_int16_t_s_s(((g_380 = (safe_sub_func_uint64_t_u_u(((safe_rshift_func_uint64_t_u_s(((((!(safe_sub_func_int64_t_s_s((safe_mul_func_int16_t_s_s(0xB195L, l_358[2][0])), (safe_unary_minus_func_int8_t_s(g_157[5]))))) , ((safe_rshift_func_uint32_t_u_s((((safe_mod_func_uint64_t_u_u((l_358[7][1] = p_9), (((g_366[3][0]--) & (((((*l_374) = g_372) != ((safe_sub_func_int16_t_s_s((l_369 |= ((((**l_327) |= (safe_div_func_int16_t_s_s((g_157[7] , g_157[0]), 0x06ABL))) | g_31) , g_306)), p_9)) , (void*)0)) == 0UL) , p_9)) , p_9))) < g_341) >= g_33[1][0][8]), 17)) , 0x2338L)) ^ 65535UL) , g_94[1]), l_379)) & (*g_373)), 0x739DBB08F21F6146LL))) , g_31), 0L)) && l_381))) >= (-5L)) & 0L) ^ l_379));
            }
            for (g_165 = 0; (g_165 == (-6)); g_165 = safe_sub_func_int8_t_s_s(g_165, 3))
            { 
                const int64_t ***l_396 = (void*)0;
                int64_t ****l_400 = (void*)0;
                int64_t ****l_401 = &l_397;
                int32_t l_406 = (-1L);
                const int8_t *l_411[4][10][5] = {{{&g_412,&g_412,&g_412,&g_412,&g_412},{(void*)0,&g_412,&g_412,&g_412,&g_412},{&g_412,&g_412,&g_412,&g_412,&g_412},{&g_412,&g_412,&g_412,&g_412,&g_412},{&g_412,(void*)0,&g_412,&g_412,&g_412},{&g_412,(void*)0,&g_412,(void*)0,&g_412},{&g_412,&g_412,&g_412,(void*)0,&g_412},{&g_412,&g_412,&g_412,&g_412,(void*)0},{&g_412,&g_412,&g_412,&g_412,&g_412},{(void*)0,&g_412,&g_412,&g_412,&g_412}},{{&g_412,&g_412,&g_412,&g_412,&g_412},{(void*)0,&g_412,&g_412,&g_412,&g_412},{&g_412,&g_412,&g_412,&g_412,&g_412},{&g_412,&g_412,&g_412,&g_412,&g_412},{&g_412,(void*)0,&g_412,&g_412,&g_412},{&g_412,(void*)0,&g_412,(void*)0,&g_412},{&g_412,&g_412,&g_412,(void*)0,&g_412},{&g_412,&g_412,&g_412,&g_412,(void*)0},{&g_412,&g_412,&g_412,&g_412,&g_412},{(void*)0,&g_412,&g_412,&g_412,&g_412}},{{&g_412,&g_412,&g_412,&g_412,&g_412},{(void*)0,&g_412,&g_412,&g_412,&g_412},{&g_412,&g_412,&g_412,&g_412,&g_412},{&g_412,&g_412,&g_412,&g_412,&g_412},{&g_412,(void*)0,&g_412,&g_412,&g_412},{&g_412,(void*)0,&g_412,(void*)0,&g_412},{&g_412,&g_412,&g_412,(void*)0,&g_412},{&g_412,&g_412,&g_412,&g_412,(void*)0},{&g_412,&g_412,&g_412,&g_412,&g_412},{(void*)0,&g_412,&g_412,&g_412,&g_412}},{{&g_412,&g_412,&g_412,&g_412,&g_412},{(void*)0,&g_412,&g_412,&g_412,&g_412},{&g_412,&g_412,&g_412,&g_412,&g_412},{&g_412,&g_412,&g_412,&g_412,(void*)0},{&g_412,&g_412,&g_412,&g_412,&g_412},{&g_412,&g_412,&g_412,&g_412,(void*)0},{(void*)0,&g_412,&g_412,&g_412,&g_412},{(void*)0,&g_412,&g_412,(void*)0,&g_412},{&g_412,&g_412,&g_412,&g_412,&g_412},{&g_412,(void*)0,&g_412,&g_412,&g_412}}};
                const int8_t **l_410[5][8][6] = {{{&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[3][7][3],&l_411[2][7][3]},{&l_411[3][5][2],&l_411[2][7][3],&l_411[3][4][4],&l_411[2][7][3],&l_411[2][7][3],(void*)0},{(void*)0,&l_411[2][7][3],(void*)0,&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3]},{&l_411[3][5][2],&l_411[0][2][2],&l_411[2][7][3],&l_411[2][7][3],&l_411[3][3][1],&l_411[2][7][3]},{&l_411[2][7][3],&l_411[0][3][1],&l_411[0][7][3],&l_411[2][3][0],&l_411[2][7][3],&l_411[2][7][3]},{(void*)0,&l_411[2][8][1],&l_411[2][7][3],&l_411[2][7][3],(void*)0,&l_411[2][7][3]},{&l_411[2][7][3],&l_411[3][1][4],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3]},{&l_411[0][8][2],&l_411[2][7][3],&l_411[0][7][3],&l_411[2][7][3],&l_411[0][7][3],&l_411[2][7][3]}},{{&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],(void*)0,&l_411[2][7][3]},{&l_411[2][7][3],(void*)0,(void*)0,&l_411[0][2][2],&l_411[2][7][3],(void*)0},{&l_411[2][7][3],(void*)0,&l_411[3][4][4],&l_411[3][1][4],(void*)0,&l_411[2][7][3]},{&l_411[1][2][4],&l_411[2][7][3],&l_411[2][7][3],&l_411[0][3][1],&l_411[0][7][3],&l_411[2][3][0]},{&l_411[3][3][1],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3]},{&l_411[3][2][0],&l_411[3][1][4],&l_411[3][7][3],&l_411[2][7][3],(void*)0,&l_411[2][8][1]},{&l_411[3][2][0],&l_411[2][8][1],(void*)0,&l_411[2][7][3],&l_411[2][7][3],&l_411[3][6][3]},{&l_411[3][3][1],&l_411[0][3][1],&l_411[2][7][3],&l_411[0][3][1],&l_411[3][3][1],&l_411[2][7][3]}},{{&l_411[1][2][4],&l_411[0][2][2],&l_411[2][7][3],&l_411[3][1][4],&l_411[2][7][3],&l_411[1][1][3]},{&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[0][2][2],&l_411[2][7][3],&l_411[1][1][3]},{&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[3][7][3],&l_411[2][7][3]},{&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[3][6][3]},{&l_411[0][8][2],(void*)0,(void*)0,&l_411[2][7][3],&l_411[3][5][2],&l_411[2][8][1]},{&l_411[2][7][3],&l_411[2][7][3],&l_411[3][7][3],&l_411[2][7][3],&l_411[3][5][2],&l_411[2][7][3]},{(void*)0,(void*)0,&l_411[2][7][3],&l_411[2][3][0],&l_411[2][7][3],&l_411[2][3][0]},{&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[3][7][3],&l_411[2][7][3]}},{{&l_411[3][5][2],&l_411[2][7][3],&l_411[3][4][4],&l_411[2][7][3],&l_411[2][7][3],(void*)0},{(void*)0,&l_411[2][7][3],(void*)0,&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3]},{&l_411[3][5][2],&l_411[0][2][2],&l_411[2][7][3],&l_411[2][7][3],(void*)0,&l_411[2][7][3]},{(void*)0,&l_411[2][7][3],&l_411[2][7][3],&l_411[0][3][1],&l_411[1][2][4],(void*)0},{&l_411[3][5][2],&l_411[3][1][4],&l_411[1][2][4],&l_411[2][4][2],&l_411[2][7][3],&l_411[2][7][3]},{&l_411[3][3][1],&l_411[2][7][3],&l_411[1][2][4],&l_411[2][7][3],(void*)0,(void*)0},{&l_411[3][4][4],&l_411[2][7][3],&l_411[2][7][3],&l_411[1][1][3],&l_411[2][7][3],&l_411[2][7][3]},{&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][8][1],(void*)0,&l_411[2][7][3]}},{{&l_411[2][7][3],&l_411[2][3][0],&l_411[3][5][2],&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3]},{&l_411[2][7][3],&l_411[2][3][0],(void*)0,&l_411[2][7][3],(void*)0,&l_411[0][2][2]},{&l_411[2][7][3],&l_411[2][7][3],(void*)0,&l_411[2][7][3],&l_411[2][7][3],&l_411[0][3][1]},{(void*)0,&l_411[2][7][3],&l_411[3][3][1],&l_411[0][2][2],(void*)0,&l_411[2][8][1]},{&l_411[2][7][3],&l_411[2][7][3],&l_411[0][7][3],(void*)0,&l_411[2][7][3],&l_411[3][1][4]},{&l_411[2][7][3],&l_411[3][1][4],&l_411[2][7][3],&l_411[0][2][2],&l_411[1][2][4],&l_411[2][7][3]},{(void*)0,&l_411[2][7][3],&l_411[2][7][3],&l_411[2][7][3],(void*)0,&l_411[2][7][3]},{&l_411[2][7][3],&l_411[2][7][3],&l_411[3][7][3],&l_411[2][7][3],&l_411[2][7][3],(void*)0}}};
                int32_t **l_418 = &l_338[6];
                int32_t ***l_419[4][2] = {{&l_23,&l_418},{&l_23,&l_418},{&l_23,&l_418},{&l_23,&l_418}};
                int i, j, k;
                l_333 ^= (((safe_rshift_func_int64_t_s_u((p_9 , ((((((g_407 |= (l_369 = (safe_mod_func_int64_t_s_s(((0xA2936E82L == ((safe_add_func_uint32_t_u_u((safe_mod_func_uint8_t_u_u(l_368, (((((((p_9 , (safe_mod_func_int64_t_s_s((safe_mod_func_int8_t_s_s((l_396 != ((*l_401) = l_397)), (safe_lshift_func_uint32_t_u_s((g_311 || ((safe_lshift_func_uint8_t_u_u((p_9 <= p_9), 4)) | (*g_373))), 31)))), 1L))) && p_9) , &g_373) == &l_399) & (-2L)) , g_313) , g_149))), l_406)) | (-7L))) || g_33[2][0][6]), 0xE09499CAD8E44A95LL)))) ^ p_9) > (*g_169)) || p_9) , g_94[2]) >= (-1L))), 54)) , (*l_312)) | p_9);
                (*g_169) = (((*l_314) = (((g_408 = &g_165) != (g_415[6][0] = (l_413 = (void*)0))) <= ((((((*g_255) = l_417) != (l_420 = (l_23 = l_418))) | (l_368 ^= ((((*l_319) = ((((((p_9 | ((safe_mul_func_uint16_t_u_u(0x7263L, (&g_373 == ((**l_401) = (*l_397))))) < ((&g_372 != l_423) & 0x5FL))) && g_414) , p_9) , (*g_372)) != (void*)0) ^ g_185)) && g_426) >= 0x0347D94C0175571CLL))) & p_9) , g_366[5][1]))) == g_414);
                if (p_9)
                    break;
                if ((*g_169))
                    continue;
            }
            if ((((*l_425) = (p_9 , p_9)) ^ p_9))
            { 
                int32_t *l_434 = &l_24[0];
                l_434 = ((safe_unary_minus_func_int64_t_s((safe_rshift_func_uint32_t_u_s((safe_add_func_int32_t_s_s((safe_lshift_func_uint16_t_u_u(5UL, 10)), 4294967293UL)), 24)))) , &g_313);
                (*l_23) = (*l_23);
                (*l_23) = l_434;
                (*l_23) = l_434;
            }
            else
            { 
                int8_t ***l_437 = (void*)0;
                int8_t ***l_438[3];
                int32_t l_443 = (-7L);
                int32_t l_459[8][9][1] = {{{0x6734A3A9L},{0x17C83ADDL},{0x328560B7L},{1L},{0x220AB6B7L},{1L},{0x220AB6B7L},{1L},{0x328560B7L}},{{0x17C83ADDL},{0x6734A3A9L},{0x7340F128L},{6L},{0x8A5B444AL},{0x553E4A9CL},{6L},{0x71E29F3CL},{6L}},{{0x553E4A9CL},{0x8A5B444AL},{6L},{0x7340F128L},{0x6734A3A9L},{0x17C83ADDL},{0x328560B7L},{1L},{0x220AB6B7L}},{{1L},{0x220AB6B7L},{1L},{0x328560B7L},{0x17C83ADDL},{0x6734A3A9L},{0x7340F128L},{6L},{0x8A5B444AL}},{{0x553E4A9CL},{6L},{0x71E29F3CL},{6L},{0x553E4A9CL},{0x8A5B444AL},{6L},{0x7340F128L},{0x6734A3A9L}},{{0x17C83ADDL},{0x328560B7L},{1L},{0x220AB6B7L},{1L},{0x220AB6B7L},{1L},{0x328560B7L},{0x17C83ADDL}},{{0x6734A3A9L},{0x7340F128L},{6L},{0x8A5B444AL},{0x553E4A9CL},{6L},{0x71E29F3CL},{6L},{0x553E4A9CL}},{{0x8A5B444AL},{6L},{0x7340F128L},{0x6734A3A9L},{0x17C83ADDL},{0x328560B7L},{1L},{0x220AB6B7L},{1L}}};
                int16_t * const l_467 = &g_168;
                int i, j, k;
                for (i = 0; i < 3; i++)
                    l_438[i] = &l_327;
                l_443 = (((safe_div_func_uint32_t_u_u((&g_415[6][0] == (l_327 = &g_408)), (l_333 = 1L))) & ((safe_lshift_func_int8_t_s_s((safe_sub_func_int16_t_s_s(l_443, ((~((!(l_417 != l_420)) | (0x38L ^ ((safe_sub_func_uint64_t_u_u((safe_sub_func_uint16_t_u_u((((safe_add_func_int8_t_s_s((((*l_314) = (safe_mul_func_int64_t_s_s(((*l_425) ^= (*g_373)), (g_457 = (safe_add_func_int64_t_s_s((((~l_443) | p_9) , (*g_373)), g_11[1])))))) , 9L), 0xE4L)) , g_346[4]) , 0x1284L), p_9)), 0x1264E6488AB867F8LL)) , 0xF8L)))) , g_380))), 1)) , (*g_408))) & (-8L));
                l_461--;
                (*l_312) ^= (((g_466[8][2][1] = &g_168) == l_467) < ((safe_rshift_func_int32_t_s_u((p_9 != (safe_add_func_int64_t_s_s((safe_rshift_func_int8_t_s_s((safe_rshift_func_int16_t_s_u((safe_rshift_func_int16_t_s_s(((safe_add_func_int32_t_s_s((safe_sub_func_uint16_t_u_u(p_9, ((++(*l_314)) & (~((safe_div_func_int32_t_s_s((safe_rshift_func_int16_t_s_s((((*l_30) = l_443) & (((safe_lshift_func_uint16_t_u_u((+((safe_mul_func_uint8_t_u_u((--(*l_319)), l_496[1][1])) | ((safe_add_func_uint8_t_u_u((((*l_32) = p_9) <= (l_326[7] == &g_346[2])), 0xA6L)) , p_9))), 13)) , p_9) < l_443)), p_9)), 9UL)) | g_11[1]))))), p_9)) , 0x32F2L), g_416[3][4])), g_66[3][3])), 2)), p_9))), 31)) == (*g_373)));
                (*g_169) ^= p_9;
            }
        }
        (*g_169) = p_9;
        ++l_499;
    }
    else
    { 
        int64_t *l_512[8] = {(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0};
        int32_t l_513[4];
        int64_t l_524[6][10][4] = {{{0x4C3D815AE43813BALL,0xF0C6CFC406DFDF2ALL,0x082E0D4638A26EFBLL,1L},{0xC881B6CB4CC4A5C9LL,0xE4DE13E2542AFC13LL,(-5L),0x2E1C39099BE1D503LL},{(-2L),(-1L),0xC881B6CB4CC4A5C9LL,(-1L)},{0xCD7E5718D9CE495DLL,0x25989EA0395394D5LL,0x25989EA0395394D5LL,0xCD7E5718D9CE495DLL},{0xF0C6CFC406DFDF2ALL,0xF884BC59129141D1LL,(-1L),(-1L)},{9L,0xE1735034541A91DALL,1L,0x082E0D4638A26EFBLL},{(-2L),3L,0xC42F5F76941C79BDLL,0x082E0D4638A26EFBLL},{0x25989EA0395394D5LL,0xE1735034541A91DALL,1L,0x19EE989D2DF288E2LL},{0xCF630E151FD4A638LL,1L,0x4C3D815AE43813BALL,(-3L)},{(-1L),(-7L),9L,0xE4DE13E2542AFC13LL}},{{1L,0x19EE989D2DF288E2LL,1L,0xCF630E151FD4A638LL},{0L,(-5L),0xA72890E95F62B265LL,0xE1735034541A91DALL},{0xCD7E5718D9CE495DLL,0xA726B99D96E26521LL,0L,0x49C30984D15A5727LL},{9L,(-1L),0L,(-1L)},{0xF884BC59129141D1LL,0xCD7E5718D9CE495DLL,0xF884BC59129141D1LL,3L},{3L,0xC881B6CB4CC4A5C9LL,0xE1735034541A91DALL,7L},{(-1L),0x082E0D4638A26EFBLL,(-10L),0xC881B6CB4CC4A5C9LL},{1L,0x2E1C39099BE1D503LL,(-10L),(-1L)},{(-1L),(-1L),0xE1735034541A91DALL,1L},{3L,(-1L),0xF884BC59129141D1LL,0x5333F827537ACEF5LL}},{{0xF884BC59129141D1LL,0x5333F827537ACEF5LL,0L,(-7L)},{9L,0x25989EA0395394D5LL,0L,1L},{0xCD7E5718D9CE495DLL,1L,0xA72890E95F62B265LL,0x4C3D815AE43813BALL},{0L,(-2L),1L,0L},{1L,0xC42F5F76941C79BDLL,9L,9L},{(-1L),(-1L),0x4C3D815AE43813BALL,(-2L)},{0xCF630E151FD4A638LL,0x49C30984D15A5727LL,1L,1L},{0x25989EA0395394D5LL,0L,0xC42F5F76941C79BDLL,1L},{(-2L),0L,1L,1L},{0L,0x49C30984D15A5727LL,0xE4DE13E2542AFC13LL,(-2L)}},{{0xA726B99D96E26521LL,(-1L),(-7L),9L},{(-3L),0xC42F5F76941C79BDLL,0xF0C6CFC406DFDF2ALL,0L},{(-1L),(-2L),0x5333F827537ACEF5LL,0x4C3D815AE43813BALL},{0xF0C6CFC406DFDF2ALL,1L,0x49C30984D15A5727LL,1L},{(-1L),0x25989EA0395394D5LL,1L,(-7L)},{0L,0x5333F827537ACEF5LL,(-1L),0x5333F827537ACEF5LL},{0x49C30984D15A5727LL,(-1L),0x2E1C39099BE1D503LL,1L},{(-7L),(-1L),0L,(-1L)},{(-2L),0x2E1C39099BE1D503LL,(-2L),0xC881B6CB4CC4A5C9LL},{(-2L),0x082E0D4638A26EFBLL,0L,7L}},{{(-7L),0xC881B6CB4CC4A5C9LL,0x2E1C39099BE1D503LL,3L},{0x49C30984D15A5727LL,0xCD7E5718D9CE495DLL,(-1L),(-1L)},{0L,(-1L),1L,0x49C30984D15A5727LL},{(-1L),0xA726B99D96E26521LL,0x49C30984D15A5727LL,0xE1735034541A91DALL},{0xF0C6CFC406DFDF2ALL,(-5L),0x5333F827537ACEF5LL,0xCF630E151FD4A638LL},{(-1L),0x19EE989D2DF288E2LL,0xF0C6CFC406DFDF2ALL,0xE4DE13E2542AFC13LL},{(-3L),(-7L),(-7L),(-3L)},{0xA726B99D96E26521LL,1L,0xE4DE13E2542AFC13LL,0x19EE989D2DF288E2LL},{0L,0xE1735034541A91DALL,1L,0x082E0D4638A26EFBLL},{(-2L),3L,0xC42F5F76941C79BDLL,0x082E0D4638A26EFBLL}},{{0x25989EA0395394D5LL,0xE1735034541A91DALL,1L,0x19EE989D2DF288E2LL},{0xCF630E151FD4A638LL,1L,0x4C3D815AE43813BALL,(-3L)},{(-1L),(-7L),9L,0xE4DE13E2542AFC13LL},{0xE1735034541A91DALL,(-1L),(-1L),0L},{(-2L),0x5333F827537ACEF5LL,0x4C3D815AE43813BALL,3L},{(-3L),0x2E1C39099BE1D503LL,7L,9L},{0L,0xF884BC59129141D1LL,0x25989EA0395394D5LL,0xE4DE13E2542AFC13LL},{1L,(-3L),1L,(-10L)},{(-10L),0xF0C6CFC406DFDF2ALL,3L,(-1L)},{1L,0x49C30984D15A5727LL,1L,0xF0C6CFC406DFDF2ALL}}};
        int16_t l_549 = 8L;
        int8_t l_567 = 0x65L;
        int i, j, k;
        for (i = 0; i < 4; i++)
            l_513[i] = 0x50CAB1D2L;
        (*g_169) |= 1L;
        for (g_12 = 0; (g_12 != 9); g_12++)
        { 
            for (g_426 = 17; (g_426 == (-2)); g_426 = safe_sub_func_uint16_t_u_u(g_426, 3))
            { 
                uint8_t l_523[10][4][6] = {{{0xF4L,0x83L,0UL,0xF4L,0xF1L,0x11L},{255UL,0xF4L,0UL,0xF4L,255UL,0xB7L},{0xF4L,255UL,0xB7L,0xC9L,255UL,0x6DL},{0x83L,0xF4L,0xF1L,255UL,0xF1L,0x6DL}},{{0xF1L,0x83L,0xB7L,0x11L,0x11L,0xB7L},{0xF1L,0xF1L,0UL,255UL,253UL,0x11L},{0x83L,0xF1L,0UL,0xC9L,0x11L,0UL},{0xF4L,0x83L,0UL,0xF4L,0xF1L,0x11L}},{{255UL,0xF4L,0UL,0xF4L,255UL,0xB7L},{0xF4L,255UL,0xB7L,0xC9L,255UL,0x6DL},{0x83L,0xF4L,0xF1L,255UL,0xF1L,0x6DL},{0xF1L,0x83L,0xB7L,0x11L,0x11L,0xB7L}},{{0xF1L,0xF1L,0UL,255UL,253UL,0x11L},{0x83L,0xF1L,0UL,0xC9L,0x11L,0UL},{0xF4L,0x83L,0UL,0xF4L,0xF1L,0x11L},{255UL,0xF4L,0UL,0xF4L,255UL,0xB7L}},{{0xF4L,255UL,0xB7L,0xC9L,255UL,0x6DL},{0x83L,0xF4L,0xF1L,255UL,0xF1L,0x6DL},{0xF1L,0x83L,0xB7L,0x11L,0x11L,0xB7L},{0xF1L,0xF1L,0UL,255UL,253UL,0x11L}},{{0x83L,0xF1L,0UL,0xC9L,0x11L,0UL},{0xF4L,0x83L,0UL,0xF4L,0xF1L,0x11L},{255UL,0xF4L,0UL,0xF4L,255UL,0xB7L},{0xF4L,255UL,0xB7L,0xC9L,255UL,0x6DL}},{{0x83L,0xF4L,0xF1L,255UL,0xF1L,0x6DL},{0xF1L,0x83L,0xB7L,0x11L,0x11L,0xB7L},{0xF1L,0xF1L,0UL,255UL,253UL,0x11L},{0x83L,0x79L,255UL,255UL,0x80L,0xF1L}},{{8UL,1UL,255UL,8UL,0x79L,0xC9L},{253UL,8UL,0xF1L,8UL,253UL,0x11L},{8UL,253UL,0x11L,255UL,253UL,0x83L},{1UL,8UL,253UL,253UL,0x79L,0x83L}},{{0x79L,1UL,0x11L,0x80L,0x80L,0x11L},{0x79L,0x79L,0xF1L,253UL,0x5FL,0xC9L},{1UL,0x79L,255UL,255UL,0x80L,0xF1L},{8UL,1UL,255UL,8UL,0x79L,0xC9L}},{{253UL,8UL,0xF1L,8UL,253UL,0x11L},{8UL,253UL,0x11L,255UL,253UL,0x83L},{1UL,8UL,253UL,253UL,0x79L,0x83L},{0x79L,1UL,0x11L,0x80L,0x80L,0x11L}}};
                int i, j, k;
                (**g_256) = ((safe_div_func_int8_t_s_s(1L, ((p_9 , ((safe_sub_func_int32_t_s_s(p_9, ((safe_add_func_int16_t_s_s((l_512[7] == (void*)0), ((*l_310) = (g_165 | l_513[1])))) | (safe_add_func_uint64_t_u_u(p_9, (safe_sub_func_uint32_t_u_u((safe_sub_func_int8_t_s_s(((!(safe_add_func_uint64_t_u_u(((p_9 <= 0L) ^ g_33[8][0][8]), (-1L)))) < l_513[0]), g_149)), l_513[1]))))))) , (-1L))) && g_426))) ^ l_523[3][2][5]);
                return l_524[3][2][1];
            }
            for (g_426 = 0; (g_426 < 8); g_426++)
            { 
                (**g_255) = &l_513[2];
            }
        }
        for (g_426 = 26; (g_426 == 5); g_426 = safe_sub_func_uint8_t_u_u(g_426, 8))
        { 
            int32_t l_534 = (-1L);
            int32_t l_536 = 0xD26B6040L;
            uint64_t l_537 = 18446744073709551610UL;
            for (g_407 = 25; (g_407 < 30); g_407 = safe_add_func_uint64_t_u_u(g_407, 8))
            { 
                uint16_t l_533 = 0xD203L;
                int32_t l_535 = (-4L);
                (**g_256) = (safe_add_func_uint16_t_u_u((l_533 != (((l_533 > p_9) > p_9) ^ l_533)), l_513[1]));
                l_537++;
                return l_535;
            }
            for (l_537 = 0; (l_537 >= 29); l_537++)
            { 
                uint32_t *l_564[5][7][7] = {{{&g_94[2],&g_380,&g_149,&g_380,&g_94[0],&g_380,&g_149},{&g_149,&g_149,(void*)0,&g_94[2],&g_380,&g_94[2],&g_380},{&g_94[1],&g_149,&g_149,&g_94[2],&g_94[2],&g_380,&g_380},{&g_94[2],&g_380,&g_380,&g_94[0],&g_380,&g_94[2],&g_149},{&g_94[2],&g_94[2],&g_94[2],(void*)0,&g_94[0],(void*)0,&g_149},{&g_94[1],&g_149,&g_94[2],&g_94[0],&g_149,(void*)0,&g_149},{&g_149,&g_94[2],(void*)0,&g_94[2],&g_94[2],(void*)0,&g_149}},{{&g_94[2],&g_380,&g_94[2],&g_94[2],&g_94[0],(void*)0,&g_380},{&g_94[2],&g_94[2],&g_94[2],&g_380,&g_380,(void*)0,&g_380},{&g_380,&g_380,&g_380,&g_94[2],&g_380,(void*)0,&g_149},{&g_94[2],&g_94[2],&g_149,&g_380,&g_94[0],&g_94[2],&g_149},{&g_380,&g_149,(void*)0,&g_380,&g_94[2],&g_380,(void*)0},{&g_94[2],&g_94[2],&g_149,&g_94[2],&g_149,&g_94[2],&g_149},{&g_94[2],&g_380,&g_149,&g_380,&g_94[0],&g_380,&g_149}},{{&g_149,&g_149,(void*)0,&g_94[2],&g_380,&g_94[2],&g_380},{&g_94[1],&g_149,&g_149,&g_94[2],&g_94[2],&g_380,&g_380},{&g_94[2],&g_380,&g_94[2],&g_94[0],&g_94[0],&g_94[2],&g_149},{&g_380,&g_149,&g_380,&g_149,&g_380,&g_149,&g_94[2]},{&g_94[2],(void*)0,&g_149,&g_94[0],&g_94[1],&g_380,&g_94[2]},{&g_94[0],&g_380,&g_94[2],&g_94[2],&g_149,&g_149,&g_149},{&g_149,&g_94[2],&g_149,&g_380,&g_94[2],&g_149,&g_94[2]}},{{&g_94[2],(void*)0,&g_380,&g_94[2],(void*)0,&g_380,&g_94[1]},{&g_380,&g_94[2],&g_94[2],&g_94[2],(void*)0,&g_149,&g_380},{&g_149,&g_380,&g_94[2],&g_149,&g_94[2],&g_94[2],&g_94[2]},{&g_380,(void*)0,&g_94[2],&g_149,&g_149,&g_380,&g_149},{&g_94[2],&g_149,&g_380,&g_94[2],&g_94[1],&g_94[2],&g_94[2]},{&g_149,&g_380,&g_380,&g_94[2],&g_380,&g_94[2],&g_380},{&g_94[0],&g_94[0],&g_94[2],&g_380,&g_94[0],&g_94[2],&g_94[1]}},{{&g_94[2],&g_94[0],&g_94[2],&g_94[2],&g_94[2],&g_380,&g_94[2]},{&g_380,&g_380,&g_94[2],&g_94[0],&g_94[0],&g_94[2],&g_149},{&g_380,&g_149,&g_380,&g_149,&g_380,&g_149,&g_94[2]},{&g_94[2],(void*)0,&g_149,&g_94[0],&g_94[1],&g_380,&g_94[2]},{&g_94[0],&g_380,&g_94[2],&g_94[2],&g_149,&g_149,&g_149},{&g_149,&g_94[2],&g_149,&g_380,&g_94[2],&g_149,&g_94[2]},{&g_94[2],(void*)0,&g_380,&g_94[2],(void*)0,&g_380,&g_94[1]}}};
                int32_t l_565 = 0x56C2B96EL;
                uint16_t l_566[10][7] = {{0x136DL,0UL,0x0D3AL,0UL,0x136DL,0xF559L,4UL},{0UL,0UL,0xE1E7L,0x5533L,2UL,0x5533L,0xE1E7L},{4UL,4UL,0UL,0x0D3AL,0xFD06L,0xFB9BL,0xF306L},{0UL,0x5533L,1UL,1UL,0x5533L,0UL,2UL},{0x136DL,0UL,0UL,0xDCD5L,0xFD06L,0xFD06L,0xDCD5L},{2UL,0x92D3L,2UL,65535UL,2UL,0xE80DL,0UL},{0UL,0UL,0x136DL,0xFB9BL,0x136DL,0UL,0UL},{1UL,0x5533L,0UL,2UL,0x852DL,0xE80DL,0x852DL},{0UL,4UL,4UL,4UL,0xF559L,0x136DL,0UL},{0x92D3L,0xE80DL,2UL,0x5533L,0x5533L,2UL,0xE80DL}};
                int i, j, k;
                l_567 = (safe_div_func_int32_t_s_s(((*l_312) ^= (!(**g_372))), (safe_lshift_func_int32_t_s_s((p_9 == ((((((*l_314) ^= l_549) || (((--(*l_30)) && ((*g_373) >= (safe_sub_func_uint8_t_u_u(p_9, ((*l_319) = (((safe_mod_func_int64_t_s_s(((*l_425) = (safe_mod_func_uint16_t_u_u(((l_536 = ((safe_mul_func_uint16_t_u_u(g_346[3], (((((safe_sub_func_int8_t_s_s((safe_add_func_uint32_t_u_u((&g_380 != l_564[2][0][2]), ((0xDD250ABB124CD325LL < g_409) >= (*g_373)))), g_407)) , (*g_373)) < l_565) , &g_185) != (void*)0))) , p_9)) < p_9), p_9))), 0xEEC46540531036A0LL)) == 4294967288UL) < g_412)))))) != 0x6A948BE95CCE685BLL)) != p_9) , l_566[0][3]) , g_366[3][0])), p_9))));
                (**g_256) |= ((void*)0 != &g_407);
                if (p_9)
                    break;
            }
        }
    }
    return p_9;
}




static int16_t  func_15(int8_t  p_16, uint32_t  p_17, int32_t  p_18)
{ 
    uint16_t l_43[8][6] = {{4UL,0x864FL,65527UL,0x864FL,4UL,65527UL},{0x864FL,4UL,65527UL,0x11FBL,0x11FBL,65527UL},{0x11FBL,0x11FBL,65527UL,4UL,0x864FL,65527UL},{4UL,0x864FL,65527UL,0x864FL,4UL,65527UL},{0x864FL,4UL,65527UL,0x11FBL,0x11FBL,65527UL},{0x11FBL,0x11FBL,65527UL,4UL,0x864FL,65527UL},{4UL,0x864FL,65527UL,0x864FL,4UL,65527UL},{0x864FL,4UL,65527UL,0x11FBL,0x11FBL,65527UL}};
    int32_t l_54 = 1L;
    int32_t l_55 = 0x1814A667L;
    int32_t l_57 = 0xF053B50BL;
    int32_t l_58[8];
    int64_t *l_83 = &g_66[3][3];
    int32_t l_106[2];
    int32_t *l_111 = (void*)0;
    int32_t **l_110[9] = {(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0};
    int32_t ***l_109 = &l_110[8];
    const int32_t l_145 = (-1L);
    int64_t *l_156 = &g_157[0];
    int8_t *l_164 = &g_165;
    uint16_t l_166 = 4UL;
    int16_t *l_167 = &g_168;
    int64_t *l_171 = (void*)0;
    int64_t *l_172 = &g_157[8];
    uint32_t l_196 = 4294967295UL;
    uint16_t l_199 = 4UL;
    int8_t l_288 = 0L;
    int8_t l_291 = (-5L);
    uint32_t l_302 = 18446744073709551615UL;
    int i, j;
    for (i = 0; i < 8; i++)
        l_58[i] = 0xE0FBC7DBL;
    for (i = 0; i < 2; i++)
        l_106[i] = (-1L);
lbl_244:
    for (g_31 = 0; (g_31 <= 0); g_31 += 1)
    { 
        int32_t l_52[5] = {0x50B10B9BL,0x50B10B9BL,0x50B10B9BL,0x50B10B9BL,0x50B10B9BL};
        uint16_t l_108 = 1UL;
        int i;
        if (g_11[(g_31 + 1)])
            break;
        if (g_11[(g_31 + 1)])
            break;
        for (p_18 = 0; (p_18 <= 0); p_18 += 1)
        { 
            int32_t *l_38 = &g_11[(g_31 + 1)];
            int32_t l_53 = 0x2DAC39F6L;
            int32_t l_56[8][5][2] = {{{0xEDC4196DL,0x55470A06L},{0xFFFF0E59L,0L},{6L,0xEDC4196DL},{(-1L),9L},{2L,0x62CF0DA5L}},{{0x2A43FB2FL,0xFFFF0E59L},{0x7A36831AL,0x7A36831AL},{(-1L),6L},{0x28A4BD3CL,0xEF314FBCL},{0xFB4D153BL,0L}},{{0x1831F773L,0xFB4D153BL},{9L,0x0066401EL},{9L,0xFB4D153BL},{0x1831F773L,0L},{0xFB4D153BL,0xEF314FBCL}},{{0x28A4BD3CL,6L},{(-1L),0x7A36831AL},{0x7A36831AL,0xFFFF0E59L},{0x2A43FB2FL,0x62CF0DA5L},{2L,9L}},{{(-1L),0xEDC4196DL},{6L,0L},{0xFFFF0E59L,0x55470A06L},{0xEDC4196DL,0x55470A06L},{0xFFFF0E59L,0L}},{{6L,0xEDC4196DL},{(-1L),9L},{2L,0x62CF0DA5L},{0x2A43FB2FL,0xFFFF0E59L},{0x7A36831AL,0x7A36831AL}},{{(-1L),6L},{0x28A4BD3CL,0xEF314FBCL},{0xFB4D153BL,0L},{0x1831F773L,0xFB4D153BL},{9L,0x0066401EL}},{{9L,0xFB4D153BL},{0x1831F773L,0L},{0xFB4D153BL,0xEF314FBCL},{0x28A4BD3CL,6L},{(-1L),0x7A36831AL}}};
            uint8_t l_59[3];
            int i, j, k;
            for (i = 0; i < 3; i++)
                l_59[i] = 0x9FL;
            if (p_18)
            { 
                const int32_t *l_34 = &g_11[0];
                int32_t *l_37 = &g_11[1];
                int32_t **l_36[5][1][4] = {{{&l_37,&l_37,&l_37,&l_37}},{{&l_37,&l_37,&l_37,&l_37}},{{&l_37,&l_37,&l_37,&l_37}},{{&l_37,&l_37,&l_37,&l_37}},{{&l_37,&l_37,&l_37,&l_37}}};
                int32_t ***l_39 = &l_36[3][0][1];
                int i, j, k;
                g_35 = l_34;
                g_11[g_31] = 0x10944B0CL;
                l_38 = &g_11[1];
                g_11[g_31] = (((*l_39) = (void*)0) == &l_38);
            }
            else
            { 
                int32_t *l_40 = &g_11[0];
                int32_t *l_41 = &g_11[(g_31 + 1)];
                int32_t *l_42[3][7] = {{&g_11[(g_31 + 1)],&g_11[(g_31 + 1)],&g_11[1],&g_11[1],&g_11[(g_31 + 1)],&g_11[(g_31 + 1)],&g_11[1]},{&g_11[1],&g_11[(g_31 + 1)],&g_11[1],&g_11[(g_31 + 1)],&g_11[1],&g_11[(g_31 + 1)],&g_11[1]},{&g_11[(g_31 + 1)],&g_11[1],&g_11[1],&g_11[(g_31 + 1)],&g_11[(g_31 + 1)],&g_11[1],&g_11[1]}};
                int i, j;
                l_43[0][0]--;
            }
            for (p_17 = 0; (p_17 <= 0); p_17 += 1)
            { 
                int32_t *l_46 = &g_11[1];
                int32_t *l_47 = &g_11[1];
                int32_t *l_48 = &g_11[1];
                int32_t *l_49 = &g_11[1];
                int32_t *l_50 = &g_11[0];
                int32_t *l_51[3][10] = {{(void*)0,(void*)0,&g_11[1],(void*)0,(void*)0,&g_11[1],(void*)0,(void*)0,&g_11[1],(void*)0},{(void*)0,&g_11[1],&g_11[1],(void*)0,&g_11[1],&g_11[1],(void*)0,&g_11[1],&g_11[1],(void*)0},{&g_11[1],(void*)0,&g_11[1],&g_11[1],(void*)0,&g_11[1],&g_11[1],(void*)0,&g_11[1],&g_11[1]}};
                int32_t **l_62[7][7] = {{&l_38,&l_38,&l_47,&l_38,&l_38,&l_47,&l_38},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{&l_51[1][6],&l_38,&l_51[1][6],&l_51[1][6],&l_38,&l_51[1][6],&l_51[1][6]},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{&l_38,&l_51[1][6],&l_51[1][6],&l_38,&l_51[1][6],&l_51[1][6],&l_38},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{&l_38,&l_38,&l_47,&l_38,&l_38,&l_47,&l_38}};
                int i, j;
                --l_59[0];
                g_35 = l_51[1][6];
            }
            if ((*l_38))
                continue;
            for (l_53 = 0; (l_53 <= 1); l_53 += 1)
            { 
                int i, j, k;
                return l_56[(g_31 + 6)][(l_53 + 2)][p_18];
            }
            for (l_54 = 0; (l_54 >= 0); l_54 -= 1)
            { 
                int64_t *l_65 = &g_66[3][3];
                int64_t **l_84 = (void*)0;
                int64_t **l_85 = &l_65;
                int64_t *l_87[8] = {&g_66[2][3],&g_66[4][1],&g_66[4][1],&g_66[2][3],&g_66[4][1],&g_66[4][1],&g_66[2][3],&g_66[4][1]};
                int64_t **l_86 = &l_87[7];
                uint32_t *l_93[3];
                int32_t l_104 = 0L;
                int32_t l_105[1];
                uint32_t l_107 = 0UL;
                int32_t l_112 = 0x2EFCB156L;
                int i;
                for (i = 0; i < 3; i++)
                    l_93[i] = &g_94[2];
                for (i = 0; i < 1; i++)
                    l_105[i] = 0L;
                l_112 &= ((((safe_mul_func_uint8_t_u_u(((((*l_65) &= 1L) , (safe_div_func_int32_t_s_s((safe_div_func_uint32_t_u_u((((((((safe_rshift_func_uint32_t_u_s(g_11[(g_31 + 1)], ((safe_div_func_int8_t_s_s(((((safe_mul_func_int64_t_s_s(((safe_sub_func_int16_t_s_s(p_16, (p_16 <= ((!(safe_mul_func_int64_t_s_s(((*l_83) = (~(l_105[0] ^= ((((*l_85) = l_83) == ((*l_86) = (void*)0)) >= ((((((+(safe_mul_func_uint8_t_u_u(0x1FL, (safe_sub_func_uint32_t_u_u((g_94[2]--), (+(safe_mul_func_int64_t_s_s(((safe_mod_func_uint32_t_u_u(g_11[1], (safe_sub_func_uint16_t_u_u(((g_12 <= g_11[(g_31 + 1)]) >= g_12), 7L)))) != p_16), l_55)))))))) == l_104) , 0x02DFE65AL) , p_17) , g_12) ^ 0xA833846322F5C3AALL))))), g_31))) < l_106[0])))) , l_107), 0UL)) , l_104) & 0x93ACL) > p_16), g_11[1])) , l_108))) , 4L) <= l_58[7]) , l_109) != (void*)0) & p_16) < p_16), 4294967291UL)), p_17))) & p_16), g_12)) != l_52[3]) , p_17) ^ 0x0A3500CD5182C662LL);
            }
        }
    }
    for (p_17 = 1; (p_17 <= 5); p_17 += 1)
    { 
        int64_t * const *l_114 = (void*)0;
        int32_t l_115 = 0xC0B326B5L;
        int32_t l_122 = (-1L);
        int32_t l_128 = 3L;
        int32_t l_129 = (-6L);
        int32_t ***l_144 = &l_110[3];
        for (g_12 = 0; (g_12 <= 5); g_12 += 1)
        { 
            int i, j;
            if (l_43[g_12][g_12])
                break;
            for (p_18 = 0; (p_18 <= 8); p_18 += 1)
            { 
                return p_17;
            }
            for (g_31 = 0; (g_31 <= 7); g_31 += 1)
            { 
                int i;
                l_58[g_31] = (~p_18);
                if (p_16)
                    continue;
                g_11[1] = (((0x33A8E694L & p_18) , 0xE34AC405L) & (((void*)0 == l_114) , 0x7FEED684L));
            }
        }
        if (p_16)
        { 
            uint64_t l_116 = 0xDCA698BDAB2CB753LL;
            int32_t l_119 = (-7L);
            int32_t l_123 = 0xDAE3C54FL;
            int32_t l_125 = 0x5C04B26AL;
            int32_t l_127[4][3] = {{1L,1L,0x4C425AE9L},{1L,1L,0x4C425AE9L},{1L,1L,0x4C425AE9L},{1L,1L,0x4C425AE9L}};
            uint32_t *l_146 = (void*)0;
            uint32_t *l_147 = (void*)0;
            uint32_t *l_148 = &g_149;
            int i, j;
            l_115 = l_115;
            for (p_18 = 1; (p_18 <= 5); p_18 += 1)
            { 
                int16_t l_120 = 0xDB9CL;
                int32_t l_121 = 0x49656563L;
                int32_t l_124[1][4] = {{0x080E9152L,0x080E9152L,0x080E9152L,0x080E9152L}};
                int32_t l_126 = (-6L);
                uint16_t l_130 = 0x6C88L;
                int i, j;
                --l_116;
                l_130++;
            }
            g_11[0] = ((l_127[1][0] = ((1L ^ (safe_mod_func_int16_t_s_s(((g_94[1] , (safe_add_func_int16_t_s_s(((l_83 != &l_116) < ((((+((*l_148) ^= (g_94[1] = ((safe_mul_func_int32_t_s_s(((((safe_mul_func_int32_t_s_s((g_11[1] , (g_33[8][0][8] > (((((safe_mod_func_uint8_t_u_u(0xB6L, ((g_31 <= (((l_115 >= 1UL) < g_94[2]) < p_16)) , p_17))) , 0xB692CA01L) , &l_110[8]) == l_144) | g_94[2]))), g_31)) , (void*)0) != (void*)0) , p_17), l_145)) | 0x7FL)))) != 1L) != l_123) && p_17)), p_18))) || p_16), g_12))) || (-1L))) == 4294967292UL);
        }
        else
        { 
            int32_t **l_150 = (void*)0;
            l_150 = (*l_144);
        }
        return g_33[6][0][7];
    }
    if (((g_66[3][3] && 0x44L) | (((*l_172) = (&g_11[0] == (g_170 = (g_169 = ((!(safe_lshift_func_int8_t_s_u(((safe_mul_func_uint8_t_u_u((g_12 , (((l_83 == (l_156 = l_83)) || g_94[1]) == (((*l_167) = (safe_div_func_uint16_t_u_u((0x63AD2DFDL > (safe_mul_func_int8_t_s_s(((*l_164) ^= (safe_add_func_uint64_t_u_u(g_33[2][0][2], 0UL))), l_166))), g_33[8][0][8]))) <= g_11[1]))), p_17)) >= (-1L)), 6))) , &g_11[1]))))) , 0L)))
    { 
        uint16_t l_173 = 1UL;
        uint32_t *l_186[9];
        int64_t *l_188[5] = {&g_66[3][3],&g_66[3][3],&g_66[3][3],&g_66[3][3],&g_66[3][3]};
        int32_t l_193 = 1L;
        int32_t ***l_257 = &g_256;
        uint64_t *l_276[9] = {&g_33[7][0][8],&g_33[7][0][8],&g_33[7][0][8],&g_33[7][0][8],&g_33[7][0][8],&g_33[7][0][8],&g_33[7][0][8],&g_33[7][0][8],&g_33[7][0][8]};
        int32_t l_283 = (-9L);
        int32_t l_287 = 0L;
        int32_t l_292 = 0x1C44CF0EL;
        int32_t l_293 = 0x11BC2BF2L;
        int32_t l_295 = 0xE1623BE8L;
        int32_t l_296[1][9] = {{0xD646E06EL,0xD646E06EL,0x34B75A98L,0xD646E06EL,0xD646E06EL,0x34B75A98L,0xD646E06EL,0xD646E06EL,0x34B75A98L}};
        uint16_t l_299 = 0x0AFDL;
        uint16_t l_305 = 0xFAD6L;
        int i, j;
        for (i = 0; i < 9; i++)
            l_186[i] = &g_149;
lbl_267:
        ++l_173;
        for (l_55 = 0; (l_55 <= 5); l_55 += 1)
        { 
            uint8_t *l_184 = &g_185;
            int64_t * const l_187 = &g_66[3][3];
            int64_t **l_191 = &l_172;
            const uint8_t l_192 = 0x7EL;
            int32_t l_236 = 1L;
            int i;
            if ((safe_div_func_uint8_t_u_u((safe_mod_func_int32_t_s_s((*g_170), ((safe_mod_func_uint8_t_u_u((((*l_184) = (l_164 != &p_16)) || (((((((l_186[6] = l_111) != &g_94[2]) , l_187) == l_188[3]) == (safe_rshift_func_uint32_t_u_u(g_33[2][0][5], (((*l_191) = &g_157[3]) != &g_66[3][3])))) > 0xB3L) != l_173)), 3L)) , p_17))), l_192)))
            { 
                int32_t l_194 = 0xBE4B794FL;
                int32_t l_195[8] = {0xFA8EE88EL,0xFA8EE88EL,0x2CC03310L,0xFA8EE88EL,0xFA8EE88EL,0x2CC03310L,0xFA8EE88EL,0xFA8EE88EL};
                int i;
                ++l_196;
                g_170 = &g_11[1];
                return g_33[6][0][6];
            }
            else
            { 
                --l_199;
            }
            for (g_165 = 0; (g_165 <= 8); g_165 += 1)
            { 
                int i, j;
                (*g_170) ^= l_43[l_55][l_55];
                return g_157[(l_55 + 1)];
            }
            for (g_12 = 1; (g_12 <= 5); g_12 += 1)
            { 
                uint64_t l_239 = 0xCCD539717E3722A4LL;
                int i, j;
                (*g_169) = (safe_mod_func_int8_t_s_s((safe_mul_func_int8_t_s_s((safe_div_func_int32_t_s_s((safe_sub_func_uint32_t_u_u((safe_mod_func_uint16_t_u_u((safe_rshift_func_uint16_t_u_u(((l_193 = (((safe_mod_func_uint64_t_u_u(p_16, (safe_sub_func_uint8_t_u_u(((*l_184)++), ((((safe_unary_minus_func_uint32_t_u((((safe_mul_func_int16_t_s_s((0L ^ l_173), ((((safe_sub_func_uint16_t_u_u((safe_add_func_int64_t_s_s(p_17, (((safe_sub_func_uint16_t_u_u(p_18, (l_43[(g_12 + 1)][g_12] |= (((safe_add_func_int16_t_s_s(((g_33[0][0][2]++) || (!l_173)), ((l_236 = 0x9C1AF257L) >= (*g_169)))) < (safe_lshift_func_int32_t_s_u((*g_169), 5))) || g_33[8][0][8])))) < l_193) ^ g_11[1]))), g_168)) , g_149) , g_66[3][3]) , 0x3A3CL))) & l_239) , p_17))) < l_239) > l_193) >= 18446744073709551607UL))))) , (-1L)) != g_12)) ^ 0x81AF9209L), 2)), g_165)), (*g_169))), g_157[2])), g_165)), g_94[2]));
                (*g_170) = p_18;
            }
            for (l_173 = 1; (l_173 <= 5); l_173 += 1)
            { 
                l_193 = (-1L);
                return g_33[8][0][8];
            }
        }
        for (g_165 = 0; (g_165 >= (-25)); g_165--)
        { 
            uint8_t *l_251[10][10][2] = {{{&g_185,(void*)0},{&g_185,&g_185},{(void*)0,&g_185},{&g_185,(void*)0},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,(void*)0},{&g_185,&g_185}},{{(void*)0,&g_185},{&g_185,(void*)0},{&g_185,&g_185},{(void*)0,&g_185},{&g_185,(void*)0},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185}},{{&g_185,&g_185},{&g_185,&g_185},{&g_185,(void*)0},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,(void*)0},{&g_185,&g_185}},{{&g_185,&g_185},{(void*)0,&g_185},{&g_185,(void*)0},{(void*)0,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{(void*)0,&g_185}},{{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{(void*)0,(void*)0},{&g_185,&g_185},{(void*)0,&g_185},{&g_185,&g_185},{&g_185,(void*)0}},{{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{(void*)0,&g_185},{&g_185,(void*)0},{&g_185,(void*)0},{&g_185,(void*)0},{&g_185,&g_185},{(void*)0,&g_185},{&g_185,&g_185}},{{&g_185,&g_185},{&g_185,(void*)0},{&g_185,&g_185},{&g_185,&g_185},{(void*)0,&g_185},{&g_185,(void*)0},{(void*)0,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185}},{{&g_185,&g_185},{&g_185,&g_185},{(void*)0,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{(void*)0,(void*)0},{&g_185,&g_185}},{{(void*)0,&g_185},{&g_185,&g_185},{&g_185,(void*)0},{&g_185,&g_185},{&g_185,&g_185},{&g_185,&g_185},{(void*)0,&g_185},{&g_185,(void*)0},{&g_185,(void*)0},{&g_185,(void*)0}},{{&g_185,&g_185},{(void*)0,&g_185},{&g_185,&g_185},{&g_185,&g_185},{&g_185,(void*)0},{&g_185,&g_185},{&g_185,&g_185},{(void*)0,&g_185},{&g_185,(void*)0},{(void*)0,&g_185}}};
            int32_t l_252[2];
            int32_t l_266 = (-9L);
            int64_t *l_274 = &g_157[7];
            int32_t l_289[7] = {0xA2D0A057L,0xA2D0A057L,0xA2D0A057L,0xA2D0A057L,0xA2D0A057L,0xA2D0A057L,0xA2D0A057L};
            int i, j, k;
            for (i = 0; i < 2; i++)
                l_252[i] = 0L;
            for (p_16 = (-8); (p_16 > (-2)); p_16++)
            { 
                if (g_168)
                    goto lbl_244;
            }
            if (((safe_sub_func_int16_t_s_s((((safe_add_func_int16_t_s_s((safe_lshift_func_uint8_t_u_s((l_252[1] ^= (g_149 , p_16)), (((p_16 > (((0xA6BC4429L & (g_255 != l_257)) ^ (((safe_mul_func_int64_t_s_s((g_33[8][0][8] || ((safe_add_func_uint64_t_u_u((safe_mul_func_uint64_t_u_u(((safe_add_func_int8_t_s_s(g_12, l_266)) , 0x221D217DB600C3A3LL), 0xF75A03B73B3FD032LL)), g_33[8][0][8])) | g_157[0])), 0x36BB0D7DC54451A0LL)) != 0xE35EL) <= g_149)) < 4294967293UL)) | p_16) | l_266))), g_33[3][0][6])) > 1UL) , g_33[1][0][6]), g_66[1][1])) | p_16))
            { 
                if ((***g_255))
                    break;
            }
            else
            { 
                uint16_t l_270[10] = {0x99BCL,0x1F3FL,0x2820L,0x2820L,0x1F3FL,0x99BCL,0x1F3FL,0x2820L,0x2820L,0x1F3FL};
                int64_t **l_275 = &l_188[4];
                int32_t l_284 = (-1L);
                int32_t l_285 = 1L;
                int32_t l_286 = 0x8B011B8DL;
                int32_t l_290 = 1L;
                int32_t l_294 = 0x4EF4180CL;
                int32_t l_297 = (-1L);
                int32_t l_298[9] = {9L,9L,9L,9L,9L,9L,9L,9L,9L};
                int i;
                if (l_55)
                    goto lbl_267;
                (***g_255) = (g_31 == g_66[3][3]);
                (***l_257) ^= ((safe_add_func_int32_t_s_s(l_270[0], (((safe_sub_func_int32_t_s_s((0x1737AA7C1C7358A4LL && g_157[3]), (((safe_unary_minus_func_int16_t_s(((((*l_275) = l_274) != (void*)0) != ((void*)0 != l_276[5])))) <= (safe_rshift_func_int32_t_s_s((safe_div_func_uint64_t_u_u((safe_add_func_uint16_t_u_u(g_33[8][0][8], g_94[2])), l_270[0])), l_252[1]))) & g_168))) , 4294967295UL) , p_16))) , p_16);
                --l_299;
            }
            l_302++;
            g_306 &= (l_305 = (***l_257));
        }
    }
    else
    { 
        uint8_t l_307[9][7] = {{0x0DL,0x0DL,1UL,0xE6L,1UL,1UL,1UL},{0xE6L,255UL,255UL,0xE6L,0UL,246UL,0xE6L},{246UL,1UL,0UL,0UL,0UL,0x22L,1UL},{0UL,255UL,0x0DL,246UL,246UL,0x0DL,255UL},{0UL,1UL,0x22L,0UL,9UL,9UL,0UL},{0x22L,255UL,0x22L,9UL,255UL,1UL,1UL},{255UL,0UL,0x0DL,0UL,255UL,0x0DL,246UL},{246UL,1UL,9UL,246UL,9UL,1UL,246UL},{0x22L,246UL,1UL,9UL,246UL,9UL,1UL}};
        int i, j;
        --l_307[0][5];
    }
    return p_16;
}





int main (int argc, char* argv[])
{
    int i, j, k;
    int print_hash_value = 0;
    if (argc == 2 && strcmp(argv[1], "1") == 0) print_hash_value = 1;
    platform_main_begin();
    crc32_gentab();
    func_1();
    for (i = 0; i < 2; i++)
    {
        transparent_crc(g_11[i], "g_11[i]", print_hash_value);
        if (print_hash_value) printf("index = [%d]\n", i);

    }
    transparent_crc(g_12, "g_12", print_hash_value);
    transparent_crc(g_31, "g_31", print_hash_value);
    for (i = 0; i < 9; i++)
    {
        for (j = 0; j < 1; j++)
        {
            for (k = 0; k < 9; k++)
            {
                transparent_crc(g_33[i][j][k], "g_33[i][j][k]", print_hash_value);
                if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);

            }
        }
    }
    for (i = 0; i < 5; i++)
    {
        for (j = 0; j < 4; j++)
        {
            transparent_crc(g_66[i][j], "g_66[i][j]", print_hash_value);
            if (print_hash_value) printf("index = [%d][%d]\n", i, j);

        }
    }
    for (i = 0; i < 3; i++)
    {
        transparent_crc(g_94[i], "g_94[i]", print_hash_value);
        if (print_hash_value) printf("index = [%d]\n", i);

    }
    transparent_crc(g_149, "g_149", print_hash_value);
    for (i = 0; i < 9; i++)
    {
        transparent_crc(g_157[i], "g_157[i]", print_hash_value);
        if (print_hash_value) printf("index = [%d]\n", i);

    }
    transparent_crc(g_165, "g_165", print_hash_value);
    transparent_crc(g_168, "g_168", print_hash_value);
    transparent_crc(g_185, "g_185", print_hash_value);
    transparent_crc(g_306, "g_306", print_hash_value);
    transparent_crc(g_311, "g_311", print_hash_value);
    transparent_crc(g_313, "g_313", print_hash_value);
    transparent_crc(g_341, "g_341", print_hash_value);
    for (i = 0; i < 6; i++)
    {
        transparent_crc(g_346[i], "g_346[i]", print_hash_value);
        if (print_hash_value) printf("index = [%d]\n", i);

    }
    for (i = 0; i < 6; i++)
    {
        for (j = 0; j < 2; j++)
        {
            transparent_crc(g_366[i][j], "g_366[i][j]", print_hash_value);
            if (print_hash_value) printf("index = [%d][%d]\n", i, j);

        }
    }
    transparent_crc(g_380, "g_380", print_hash_value);
    transparent_crc(g_407, "g_407", print_hash_value);
    transparent_crc(g_409, "g_409", print_hash_value);
    transparent_crc(g_412, "g_412", print_hash_value);
    transparent_crc(g_414, "g_414", print_hash_value);
    for (i = 0; i < 5; i++)
    {
        for (j = 0; j < 10; j++)
        {
            transparent_crc(g_416[i][j], "g_416[i][j]", print_hash_value);
            if (print_hash_value) printf("index = [%d][%d]\n", i, j);

        }
    }
    transparent_crc(g_426, "g_426", print_hash_value);
    transparent_crc(g_457, "g_457", print_hash_value);
    platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
    return 0;
}

/************************ statistics *************************
XXX max struct depth: 0
breakdown:
   depth: 0, occurrence: 138
XXX total union variables: 0

XXX max expression depth: 48
breakdown:
   depth: 1, occurrence: 114
   depth: 2, occurrence: 28
   depth: 3, occurrence: 1
   depth: 4, occurrence: 1
   depth: 5, occurrence: 1
   depth: 6, occurrence: 2
   depth: 16, occurrence: 1
   depth: 17, occurrence: 2
   depth: 18, occurrence: 2
   depth: 19, occurrence: 1
   depth: 24, occurrence: 1
   depth: 25, occurrence: 1
   depth: 28, occurrence: 1
   depth: 29, occurrence: 1
   depth: 30, occurrence: 1
   depth: 31, occurrence: 1
   depth: 32, occurrence: 1
   depth: 34, occurrence: 3
   depth: 38, occurrence: 1
   depth: 43, occurrence: 1
   depth: 48, occurrence: 1

XXX total number of pointers: 101

XXX times a variable address is taken: 515
XXX times a pointer is dereferenced on RHS: 36
breakdown:
   depth: 1, occurrence: 32
   depth: 2, occurrence: 2
   depth: 3, occurrence: 2
XXX times a pointer is dereferenced on LHS: 69
breakdown:
   depth: 1, occurrence: 59
   depth: 2, occurrence: 7
   depth: 3, occurrence: 3
XXX times a pointer is compared with null: 5
XXX times a pointer is compared with address of another variable: 5
XXX times a pointer is compared with another pointer: 3
XXX times a pointer is qualified to be dereferenced: 1932

XXX max dereference level: 3
breakdown:
   level: 0, occurrence: 0
   level: 1, occurrence: 190
   level: 2, occurrence: 35
   level: 3, occurrence: 30
XXX number of pointers point to pointers: 36
XXX number of pointers point to scalars: 65
XXX number of pointers point to structs: 0
XXX percent of pointers has null in alias set: 38.6
XXX average alias set size: 1.44

XXX times a non-volatile is read: 427
XXX times a non-volatile is write: 241
XXX times a volatile is read: 0
XXX    times read thru a pointer: 0
XXX times a volatile is write: 0
XXX    times written thru a pointer: 0
XXX times a volatile is available for access: 0
XXX percentage of non-volatile access: 100

XXX forward jumps: 0
XXX backward jumps: 2

XXX stmts: 111
XXX max block depth: 3
breakdown:
   depth: 0, occurrence: 13
   depth: 1, occurrence: 17
   depth: 2, occurrence: 28
   depth: 3, occurrence: 53

XXX percentage a fresh-made variable is used: 16.5
XXX percentage an existing variable is used: 83.5
XXX total OOB instances added: 0
********************* end of statistics **********************/

```

Fix patch:
commit abe4677d9f8ab82f722f29dbf57952052accd70b
Author: Yingwei Zheng <dtcxzyw2333@gmail.com>
Date:   Tue Mar 5 03:51:06 2024 +0800

    [InstCombine] Fix infinite loop due to incorrect `DoesConsume` (#82973)
    
    When a call to `getFreelyInvertedImpl` with a select/phi node fails,
    `DoesConsume` should not be changed.
    
    Fixes https://github.com/llvm/llvm-project/issues/82877.

diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 87c8dca7efed..80ce0c9275b2 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2341,11 +2341,13 @@ Value *InstCombiner::getFreelyInvertedImpl(Value *V, bool WillInvertAllUses,
                   !shouldAvoidAbsorbingNotIntoSelect(*cast<SelectInst>(V));
   // Selects/min/max with invertible operands are freely invertible
   if (IsSelect || match(V, m_MaxOrMin(m_Value(A), m_Value(B)))) {
+    bool LocalDoesConsume = DoesConsume;
     if (!getFreelyInvertedImpl(B, B->hasOneUse(), /*Builder*/ nullptr,
-                               DoesConsume, Depth))
+                               LocalDoesConsume, Depth))
       return nullptr;
     if (Value *NotA = getFreelyInvertedImpl(A, A->hasOneUse(), Builder,
-                                            DoesConsume, Depth)) {
+                                            LocalDoesConsume, Depth)) {
+      DoesConsume = LocalDoesConsume;
       if (Builder != nullptr) {
         Value *NotB = getFreelyInvertedImpl(B, B->hasOneUse(), Builder,
                                             DoesConsume, Depth);
@@ -2361,12 +2363,13 @@ Value *InstCombiner::getFreelyInvertedImpl(Value *V, bool WillInvertAllUses,
   }
 
   if (PHINode *PN = dyn_cast<PHINode>(V)) {
+    bool LocalDoesConsume = DoesConsume;
     SmallVector<std::pair<Value *, BasicBlock *>, 8> IncomingValues;
     for (Use &U : PN->operands()) {
       BasicBlock *IncomingBlock = PN->getIncomingBlock(U);
       Value *NewIncomingVal = getFreelyInvertedImpl(
           U.get(), /*WillInvertAllUses=*/false,
-          /*Builder=*/nullptr, DoesConsume, MaxAnalysisRecursionDepth - 1);
+          /*Builder=*/nullptr, LocalDoesConsume, MaxAnalysisRecursionDepth - 1);
       if (NewIncomingVal == nullptr)
         return nullptr;
       // Make sure that we can safely erase the original PHI node.
@@ -2375,6 +2378,8 @@ Value *InstCombiner::getFreelyInvertedImpl(Value *V, bool WillInvertAllUses,
       if (Builder != nullptr)
         IncomingValues.emplace_back(NewIncomingVal, IncomingBlock);
     }
+
+    DoesConsume = LocalDoesConsume;
     if (Builder != nullptr) {
       IRBuilderBase::InsertPointGuard Guard(*Builder);
       Builder->SetInsertPoint(PN);


Regression tests:
file: llvm/test/Transforms/InstCombine/pr82877.ll
commands: opt -S -passes=instcombine < %s
tests: test_name: func
test_body: define i64 @func(i32 %p, i1 %cmp1) {
entry:
  %not = xor i32 %p, -1
  br label %for.body

for.body:                                         ; preds = %for.body, %entry
  %p0 = phi i32 [ %not, %entry ], [ %conv, %for.body ]
  %cond = select i1 %cmp1, i32 0, i32 -1231558963
  %xor = xor i32 %cond, %p0
  %cmp2 = icmp ne i32 %xor, 1
  %conv = zext i1 %cmp2 to i32
  br i1 %cmp2, label %for.body, label %for.exit

for.exit:                                         ; preds = %for.body
  ret i64 0
}