; LLVM IR from ramsdell/lineqpp :: 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, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.lua_State = type { ptr, i8, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i16, i16, i8, i8, i32, i32, ptr, %struct.lua_TValue, %struct.lua_TValue, ptr, ptr, ptr, i64 }
%struct.global_State = type { %struct.stringtable, ptr, ptr, i8, i8, i32, ptr, ptr, ptr, ptr, ptr, ptr, %struct.Mbuffer, i64, i64, i64, i64, i32, i32, ptr, %struct.lua_TValue, ptr, %struct.UpVal, [9 x ptr], [17 x ptr] }
%struct.stringtable = type { ptr, i32, i32 }
%struct.Mbuffer = type { ptr, i64, i64 }
%struct.UpVal = type { ptr, i8, i8, ptr, %union.anon }
%union.anon = type { %struct.lua_TValue }
%struct.GCheader = type { ptr, i8, i8 }

@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 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 @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

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

declare hidden void @luaG_runerror(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define hidden void @luaV_settable(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #3 {
  %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 %struct.lua_TValue, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  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) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %149, %4
  %20 = load i32, ptr %9, align 4, !tbaa !9
  %21 = icmp slt i32 %20, 100
  br i1 %21, label %22, label %152

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.lua_TValue, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 8, !tbaa !11
  %26 = icmp eq i32 %25, 5
  br i1 %26, label %27, label %113

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.lua_TValue, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !13
  store ptr %30, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = load ptr, ptr %12, align 8, !tbaa !5
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = call ptr @luaH_set(ptr noundef %31, ptr noundef %32, ptr noundef %33)
  store ptr %34, ptr %13, align 8, !tbaa !5
  %35 = load ptr, ptr %13, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.lua_TValue, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 8, !tbaa !11
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %71

39:                                               ; preds = %27
  %40 = load ptr, ptr %12, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.Table, ptr %40, i32 0, i32 5
  %42 = load ptr, ptr %41, align 8, !tbaa !14
  %43 = icmp eq ptr %42, null
  br i1 %43, label %44, label %45

44:                                               ; preds = %39
  br label %68

45:                                               ; preds = %39
  %46 = load ptr, ptr %12, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.Table, ptr %46, i32 0, i32 5
  %48 = load ptr, ptr %47, align 8, !tbaa !14
  %49 = getelementptr inbounds %struct.Table, ptr %48, i32 0, i32 3
  %50 = load i8, ptr %49, align 2, !tbaa !16
  %51 = zext i8 %50 to i32
  %52 = and i32 %51, 2
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %55

54:                                               ; preds = %45
  br label %66

55:                                               ; preds = %45
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.Table, ptr %56, i32 0, i32 5
  %58 = load ptr, ptr %57, align 8, !tbaa !14
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.lua_State, ptr %59, i32 0, i32 6
  %61 = load ptr, ptr %60, align 8, !tbaa !17
  %62 = getelementptr inbounds %struct.global_State, ptr %61, i32 0, i32 24
  %63 = getelementptr inbounds [17 x ptr], ptr %62, i64 0, i64 1
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = call ptr @luaT_gettm(ptr noundef %58, i32 noundef 1, ptr noundef %64)
  br label %66

66:                                               ; preds = %55, %54
  %67 = phi ptr [ null, %54 ], [ %65, %55 ]
  br label %68

68:                                               ; preds = %66, %44
  %69 = phi ptr [ null, %44 ], [ %67, %66 ]
  store ptr %69, ptr %11, align 8, !tbaa !5
  %70 = icmp eq ptr %69, null
  br i1 %70, label %71, label %109

71:                                               ; preds = %68, %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %72, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %73 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %73, ptr %15, align 8, !tbaa !5
  %74 = load ptr, ptr %15, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.lua_TValue, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.lua_TValue, ptr %76, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %75, ptr align 8 %77, i64 8, i1 false), !tbaa.struct !21
  %78 = load ptr, ptr %14, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.lua_TValue, ptr %78, i32 0, i32 1
  %80 = load i32, ptr %79, align 8, !tbaa !11
  %81 = load ptr, ptr %15, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.lua_TValue, ptr %81, i32 0, i32 1
  store i32 %80, ptr %82, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  %83 = load ptr, ptr %12, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.Table, ptr %83, i32 0, i32 3
  store i8 0, ptr %84, align 2, !tbaa !16
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.lua_TValue, ptr %85, i32 0, i32 1
  %87 = load i32, ptr %86, align 8, !tbaa !11
  %88 = icmp sge i32 %87, 4
  br i1 %88, label %89, label %108

89:                                               ; preds = %71
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.lua_TValue, ptr %90, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !13
  %93 = getelementptr inbounds %struct.GCheader, ptr %92, i32 0, i32 2
  %94 = load i8, ptr %93, align 1, !tbaa !13
  %95 = zext i8 %94 to i32
  %96 = and i32 %95, 3
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %108

98:                                               ; preds = %89
  %99 = load ptr, ptr %12, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.GCheader, ptr %99, i32 0, i32 2
  %101 = load i8, ptr %100, align 1, !tbaa !13
  %102 = zext i8 %101 to i32
  %103 = and i32 %102, 4
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %105, label %108

105:                                              ; preds = %98
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = load ptr, ptr %12, align 8, !tbaa !5
  call void @luaC_barrierback(ptr noundef %106, ptr noundef %107)
  br label %108

108:                                              ; preds = %105, %98, %89, %71
  store i32 1, ptr %16, align 4
  br label %110

109:                                              ; preds = %68
  store i32 0, ptr %16, align 4
  br label %110

110:                                              ; preds = %109, %108
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %111 = load i32, ptr %16, align 4
  switch i32 %111, label %146 [
    i32 0, label %112
  ]

112:                                              ; preds = %110
  br label %124

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

120:                                              ; preds = %113
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  call void @luaG_typeerror(ptr noundef %121, ptr noundef %122, ptr noundef @.str.1)
  br label %123

123:                                              ; preds = %120, %113
  br label %124

124:                                              ; preds = %123, %112
  %125 = load ptr, ptr %11, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.lua_TValue, ptr %125, i32 0, i32 1
  %127 = load i32, ptr %126, align 8, !tbaa !11
  %128 = icmp eq i32 %127, 6
  br i1 %128, label %129, label %135

129:                                              ; preds = %124
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  %132 = load ptr, ptr %6, align 8, !tbaa !5
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = load ptr, ptr %8, align 8, !tbaa !5
  call void @callTM(ptr noundef %130, ptr noundef %131, ptr noundef %132, ptr noundef %133, ptr noundef %134)
  store i32 1, ptr %16, align 4
  br label %146

135:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %136 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %136, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  store ptr %10, ptr %18, align 8, !tbaa !5
  %137 = load ptr, ptr %18, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.lua_TValue, ptr %137, i32 0, i32 0
  %139 = load ptr, ptr %17, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.lua_TValue, ptr %139, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %138, ptr align 8 %140, i64 8, i1 false), !tbaa.struct !21
  %141 = load ptr, ptr %17, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.lua_TValue, ptr %141, i32 0, i32 1
  %143 = load i32, ptr %142, align 8, !tbaa !11
  %144 = load ptr, ptr %18, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.lua_TValue, ptr %144, i32 0, i32 1
  store i32 %143, ptr %145, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  store ptr %10, ptr %6, align 8, !tbaa !5
  store i32 0, ptr %16, align 4
  br label %146

146:                                              ; preds = %135, %129, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  %147 = load i32, ptr %16, align 4
  switch i32 %147, label %154 [
    i32 0, label %148
  ]

148:                                              ; preds = %146
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %9, align 4, !tbaa !9
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %9, align 4, !tbaa !9
  br label %19, !llvm.loop !22

152:                                              ; preds = %19
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ptr, ...) @luaG_runerror(ptr noundef %153, ptr noundef @.str.3)
  store i32 0, ptr %16, align 4
  br label %154

154:                                              ; preds = %152, %146
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  %155 = load i32, ptr %16, align 4
  switch i32 %155, label %157 [
    i32 0, label %156
    i32 1, label %156
  ]

156:                                              ; preds = %154, %154
  ret void

157:                                              ; preds = %154
  unreachable
}

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

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

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

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 = { 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 }

!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 16}
!15 = !{!"Table", !6, i64 0, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !10, i64 56}
!16 = !{!15, !7, i64 10}
!17 = !{!18, !6, i64 32}
!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, !10, i64 88, !10, i64 92, !19, i64 96, !19, i64 98, !7, i64 100, !7, i64 101, !10, i64 104, !10, i64 108, !6, i64 112, !12, i64 120, !12, i64 136, !6, i64 152, !6, i64 160, !6, i64 168, !20, i64 176}
!19 = !{!"short", !7, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{i64 0, i64 8, !13}
!22 = distinct !{!22, !23}
!23 = !{!"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.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define hidden void @luaV_settable(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #2 {
.peel.begin:
  %4 = alloca %struct.lua_TValue, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = getelementptr inbounds i8, ptr %4, i64 8
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp eq i32 %8, 5
  br i1 %9, label %16, label %10

10:                                               ; preds = %.peel.begin
  %11 = tail call ptr @luaT_gettmbyobj(ptr noundef %0, ptr noundef nonnull %1, i32 noundef 1) #3
  %12 = getelementptr inbounds i8, ptr %11, i64 8
  %13 = load i32, ptr %12, align 8, !tbaa !5
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %36

15:                                               ; preds = %10
  tail call void @luaG_typeerror(ptr noundef %0, ptr noundef nonnull %1, ptr noundef nonnull @.str.1) #3
  br label %36

16:                                               ; preds = %.peel.begin
  %17 = load ptr, ptr %1, align 8, !tbaa !10
  %18 = tail call ptr @luaH_set(ptr noundef %0, ptr noundef %17, ptr noundef %2) #3
  %19 = getelementptr inbounds i8, ptr %18, i64 8
  %20 = load i32, ptr %19, align 8, !tbaa !5
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %.thread

22:                                               ; preds = %16
  %23 = getelementptr inbounds i8, ptr %17, i64 16
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = icmp eq ptr %24, null
  br i1 %25, label %.thread, label %26

26:                                               ; preds = %22
  %27 = getelementptr inbounds i8, ptr %24, i64 10
  %28 = load i8, ptr %27, align 2, !tbaa !14
  %29 = and i8 %28, 2
  %.not.peel = icmp eq i8 %29, 0
  br i1 %.not.peel, label %30, label %.thread

30:                                               ; preds = %26
  %31 = load ptr, ptr %5, align 8, !tbaa !15
  %32 = getelementptr inbounds i8, ptr %31, i64 304
  %33 = load ptr, ptr %32, align 8, !tbaa !19
  %34 = tail call ptr @luaT_gettm(ptr noundef nonnull %24, i32 noundef 1, ptr noundef %33) #3
  %35 = icmp eq ptr %34, null
  br i1 %35, label %.thread, label %36

36:                                               ; preds = %30, %15, %10
  %.3.peel = phi ptr [ %11, %15 ], [ %11, %10 ], [ %34, %30 ]
  %37 = getelementptr inbounds i8, ptr %.3.peel, i64 8
  %38 = load i32, ptr %37, align 8, !tbaa !5
  %39 = icmp eq i32 %38, 6
  br i1 %39, label %.loopexit, label %.peel.next

.peel.next:                                       ; preds = %36
  %40 = load i64, ptr %.3.peel, align 8, !tbaa !10
  store i64 %40, ptr %4, align 8, !tbaa !10
  store i32 %38, ptr %6, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %.peel.next, %90
  %.in = phi i64 [ %40, %.peel.next ], [ %91, %90 ]
  %42 = phi i32 [ %38, %.peel.next ], [ %88, %90 ]
  %.04266 = phi i32 [ 1, %.peel.next ], [ %92, %90 ]
  %43 = inttoptr i64 %.in to ptr
  %44 = icmp eq i32 %42, 5
  br i1 %44, label %45, label %80

45:                                               ; preds = %41
  %46 = call ptr @luaH_set(ptr noundef %0, ptr noundef %43, ptr noundef %2) #3
  %47 = getelementptr inbounds i8, ptr %46, i64 8
  %48 = load i32, ptr %47, align 8, !tbaa !5
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %.thread

50:                                               ; preds = %45
  %51 = getelementptr inbounds i8, ptr %43, i64 16
  %52 = load ptr, ptr %51, align 8, !tbaa !11
  %53 = icmp eq ptr %52, null
  br i1 %53, label %.thread, label %54

54:                                               ; preds = %50
  %55 = getelementptr inbounds i8, ptr %52, i64 10
  %56 = load i8, ptr %55, align 2, !tbaa !14
  %57 = and i8 %56, 2
  %.not = icmp eq i8 %57, 0
  br i1 %.not, label %58, label %.thread

58:                                               ; preds = %54
  %59 = load ptr, ptr %5, align 8, !tbaa !15
  %60 = getelementptr inbounds i8, ptr %59, i64 304
  %61 = load ptr, ptr %60, align 8, !tbaa !19
  %62 = call ptr @luaT_gettm(ptr noundef nonnull %52, i32 noundef 1, ptr noundef %61) #3
  %63 = icmp eq ptr %62, null
  br i1 %63, label %.thread, label %86

.thread:                                          ; preds = %54, %50, %58, %45, %30, %26, %22, %16
  %.lcssa68 = phi ptr [ %17, %16 ], [ %17, %22 ], [ %17, %26 ], [ %17, %30 ], [ %43, %45 ], [ %43, %58 ], [ %43, %50 ], [ %43, %54 ]
  %.lcssa = phi ptr [ %18, %16 ], [ %18, %22 ], [ %18, %26 ], [ %18, %30 ], [ %46, %45 ], [ %46, %58 ], [ %46, %50 ], [ %46, %54 ]
  %64 = getelementptr inbounds i8, ptr %.lcssa, i64 8
  %65 = load i64, ptr %3, align 8, !tbaa !10
  store i64 %65, ptr %.lcssa, align 8, !tbaa !10
  %66 = getelementptr inbounds i8, ptr %3, i64 8
  %67 = load i32, ptr %66, align 8, !tbaa !5
  store i32 %67, ptr %64, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %.lcssa68, i64 10
  store i8 0, ptr %68, align 2, !tbaa !14
  %69 = icmp sgt i32 %67, 3
  br i1 %69, label %70, label %.thread57

70:                                               ; preds = %.thread
  %71 = load ptr, ptr %3, align 8, !tbaa !10
  %72 = getelementptr inbounds i8, ptr %71, i64 9
  %73 = load i8, ptr %72, align 1, !tbaa !10
  %74 = and i8 %73, 3
  %.not50 = icmp eq i8 %74, 0
  br i1 %.not50, label %.thread57, label %75

75:                                               ; preds = %70
  %76 = getelementptr inbounds i8, ptr %.lcssa68, i64 9
  %77 = load i8, ptr %76, align 1, !tbaa !10
  %78 = and i8 %77, 4
  %.not51 = icmp eq i8 %78, 0
  br i1 %.not51, label %.thread57, label %79

79:                                               ; preds = %75
  call void @luaC_barrierback(ptr noundef %0, ptr noundef nonnull %.lcssa68) #3
  br label %.thread57

80:                                               ; preds = %41
  %81 = call ptr @luaT_gettmbyobj(ptr noundef %0, ptr noundef nonnull %4, i32 noundef 1) #3
  %82 = getelementptr inbounds i8, ptr %81, i64 8
  %83 = load i32, ptr %82, align 8, !tbaa !5
  %84 = icmp eq i32 %83, 0
  br i1 %84, label %85, label %86

85:                                               ; preds = %80
  call void @luaG_typeerror(ptr noundef %0, ptr noundef nonnull %4, ptr noundef nonnull @.str.1) #3
  br label %86

86:                                               ; preds = %58, %80, %85
  %.3 = phi ptr [ %81, %85 ], [ %81, %80 ], [ %62, %58 ]
  %87 = getelementptr inbounds i8, ptr %.3, i64 8
  %88 = load i32, ptr %87, align 8, !tbaa !5
  %89 = icmp eq i32 %88, 6
  br i1 %89, label %.loopexit, label %90

.loopexit:                                        ; preds = %86, %36
  %.3.lcssa = phi ptr [ %.3.peel, %36 ], [ %.3, %86 ]
  %.067.lcssa69 = phi ptr [ %1, %36 ], [ %4, %86 ]
  call void @callTM(ptr noundef %0, ptr noundef nonnull %.3.lcssa, ptr noundef nonnull %.067.lcssa69, ptr noundef %2, ptr noundef %3)
  br label %.thread57

90:                                               ; preds = %86
  %91 = load i64, ptr %.3, align 8, !tbaa !10
  store i64 %91, ptr %4, align 8, !tbaa !10
  store i32 %88, ptr %6, align 8, !tbaa !5
  %92 = add nuw nsw i32 %.04266, 1
  %exitcond.not = icmp eq i32 %92, 100
  br i1 %exitcond.not, label %.loopexit73, label %41, !llvm.loop !20

.loopexit73:                                      ; preds = %90
  call void (ptr, ptr, ...) @luaG_runerror(ptr noundef %0, ptr noundef nonnull @.str.3) #3
  br label %.thread57

.thread57:                                        ; preds = %.thread, %70, %75, %79, %.loopexit, %.loopexit73
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  ret void
}

declare hidden ptr @luaH_set(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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 = !{!7, !7, i64 0}
!11 = !{!12, !13, i64 16}
!12 = !{!"Table", !13, i64 0, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !9, i64 56}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!12, !7, i64 10}
!15 = !{!16, !13, i64 32}
!16 = !{!"lua_State", !13, i64 0, !7, i64 8, !7, i64 9, !7, i64 10, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !9, i64 88, !9, i64 92, !17, i64 96, !17, i64 98, !7, i64 100, !7, i64 101, !9, i64 104, !9, i64 108, !13, i64 112, !6, i64 120, !6, i64 136, !13, i64 152, !13, i64 160, !13, i64 168, !18, i64 176}
!17 = !{!"short", !7, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!13, !13, i64 0}
!20 = distinct !{!20, !21, !22}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!"llvm.loop.peeled.count", i32 1}


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