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

; 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.lua_State = type { %union.anon }
%union.anon = type { %struct.anon, [320 x i8] }
%struct.anon = type { %struct.GCRef, i8, i8, i8, i8, %struct.MRef, %struct.GCRef, ptr, ptr, %struct.MRef, %struct.MRef, %struct.GCRef, %struct.GCRef, ptr, i32 }
%struct.MRef = type { i32 }
%struct.GCRef = type { i32 }
%union.TValue = type { i64 }
%struct.anon.2 = type { %struct.GCRef, %union.FrameLink }
%union.FrameLink = type { i32 }
%struct.GG_State = type { %struct.lua_State, %struct.global_State, %struct.jit_State, [64 x i16], [243 x ptr], [57 x i32] }
%struct.global_State = type { ptr, i32, i32, ptr, ptr, %struct.GCState, i32, %struct.SBuf, %struct.GCstr, i8, i8, i8, i8, %struct.GCRef, %union.TValue, %union.TValue, %union.TValue, %struct.Node, %struct.GCupval, i32, i32, ptr, ptr, ptr, i32, i32, %struct.GCRef, %struct.MRef, %struct.MRef, [38 x %struct.GCRef] }
%struct.GCState = type { i32, i32, i8, i8, i8, i8, i32, %struct.GCRef, %struct.MRef, %struct.GCRef, %struct.GCRef, %struct.GCRef, %struct.GCRef, i32, i32, i32, i32 }
%struct.SBuf = type { %struct.MRef, %struct.MRef, %struct.MRef, %struct.MRef }
%struct.GCstr = type { %struct.GCRef, i8, i8, i8, i8, i32, i32 }
%struct.Node = type { %union.TValue, %union.TValue, %struct.MRef, %struct.MRef }
%struct.GCupval = type { %struct.GCRef, i8, i8, i8, i8, %union.anon.4, %struct.MRef, i32 }
%union.anon.4 = type { %union.TValue }
%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.7 }
%struct.anon.7 = type { i32, %struct.IRType1, i8, i8, i8 }
%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 }
%struct.anon.0 = type { %union.anon.1, i32 }
%union.anon.1 = type { %struct.GCRef }

@lj_vm_asm_begin = external hidden global [0 x i8], align 1
@lj_bc_ofs = external hidden constant [0 x i16], align 2

; 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: nounwind willreturn memory(none)
declare ptr @__errno_location() #1

declare hidden void @lj_trace_ins(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @callhook(ptr noundef, i32 noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
define hidden ptr @lj_dispatch_call(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %12 = call ptr @__errno_location() #5
  %13 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %13, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.lua_State, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds %struct.anon, ptr %15, i32 0, i32 7
  %17 = load ptr, ptr %16, align 8, !tbaa !11
  %18 = getelementptr inbounds %union.TValue, ptr %17, i64 -1
  %19 = getelementptr inbounds %struct.anon.2, ptr %18, i32 0, i32 0
  %20 = getelementptr inbounds %struct.GCRef, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !11
  %22 = zext i32 %21 to i64
  %23 = inttoptr i64 %22 to ptr
  store ptr %23, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.lua_State, ptr %24, i32 0, i32 0
  %26 = getelementptr inbounds %struct.anon, ptr %25, i32 0, i32 5
  %27 = getelementptr inbounds %struct.MRef, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !11
  %29 = zext i32 %28 to i64
  %30 = inttoptr i64 %29 to ptr
  store ptr %30, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 -384
  %33 = getelementptr inbounds %struct.GG_State, ptr %32, i32 0, i32 2
  store ptr %33, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = call i32 @call_init(ptr noundef %34, ptr noundef %35)
  store i32 %36, ptr %10, align 4, !tbaa !9
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.jit_State, ptr %38, i32 0, i32 1
  store ptr %37, ptr %39, align 8, !tbaa !12
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = ptrtoint ptr %40 to i64
  %42 = and i64 %41, 1
  %43 = icmp ne i64 %42, 0
  br i1 %43, label %44, label %51

44:                                               ; preds = %2
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = ptrtoint ptr %45 to i64
  %47 = and i64 %46, -2
  %48 = inttoptr i64 %47 to ptr
  store ptr %48, ptr %4, align 8, !tbaa !5
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  call void @lj_trace_hot(ptr noundef %49, ptr noundef %50)
  br label %115

51:                                               ; preds = %2
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.jit_State, ptr %52, i32 0, i32 16
  %54 = load i32, ptr %53, align 4, !tbaa !22
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %67

56:                                               ; preds = %51
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.global_State, ptr %57, i32 0, i32 10
  %59 = load i8, ptr %58, align 1, !tbaa !23
  %60 = zext i8 %59 to i32
  %61 = and i32 %60, 96
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %67, label %63

63:                                               ; preds = %56
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds i32, ptr %65, i64 -1
  call void @lj_trace_ins(ptr noundef %64, ptr noundef %66)
  br label %67

67:                                               ; preds = %63, %56, %51
  br label %68

68:                                               ; preds = %67
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.global_State, ptr %69, i32 0, i32 10
  %71 = load i8, ptr %70, align 1, !tbaa !23
  %72 = zext i8 %71 to i32
  %73 = and i32 %72, 1
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %114

75:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %76

76:                                               ; preds = %87, %75
  %77 = load i32, ptr %11, align 4, !tbaa !9
  %78 = load i32, ptr %10, align 4, !tbaa !9
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %80, label %90

80:                                               ; preds = %76
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.lua_State, ptr %81, i32 0, i32 0
  %83 = getelementptr inbounds %struct.anon, ptr %82, i32 0, i32 8
  %84 = load ptr, ptr %83, align 8, !tbaa !11
  %85 = getelementptr inbounds %union.TValue, ptr %84, i32 1
  store ptr %85, ptr %83, align 8, !tbaa !11
  %86 = getelementptr inbounds %struct.anon.0, ptr %84, i32 0, i32 1
  store i32 -1, ptr %86, align 4, !tbaa !11
  br label %87

87:                                               ; preds = %80
  %88 = load i32, ptr %11, align 4, !tbaa !9
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %11, align 4, !tbaa !9
  br label %76, !llvm.loop !30

90:                                               ; preds = %76
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  call void @callhook(ptr noundef %91, i32 noundef 0, i32 noundef -1)
  br label %92

92:                                               ; preds = %107, %90
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = add nsw i32 %93, -1
  store i32 %94, ptr %10, align 4, !tbaa !9
  %95 = icmp sgt i32 %93, 0
  br i1 %95, label %96, label %105

96:                                               ; preds = %92
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.lua_State, ptr %97, i32 0, i32 0
  %99 = getelementptr inbounds %struct.anon, ptr %98, i32 0, i32 8
  %100 = load ptr, ptr %99, align 8, !tbaa !11
  %101 = getelementptr inbounds %union.TValue, ptr %100, i64 -1
  %102 = getelementptr inbounds %struct.anon.0, ptr %101, i32 0, i32 1
  %103 = load i32, ptr %102, align 4, !tbaa !11
  %104 = icmp eq i32 %103, -1
  br label %105

105:                                              ; preds = %96, %92
  %106 = phi i1 [ false, %92 ], [ %104, %96 ]
  br i1 %106, label %107, label %113

107:                                              ; preds = %105
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.lua_State, ptr %108, i32 0, i32 0
  %110 = getelementptr inbounds %struct.anon, ptr %109, i32 0, i32 8
  %111 = load ptr, ptr %110, align 8, !tbaa !11
  %112 = getelementptr inbounds %union.TValue, ptr %111, i32 -1
  store ptr %112, ptr %110, align 8, !tbaa !11
  br label %92, !llvm.loop !32

113:                                              ; preds = %105
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %114

114:                                              ; preds = %113, %68
  br label %115

115:                                              ; preds = %114, %44
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds i32, ptr %116, i64 -1
  %118 = load i32, ptr %117, align 4, !tbaa !9
  %119 = and i32 %118, 255
  store i32 %119, ptr %7, align 4, !tbaa !9
  %120 = load ptr, ptr %9, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.jit_State, ptr %120, i32 0, i32 6
  %122 = load i32, ptr %121, align 8, !tbaa !33
  %123 = and i32 %122, 1
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %130

125:                                              ; preds = %115
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.jit_State, ptr %126, i32 0, i32 16
  %128 = load i32, ptr %127, align 4, !tbaa !22
  %129 = icmp ne i32 %128, 0
  br i1 %129, label %130, label %140

130:                                              ; preds = %125, %115
  %131 = load i32, ptr %7, align 4, !tbaa !9
  %132 = icmp eq i32 %131, 89
  br i1 %132, label %136, label %133

133:                                              ; preds = %130
  %134 = load i32, ptr %7, align 4, !tbaa !9
  %135 = icmp eq i32 %134, 92
  br i1 %135, label %136, label %140

136:                                              ; preds = %133, %130
  %137 = load i32, ptr %7, align 4, !tbaa !9
  %138 = add nsw i32 %137, 90
  %139 = sub nsw i32 %138, 89
  store i32 %139, ptr %7, align 4, !tbaa !9
  br label %140

140:                                              ; preds = %136, %133, %125
  %141 = load i32, ptr %5, align 4, !tbaa !9
  %142 = call ptr @__errno_location() #5
  store i32 %141, ptr %142, align 4, !tbaa !9
  %143 = load i32, ptr %7, align 4, !tbaa !9
  %144 = zext i32 %143 to i64
  %145 = getelementptr inbounds [0 x i16], ptr @lj_bc_ofs, i64 0, i64 %144
  %146 = load i16, ptr %145, align 2, !tbaa !34
  %147 = zext i16 %146 to i32
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds i8, ptr @lj_vm_asm_begin, i64 %148
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret ptr %149
}

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

declare hidden void @lj_trace_hot(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind willreturn memory(none) "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 = { 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 = { nounwind 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 = !{!"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 96}
!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}
!22 = !{!13, !10, i64 188}
!23 = !{!24, !7, i64 125}
!24 = !{!"global_State", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !25, i64 32, !10, i64 88, !26, i64 92, !27, i64 108, !7, i64 124, !7, i64 125, !7, i64 126, !7, i64 127, !15, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !28, i64 160, !29, i64 184, !10, i64 208, !10, i64 212, !6, i64 216, !6, i64 224, !6, i64 232, !10, i64 240, !10, i64 244, !15, i64 248, !17, i64 252, !17, i64 256, !7, i64 260}
!25 = !{!"GCState", !10, i64 0, !10, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !10, i64 12, !15, i64 16, !17, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52}
!26 = !{!"SBuf", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12}
!27 = !{!"GCstr", !15, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !10, i64 8, !10, i64 12}
!28 = !{!"Node", !7, i64 0, !7, i64 8, !17, i64 16, !17, i64 20}
!29 = !{!"GCupval", !15, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !17, i64 16, !10, i64 20}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = distinct !{!32, !31}
!33 = !{!13, !10, i64 136}
!34 = !{!16, !16, 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"

@lj_vm_asm_begin = external hidden global [0 x i8], align 1
@lj_bc_ofs = external hidden local_unnamed_addr constant [0 x i16], align 2

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #0

declare hidden void @lj_trace_ins(ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define hidden nonnull ptr @lj_dispatch_call(ptr noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = tail call ptr @__errno_location() #3
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %6, i64 -8
  %8 = load i32, ptr %7, align 8, !tbaa !9
  %9 = zext i32 %8 to i64
  %10 = inttoptr i64 %9 to ptr
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load i32, ptr %11, align 8, !tbaa !9
  %13 = zext i32 %12 to i64
  %14 = inttoptr i64 %13 to ptr
  %15 = getelementptr inbounds i8, ptr %14, i64 416
  %16 = tail call i32 @call_init(ptr noundef %0, ptr noundef %10)
  %17 = getelementptr inbounds i8, ptr %14, i64 512
  store ptr %0, ptr %17, align 8, !tbaa !10
  %18 = ptrtoint ptr %1 to i64
  %19 = and i64 %18, 1
  %.not = icmp eq i64 %19, 0
  br i1 %.not, label %23, label %20

20:                                               ; preds = %2
  %21 = and i64 %18, -2
  %22 = inttoptr i64 %21 to ptr
  tail call void @lj_trace_hot(ptr noundef nonnull %15, ptr noundef %22) #4
  br label %.critedge

23:                                               ; preds = %2
  %24 = getelementptr inbounds i8, ptr %14, i64 604
  %25 = load i32, ptr %24, align 4, !tbaa !21
  %.not37 = icmp eq i32 %25, 0
  br i1 %.not37, label %32, label %26

26:                                               ; preds = %23
  %27 = getelementptr inbounds i8, ptr %14, i64 125
  %28 = load i8, ptr %27, align 1, !tbaa !22
  %29 = and i8 %28, 96
  %.not38 = icmp eq i8 %29, 0
  br i1 %.not38, label %30, label %32

30:                                               ; preds = %26
  %31 = getelementptr inbounds i8, ptr %1, i64 -4
  tail call void @lj_trace_ins(ptr noundef nonnull %15, ptr noundef nonnull %31) #4
  br label %32

32:                                               ; preds = %23, %26, %30
  %33 = getelementptr inbounds i8, ptr %14, i64 125
  %34 = load i8, ptr %33, align 1, !tbaa !22
  %35 = and i8 %34, 1
  %.not39 = icmp eq i8 %35, 0
  br i1 %.not39, label %.critedge, label %.preheader

.preheader:                                       ; preds = %32
  %36 = icmp sgt i32 %16, 0
  br i1 %36, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader
  tail call void @callhook(ptr noundef nonnull %0, i32 noundef 0, i32 noundef -1)
  br label %.critedge

.lr.ph:                                           ; preds = %.preheader
  %37 = getelementptr inbounds i8, ptr %0, i64 24
  %xtraiter = and i32 %16, 3
  %38 = icmp ult i32 %16, 4
  br i1 %38, label %._crit_edge.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i32 %16, 2147483644
  br label %39

39:                                               ; preds = %39, %.lr.ph.new
  %niter = phi i32 [ 0, %.lr.ph.new ], [ %niter.next.3, %39 ]
  %40 = load ptr, ptr %37, align 8, !tbaa !9
  %41 = getelementptr inbounds i8, ptr %40, i64 8
  store ptr %41, ptr %37, align 8, !tbaa !9
  %42 = getelementptr inbounds i8, ptr %40, i64 4
  store i32 -1, ptr %42, align 4, !tbaa !9
  %43 = load ptr, ptr %37, align 8, !tbaa !9
  %44 = getelementptr inbounds i8, ptr %43, i64 8
  store ptr %44, ptr %37, align 8, !tbaa !9
  %45 = getelementptr inbounds i8, ptr %43, i64 4
  store i32 -1, ptr %45, align 4, !tbaa !9
  %46 = load ptr, ptr %37, align 8, !tbaa !9
  %47 = getelementptr inbounds i8, ptr %46, i64 8
  store ptr %47, ptr %37, align 8, !tbaa !9
  %48 = getelementptr inbounds i8, ptr %46, i64 4
  store i32 -1, ptr %48, align 4, !tbaa !9
  %49 = load ptr, ptr %37, align 8, !tbaa !9
  %50 = getelementptr inbounds i8, ptr %49, i64 8
  store ptr %50, ptr %37, align 8, !tbaa !9
  %51 = getelementptr inbounds i8, ptr %49, i64 4
  store i32 -1, ptr %51, align 4, !tbaa !9
  %niter.next.3 = add i32 %niter, 4
  %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.unr-lcssa, label %39, !llvm.loop !29

._crit_edge.unr-lcssa:                            ; preds = %39, %.lr.ph
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.unr-lcssa, %.epil.preheader
  %epil.iter = phi i32 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.unr-lcssa ]
  %52 = load ptr, ptr %37, align 8, !tbaa !9
  %53 = getelementptr inbounds i8, ptr %52, i64 8
  store ptr %53, ptr %37, align 8, !tbaa !9
  %54 = getelementptr inbounds i8, ptr %52, i64 4
  store i32 -1, ptr %54, align 4, !tbaa !9
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !31

._crit_edge:                                      ; preds = %.epil.preheader, %._crit_edge.unr-lcssa
  tail call void @callhook(ptr noundef nonnull %0, i32 noundef 0, i32 noundef -1)
  %55 = getelementptr inbounds i8, ptr %0, i64 24
  br i1 %36, label %.lr.ph44, label %.critedge

.lr.ph44:                                         ; preds = %._crit_edge
  %.promoted = load ptr, ptr %55, align 8, !tbaa !9
  br label %56

56:                                               ; preds = %.lr.ph44, %61
  %57 = phi ptr [ %.promoted, %.lr.ph44 ], [ %63, %61 ]
  %.in = phi i32 [ %16, %.lr.ph44 ], [ %62, %61 ]
  %58 = getelementptr inbounds i8, ptr %57, i64 -4
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = icmp eq i32 %59, -1
  br i1 %60, label %61, label %.critedge

61:                                               ; preds = %56
  %62 = add nsw i32 %.in, -1
  %63 = getelementptr inbounds i8, ptr %57, i64 -8
  store ptr %63, ptr %55, align 8, !tbaa !9
  %64 = icmp sgt i32 %.in, 1
  br i1 %64, label %56, label %.critedge, !llvm.loop !33

.critedge:                                        ; preds = %61, %56, %._crit_edge.thread, %._crit_edge, %32, %20
  %.033 = phi ptr [ %22, %20 ], [ %1, %32 ], [ %1, %._crit_edge ], [ %1, %._crit_edge.thread ], [ %1, %56 ], [ %1, %61 ]
  %65 = getelementptr inbounds i8, ptr %.033, i64 -4
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = and i32 %66, 255
  %68 = getelementptr inbounds i8, ptr %14, i64 552
  %69 = load i32, ptr %68, align 8, !tbaa !34
  %70 = and i32 %69, 1
  %.not40 = icmp eq i32 %70, 0
  br i1 %.not40, label %74, label %71

71:                                               ; preds = %.critedge
  %72 = getelementptr inbounds i8, ptr %14, i64 604
  %73 = load i32, ptr %72, align 4, !tbaa !21
  %.not41 = icmp eq i32 %73, 0
  br i1 %.not41, label %77, label %74

74:                                               ; preds = %71, %.critedge
  %trunc = trunc i32 %66 to i8
  switch i8 %trunc, label %77 [
    i8 92, label %75
    i8 89, label %75
  ]

75:                                               ; preds = %74, %74
  %76 = add nuw nsw i32 %67, 1
  br label %77

77:                                               ; preds = %74, %75, %71
  %.034 = phi i32 [ %76, %75 ], [ %67, %74 ], [ %67, %71 ]
  store i32 %4, ptr %3, align 4, !tbaa !5
  %78 = zext nneg i32 %.034 to i64
  %79 = getelementptr inbounds [0 x i16], ptr @lj_bc_ofs, i64 0, i64 %78
  %80 = load i16, ptr %79, align 2, !tbaa !35
  %81 = zext i16 %80 to i64
  %82 = getelementptr inbounds i8, ptr @lj_vm_asm_begin, i64 %81
  ret ptr %82
}

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

declare hidden void @lj_trace_hot(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { 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 willreturn memory(none) }
attributes #4 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !14, i64 96}
!11 = !{!"jit_State", !12, i64 0, !14, i64 96, !14, i64 104, !14, i64 112, !14, i64 120, !14, i64 128, !6, i64 136, !6, i64 140, !6, i64 144, !7, i64 148, !7, i64 149, !17, i64 150, !7, i64 151, !18, i64 152, !14, i64 176, !6, i64 184, !6, i64 188, !6, i64 192, !6, i64 196, !6, i64 200, !6, i64 204, !6, i64 208, !16, i64 212, !7, i64 216, !14, i64 256, !6, i64 264, !6, i64 268, !6, i64 272, !6, i64 276, !14, i64 280, !14, i64 288, !6, i64 296, !6, i64 300, !7, i64 304, !14, i64 312, !6, i64 320, !6, i64 324, !14, i64 328, !7, i64 336, !7, i64 536, !7, i64 1556, !7, i64 1616, !7, i64 1744, !6, i64 2256, !6, i64 2260, !7, i64 2264, !6, i64 2392, !19, i64 2396, !14, i64 2416, !6, i64 2424, !6, i64 2428, !14, i64 2432, !6, i64 2440, !6, i64 2444, !14, i64 2448, !14, i64 2456, !14, i64 2464, !20, i64 2472, !20, i64 2480, !7, i64 2488, !14, i64 2496, !6, i64 2504, !6, i64 2508}
!12 = !{!"GCtrace", !13, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !6, i64 8, !13, i64 12, !14, i64 16, !6, i64 24, !15, i64 28, !15, i64 30, !14, i64 32, !14, i64 40, !13, i64 48, !16, i64 52, !6, i64 56, !6, i64 60, !14, i64 64, !6, i64 72, !15, i64 76, !15, i64 78, !15, i64 80, !15, i64 82, !15, i64 84, !15, i64 86, !15, i64 88, !7, i64 90, !7, i64 91}
!13 = !{!"GCRef", !6, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!"MRef", !6, i64 0}
!17 = !{!"IRType1", !7, i64 0}
!18 = !{!"FoldState", !7, i64 0, !7, i64 8, !7, i64 16}
!19 = !{!"ScEvEntry", !16, i64 0, !15, i64 4, !15, i64 6, !15, i64 8, !15, i64 10, !17, i64 12, !7, i64 13}
!20 = !{!"long", !7, i64 0}
!21 = !{!11, !6, i64 188}
!22 = !{!23, !7, i64 125}
!23 = !{!"global_State", !14, i64 0, !6, i64 8, !6, i64 12, !14, i64 16, !14, i64 24, !24, i64 32, !6, i64 88, !25, i64 92, !26, i64 108, !7, i64 124, !7, i64 125, !7, i64 126, !7, i64 127, !13, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !27, i64 160, !28, i64 184, !6, i64 208, !6, i64 212, !14, i64 216, !14, i64 224, !14, i64 232, !6, i64 240, !6, i64 244, !13, i64 248, !16, i64 252, !16, i64 256, !7, i64 260}
!24 = !{!"GCState", !6, i64 0, !6, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !6, i64 12, !13, i64 16, !16, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52}
!25 = !{!"SBuf", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12}
!26 = !{!"GCstr", !13, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !6, i64 8, !6, i64 12}
!27 = !{!"Node", !7, i64 0, !7, i64 8, !16, i64 16, !16, i64 20}
!28 = !{!"GCupval", !13, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !16, i64 16, !6, i64 20}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.unroll.disable"}
!33 = distinct !{!33, !30}
!34 = !{!11, !6, i64 136}
!35 = !{!15, !15, i64 0}


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