; LLVM IR from ejoy/ejoy2d :: lua (lvm)

; 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_TValue = type { %union.Value, i32 }
%union.Value = type { ptr }
%struct.Table = type { ptr, i8, i8, i8, i8, i32, ptr, ptr, ptr, ptr, ptr }
%struct.lua_State = type { ptr, i8, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.CallInfo, ptr, i64, i32, i32, i32, i16, i16, i8, i8 }
%struct.CallInfo = type { ptr, ptr, ptr, ptr, %union.anon, i64, i16, i8 }
%union.anon = type { %struct.anon.0 }
%struct.anon.0 = type { ptr, i64, i64 }
%struct.global_State = type { ptr, ptr, i64, i64, i64, i64, %struct.stringtable, %struct.lua_TValue, i32, i8, i8, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.Mbuffer, i32, i32, i32, ptr, ptr, ptr, ptr, [24 x ptr], [9 x ptr] }
%struct.stringtable = type { ptr, i32, i32 }
%struct.Mbuffer = type { ptr, i64, i64 }
%struct.GCObject = type { ptr, i8, i8 }

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@luaO_nilobject_ = external hidden constant %struct.lua_TValue, align 8
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1

; 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

declare hidden ptr @luaH_get(ptr noundef, ptr noundef) #1

declare hidden ptr @luaT_gettm(ptr noundef, i32 noundef, ptr noundef) #1

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

declare hidden ptr @luaT_gettmbyobj(ptr noundef, ptr noundef, i32 noundef) #1

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

declare hidden void @luaT_callTM(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

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

; Function Attrs: nounwind uwtable
define hidden void @luaV_settable(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %138, %4
  %16 = load i32, ptr %9, align 4, !tbaa !9
  %17 = icmp slt i32 %16, 2000
  br i1 %17, label %18, label %141

18:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.lua_TValue, ptr %19, i32 0, i32 1
  %21 = load i32, ptr %20, align 8, !tbaa !11
  %22 = icmp eq i32 %21, 69
  br i1 %22, label %23, label %110

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.lua_TValue, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  store ptr %26, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %27 = load ptr, ptr %11, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = call ptr @luaH_get(ptr noundef %27, ptr noundef %28)
  store ptr %29, ptr %12, align 8, !tbaa !5
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.lua_TValue, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 8, !tbaa !11
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %74

34:                                               ; preds = %23
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.Table, ptr %35, i32 0, i32 9
  %37 = load ptr, ptr %36, align 8, !tbaa !14
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  br label %63

40:                                               ; preds = %34
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.Table, ptr %41, i32 0, i32 9
  %43 = load ptr, ptr %42, align 8, !tbaa !14
  %44 = getelementptr inbounds %struct.Table, ptr %43, i32 0, i32 3
  %45 = load i8, ptr %44, align 2, !tbaa !16
  %46 = zext i8 %45 to i32
  %47 = and i32 %46, 2
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %40
  br label %61

50:                                               ; preds = %40
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.Table, ptr %51, i32 0, i32 9
  %53 = load ptr, ptr %52, align 8, !tbaa !14
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.lua_State, ptr %54, i32 0, i32 5
  %56 = load ptr, ptr %55, align 8, !tbaa !17
  %57 = getelementptr inbounds %struct.global_State, ptr %56, i32 0, i32 32
  %58 = getelementptr inbounds [24 x ptr], ptr %57, i64 0, i64 1
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  %60 = call ptr @luaT_gettm(ptr noundef %53, i32 noundef 1, ptr noundef %59)
  br label %61

61:                                               ; preds = %50, %49
  %62 = phi ptr [ null, %49 ], [ %60, %50 ]
  br label %63

63:                                               ; preds = %61, %39
  %64 = phi ptr [ null, %39 ], [ %62, %61 ]
  store ptr %64, ptr %10, align 8, !tbaa !5
  %65 = icmp eq ptr %64, null
  br i1 %65, label %66, label %106

66:                                               ; preds = %63
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = icmp ne ptr %67, @luaO_nilobject_
  br i1 %68, label %74, label %69

69:                                               ; preds = %66
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = call ptr @luaH_newkey(ptr noundef %70, ptr noundef %71, ptr noundef %72)
  store ptr %73, ptr %12, align 8, !tbaa !5
  br i1 true, label %74, label %106

74:                                               ; preds = %69, %66, %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %75 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %75, ptr %13, align 8, !tbaa !5
  %76 = load ptr, ptr %13, align 8, !tbaa !5
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %76, ptr align 8 %77, i64 16, i1 false), !tbaa.struct !22
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.Table, ptr %79, i32 0, i32 3
  store i8 0, ptr %80, align 2, !tbaa !16
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.lua_TValue, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 8, !tbaa !11
  %84 = and i32 %83, 64
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %105

86:                                               ; preds = %74
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.Table, ptr %87, i32 0, i32 2
  %89 = load i8, ptr %88, align 1, !tbaa !23
  %90 = zext i8 %89 to i32
  %91 = and i32 %90, 4
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %93, label %105

93:                                               ; preds = %86
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.lua_TValue, ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8, !tbaa !13
  %97 = getelementptr inbounds %struct.GCObject, ptr %96, i32 0, i32 2
  %98 = load i8, ptr %97, align 1, !tbaa !24
  %99 = zext i8 %98 to i32
  %100 = and i32 %99, 3
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %105

102:                                              ; preds = %93
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = load ptr, ptr %11, align 8, !tbaa !5
  call void @luaC_barrierback_(ptr noundef %103, ptr noundef %104)
  br label %105

105:                                              ; preds = %102, %93, %86, %74
  store i32 1, ptr %14, align 4
  br label %107

106:                                              ; preds = %69, %63
  store i32 0, ptr %14, align 4
  br label %107

107:                                              ; preds = %106, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  %108 = load i32, ptr %14, align 4
  switch i32 %108, label %135 [
    i32 0, label %109
  ]

109:                                              ; preds = %107
  br label %121

110:                                              ; preds = %18
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = call ptr @luaT_gettmbyobj(ptr noundef %111, ptr noundef %112, i32 noundef 1)
  store ptr %113, ptr %10, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.lua_TValue, ptr %113, i32 0, i32 1
  %115 = load i32, ptr %114, align 8, !tbaa !11
  %116 = icmp eq i32 %115, 0
  br i1 %116, label %117, label %120

117:                                              ; preds = %110
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  call void @luaG_typeerror(ptr noundef %118, ptr noundef %119, ptr noundef @.str) #6
  unreachable

120:                                              ; preds = %110
  br label %121

121:                                              ; preds = %120, %109
  %122 = load ptr, ptr %10, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.lua_TValue, ptr %122, i32 0, i32 1
  %124 = load i32, ptr %123, align 8, !tbaa !11
  %125 = and i32 %124, 15
  %126 = icmp eq i32 %125, 6
  br i1 %126, label %127, label %133

127:                                              ; preds = %121
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = load ptr, ptr %10, align 8, !tbaa !5
  %130 = load ptr, ptr %6, align 8, !tbaa !5
  %131 = load ptr, ptr %7, align 8, !tbaa !5
  %132 = load ptr, ptr %8, align 8, !tbaa !5
  call void @luaT_callTM(ptr noundef %128, ptr noundef %129, ptr noundef %130, ptr noundef %131, ptr noundef %132, i32 noundef 0)
  store i32 1, ptr %14, align 4
  br label %135

133:                                              ; preds = %121
  %134 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %134, ptr %6, align 8, !tbaa !5
  store i32 0, ptr %14, align 4
  br label %135

135:                                              ; preds = %133, %127, %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %136 = load i32, ptr %14, align 4
  switch i32 %136, label %143 [
    i32 0, label %137
  ]

137:                                              ; preds = %135
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %9, align 4, !tbaa !9
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %9, align 4, !tbaa !9
  br label %15, !llvm.loop !26

141:                                              ; preds = %15
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ptr, ...) @luaG_runerror(ptr noundef %142, ptr noundef @.str.2) #6
  unreachable

143:                                              ; preds = %135
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret void
}

declare hidden ptr @luaH_newkey(ptr noundef, ptr noundef, ptr noundef) #1

declare hidden void @luaC_barrierback_(ptr noundef, ptr noundef) #1

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }
attributes #6 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"lua_TValue", !7, i64 0, !10, i64 8}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !6, i64 40}
!15 = !{!"Table", !6, i64 0, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!16 = !{!15, !7, i64 10}
!17 = !{!18, !6, i64 24}
!18 = !{!"lua_State", !6, i64 0, !7, i64 8, !7, i64 9, !7, i64 10, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !19, i64 96, !6, i64 168, !20, i64 176, !10, i64 184, !10, i64 188, !10, i64 192, !21, i64 196, !21, i64 198, !7, i64 200, !7, i64 201}
!19 = !{!"CallInfo", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !20, i64 56, !21, i64 64, !7, i64 66}
!20 = !{!"long", !7, i64 0}
!21 = !{!"short", !7, i64 0}
!22 = !{i64 0, i64 8, !13, i64 8, i64 4, !9}
!23 = !{!15, !7, i64 9}
!24 = !{!25, !7, i64 9}
!25 = !{!"GCObject", !6, i64 0, !7, i64 8, !7, i64 9}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; 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.lua_TValue = type { %union.Value, i32 }
%union.Value = type { ptr }

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@luaO_nilobject_ = external hidden constant %struct.lua_TValue, align 8
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1

declare hidden ptr @luaH_get(ptr noundef, ptr noundef) local_unnamed_addr #0

declare hidden ptr @luaT_gettm(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

declare hidden ptr @luaT_gettmbyobj(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

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

declare hidden void @luaT_callTM(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define hidden void @luaV_settable(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #3 {
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %.phi.trans.insert = getelementptr inbounds i8, ptr %1, i64 8
  %.pre = load i32, ptr %.phi.trans.insert, align 8, !tbaa !5
  br label %8

6:                                                ; preds = %53
  %7 = add nuw nsw i32 %.04269, 1
  %exitcond.not = icmp eq i32 %7, 2000
  br i1 %exitcond.not, label %58, label %8, !llvm.loop !10

8:                                                ; preds = %4, %6
  %9 = phi i32 [ %.pre, %4 ], [ %54, %6 ]
  %.03970 = phi ptr [ %1, %4 ], [ %.3, %6 ]
  %.04269 = phi i32 [ 0, %4 ], [ %7, %6 ]
  %10 = icmp eq i32 %9, 69
  br i1 %10, label %11, label %47

11:                                               ; preds = %8
  %12 = load ptr, ptr %.03970, align 8, !tbaa !12
  %13 = tail call ptr @luaH_get(ptr noundef %12, ptr noundef %2) #4
  %14 = getelementptr inbounds i8, ptr %13, i64 8
  %15 = load i32, ptr %14, align 8, !tbaa !5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %.loopexit

17:                                               ; preds = %11
  %18 = getelementptr inbounds i8, ptr %12, i64 40
  %19 = load ptr, ptr %18, align 8, !tbaa !13
  %20 = icmp eq ptr %19, null
  br i1 %20, label %.thread, label %21

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %19, i64 10
  %23 = load i8, ptr %22, align 2, !tbaa !16
  %24 = and i8 %23, 2
  %.not = icmp eq i8 %24, 0
  br i1 %.not, label %25, label %.thread

25:                                               ; preds = %21
  %26 = load ptr, ptr %5, align 8, !tbaa !17
  %27 = getelementptr inbounds i8, ptr %26, i64 256
  %28 = load ptr, ptr %27, align 8, !tbaa !22
  %29 = tail call ptr @luaT_gettm(ptr noundef nonnull %19, i32 noundef 1, ptr noundef %28) #4
  %30 = icmp eq ptr %29, null
  br i1 %30, label %.thread, label %._crit_edge

._crit_edge:                                      ; preds = %25
  %.phi.trans.insert79 = getelementptr inbounds i8, ptr %29, i64 8
  %.pre80 = load i32, ptr %.phi.trans.insert79, align 8, !tbaa !5
  br label %53

.thread:                                          ; preds = %21, %17, %25
  %.not49 = icmp eq ptr %13, @luaO_nilobject_
  br i1 %.not49, label %31, label %.loopexit

31:                                               ; preds = %.thread
  %32 = tail call ptr @luaH_newkey(ptr noundef %0, ptr noundef nonnull %12, ptr noundef %2) #4
  br label %.loopexit

.loopexit:                                        ; preds = %11, %31, %.thread
  %.041 = phi ptr [ %13, %.thread ], [ %32, %31 ], [ %13, %11 ]
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %.041, ptr noundef nonnull align 8 dereferenceable(16) %3, i64 16, i1 false), !tbaa.struct !23
  %33 = getelementptr inbounds i8, ptr %12, i64 10
  store i8 0, ptr %33, align 2, !tbaa !16
  %34 = getelementptr inbounds i8, ptr %3, i64 8
  %35 = load i32, ptr %34, align 8, !tbaa !5
  %36 = and i32 %35, 64
  %.not50 = icmp eq i32 %36, 0
  br i1 %.not50, label %.thread54, label %37

37:                                               ; preds = %.loopexit
  %38 = getelementptr inbounds i8, ptr %12, i64 9
  %39 = load i8, ptr %38, align 1, !tbaa !25
  %40 = and i8 %39, 4
  %.not51 = icmp eq i8 %40, 0
  br i1 %.not51, label %.thread54, label %41

41:                                               ; preds = %37
  %42 = load ptr, ptr %3, align 8, !tbaa !12
  %43 = getelementptr inbounds i8, ptr %42, i64 9
  %44 = load i8, ptr %43, align 1, !tbaa !26
  %45 = and i8 %44, 3
  %.not52 = icmp eq i8 %45, 0
  br i1 %.not52, label %.thread54, label %46

46:                                               ; preds = %41
  tail call void @luaC_barrierback_(ptr noundef %0, ptr noundef nonnull %12) #4
  br label %.thread54

47:                                               ; preds = %8
  %48 = tail call ptr @luaT_gettmbyobj(ptr noundef %0, ptr noundef nonnull %.03970, i32 noundef 1) #4
  %49 = getelementptr inbounds i8, ptr %48, i64 8
  %50 = load i32, ptr %49, align 8, !tbaa !5
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %53

52:                                               ; preds = %47
  tail call void @luaG_typeerror(ptr noundef %0, ptr noundef nonnull %.03970, ptr noundef nonnull @.str) #5
  unreachable

53:                                               ; preds = %._crit_edge, %47
  %54 = phi i32 [ %50, %47 ], [ %.pre80, %._crit_edge ]
  %.3 = phi ptr [ %48, %47 ], [ %29, %._crit_edge ]
  %55 = and i32 %54, 15
  %56 = icmp eq i32 %55, 6
  br i1 %56, label %57, label %6

57:                                               ; preds = %53
  tail call void @luaT_callTM(ptr noundef %0, ptr noundef nonnull %.3, ptr noundef nonnull %.03970, ptr noundef %2, ptr noundef %3, i32 noundef 0) #4
  br label %.thread54

58:                                               ; preds = %6
  tail call void (ptr, ptr, ...) @luaG_runerror(ptr noundef %0, ptr noundef nonnull @.str.2) #5
  unreachable

.thread54:                                        ; preds = %.loopexit, %37, %41, %46, %57
  ret void
}

declare hidden ptr @luaH_newkey(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare hidden void @luaC_barrierback_(ptr noundef, ptr noundef) local_unnamed_addr #0

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !9, i64 8}
!6 = !{!"lua_TValue", !7, i64 0, !9, i64 8}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !15, i64 40}
!14 = !{!"Table", !15, i64 0, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !9, i64 12, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!14, !7, i64 10}
!17 = !{!18, !15, i64 24}
!18 = !{!"lua_State", !15, i64 0, !7, i64 8, !7, i64 9, !7, i64 10, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !19, i64 96, !15, i64 168, !20, i64 176, !9, i64 184, !9, i64 188, !9, i64 192, !21, i64 196, !21, i64 198, !7, i64 200, !7, i64 201}
!19 = !{!"CallInfo", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !7, i64 32, !20, i64 56, !21, i64 64, !7, i64 66}
!20 = !{!"long", !7, i64 0}
!21 = !{!"short", !7, i64 0}
!22 = !{!15, !15, i64 0}
!23 = !{i64 0, i64 8, !12, i64 8, i64 4, !24}
!24 = !{!9, !9, i64 0}
!25 = !{!14, !7, i64 9}
!26 = !{!27, !7, i64 9}
!27 = !{!"GCObject", !15, i64 0, !7, i64 8, !7, i64 9}


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