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

; 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.LoopState = type { ptr, ptr, 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.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.GG_State = type { %struct.lua_State, %struct.global_State, %struct.jit_State, [64 x i16], [243 x ptr], [57 x i32] }
%struct.lua_State = type { %union.anon.4 }
%union.anon.4 = type { %struct.anon.5, [320 x i8] }
%struct.anon.5 = type { %struct.GCRef, i8, i8, i8, i8, %struct.MRef, %struct.GCRef, ptr, ptr, %struct.MRef, %struct.MRef, %struct.GCRef, %struct.GCRef, ptr, 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.6, %struct.MRef, i32 }
%union.anon.6 = type { %union.TValue }
%struct.anon.1 = type { %union.anon, i32 }
%union.anon = type { %struct.GCRef }

; Function Attrs: nounwind uwtable
define hidden i32 @lj_opt_loop(ptr noundef %0) #0 {
  %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 %struct.LoopState, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.jit_State, ptr %12, i32 0, i32 0
  %14 = getelementptr inbounds %struct.GCtrace, ptr %13, i32 0, i32 5
  %15 = load i32, ptr %14, align 8, !tbaa !9
  store i32 %15, ptr %4, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.jit_State, ptr %16, i32 0, i32 0
  %18 = getelementptr inbounds %struct.GCtrace, ptr %17, i32 0, i32 9
  %19 = load i16, ptr %18, align 4, !tbaa !21
  %20 = zext i16 %19 to i32
  store i32 %20, ptr %5, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.jit_State, ptr %21, i32 0, i32 0
  %23 = getelementptr inbounds %struct.GCtrace, ptr %22, i32 0, i32 10
  %24 = load i16, ptr %23, align 2, !tbaa !22
  %25 = zext i16 %24 to i32
  store i32 %25, ptr %6, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.LoopState, ptr %7, i32 0, i32 0
  store ptr %26, ptr %27, align 8, !tbaa !23
  %28 = getelementptr inbounds %struct.LoopState, ptr %7, i32 0, i32 1
  store ptr null, ptr %28, align 8, !tbaa !25
  %29 = getelementptr inbounds %struct.LoopState, ptr %7, i32 0, i32 2
  store i32 0, ptr %29, align 8, !tbaa !26
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.jit_State, ptr %30, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8, !tbaa !27
  %33 = call i32 @lj_vm_cpcall(ptr noundef %32, ptr noundef null, ptr noundef %7, ptr noundef @cploop_opt)
  store i32 %33, ptr %8, align 4, !tbaa !20
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 -800
  %36 = getelementptr inbounds %struct.GG_State, ptr %35, i32 0, i32 1
  %37 = getelementptr inbounds %struct.LoopState, ptr %7, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !25
  %39 = getelementptr inbounds %struct.LoopState, ptr %7, i32 0, i32 2
  %40 = load i32, ptr %39, align 8, !tbaa !26
  %41 = zext i32 %40 to i64
  %42 = mul i64 %41, 2
  call void @lj_mem_free(ptr noundef %36, ptr noundef %38, i64 noundef %42)
  %43 = load i32, ptr %8, align 4, !tbaa !20
  %44 = icmp ne i32 %43, 0
  %45 = xor i1 %44, true
  %46 = xor i1 %45, true
  %47 = zext i1 %46 to i32
  %48 = sext i32 %47 to i64
  %49 = call i64 @llvm.expect.i64(i64 %48, i64 0)
  %50 = icmp ne i64 %49, 0
  br i1 %50, label %51, label %100

51:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.jit_State, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !27
  store ptr %54, ptr %9, align 8, !tbaa !5
  %55 = load i32, ptr %8, align 4, !tbaa !20
  %56 = icmp eq i32 %55, 2
  br i1 %56, label %57, label %96

57:                                               ; preds = %51
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.lua_State, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %struct.anon.5, ptr %59, i32 0, i32 8
  %61 = load ptr, ptr %60, align 8, !tbaa !28
  %62 = getelementptr inbounds %union.TValue, ptr %61, i64 -1
  %63 = getelementptr inbounds %struct.anon.1, ptr %62, i32 0, i32 1
  %64 = load i32, ptr %63, align 4, !tbaa !28
  %65 = icmp ule i32 %64, -65537
  br i1 %65, label %66, label %96

66:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %67 = load ptr, ptr %9, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.lua_State, ptr %67, i32 0, i32 0
  %69 = getelementptr inbounds %struct.anon.5, ptr %68, i32 0, i32 8
  %70 = load ptr, ptr %69, align 8, !tbaa !28
  %71 = getelementptr inbounds %union.TValue, ptr %70, i64 -1
  %72 = call i32 @numberVint(ptr noundef %71)
  store i32 %72, ptr %10, align 4, !tbaa !20
  %73 = load i32, ptr %10, align 4, !tbaa !20
  switch i32 %73, label %91 [
    i32 26, label %74
    i32 24, label %74
  ]

74:                                               ; preds = %66, %66
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.jit_State, ptr %75, i32 0, i32 17
  %77 = load i32, ptr %76, align 8, !tbaa !29
  %78 = add nsw i32 %77, -1
  store i32 %78, ptr %76, align 8, !tbaa !29
  %79 = icmp slt i32 %78, 0
  br i1 %79, label %80, label %81

80:                                               ; preds = %74
  br label %92

81:                                               ; preds = %74
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.lua_State, ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds %struct.anon.5, ptr %83, i32 0, i32 8
  %85 = load ptr, ptr %84, align 8, !tbaa !28
  %86 = getelementptr inbounds %union.TValue, ptr %85, i32 -1
  store ptr %86, ptr %84, align 8, !tbaa !28
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = load i32, ptr %4, align 4, !tbaa !20
  %89 = load i32, ptr %5, align 4, !tbaa !20
  %90 = load i32, ptr %6, align 4, !tbaa !20
  call void @loop_undo(ptr noundef %87, i32 noundef %88, i32 noundef %89, i32 noundef %90)
  store i32 1, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %93

91:                                               ; preds = %66
  br label %92

92:                                               ; preds = %91, %80
  store i32 0, ptr %11, align 4
  br label %93

93:                                               ; preds = %92, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %94 = load i32, ptr %11, align 4
  switch i32 %94, label %99 [
    i32 0, label %95
  ]

95:                                               ; preds = %93
  br label %96

96:                                               ; preds = %95, %57, %51
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  %98 = load i32, ptr %8, align 4, !tbaa !20
  call void @lj_err_throw(ptr noundef %97, i32 noundef %98) #7
  unreachable

99:                                               ; preds = %93
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %101

100:                                              ; preds = %1
  store i32 0, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %101

101:                                              ; preds = %100, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  %102 = load i32, ptr %2, align 4
  ret i32 %102
}

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @cploop_opt(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @lj_mem_free(ptr noundef, ptr noundef, i64 noundef) #3

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

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

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

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn }

!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, !13, i64 8}
!10 = !{!"jit_State", !11, i64 0, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !13, i64 136, !13, i64 140, !13, i64 144, !7, i64 148, !7, i64 149, !16, i64 150, !7, i64 151, !17, i64 152, !6, i64 176, !13, i64 184, !13, i64 188, !13, i64 192, !13, i64 196, !13, i64 200, !13, i64 204, !13, i64 208, !15, i64 212, !7, i64 216, !6, i64 256, !13, i64 264, !13, i64 268, !13, i64 272, !13, i64 276, !6, i64 280, !6, i64 288, !13, i64 296, !13, i64 300, !7, i64 304, !6, i64 312, !13, i64 320, !13, i64 324, !6, i64 328, !7, i64 336, !7, i64 536, !7, i64 1556, !7, i64 1616, !7, i64 1744, !13, i64 2256, !13, i64 2260, !7, i64 2264, !13, i64 2392, !18, i64 2396, !6, i64 2416, !13, i64 2424, !13, i64 2428, !6, i64 2432, !13, i64 2440, !13, i64 2444, !6, i64 2448, !6, i64 2456, !6, i64 2464, !19, i64 2472, !19, i64 2480, !7, i64 2488, !6, i64 2496, !13, i64 2504, !13, i64 2508}
!11 = !{!"GCtrace", !12, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !13, i64 8, !12, i64 12, !6, i64 16, !13, i64 24, !14, i64 28, !14, i64 30, !6, i64 32, !6, i64 40, !12, i64 48, !15, i64 52, !13, i64 56, !13, i64 60, !6, i64 64, !13, i64 72, !14, i64 76, !14, i64 78, !14, i64 80, !14, i64 82, !14, i64 84, !14, i64 86, !14, i64 88, !7, i64 90, !7, i64 91}
!12 = !{!"GCRef", !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!"MRef", !13, i64 0}
!16 = !{!"IRType1", !7, i64 0}
!17 = !{!"FoldState", !7, i64 0, !7, i64 8, !7, i64 16}
!18 = !{!"ScEvEntry", !15, i64 0, !14, i64 4, !14, i64 6, !14, i64 8, !14, i64 10, !16, i64 12, !7, i64 13}
!19 = !{!"long", !7, i64 0}
!20 = !{!13, !13, i64 0}
!21 = !{!10, !14, i64 28}
!22 = !{!10, !14, i64 30}
!23 = !{!24, !6, i64 0}
!24 = !{!"LoopState", !6, i64 0, !6, i64 8, !13, i64 16}
!25 = !{!24, !6, i64 8}
!26 = !{!24, !13, i64 16}
!27 = !{!10, !6, i64 96}
!28 = !{!7, !7, i64 0}
!29 = !{!10, !13, i64 192}


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

%struct.LoopState = type { ptr, ptr, i32 }

; Function Attrs: nounwind uwtable
define hidden range(i32 0, 2) i32 @lj_opt_loop(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca %struct.LoopState, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 28
  %6 = load i16, ptr %5, align 4, !tbaa !19
  %7 = zext i16 %6 to i32
  %8 = getelementptr inbounds i8, ptr %0, i64 30
  %9 = load i16, ptr %8, align 2, !tbaa !20
  %10 = zext i16 %9 to i32
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #5
  store ptr %0, ptr %2, align 8, !tbaa !21
  %11 = getelementptr inbounds i8, ptr %2, i64 8
  store ptr null, ptr %11, align 8, !tbaa !23
  %12 = getelementptr inbounds i8, ptr %2, i64 16
  store i32 0, ptr %12, align 8, !tbaa !24
  %13 = getelementptr inbounds i8, ptr %0, i64 96
  %14 = load ptr, ptr %13, align 8, !tbaa !25
  %15 = call i32 @lj_vm_cpcall(ptr noundef %14, ptr noundef null, ptr noundef nonnull %2, ptr noundef nonnull @cploop_opt) #5
  %16 = getelementptr inbounds i8, ptr %0, i64 -416
  %17 = load ptr, ptr %11, align 8, !tbaa !23
  %18 = load i32, ptr %12, align 8, !tbaa !24
  %19 = zext i32 %18 to i64
  %20 = shl nuw nsw i64 %19, 1
  call void @lj_mem_free(ptr noundef nonnull %16, ptr noundef %17, i64 noundef %20)
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %41, label %21, !prof !26

21:                                               ; preds = %1
  %22 = load ptr, ptr %13, align 8, !tbaa !25
  %23 = icmp eq i32 %15, 2
  br i1 %23, label %24, label %40

24:                                               ; preds = %21
  %25 = getelementptr inbounds i8, ptr %22, i64 24
  %26 = load ptr, ptr %25, align 8, !tbaa !27
  %27 = getelementptr inbounds i8, ptr %26, i64 -4
  %28 = load i32, ptr %27, align 4, !tbaa !27
  %29 = icmp ult i32 %28, -65536
  br i1 %29, label %30, label %40

30:                                               ; preds = %24
  %31 = getelementptr inbounds i8, ptr %26, i64 -8
  %32 = call i32 @numberVint(ptr noundef nonnull %31)
  switch i32 %32, label %40 [
    i32 26, label %33
    i32 24, label %33
  ]

33:                                               ; preds = %30, %30
  %34 = getelementptr inbounds i8, ptr %0, i64 192
  %35 = load i32, ptr %34, align 8, !tbaa !28
  %36 = add nsw i32 %35, -1
  store i32 %36, ptr %34, align 8, !tbaa !28
  %37 = icmp slt i32 %35, 1
  br i1 %37, label %40, label %.critedge

.critedge:                                        ; preds = %33
  %38 = load ptr, ptr %25, align 8, !tbaa !27
  %39 = getelementptr inbounds i8, ptr %38, i64 -8
  store ptr %39, ptr %25, align 8, !tbaa !27
  call void @loop_undo(ptr noundef nonnull %0, i32 noundef %4, i32 noundef %7, i32 noundef %10)
  br label %41

40:                                               ; preds = %30, %33, %24, %21
  call void @lj_err_throw(ptr noundef %22, i32 noundef %15) #6
  unreachable

41:                                               ; preds = %1, %.critedge
  %.1 = phi i32 [ 1, %.critedge ], [ 0, %1 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #5
  ret i32 %.1
}

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

declare hidden i32 @lj_vm_cpcall(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden ptr @cploop_opt(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @lj_mem_free(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

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

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

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

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { 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, !9, i64 8}
!6 = !{!"jit_State", !7, i64 0, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !9, i64 136, !9, i64 140, !9, i64 144, !10, i64 148, !10, i64 149, !15, i64 150, !10, i64 151, !16, i64 152, !12, i64 176, !9, i64 184, !9, i64 188, !9, i64 192, !9, i64 196, !9, i64 200, !9, i64 204, !9, i64 208, !14, i64 212, !10, i64 216, !12, i64 256, !9, i64 264, !9, i64 268, !9, i64 272, !9, i64 276, !12, i64 280, !12, i64 288, !9, i64 296, !9, i64 300, !10, i64 304, !12, i64 312, !9, i64 320, !9, i64 324, !12, i64 328, !10, i64 336, !10, i64 536, !10, i64 1556, !10, i64 1616, !10, i64 1744, !9, i64 2256, !9, i64 2260, !10, i64 2264, !9, i64 2392, !17, i64 2396, !12, i64 2416, !9, i64 2424, !9, i64 2428, !12, i64 2432, !9, i64 2440, !9, i64 2444, !12, i64 2448, !12, i64 2456, !12, i64 2464, !18, i64 2472, !18, i64 2480, !10, i64 2488, !12, i64 2496, !9, i64 2504, !9, i64 2508}
!7 = !{!"GCtrace", !8, i64 0, !10, i64 4, !10, i64 5, !10, i64 6, !10, i64 7, !9, i64 8, !8, i64 12, !12, i64 16, !9, i64 24, !13, i64 28, !13, i64 30, !12, i64 32, !12, i64 40, !8, i64 48, !14, i64 52, !9, i64 56, !9, i64 60, !12, i64 64, !9, i64 72, !13, i64 76, !13, i64 78, !13, i64 80, !13, i64 82, !13, i64 84, !13, i64 86, !13, i64 88, !10, i64 90, !10, i64 91}
!8 = !{!"GCRef", !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!"short", !10, i64 0}
!14 = !{!"MRef", !9, i64 0}
!15 = !{!"IRType1", !10, i64 0}
!16 = !{!"FoldState", !10, i64 0, !10, i64 8, !10, i64 16}
!17 = !{!"ScEvEntry", !14, i64 0, !13, i64 4, !13, i64 6, !13, i64 8, !13, i64 10, !15, i64 12, !10, i64 13}
!18 = !{!"long", !10, i64 0}
!19 = !{!6, !13, i64 28}
!20 = !{!6, !13, i64 30}
!21 = !{!22, !12, i64 0}
!22 = !{!"LoopState", !12, i64 0, !12, i64 8, !9, i64 16}
!23 = !{!22, !12, i64 8}
!24 = !{!22, !9, i64 16}
!25 = !{!6, !12, i64 96}
!26 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!27 = !{!10, !10, i64 0}
!28 = !{!6, !9, i64 192}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass