; LLVM IR from paintdream/DontStarveLuaJIT :: src/luajit/src (lj_opt_fold)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.IRType1 = type { i8 }
%struct.jit_State = type { %struct.GCtrace, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i8, i8, %struct.IRType1, i8, %struct.FoldState, ptr, i32, i32, i32, i32, i32, i32, i32, %struct.MRef, [5 x %union.TValue], ptr, i32, i32, i32, i32, ptr, ptr, i32, i32, i8, ptr, i32, i32, ptr, [100 x i16], [255 x i32], [15 x i32], [16 x ptr], [64 x %struct.HotPenalty], i32, i32, [16 x %struct.BPropEntry], i32, %struct.ScEvEntry, ptr, i32, i32, ptr, i32, i32, ptr, ptr, ptr, i64, i64, %union.TValue, ptr, i32, i32 }
%struct.GCtrace = type { %struct.GCRef, i8, i8, i8, i8, i32, %struct.GCRef, ptr, i32, i16, i16, ptr, ptr, %struct.GCRef, %struct.MRef, i32, i32, ptr, i32, i16, i16, i16, i16, i16, i16, i16, i8, i8 }
%struct.GCRef = type { i32 }
%struct.FoldState = type { %union.IRIns, %union.IRIns, %union.IRIns }
%union.IRIns = type { %struct.anon.0 }
%struct.anon.0 = type { i32, %struct.IRType1, i8, i8, i8 }
%struct.MRef = type { i32 }
%struct.HotPenalty = type { %struct.MRef, i16, i16 }
%struct.BPropEntry = type { i16, i16, i32 }
%struct.ScEvEntry = type { %struct.MRef, i16, i16, i16, i16, %struct.IRType1, i8 }
%union.TValue = type { i64 }
%struct.anon = type { i16, i16, i16, i16 }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #1

; Function Attrs: nounwind uwtable
define hidden i32 @lj_opt_cse(ptr noundef %0) #2 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca %struct.IRType1, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.jit_State, ptr %12, i32 0, i32 13
  %14 = getelementptr inbounds %struct.FoldState, ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds %struct.anon, ptr %14, i32 0, i32 0
  %16 = load i16, ptr %15, align 8, !tbaa !9
  %17 = zext i16 %16 to i32
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.jit_State, ptr %18, i32 0, i32 13
  %20 = getelementptr inbounds %struct.FoldState, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds %struct.anon, ptr %20, i32 0, i32 1
  %22 = load i16, ptr %21, align 2, !tbaa !9
  %23 = zext i16 %22 to i32
  %24 = shl i32 %23, 16
  %25 = add i32 %17, %24
  store i32 %25, ptr %4, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.jit_State, ptr %26, i32 0, i32 13
  %28 = getelementptr inbounds %struct.FoldState, ptr %27, i32 0, i32 0
  %29 = getelementptr inbounds %struct.anon.0, ptr %28, i32 0, i32 2
  %30 = load i8, ptr %29, align 1, !tbaa !9
  %31 = zext i8 %30 to i32
  store i32 %31, ptr %5, align 4, !tbaa !10
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.jit_State, ptr %32, i32 0, i32 6
  %34 = load i32, ptr %33, align 8, !tbaa !12
  %35 = and i32 %34, 131072
  %36 = icmp ne i32 %35, 0
  %37 = xor i1 %36, true
  %38 = xor i1 %37, true
  %39 = zext i1 %38 to i32
  %40 = sext i32 %39 to i64
  %41 = call i64 @llvm.expect.i64(i64 %40, i64 1)
  %42 = icmp ne i64 %41, 0
  br i1 %42, label %43, label %119

43:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.jit_State, ptr %44, i32 0, i32 38
  %46 = load i32, ptr %5, align 4, !tbaa !10
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds [100 x i16], ptr %45, i64 0, i64 %47
  %49 = load i16, ptr %48, align 2, !tbaa !22
  %50 = zext i16 %49 to i32
  store i32 %50, ptr %6, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.jit_State, ptr %51, i32 0, i32 13
  %53 = getelementptr inbounds %struct.FoldState, ptr %52, i32 0, i32 0
  %54 = getelementptr inbounds %struct.anon, ptr %53, i32 0, i32 0
  %55 = load i16, ptr %54, align 8, !tbaa !9
  %56 = zext i16 %55 to i32
  store i32 %56, ptr %7, align 4, !tbaa !10
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.jit_State, ptr %57, i32 0, i32 13
  %59 = getelementptr inbounds %struct.FoldState, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %struct.anon, ptr %59, i32 0, i32 1
  %61 = load i16, ptr %60, align 2, !tbaa !9
  %62 = zext i16 %61 to i32
  %63 = load i32, ptr %7, align 4, !tbaa !10
  %64 = icmp ugt i32 %62, %63
  br i1 %64, label %65, label %72

65:                                               ; preds = %43
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.jit_State, ptr %66, i32 0, i32 13
  %68 = getelementptr inbounds %struct.FoldState, ptr %67, i32 0, i32 0
  %69 = getelementptr inbounds %struct.anon, ptr %68, i32 0, i32 1
  %70 = load i16, ptr %69, align 2, !tbaa !9
  %71 = zext i16 %70 to i32
  store i32 %71, ptr %7, align 4, !tbaa !10
  br label %72

72:                                               ; preds = %65, %43
  br label %73

73:                                               ; preds = %104, %72
  %74 = load i32, ptr %6, align 4, !tbaa !10
  %75 = load i32, ptr %7, align 4, !tbaa !10
  %76 = icmp ugt i32 %74, %75
  br i1 %76, label %77, label %115

77:                                               ; preds = %73
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.jit_State, ptr %78, i32 0, i32 0
  %80 = getelementptr inbounds %struct.GCtrace, ptr %79, i32 0, i32 7
  %81 = load ptr, ptr %80, align 8, !tbaa !23
  %82 = load i32, ptr %6, align 4, !tbaa !10
  %83 = zext i32 %82 to i64
  %84 = getelementptr inbounds %union.IRIns, ptr %81, i64 %83
  %85 = getelementptr inbounds %struct.anon.0, ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = load i32, ptr %4, align 4, !tbaa !10
  %88 = icmp eq i32 %86, %87
  br i1 %88, label %89, label %104

89:                                               ; preds = %77
  %90 = load i32, ptr %6, align 4, !tbaa !10
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.jit_State, ptr %91, i32 0, i32 0
  %93 = getelementptr inbounds %struct.GCtrace, ptr %92, i32 0, i32 7
  %94 = load ptr, ptr %93, align 8, !tbaa !23
  %95 = load i32, ptr %6, align 4, !tbaa !10
  %96 = zext i32 %95 to i64
  %97 = getelementptr inbounds %union.IRIns, ptr %94, i64 %96
  %98 = getelementptr inbounds %struct.anon.0, ptr %97, i32 0, i32 1
  %99 = getelementptr inbounds %struct.IRType1, ptr %98, i32 0, i32 0
  %100 = load i8, ptr %99, align 4, !tbaa !9
  %101 = zext i8 %100 to i32
  %102 = shl i32 %101, 24
  %103 = add i32 %90, %102
  store i32 %103, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %116

104:                                              ; preds = %77
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.jit_State, ptr %105, i32 0, i32 0
  %107 = getelementptr inbounds %struct.GCtrace, ptr %106, i32 0, i32 7
  %108 = load ptr, ptr %107, align 8, !tbaa !23
  %109 = load i32, ptr %6, align 4, !tbaa !10
  %110 = zext i32 %109 to i64
  %111 = getelementptr inbounds %union.IRIns, ptr %108, i64 %110
  %112 = getelementptr inbounds %struct.anon, ptr %111, i32 0, i32 3
  %113 = load i16, ptr %112, align 2, !tbaa !9
  %114 = zext i16 %113 to i32
  store i32 %114, ptr %6, align 4, !tbaa !10
  br label %73, !llvm.loop !24

115:                                              ; preds = %73
  store i32 0, ptr %8, align 4
  br label %116

116:                                              ; preds = %115, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %117 = load i32, ptr %8, align 4
  switch i32 %117, label %180 [
    i32 0, label %118
  ]

118:                                              ; preds = %116
  br label %119

119:                                              ; preds = %118, %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %120 = load ptr, ptr %3, align 8, !tbaa !5
  %121 = call i32 @lj_ir_nextins(ptr noundef %120)
  store i32 %121, ptr %9, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.jit_State, ptr %122, i32 0, i32 0
  %124 = getelementptr inbounds %struct.GCtrace, ptr %123, i32 0, i32 7
  %125 = load ptr, ptr %124, align 8, !tbaa !23
  %126 = load i32, ptr %9, align 4, !tbaa !10
  %127 = zext i32 %126 to i64
  %128 = getelementptr inbounds %union.IRIns, ptr %125, i64 %127
  store ptr %128, ptr %10, align 8, !tbaa !5
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.jit_State, ptr %129, i32 0, i32 38
  %131 = load i32, ptr %5, align 4, !tbaa !10
  %132 = zext i32 %131 to i64
  %133 = getelementptr inbounds [100 x i16], ptr %130, i64 0, i64 %132
  %134 = load i16, ptr %133, align 2, !tbaa !22
  %135 = load ptr, ptr %10, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.anon, ptr %135, i32 0, i32 3
  store i16 %134, ptr %136, align 2, !tbaa !9
  %137 = load i32, ptr %4, align 4, !tbaa !10
  %138 = load ptr, ptr %10, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.anon.0, ptr %138, i32 0, i32 0
  store i32 %137, ptr %139, align 4, !tbaa !9
  %140 = load i32, ptr %9, align 4, !tbaa !10
  %141 = trunc i32 %140 to i16
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.jit_State, ptr %142, i32 0, i32 38
  %144 = load i32, ptr %5, align 4, !tbaa !10
  %145 = zext i32 %144 to i64
  %146 = getelementptr inbounds [100 x i16], ptr %143, i64 0, i64 %145
  store i16 %141, ptr %146, align 2, !tbaa !22
  %147 = load ptr, ptr %3, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.jit_State, ptr %147, i32 0, i32 13
  %149 = getelementptr inbounds %struct.FoldState, ptr %148, i32 0, i32 0
  %150 = getelementptr inbounds %struct.anon.0, ptr %149, i32 0, i32 2
  %151 = load i8, ptr %150, align 1, !tbaa !9
  %152 = load ptr, ptr %10, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.anon.0, ptr %152, i32 0, i32 2
  store i8 %151, ptr %153, align 1, !tbaa !9
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.jit_State, ptr %154, i32 0, i32 13
  %156 = getelementptr inbounds %struct.FoldState, ptr %155, i32 0, i32 0
  %157 = getelementptr inbounds %struct.anon.0, ptr %156, i32 0, i32 1
  %158 = getelementptr inbounds %struct.IRType1, ptr %157, i32 0, i32 0
  %159 = load i8, ptr %158, align 4, !tbaa !9
  %160 = zext i8 %159 to i32
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.jit_State, ptr %161, i32 0, i32 11
  %163 = getelementptr inbounds %struct.IRType1, ptr %162, i32 0, i32 0
  %164 = load i8, ptr %163, align 2, !tbaa !26
  %165 = zext i8 %164 to i32
  %166 = or i32 %165, %160
  %167 = trunc i32 %166 to i8
  store i8 %167, ptr %163, align 2, !tbaa !26
  %168 = load i32, ptr %9, align 4, !tbaa !10
  %169 = load ptr, ptr %10, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.anon.0, ptr %169, i32 0, i32 1
  %171 = load ptr, ptr %3, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.jit_State, ptr %171, i32 0, i32 13
  %173 = getelementptr inbounds %struct.FoldState, ptr %172, i32 0, i32 0
  %174 = getelementptr inbounds %struct.anon.0, ptr %173, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %170, ptr align 4 %174, i64 1, i1 false), !tbaa.struct !27
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %11, ptr align 4 %170, i64 1, i1 false), !tbaa.struct !27
  %175 = getelementptr inbounds %struct.IRType1, ptr %11, i32 0, i32 0
  %176 = load i8, ptr %175, align 1, !tbaa !28
  %177 = zext i8 %176 to i32
  %178 = shl i32 %177, 24
  %179 = add i32 %168, %178
  store i32 %179, ptr %2, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %180

180:                                              ; preds = %119, %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %181 = load i32, ptr %2, align 4
  ret i32 %181
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @lj_ir_nextins(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { alwaysinline nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 136}
!13 = !{!"jit_State", !14, i64 0, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !11, i64 136, !11, i64 140, !11, i64 144, !7, i64 148, !7, i64 149, !18, i64 150, !7, i64 151, !19, i64 152, !6, i64 176, !11, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204, !11, i64 208, !17, i64 212, !7, i64 216, !6, i64 256, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !6, i64 280, !6, i64 288, !11, i64 296, !11, i64 300, !7, i64 304, !6, i64 312, !11, i64 320, !11, i64 324, !6, i64 328, !7, i64 336, !7, i64 536, !7, i64 1556, !7, i64 1616, !7, i64 1744, !11, i64 2256, !11, i64 2260, !7, i64 2264, !11, i64 2392, !20, i64 2396, !6, i64 2416, !11, i64 2424, !11, i64 2428, !6, i64 2432, !11, i64 2440, !11, i64 2444, !6, i64 2448, !6, i64 2456, !6, i64 2464, !21, i64 2472, !21, i64 2480, !7, i64 2488, !6, i64 2496, !11, i64 2504, !11, i64 2508}
!14 = !{!"GCtrace", !15, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !11, i64 8, !15, i64 12, !6, i64 16, !11, i64 24, !16, i64 28, !16, i64 30, !6, i64 32, !6, i64 40, !15, i64 48, !17, i64 52, !11, i64 56, !11, i64 60, !6, i64 64, !11, i64 72, !16, i64 76, !16, i64 78, !16, i64 80, !16, i64 82, !16, i64 84, !16, i64 86, !16, i64 88, !7, i64 90, !7, i64 91}
!15 = !{!"GCRef", !11, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!"MRef", !11, i64 0}
!18 = !{!"IRType1", !7, i64 0}
!19 = !{!"FoldState", !7, i64 0, !7, i64 8, !7, i64 16}
!20 = !{!"ScEvEntry", !17, i64 0, !16, i64 4, !16, i64 6, !16, i64 8, !16, i64 10, !18, i64 12, !7, i64 13}
!21 = !{!"long", !7, i64 0}
!22 = !{!16, !16, i64 0}
!23 = !{!13, !6, i64 16}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!13, !7, i64 150}
!27 = !{i64 0, i64 1, !9}
!28 = !{!18, !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%union.IRIns = type { %struct.anon.0 }
%struct.anon.0 = type { i32, %struct.IRType1, i8, i8, i8 }
%struct.IRType1 = type { i8 }

; Function Attrs: nounwind uwtable
define hidden i32 @lj_opt_cse(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 152
  %3 = load i16, ptr %2, align 8, !tbaa !5
  %4 = zext i16 %3 to i32
  %5 = getelementptr inbounds i8, ptr %0, i64 154
  %6 = load i16, ptr %5, align 2, !tbaa !5
  %7 = zext i16 %6 to i32
  %8 = shl nuw i32 %7, 16
  %9 = or disjoint i32 %8, %4
  %10 = getelementptr inbounds i8, ptr %0, i64 157
  %11 = load i8, ptr %10, align 1, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 136
  %13 = load i32, ptr %12, align 8, !tbaa !8
  %14 = and i32 %13, 131072
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %..loopexit_crit_edge, label %15, !prof !20

..loopexit_crit_edge:                             ; preds = %1
  %.pre = zext i8 %11 to i64
  br label %.loopexit

15:                                               ; preds = %1
  %16 = getelementptr inbounds i8, ptr %0, i64 336
  %17 = zext i8 %11 to i64
  %18 = getelementptr inbounds [100 x i16], ptr %16, i64 0, i64 %17
  %spec.select46 = tail call i16 @llvm.umax.i16(i16 %6, i16 %3)
  %.039.in48 = load i16, ptr %18, align 2, !tbaa !5
  %.not4449 = icmp ult i16 %spec.select46, %.039.in48
  br i1 %.not4449, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %15
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  %20 = load ptr, ptr %19, align 8, !tbaa !21
  br label %21

21:                                               ; preds = %.lr.ph, %31
  %.039.in50 = phi i16 [ %.039.in48, %.lr.ph ], [ %.039.in, %31 ]
  %22 = zext i16 %.039.in50 to i64
  %23 = getelementptr inbounds %union.IRIns, ptr %20, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = icmp eq i32 %24, %9
  br i1 %25, label %.thread, label %31

.thread:                                          ; preds = %21
  %.039.le = zext i16 %.039.in50 to i32
  %26 = getelementptr inbounds i8, ptr %23, i64 4
  %27 = load i8, ptr %26, align 4, !tbaa !5
  %28 = zext i8 %27 to i32
  %29 = shl nuw i32 %28, 24
  %30 = or disjoint i32 %29, %.039.le
  br label %54

31:                                               ; preds = %21
  %32 = getelementptr inbounds i8, ptr %23, i64 6
  %.039.in = load i16, ptr %32, align 2, !tbaa !5
  %.not44 = icmp ult i16 %spec.select46, %.039.in
  br i1 %.not44, label %21, label %.loopexit, !llvm.loop !22

.loopexit:                                        ; preds = %31, %..loopexit_crit_edge, %15
  %.pre-phi = phi i64 [ %.pre, %..loopexit_crit_edge ], [ %17, %15 ], [ %17, %31 ]
  %33 = tail call i32 @lj_ir_nextins(ptr noundef nonnull %0)
  %34 = getelementptr inbounds i8, ptr %0, i64 16
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  %36 = zext i32 %33 to i64
  %37 = getelementptr inbounds %union.IRIns, ptr %35, i64 %36
  %38 = getelementptr inbounds i8, ptr %0, i64 336
  %39 = getelementptr inbounds [100 x i16], ptr %38, i64 0, i64 %.pre-phi
  %40 = load i16, ptr %39, align 2, !tbaa !24
  %41 = getelementptr inbounds i8, ptr %37, i64 6
  store i16 %40, ptr %41, align 2, !tbaa !5
  store i32 %9, ptr %37, align 4, !tbaa !5
  %42 = trunc i32 %33 to i16
  store i16 %42, ptr %39, align 2, !tbaa !24
  %43 = load i8, ptr %10, align 1, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %37, i64 5
  store i8 %43, ptr %44, align 1, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %0, i64 156
  %46 = load i8, ptr %45, align 4, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %0, i64 150
  %48 = load i8, ptr %47, align 2, !tbaa !25
  %49 = or i8 %48, %46
  store i8 %49, ptr %47, align 2, !tbaa !25
  %50 = getelementptr inbounds i8, ptr %37, i64 4
  store i8 %46, ptr %50, align 4, !tbaa !5
  %51 = zext i8 %46 to i32
  %52 = shl nuw i32 %51, 24
  %53 = add i32 %52, %33
  br label %54

54:                                               ; preds = %.thread, %.loopexit
  %.1 = phi i32 [ %53, %.loopexit ], [ %30, %.thread ]
  ret i32 %.1
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @lj_ir_nextins(ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i16 @llvm.umax.i16(i16, i16) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { alwaysinline nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !12, i64 136}
!9 = !{!"jit_State", !10, i64 0, !13, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !13, i64 128, !12, i64 136, !12, i64 140, !12, i64 144, !6, i64 148, !6, i64 149, !16, i64 150, !6, i64 151, !17, i64 152, !13, i64 176, !12, i64 184, !12, i64 188, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !12, i64 208, !15, i64 212, !6, i64 216, !13, i64 256, !12, i64 264, !12, i64 268, !12, i64 272, !12, i64 276, !13, i64 280, !13, i64 288, !12, i64 296, !12, i64 300, !6, i64 304, !13, i64 312, !12, i64 320, !12, i64 324, !13, i64 328, !6, i64 336, !6, i64 536, !6, i64 1556, !6, i64 1616, !6, i64 1744, !12, i64 2256, !12, i64 2260, !6, i64 2264, !12, i64 2392, !18, i64 2396, !13, i64 2416, !12, i64 2424, !12, i64 2428, !13, i64 2432, !12, i64 2440, !12, i64 2444, !13, i64 2448, !13, i64 2456, !13, i64 2464, !19, i64 2472, !19, i64 2480, !6, i64 2488, !13, i64 2496, !12, i64 2504, !12, i64 2508}
!10 = !{!"GCtrace", !11, i64 0, !6, i64 4, !6, i64 5, !6, i64 6, !6, i64 7, !12, i64 8, !11, i64 12, !13, i64 16, !12, i64 24, !14, i64 28, !14, i64 30, !13, i64 32, !13, i64 40, !11, i64 48, !15, i64 52, !12, i64 56, !12, i64 60, !13, i64 64, !12, i64 72, !14, i64 76, !14, i64 78, !14, i64 80, !14, i64 82, !14, i64 84, !14, i64 86, !14, i64 88, !6, i64 90, !6, i64 91}
!11 = !{!"GCRef", !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{!"any pointer", !6, i64 0}
!14 = !{!"short", !6, i64 0}
!15 = !{!"MRef", !12, i64 0}
!16 = !{!"IRType1", !6, i64 0}
!17 = !{!"FoldState", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"ScEvEntry", !15, i64 0, !14, i64 4, !14, i64 6, !14, i64 8, !14, i64 10, !16, i64 12, !6, i64 13}
!19 = !{!"long", !6, i64 0}
!20 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!21 = !{!9, !13, i64 16}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!14, !14, i64 0}
!25 = !{!9, !6, i64 150}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass