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

; 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.anon.1 = type { %union.anon, i32 }
%union.anon = type { %struct.GCRef }
%struct.GCRef = type { i32 }
%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.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.3 = type { i32, i32 }

; 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(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @lj_ir_set_(ptr noundef, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext) #1

declare hidden i32 @lj_opt_fold(ptr noundef) #2

; Function Attrs: noreturn
declare hidden void @lj_trace_err(ptr noundef, i32 noundef) #3

declare hidden i32 @lj_strscan_num(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @numisint(double noundef) #4

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

declare hidden i32 @lj_ir_kint(ptr noundef, i32 noundef) #2

declare hidden i32 @lj_ir_tonum(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define hidden i32 @lj_opt_narrow_pow(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) #4 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  %14 = load ptr, ptr %9, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.anon.1, ptr %14, i32 0, i32 1
  %16 = load i32, ptr %15, align 4, !tbaa !11
  %17 = icmp eq i32 %16, -5
  br i1 %17, label %18, label %30

18:                                               ; preds = %4
  %19 = load ptr, ptr %9, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.anon.1, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds %struct.GCRef, ptr %20, i32 0, i32 0
  %22 = load i32, ptr %21, align 8, !tbaa !11
  %23 = zext i32 %22 to i64
  %24 = inttoptr i64 %23 to ptr
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = call i32 @lj_strscan_num(ptr noundef %24, ptr noundef %25)
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %30, label %28

28:                                               ; preds = %18
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  call void @lj_trace_err(ptr noundef %29, i32 noundef 11) #5
  unreachable

30:                                               ; preds = %18, %4
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = load double, ptr %31, align 8, !tbaa !11
  %33 = call i32 @numisint(double noundef %32)
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %126

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = trunc i32 %36 to i16
  %38 = zext i16 %37 to i32
  %39 = icmp slt i32 %38, 32768
  br i1 %39, label %40, label %69

40:                                               ; preds = %35
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.jit_State, ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds %struct.GCtrace, ptr %42, i32 0, i32 7
  %44 = load ptr, ptr %43, align 8, !tbaa !12
  %45 = load i32, ptr %7, align 4, !tbaa !9
  %46 = trunc i32 %45 to i16
  %47 = zext i16 %46 to i64
  %48 = getelementptr inbounds %union.IRIns, ptr %44, i64 %47
  %49 = getelementptr inbounds %struct.MRef, ptr %48, i32 0, i32 0
  %50 = load i32, ptr %49, align 4, !tbaa !11
  %51 = zext i32 %50 to i64
  %52 = inttoptr i64 %51 to ptr
  %53 = getelementptr inbounds %struct.anon.3, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 4, !tbaa !11
  %55 = icmp sge i32 %54, 0
  br i1 %55, label %56, label %69

56:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = call i32 @numberVint(ptr noundef %57)
  store i32 %58, ptr %11, align 4, !tbaa !9
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = icmp sge i32 %59, -65536
  br i1 %60, label %61, label %64

61:                                               ; preds = %56
  %62 = load i32, ptr %11, align 4, !tbaa !9
  %63 = icmp sle i32 %62, 65536
  br i1 %63, label %65, label %64

64:                                               ; preds = %61, %56
  store i32 2, ptr %12, align 4
  br label %66

65:                                               ; preds = %61
  store i32 1, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %12, align 4
  br label %66

66:                                               ; preds = %65, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  %67 = load i32, ptr %12, align 4
  switch i32 %67, label %124 [
    i32 0, label %68
  ]

68:                                               ; preds = %66
  br label %69

69:                                               ; preds = %68, %40, %35
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = lshr i32 %70, 24
  %72 = and i32 %71, 31
  %73 = sub i32 %72, 15
  %74 = icmp ule i32 %73, 4
  br i1 %74, label %91, label %75

75:                                               ; preds = %69
  %76 = load i32, ptr %8, align 4, !tbaa !9
  %77 = and i32 %76, 520093696
  %78 = icmp eq i32 %77, 67108864
  br i1 %78, label %79, label %85

79:                                               ; preds = %75
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = load i32, ptr %8, align 4, !tbaa !9
  %82 = trunc i32 %81 to i16
  call void @lj_ir_set_(ptr noundef %80, i16 noundef zeroext 23950, i16 noundef zeroext %82, i16 noundef zeroext 0)
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = call i32 @lj_opt_fold(ptr noundef %83)
  store i32 %84, ptr %8, align 4, !tbaa !9
  br label %85

85:                                               ; preds = %79, %75
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = load i32, ptr %8, align 4, !tbaa !9
  %88 = trunc i32 %87 to i16
  call void @lj_ir_set_(ptr noundef %86, i16 noundef zeroext 23187, i16 noundef zeroext %88, i16 noundef zeroext 12910)
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = call i32 @lj_opt_fold(ptr noundef %89)
  store i32 %90, ptr %8, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %85, %69
  %92 = load i32, ptr %10, align 4, !tbaa !9
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %116

94:                                               ; preds = %91
  %95 = load i32, ptr %8, align 4, !tbaa !9
  %96 = trunc i32 %95 to i16
  %97 = zext i16 %96 to i32
  %98 = icmp slt i32 %97, 32768
  br i1 %98, label %116, label %99

99:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = load i32, ptr %8, align 4, !tbaa !9
  %102 = trunc i32 %101 to i16
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = call i32 @lj_ir_kint(ptr noundef %103, i32 noundef 65536)
  %105 = trunc i32 %104 to i16
  call void @lj_ir_set_(ptr noundef %100, i16 noundef zeroext 10515, i16 noundef zeroext %102, i16 noundef zeroext %105)
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = call i32 @lj_opt_fold(ptr noundef %106)
  store i32 %107, ptr %13, align 4, !tbaa !9
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = load i32, ptr %13, align 4, !tbaa !9
  %110 = trunc i32 %109 to i16
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = call i32 @lj_ir_kint(ptr noundef %111, i32 noundef 131072)
  %113 = trunc i32 %112 to i16
  call void @lj_ir_set_(ptr noundef %108, i16 noundef zeroext 1683, i16 noundef zeroext %110, i16 noundef zeroext %113)
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = call i32 @lj_opt_fold(ptr noundef %114)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %116

116:                                              ; preds = %99, %94, %91
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = load i32, ptr %7, align 4, !tbaa !9
  %119 = trunc i32 %118 to i16
  %120 = load i32, ptr %8, align 4, !tbaa !9
  %121 = trunc i32 %120 to i16
  call void @lj_ir_set_(ptr noundef %117, i16 noundef zeroext 11790, i16 noundef zeroext %119, i16 noundef zeroext %121)
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  %123 = call i32 @lj_opt_fold(ptr noundef %122)
  store i32 %123, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %124

124:                                              ; preds = %116, %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %125 = load i32, ptr %12, align 4
  switch i32 %125, label %198 [
    i32 1, label %196
    i32 2, label %127
  ]

126:                                              ; preds = %30
  br label %127

127:                                              ; preds = %126, %124
  %128 = load i32, ptr %7, align 4, !tbaa !9
  %129 = trunc i32 %128 to i16
  %130 = zext i16 %129 to i32
  %131 = icmp slt i32 %130, 32768
  br i1 %131, label %132, label %149

132:                                              ; preds = %127
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.jit_State, ptr %133, i32 0, i32 0
  %135 = getelementptr inbounds %struct.GCtrace, ptr %134, i32 0, i32 7
  %136 = load ptr, ptr %135, align 8, !tbaa !12
  %137 = load i32, ptr %7, align 4, !tbaa !9
  %138 = trunc i32 %137 to i16
  %139 = zext i16 %138 to i64
  %140 = getelementptr inbounds %union.IRIns, ptr %136, i64 %139
  %141 = getelementptr inbounds %struct.MRef, ptr %140, i32 0, i32 0
  %142 = load i32, ptr %141, align 4, !tbaa !11
  %143 = zext i32 %142 to i64
  %144 = inttoptr i64 %143 to ptr
  %145 = load i64, ptr %144, align 8, !tbaa !11
  %146 = icmp eq i64 %145, 4607182418800017408
  br i1 %146, label %147, label %149

147:                                              ; preds = %132
  %148 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %148, ptr %5, align 4
  br label %196

149:                                              ; preds = %132, %127
  %150 = load ptr, ptr %6, align 8, !tbaa !5
  %151 = load i32, ptr %8, align 4, !tbaa !9
  %152 = call i32 @lj_ir_tonum(ptr noundef %150, i32 noundef %151)
  store i32 %152, ptr %8, align 4, !tbaa !9
  %153 = load i32, ptr %8, align 4, !tbaa !9
  %154 = trunc i32 %153 to i16
  %155 = zext i16 %154 to i32
  %156 = icmp slt i32 %155, 32768
  br i1 %156, label %157, label %178

157:                                              ; preds = %149
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.jit_State, ptr %158, i32 0, i32 0
  %160 = getelementptr inbounds %struct.GCtrace, ptr %159, i32 0, i32 7
  %161 = load ptr, ptr %160, align 8, !tbaa !12
  %162 = load i32, ptr %8, align 4, !tbaa !9
  %163 = trunc i32 %162 to i16
  %164 = zext i16 %163 to i64
  %165 = getelementptr inbounds %union.IRIns, ptr %161, i64 %164
  %166 = getelementptr inbounds %struct.MRef, ptr %165, i32 0, i32 0
  %167 = load i32, ptr %166, align 4, !tbaa !11
  %168 = zext i32 %167 to i64
  %169 = inttoptr i64 %168 to ptr
  %170 = load double, ptr %169, align 8, !tbaa !11
  %171 = fcmp oeq double %170, 5.000000e-01
  br i1 %171, label %172, label %178

172:                                              ; preds = %157
  %173 = load ptr, ptr %6, align 8, !tbaa !5
  %174 = load i32, ptr %7, align 4, !tbaa !9
  %175 = trunc i32 %174 to i16
  call void @lj_ir_set_(ptr noundef %173, i16 noundef zeroext 13582, i16 noundef zeroext %175, i16 noundef zeroext 3)
  %176 = load ptr, ptr %6, align 8, !tbaa !5
  %177 = call i32 @lj_opt_fold(ptr noundef %176)
  store i32 %177, ptr %5, align 4
  br label %196

178:                                              ; preds = %157, %149
  %179 = load ptr, ptr %6, align 8, !tbaa !5
  %180 = load i32, ptr %7, align 4, !tbaa !9
  %181 = trunc i32 %180 to i16
  call void @lj_ir_set_(ptr noundef %179, i16 noundef zeroext 13582, i16 noundef zeroext %181, i16 noundef zeroext 7)
  %182 = load ptr, ptr %6, align 8, !tbaa !5
  %183 = call i32 @lj_opt_fold(ptr noundef %182)
  store i32 %183, ptr %7, align 4, !tbaa !9
  %184 = load ptr, ptr %6, align 8, !tbaa !5
  %185 = load i32, ptr %7, align 4, !tbaa !9
  %186 = trunc i32 %185 to i16
  %187 = load i32, ptr %8, align 4, !tbaa !9
  %188 = trunc i32 %187 to i16
  call void @lj_ir_set_(ptr noundef %184, i16 noundef zeroext 11022, i16 noundef zeroext %186, i16 noundef zeroext %188)
  %189 = load ptr, ptr %6, align 8, !tbaa !5
  %190 = call i32 @lj_opt_fold(ptr noundef %189)
  store i32 %190, ptr %8, align 4, !tbaa !9
  %191 = load ptr, ptr %6, align 8, !tbaa !5
  %192 = load i32, ptr %8, align 4, !tbaa !9
  %193 = trunc i32 %192 to i16
  call void @lj_ir_set_(ptr noundef %191, i16 noundef zeroext 13582, i16 noundef zeroext %193, i16 noundef zeroext 5)
  %194 = load ptr, ptr %6, align 8, !tbaa !5
  %195 = call i32 @lj_opt_fold(ptr noundef %194)
  store i32 %195, ptr %5, align 4
  br label %196

196:                                              ; preds = %178, %172, %147, %124
  %197 = load i32, ptr %5, align 4
  ret i32 %197

198:                                              ; preds = %124
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { noreturn "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 #4 = { 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 = { noreturn }
attributes #6 = { 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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !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, !10, i64 136, !10, i64 140, !10, i64 144, !7, i64 148, !7, i64 149, !18, i64 150, !7, i64 151, !19, i64 152, !6, i64 176, !10, i64 184, !10, i64 188, !10, i64 192, !10, i64 196, !10, i64 200, !10, i64 204, !10, i64 208, !17, i64 212, !7, i64 216, !6, i64 256, !10, i64 264, !10, i64 268, !10, i64 272, !10, i64 276, !6, i64 280, !6, i64 288, !10, i64 296, !10, i64 300, !7, i64 304, !6, i64 312, !10, i64 320, !10, i64 324, !6, i64 328, !7, i64 336, !7, i64 536, !7, i64 1556, !7, i64 1616, !7, i64 1744, !10, i64 2256, !10, i64 2260, !7, i64 2264, !10, i64 2392, !20, i64 2396, !6, i64 2416, !10, i64 2424, !10, i64 2428, !6, i64 2432, !10, i64 2440, !10, i64 2444, !6, i64 2448, !6, i64 2456, !6, i64 2464, !21, i64 2472, !21, i64 2480, !7, i64 2488, !6, i64 2496, !10, i64 2504, !10, i64 2508}
!14 = !{!"GCtrace", !15, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !10, i64 8, !15, i64 12, !6, i64 16, !10, i64 24, !16, i64 28, !16, i64 30, !6, i64 32, !6, i64 40, !15, i64 48, !17, i64 52, !10, i64 56, !10, i64 60, !6, i64 64, !10, 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", !10, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!"MRef", !10, 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}


; 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: alwaysinline nounwind uwtable
declare hidden void @lj_ir_set_(ptr noundef, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #0

declare hidden i32 @lj_opt_fold(ptr noundef) local_unnamed_addr #1

; Function Attrs: noreturn
declare hidden void @lj_trace_err(ptr noundef, i32 noundef) local_unnamed_addr #2

declare hidden i32 @lj_strscan_num(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @numisint(double noundef) local_unnamed_addr #3

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

declare hidden i32 @lj_ir_kint(ptr noundef, i32 noundef) local_unnamed_addr #1

declare hidden i32 @lj_ir_tonum(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define hidden i32 @lj_opt_narrow_pow(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) local_unnamed_addr #3 {
  %5 = getelementptr inbounds i8, ptr %3, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = icmp eq i32 %6, -5
  br i1 %7, label %8, label %14

8:                                                ; preds = %4
  %9 = load i32, ptr %3, align 8, !tbaa !5
  %10 = zext i32 %9 to i64
  %11 = inttoptr i64 %10 to ptr
  %12 = tail call i32 @lj_strscan_num(ptr noundef %11, ptr noundef nonnull %3) #4
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %13, label %14

13:                                               ; preds = %8
  tail call void @lj_trace_err(ptr noundef %0, i32 noundef 11) #5
  unreachable

14:                                               ; preds = %8, %4
  %15 = load double, ptr %3, align 8, !tbaa !5
  %16 = tail call i32 @numisint(double noundef %15)
  %.not64 = icmp eq i32 %16, 0
  %.pre = trunc i32 %1 to i16
  %.pre79 = and i32 %1, 32768
  %17 = icmp eq i32 %.pre79, 0
  br i1 %.not64, label %58, label %18

18:                                               ; preds = %14
  br i1 %17, label %19, label %33

19:                                               ; preds = %18
  %20 = getelementptr inbounds i8, ptr %0, i64 16
  %21 = load ptr, ptr %20, align 8, !tbaa !8
  %.mask = and i32 %1, 32767
  %22 = zext nneg i32 %.mask to i64
  %23 = getelementptr inbounds %union.IRIns, ptr %21, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = zext i32 %24 to i64
  %26 = inttoptr i64 %25 to ptr
  %27 = getelementptr inbounds i8, ptr %26, i64 4
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = icmp sgt i32 %28, -1
  br i1 %29, label %30, label %33

30:                                               ; preds = %19
  %31 = tail call i32 @numberVint(ptr noundef nonnull %3)
  %32 = add i32 %31, 65536
  %or.cond = icmp ult i32 %32, 131073
  br i1 %or.cond, label %33, label %.thread83

33:                                               ; preds = %30, %19, %18
  %.not66 = phi i1 [ false, %30 ], [ true, %19 ], [ true, %18 ]
  %34 = lshr i32 %2, 24
  %35 = and i32 %34, 31
  %36 = add nsw i32 %35, -15
  %37 = icmp ult i32 %36, 5
  br i1 %37, label %47, label %38

38:                                               ; preds = %33
  %39 = and i32 %2, 520093696
  %40 = icmp eq i32 %39, 67108864
  br i1 %40, label %41, label %44

41:                                               ; preds = %38
  %42 = trunc i32 %2 to i16
  tail call void @lj_ir_set_(ptr noundef %0, i16 noundef zeroext 23950, i16 noundef zeroext %42, i16 noundef zeroext 0)
  %43 = tail call i32 @lj_opt_fold(ptr noundef %0) #4
  br label %44

44:                                               ; preds = %41, %38
  %.062 = phi i32 [ %43, %41 ], [ %2, %38 ]
  %45 = trunc i32 %.062 to i16
  tail call void @lj_ir_set_(ptr noundef %0, i16 noundef zeroext 23187, i16 noundef zeroext %45, i16 noundef zeroext 12910)
  %46 = tail call i32 @lj_opt_fold(ptr noundef %0) #4
  br label %47

47:                                               ; preds = %44, %33
  %.163 = phi i32 [ %2, %33 ], [ %46, %44 ]
  %48 = and i32 %.163, 32768
  %.not67.not = icmp eq i32 %48, 0
  %or.cond73 = select i1 %.not66, i1 true, i1 %.not67.not
  %.pre81 = trunc i32 %.163 to i16
  br i1 %or.cond73, label %.thread, label %49

49:                                               ; preds = %47
  %50 = tail call i32 @lj_ir_kint(ptr noundef %0, i32 noundef 65536) #4
  %51 = trunc i32 %50 to i16
  tail call void @lj_ir_set_(ptr noundef %0, i16 noundef zeroext 10515, i16 noundef zeroext %.pre81, i16 noundef zeroext %51)
  %52 = tail call i32 @lj_opt_fold(ptr noundef %0) #4
  %53 = trunc i32 %52 to i16
  %54 = tail call i32 @lj_ir_kint(ptr noundef %0, i32 noundef 131072) #4
  %55 = trunc i32 %54 to i16
  tail call void @lj_ir_set_(ptr noundef %0, i16 noundef zeroext 1683, i16 noundef zeroext %53, i16 noundef zeroext %55)
  %56 = tail call i32 @lj_opt_fold(ptr noundef %0) #4
  br label %.thread

.thread:                                          ; preds = %47, %49
  tail call void @lj_ir_set_(ptr noundef %0, i16 noundef zeroext 11790, i16 noundef zeroext %.pre, i16 noundef zeroext %.pre81)
  %57 = tail call i32 @lj_opt_fold(ptr noundef %0) #4
  br label %90

58:                                               ; preds = %14
  br i1 %17, label %.thread83, label %68

.thread83:                                        ; preds = %30, %58
  %59 = getelementptr inbounds i8, ptr %0, i64 16
  %60 = load ptr, ptr %59, align 8, !tbaa !8
  %.mask69 = and i32 %1, 32767
  %61 = zext nneg i32 %.mask69 to i64
  %62 = getelementptr inbounds %union.IRIns, ptr %60, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = zext i32 %63 to i64
  %65 = inttoptr i64 %64 to ptr
  %66 = load i64, ptr %65, align 8, !tbaa !5
  %67 = icmp eq i64 %66, 4607182418800017408
  br i1 %67, label %90, label %68

68:                                               ; preds = %.thread83, %58
  %69 = tail call i32 @lj_ir_tonum(ptr noundef %0, i32 noundef %2) #4
  %70 = trunc i32 %69 to i16
  %71 = and i32 %69, 32768
  %.not70.not = icmp eq i32 %71, 0
  br i1 %.not70.not, label %72, label %84

72:                                               ; preds = %68
  %73 = getelementptr inbounds i8, ptr %0, i64 16
  %74 = load ptr, ptr %73, align 8, !tbaa !8
  %.mask71 = and i32 %69, 32767
  %75 = zext nneg i32 %.mask71 to i64
  %76 = getelementptr inbounds %union.IRIns, ptr %74, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = zext i32 %77 to i64
  %79 = inttoptr i64 %78 to ptr
  %80 = load double, ptr %79, align 8, !tbaa !5
  %81 = fcmp oeq double %80, 5.000000e-01
  br i1 %81, label %82, label %84

82:                                               ; preds = %72
  tail call void @lj_ir_set_(ptr noundef nonnull %0, i16 noundef zeroext 13582, i16 noundef zeroext %.pre, i16 noundef zeroext 3)
  %83 = tail call i32 @lj_opt_fold(ptr noundef nonnull %0) #4
  br label %90

84:                                               ; preds = %72, %68
  tail call void @lj_ir_set_(ptr noundef %0, i16 noundef zeroext 13582, i16 noundef zeroext %.pre, i16 noundef zeroext 7)
  %85 = tail call i32 @lj_opt_fold(ptr noundef %0) #4
  %86 = trunc i32 %85 to i16
  tail call void @lj_ir_set_(ptr noundef %0, i16 noundef zeroext 11022, i16 noundef zeroext %86, i16 noundef zeroext %70)
  %87 = tail call i32 @lj_opt_fold(ptr noundef %0) #4
  %88 = trunc i32 %87 to i16
  tail call void @lj_ir_set_(ptr noundef %0, i16 noundef zeroext 13582, i16 noundef zeroext %88, i16 noundef zeroext 5)
  %89 = tail call i32 @lj_opt_fold(ptr noundef %0) #4
  br label %90

90:                                               ; preds = %.thread, %.thread83, %84, %82
  %.1 = phi i32 [ %83, %82 ], [ %89, %84 ], [ %1, %.thread83 ], [ %57, %.thread ]
  ret i32 %.1
}

attributes #0 = { 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 #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 = { noreturn "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 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 #4 = { nounwind }
attributes #5 = { noreturn 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}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass