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

; 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.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.IRType1 = type { i8 }
%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

declare hidden i32 @lj_ir_emit(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare hidden i32 @aa_xref(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define hidden i32 @lj_opt_dse_xstore(ptr noundef %0) #2 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.jit_State, ptr %13, i32 0, i32 13
  %15 = getelementptr inbounds %struct.FoldState, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds %struct.anon, ptr %15, i32 0, i32 0
  %17 = load i16, ptr %16, align 8, !tbaa !9
  %18 = zext i16 %17 to i32
  store i32 %18, ptr %4, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.jit_State, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds %struct.GCtrace, ptr %20, i32 0, i32 7
  %22 = load ptr, ptr %21, align 8, !tbaa !12
  %23 = load i32, ptr %4, align 4, !tbaa !10
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds %union.IRIns, ptr %22, i64 %24
  store ptr %25, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %26 = load i32, ptr %4, align 4, !tbaa !10
  store i32 %26, ptr %6, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.jit_State, ptr %27, i32 0, i32 13
  %29 = getelementptr inbounds %struct.FoldState, ptr %28, i32 0, i32 0
  %30 = getelementptr inbounds %struct.anon, ptr %29, i32 0, i32 1
  %31 = load i16, ptr %30, align 2, !tbaa !9
  %32 = zext i16 %31 to i32
  store i32 %32, ptr %7, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.jit_State, ptr %33, i32 0, i32 38
  %35 = getelementptr inbounds [100 x i16], ptr %34, i64 0, i64 77
  store ptr %35, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = load i16, ptr %36, align 2, !tbaa !22
  %38 = zext i16 %37 to i32
  store i32 %38, ptr %9, align 4, !tbaa !10
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.jit_State, ptr %39, i32 0, i32 38
  %41 = getelementptr inbounds [100 x i16], ptr %40, i64 0, i64 98
  %42 = load i16, ptr %41, align 4, !tbaa !22
  %43 = zext i16 %42 to i32
  %44 = load i32, ptr %6, align 4, !tbaa !10
  %45 = icmp ugt i32 %43, %44
  br i1 %45, label %46, label %52

46:                                               ; preds = %1
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.jit_State, ptr %47, i32 0, i32 38
  %49 = getelementptr inbounds [100 x i16], ptr %48, i64 0, i64 98
  %50 = load i16, ptr %49, align 4, !tbaa !22
  %51 = zext i16 %50 to i32
  store i32 %51, ptr %6, align 4, !tbaa !10
  br label %52

52:                                               ; preds = %46, %1
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.jit_State, ptr %53, i32 0, i32 38
  %55 = getelementptr inbounds [100 x i16], ptr %54, i64 0, i64 89
  %56 = load i16, ptr %55, align 2, !tbaa !22
  %57 = zext i16 %56 to i32
  %58 = load i32, ptr %6, align 4, !tbaa !10
  %59 = icmp ugt i32 %57, %58
  br i1 %59, label %60, label %66

60:                                               ; preds = %52
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.jit_State, ptr %61, i32 0, i32 38
  %63 = getelementptr inbounds [100 x i16], ptr %62, i64 0, i64 89
  %64 = load i16, ptr %63, align 2, !tbaa !22
  %65 = zext i16 %64 to i32
  store i32 %65, ptr %6, align 4, !tbaa !10
  br label %66

66:                                               ; preds = %60, %52
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.jit_State, ptr %67, i32 0, i32 38
  %69 = getelementptr inbounds [100 x i16], ptr %68, i64 0, i64 79
  %70 = load i16, ptr %69, align 2, !tbaa !22
  %71 = zext i16 %70 to i32
  %72 = load i32, ptr %6, align 4, !tbaa !10
  %73 = icmp ugt i32 %71, %72
  br i1 %73, label %74, label %80

74:                                               ; preds = %66
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.jit_State, ptr %75, i32 0, i32 38
  %77 = getelementptr inbounds [100 x i16], ptr %76, i64 0, i64 79
  %78 = load i16, ptr %77, align 2, !tbaa !22
  %79 = zext i16 %78 to i32
  store i32 %79, ptr %6, align 4, !tbaa !10
  br label %80

80:                                               ; preds = %74, %66
  br label %81

81:                                               ; preds = %187, %80
  %82 = load i32, ptr %9, align 4, !tbaa !10
  %83 = load i32, ptr %6, align 4, !tbaa !10
  %84 = icmp ugt i32 %82, %83
  br i1 %84, label %85, label %188

85:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.jit_State, ptr %86, i32 0, i32 0
  %88 = getelementptr inbounds %struct.GCtrace, ptr %87, i32 0, i32 7
  %89 = load ptr, ptr %88, align 8, !tbaa !12
  %90 = load i32, ptr %9, align 4, !tbaa !10
  %91 = zext i32 %90 to i64
  %92 = getelementptr inbounds %union.IRIns, ptr %89, i64 %91
  store ptr %92, ptr %10, align 8, !tbaa !5
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.jit_State, ptr %95, i32 0, i32 13
  %97 = getelementptr inbounds %struct.FoldState, ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = call i32 @aa_xref(ptr noundef %93, ptr noundef %94, ptr noundef %97, ptr noundef %98)
  switch i32 %99, label %180 [
    i32 0, label %180
    i32 1, label %100
    i32 2, label %109
  ]

100:                                              ; preds = %85
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.anon, ptr %101, i32 0, i32 1
  %103 = load i16, ptr %102, align 2, !tbaa !9
  %104 = zext i16 %103 to i32
  %105 = load i32, ptr %7, align 4, !tbaa !10
  %106 = icmp ne i32 %104, %105
  br i1 %106, label %107, label %108

107:                                              ; preds = %100
  store i32 5, ptr %11, align 4
  br label %185

108:                                              ; preds = %100
  br label %180

109:                                              ; preds = %85
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.anon, ptr %110, i32 0, i32 1
  %112 = load i16, ptr %111, align 2, !tbaa !9
  %113 = zext i16 %112 to i32
  %114 = load i32, ptr %7, align 4, !tbaa !10
  %115 = icmp eq i32 %113, %114
  br i1 %115, label %116, label %117

116:                                              ; preds = %109
  store i32 4, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %185

117:                                              ; preds = %109
  %118 = load i32, ptr %9, align 4, !tbaa !10
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.jit_State, ptr %119, i32 0, i32 38
  %121 = getelementptr inbounds [100 x i16], ptr %120, i64 0, i64 17
  %122 = load i16, ptr %121, align 2, !tbaa !22
  %123 = zext i16 %122 to i32
  %124 = icmp ugt i32 %118, %123
  br i1 %124, label %125, label %179

125:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %126 = load ptr, ptr %3, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.jit_State, ptr %126, i32 0, i32 0
  %128 = getelementptr inbounds %struct.GCtrace, ptr %127, i32 0, i32 7
  %129 = load ptr, ptr %128, align 8, !tbaa !12
  %130 = load ptr, ptr %3, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.jit_State, ptr %130, i32 0, i32 0
  %132 = getelementptr inbounds %struct.GCtrace, ptr %131, i32 0, i32 5
  %133 = load i32, ptr %132, align 8, !tbaa !23
  %134 = sub i32 %133, 1
  %135 = zext i32 %134 to i64
  %136 = getelementptr inbounds %union.IRIns, ptr %129, i64 %135
  store ptr %136, ptr %12, align 8, !tbaa !5
  br label %137

137:                                              ; preds = %157, %125
  %138 = load ptr, ptr %12, align 8, !tbaa !5
  %139 = load ptr, ptr %10, align 8, !tbaa !5
  %140 = icmp ugt ptr %138, %139
  br i1 %140, label %141, label %160

141:                                              ; preds = %137
  %142 = load ptr, ptr %12, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.anon.0, ptr %142, i32 0, i32 1
  %144 = getelementptr inbounds %struct.IRType1, ptr %143, i32 0, i32 0
  %145 = load i8, ptr %144, align 4, !tbaa !9
  %146 = zext i8 %145 to i32
  %147 = and i32 %146, 128
  %148 = icmp ne i32 %147, 0
  br i1 %148, label %155, label %149

149:                                              ; preds = %141
  %150 = load ptr, ptr %12, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.anon.0, ptr %150, i32 0, i32 2
  %152 = load i8, ptr %151, align 1, !tbaa !9
  %153 = zext i8 %152 to i32
  %154 = icmp eq i32 %153, 70
  br i1 %154, label %155, label %156

155:                                              ; preds = %149, %141
  store i32 5, ptr %11, align 4
  br label %176

156:                                              ; preds = %149
  br label %157

157:                                              ; preds = %156
  %158 = load ptr, ptr %12, align 8, !tbaa !5
  %159 = getelementptr inbounds %union.IRIns, ptr %158, i32 -1
  store ptr %159, ptr %12, align 8, !tbaa !5
  br label %137, !llvm.loop !24

160:                                              ; preds = %137
  %161 = load ptr, ptr %10, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.anon, ptr %161, i32 0, i32 3
  %163 = load i16, ptr %162, align 2, !tbaa !9
  %164 = load ptr, ptr %8, align 8, !tbaa !5
  store i16 %163, ptr %164, align 2, !tbaa !22
  %165 = load ptr, ptr %10, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.anon.0, ptr %165, i32 0, i32 2
  store i8 12, ptr %166, align 1, !tbaa !9
  %167 = load ptr, ptr %10, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.anon.0, ptr %167, i32 0, i32 1
  %169 = getelementptr inbounds %struct.IRType1, ptr %168, i32 0, i32 0
  store i8 0, ptr %169, align 4, !tbaa !9
  %170 = load ptr, ptr %10, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.anon, ptr %170, i32 0, i32 1
  store i16 0, ptr %171, align 2, !tbaa !9
  %172 = load ptr, ptr %10, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.anon, ptr %172, i32 0, i32 0
  store i16 0, ptr %173, align 4, !tbaa !9
  %174 = load ptr, ptr %10, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.anon, ptr %174, i32 0, i32 3
  store i16 0, ptr %175, align 2, !tbaa !9
  store i32 0, ptr %11, align 4
  br label %176

176:                                              ; preds = %160, %155
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %177 = load i32, ptr %11, align 4
  switch i32 %177, label %185 [
    i32 0, label %178
  ]

178:                                              ; preds = %176
  br label %179

179:                                              ; preds = %178, %117
  store i32 5, ptr %11, align 4
  br label %185

180:                                              ; preds = %108, %85, %85
  %181 = load ptr, ptr %10, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.anon, ptr %181, i32 0, i32 3
  store ptr %182, ptr %8, align 8, !tbaa !5
  %183 = load i16, ptr %182, align 2, !tbaa !22
  %184 = zext i16 %183 to i32
  store i32 %184, ptr %9, align 4, !tbaa !10
  store i32 0, ptr %11, align 4
  br label %185

185:                                              ; preds = %180, %179, %176, %116, %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %186 = load i32, ptr %11, align 4
  switch i32 %186, label %192 [
    i32 0, label %187
    i32 5, label %189
  ]

187:                                              ; preds = %185
  br label %81, !llvm.loop !26

188:                                              ; preds = %81
  br label %189

189:                                              ; preds = %188, %185
  %190 = load ptr, ptr %3, align 8, !tbaa !5
  %191 = call i32 @lj_ir_emit(ptr noundef %190)
  store i32 %191, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %192

192:                                              ; preds = %189, %185
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %193 = load i32, ptr %2, align 4
  ret i32 %193
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = { 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, !6, i64 16}
!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, !11, i64 8}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}


; 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 }

declare hidden i32 @lj_ir_emit(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define hidden i32 @lj_opt_dse_xstore(ptr noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 152
  %3 = load i16, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = load ptr, ptr %4, align 8, !tbaa !8
  %6 = zext i16 %3 to i64
  %7 = getelementptr inbounds %union.IRIns, ptr %5, i64 %6
  %8 = getelementptr inbounds i8, ptr %0, i64 154
  %9 = load i16, ptr %8, align 2, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 490
  %11 = getelementptr inbounds i8, ptr %0, i64 532
  %12 = load i16, ptr %11, align 4, !tbaa !20
  %spec.select = tail call i16 @llvm.umax.i16(i16 %12, i16 %3)
  %13 = getelementptr inbounds i8, ptr %0, i64 514
  %14 = load i16, ptr %13, align 2, !tbaa !20
  %.156.in = tail call i16 @llvm.umax.i16(i16 %14, i16 %spec.select)
  %15 = getelementptr inbounds i8, ptr %0, i64 494
  %16 = load i16, ptr %15, align 2, !tbaa !20
  %.257.in = tail call i16 @llvm.umax.i16(i16 %16, i16 %.156.in)
  %.051.in78 = load i16, ptr %10, align 2, !tbaa !20
  %17 = icmp ugt i16 %.051.in78, %.257.in
  br i1 %17, label %.lr.ph, label %.thread67

.lr.ph:                                           ; preds = %1, %52
  %.051.in80 = phi i16 [ %.051.in, %52 ], [ %.051.in78, %1 ]
  %.05379 = phi ptr [ %53, %52 ], [ %10, %1 ]
  %18 = load ptr, ptr %4, align 8, !tbaa !8
  %19 = zext i16 %.051.in80 to i64
  %20 = getelementptr inbounds %union.IRIns, ptr %18, i64 %19
  %21 = tail call i32 @aa_xref(ptr noundef nonnull %0, ptr noundef %7, ptr noundef nonnull %2, ptr noundef nonnull %20)
  switch i32 %21, label %52 [
    i32 2, label %25
    i32 1, label %22
  ]

22:                                               ; preds = %.lr.ph
  %23 = getelementptr inbounds i8, ptr %20, i64 2
  %24 = load i16, ptr %23, align 2, !tbaa !5
  %.not = icmp eq i16 %24, %9
  br i1 %.not, label %52, label %.thread67

25:                                               ; preds = %.lr.ph
  %26 = getelementptr inbounds i8, ptr %20, i64 2
  %27 = load i16, ptr %26, align 2, !tbaa !5
  %28 = icmp eq i16 %27, %9
  br i1 %28, label %.thread71, label %29

29:                                               ; preds = %25
  %30 = getelementptr inbounds i8, ptr %0, i64 370
  %31 = load i16, ptr %30, align 2, !tbaa !20
  %32 = icmp ugt i16 %.051.in80, %31
  br i1 %32, label %33, label %.thread67

33:                                               ; preds = %29
  %34 = load ptr, ptr %4, align 8, !tbaa !8
  %35 = getelementptr inbounds i8, ptr %0, i64 8
  %36 = load i32, ptr %35, align 8, !tbaa !21
  %37 = add i32 %36, -1
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds %union.IRIns, ptr %34, i64 %38
  %.not6482 = icmp ugt ptr %39, %20
  br i1 %.not6482, label %.lr.ph84, label %._crit_edge

40:                                               ; preds = %44
  %41 = getelementptr inbounds i8, ptr %.083, i64 -8
  %.not64 = icmp ugt ptr %41, %20
  br i1 %.not64, label %.lr.ph84, label %._crit_edge, !llvm.loop !22

.lr.ph84:                                         ; preds = %33, %40
  %.083 = phi ptr [ %41, %40 ], [ %39, %33 ]
  %42 = getelementptr inbounds i8, ptr %.083, i64 4
  %43 = load i8, ptr %42, align 4, !tbaa !5
  %.not63 = icmp sgt i8 %43, -1
  br i1 %.not63, label %44, label %.thread67

44:                                               ; preds = %.lr.ph84
  %45 = getelementptr inbounds i8, ptr %.083, i64 5
  %46 = load i8, ptr %45, align 1, !tbaa !5
  %47 = icmp eq i8 %46, 70
  br i1 %47, label %.thread67, label %40

._crit_edge:                                      ; preds = %40, %33
  %48 = getelementptr inbounds i8, ptr %20, i64 6
  %49 = load i16, ptr %48, align 2, !tbaa !5
  store i16 %49, ptr %.05379, align 2, !tbaa !20
  %50 = getelementptr inbounds i8, ptr %20, i64 5
  store i8 12, ptr %50, align 1, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %20, i64 4
  store i8 0, ptr %51, align 4, !tbaa !5
  store i16 0, ptr %26, align 2, !tbaa !5
  store i16 0, ptr %20, align 4, !tbaa !5
  store i16 0, ptr %48, align 2, !tbaa !5
  br label %.thread67

52:                                               ; preds = %.lr.ph, %22
  %53 = getelementptr inbounds i8, ptr %20, i64 6
  %.051.in = load i16, ptr %53, align 2, !tbaa !20
  %54 = icmp ugt i16 %.051.in, %.257.in
  br i1 %54, label %.lr.ph, label %.thread67

.thread67:                                        ; preds = %52, %22, %44, %.lr.ph84, %1, %29, %._crit_edge
  %55 = tail call i32 @lj_ir_emit(ptr noundef %0) #3
  br label %.thread71

.thread71:                                        ; preds = %25, %.thread67
  %.2 = phi i32 [ %55, %.thread67 ], [ 4, %25 ]
  ret i32 %.2
}

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

attributes #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 = { 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) }
attributes #3 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !13, i64 16}
!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 = !{!14, !14, i64 0}
!21 = !{!9, !12, i64 8}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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