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

; 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.Node = type { %struct.lua_TValue, %union.TKey }
%struct.lua_TValue = type { %union.Value, i32 }
%union.Value = type { ptr }
%union.TKey = type { %struct.anon }
%struct.anon = type { %union.Value, i32, i32 }
%struct.Table = type { ptr, i8, i8, i8, i8, i32, ptr, ptr, ptr, ptr, ptr }
%struct.GCObject = type { ptr, i8, i8 }

@dummynode_ = external hidden constant %struct.Node, align 8
@.str = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 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

; 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) #1

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

; Function Attrs: nounwind uwtable
define hidden ptr @luaH_newkey(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.lua_TValue, align 8
  %10 = alloca double, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.lua_TValue, ptr %18, i32 0, i32 1
  %20 = load i32, ptr %19, align 8, !tbaa !9
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %3
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ptr, ...) @luaG_runerror(ptr noundef %23, ptr noundef @.str) #6
  unreachable

24:                                               ; preds = %3
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.lua_TValue, ptr %25, i32 0, i32 1
  %27 = load i32, ptr %26, align 8, !tbaa !9
  %28 = icmp eq i32 %27, 3
  br i1 %28, label %29, label %49

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.lua_TValue, ptr %30, i32 0, i32 0
  %32 = load double, ptr %31, align 8, !tbaa !12
  store double %32, ptr %10, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %33 = load double, ptr %10, align 8, !tbaa !13
  %34 = load double, ptr %10, align 8, !tbaa !13
  %35 = fcmp oeq double %33, %34
  br i1 %35, label %38, label %36

36:                                               ; preds = %29
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ptr, ...) @luaG_runerror(ptr noundef %37, ptr noundef @.str.1) #6
  unreachable

38:                                               ; preds = %29
  %39 = load double, ptr %10, align 8, !tbaa !13
  %40 = call i32 @numisinteger(double noundef %39, ptr noundef %11)
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %48

42:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store ptr %9, ptr %12, align 8, !tbaa !5
  %43 = load i64, ptr %11, align 8, !tbaa !15
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.lua_TValue, ptr %44, i32 0, i32 0
  store i64 %43, ptr %45, align 8, !tbaa !12
  %46 = load ptr, ptr %12, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.lua_TValue, ptr %46, i32 0, i32 1
  store i32 19, ptr %47, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  store ptr %9, ptr %7, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %42, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %49

49:                                               ; preds = %48, %24
  br label %50

50:                                               ; preds = %49
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = call ptr @mainposition(ptr noundef %51, ptr noundef %52)
  store ptr %53, ptr %8, align 8, !tbaa !5
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.Node, ptr %54, i32 0, i32 0
  %56 = getelementptr inbounds %struct.lua_TValue, ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 8, !tbaa !17
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %62

59:                                               ; preds = %50
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = icmp eq ptr %60, @dummynode_
  br i1 %61, label %62, label %180

62:                                               ; preds = %59, %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = call ptr @getfreepos(ptr noundef %63)
  store ptr %64, ptr %14, align 8, !tbaa !5
  %65 = load ptr, ptr %14, align 8, !tbaa !5
  %66 = icmp eq ptr %65, null
  br i1 %66, label %67, label %75

67:                                               ; preds = %62
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  call void @rehash(ptr noundef %68, ptr noundef %69, ptr noundef %70)
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = call ptr @luaH_set(ptr noundef %71, ptr noundef %72, ptr noundef %73)
  store ptr %74, ptr %4, align 8
  store i32 1, ptr %15, align 4
  br label %177

75:                                               ; preds = %62
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.Node, ptr %77, i32 0, i32 1
  %79 = call ptr @mainposition(ptr noundef %76, ptr noundef %78)
  store ptr %79, ptr %13, align 8, !tbaa !5
  %80 = load ptr, ptr %13, align 8, !tbaa !5
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = icmp ne ptr %80, %81
  br i1 %82, label %83, label %140

83:                                               ; preds = %75
  br label %84

84:                                               ; preds = %94, %83
  %85 = load ptr, ptr %13, align 8, !tbaa !5
  %86 = load ptr, ptr %13, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.Node, ptr %86, i32 0, i32 1
  %88 = getelementptr inbounds %struct.anon, ptr %87, i32 0, i32 2
  %89 = load i32, ptr %88, align 4, !tbaa !12
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds %struct.Node, ptr %85, i64 %90
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = icmp ne ptr %91, %92
  br i1 %93, label %94, label %102

94:                                               ; preds = %84
  %95 = load ptr, ptr %13, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.Node, ptr %95, i32 0, i32 1
  %97 = getelementptr inbounds %struct.anon, ptr %96, i32 0, i32 2
  %98 = load i32, ptr %97, align 4, !tbaa !12
  %99 = load ptr, ptr %13, align 8, !tbaa !5
  %100 = sext i32 %98 to i64
  %101 = getelementptr inbounds %struct.Node, ptr %99, i64 %100
  store ptr %101, ptr %13, align 8, !tbaa !5
  br label %84, !llvm.loop !19

102:                                              ; preds = %84
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  %104 = load ptr, ptr %13, align 8, !tbaa !5
  %105 = ptrtoint ptr %103 to i64
  %106 = ptrtoint ptr %104 to i64
  %107 = sub i64 %105, %106
  %108 = sdiv exact i64 %107, 32
  %109 = trunc i64 %108 to i32
  %110 = load ptr, ptr %13, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.Node, ptr %110, i32 0, i32 1
  %112 = getelementptr inbounds %struct.anon, ptr %111, i32 0, i32 2
  store i32 %109, ptr %112, align 4, !tbaa !12
  %113 = load ptr, ptr %14, align 8, !tbaa !5
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %113, ptr align 8 %114, i64 32, i1 false), !tbaa.struct !21
  %115 = load ptr, ptr %8, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.Node, ptr %115, i32 0, i32 1
  %117 = getelementptr inbounds %struct.anon, ptr %116, i32 0, i32 2
  %118 = load i32, ptr %117, align 4, !tbaa !12
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %136

120:                                              ; preds = %102
  %121 = load ptr, ptr %8, align 8, !tbaa !5
  %122 = load ptr, ptr %14, align 8, !tbaa !5
  %123 = ptrtoint ptr %121 to i64
  %124 = ptrtoint ptr %122 to i64
  %125 = sub i64 %123, %124
  %126 = sdiv exact i64 %125, 32
  %127 = trunc i64 %126 to i32
  %128 = load ptr, ptr %14, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.Node, ptr %128, i32 0, i32 1
  %130 = getelementptr inbounds %struct.anon, ptr %129, i32 0, i32 2
  %131 = load i32, ptr %130, align 4, !tbaa !12
  %132 = add nsw i32 %131, %127
  store i32 %132, ptr %130, align 4, !tbaa !12
  %133 = load ptr, ptr %8, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.Node, ptr %133, i32 0, i32 1
  %135 = getelementptr inbounds %struct.anon, ptr %134, i32 0, i32 2
  store i32 0, ptr %135, align 4, !tbaa !12
  br label %136

136:                                              ; preds = %120, %102
  %137 = load ptr, ptr %8, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.Node, ptr %137, i32 0, i32 0
  %139 = getelementptr inbounds %struct.lua_TValue, ptr %138, i32 0, i32 1
  store i32 0, ptr %139, align 8, !tbaa !17
  br label %176

140:                                              ; preds = %75
  %141 = load ptr, ptr %8, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.Node, ptr %141, i32 0, i32 1
  %143 = getelementptr inbounds %struct.anon, ptr %142, i32 0, i32 2
  %144 = load i32, ptr %143, align 4, !tbaa !12
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %163

146:                                              ; preds = %140
  %147 = load ptr, ptr %8, align 8, !tbaa !5
  %148 = load ptr, ptr %8, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.Node, ptr %148, i32 0, i32 1
  %150 = getelementptr inbounds %struct.anon, ptr %149, i32 0, i32 2
  %151 = load i32, ptr %150, align 4, !tbaa !12
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds %struct.Node, ptr %147, i64 %152
  %154 = load ptr, ptr %14, align 8, !tbaa !5
  %155 = ptrtoint ptr %153 to i64
  %156 = ptrtoint ptr %154 to i64
  %157 = sub i64 %155, %156
  %158 = sdiv exact i64 %157, 32
  %159 = trunc i64 %158 to i32
  %160 = load ptr, ptr %14, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.Node, ptr %160, i32 0, i32 1
  %162 = getelementptr inbounds %struct.anon, ptr %161, i32 0, i32 2
  store i32 %159, ptr %162, align 4, !tbaa !12
  br label %164

163:                                              ; preds = %140
  br label %164

164:                                              ; preds = %163, %146
  %165 = load ptr, ptr %14, align 8, !tbaa !5
  %166 = load ptr, ptr %8, align 8, !tbaa !5
  %167 = ptrtoint ptr %165 to i64
  %168 = ptrtoint ptr %166 to i64
  %169 = sub i64 %167, %168
  %170 = sdiv exact i64 %169, 32
  %171 = trunc i64 %170 to i32
  %172 = load ptr, ptr %8, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.Node, ptr %172, i32 0, i32 1
  %174 = getelementptr inbounds %struct.anon, ptr %173, i32 0, i32 2
  store i32 %171, ptr %174, align 4, !tbaa !12
  %175 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %175, ptr %8, align 8, !tbaa !5
  br label %176

176:                                              ; preds = %164, %136
  store i32 0, ptr %15, align 4
  br label %177

177:                                              ; preds = %176, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  %178 = load i32, ptr %15, align 4
  switch i32 %178, label %221 [
    i32 0, label %179
  ]

179:                                              ; preds = %177
  br label %180

180:                                              ; preds = %179, %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %181 = load ptr, ptr %8, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.Node, ptr %181, i32 0, i32 1
  store ptr %182, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %183 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %183, ptr %17, align 8, !tbaa !5
  %184 = load ptr, ptr %16, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.anon, ptr %184, i32 0, i32 0
  %186 = load ptr, ptr %17, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.lua_TValue, ptr %186, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %185, ptr align 8 %187, i64 8, i1 false), !tbaa.struct !23
  %188 = load ptr, ptr %17, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.lua_TValue, ptr %188, i32 0, i32 1
  %190 = load i32, ptr %189, align 8, !tbaa !9
  %191 = load ptr, ptr %16, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.anon, ptr %191, i32 0, i32 1
  store i32 %190, ptr %192, align 8, !tbaa !12
  %193 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %194 = load ptr, ptr %7, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.lua_TValue, ptr %194, i32 0, i32 1
  %196 = load i32, ptr %195, align 8, !tbaa !9
  %197 = and i32 %196, 64
  %198 = icmp ne i32 %197, 0
  br i1 %198, label %199, label %218

199:                                              ; preds = %180
  %200 = load ptr, ptr %6, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.Table, ptr %200, i32 0, i32 2
  %202 = load i8, ptr %201, align 1, !tbaa !24
  %203 = zext i8 %202 to i32
  %204 = and i32 %203, 4
  %205 = icmp ne i32 %204, 0
  br i1 %205, label %206, label %218

206:                                              ; preds = %199
  %207 = load ptr, ptr %7, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.lua_TValue, ptr %207, i32 0, i32 0
  %209 = load ptr, ptr %208, align 8, !tbaa !12
  %210 = getelementptr inbounds %struct.GCObject, ptr %209, i32 0, i32 2
  %211 = load i8, ptr %210, align 1, !tbaa !26
  %212 = zext i8 %211 to i32
  %213 = and i32 %212, 3
  %214 = icmp ne i32 %213, 0
  br i1 %214, label %215, label %218

215:                                              ; preds = %206
  %216 = load ptr, ptr %5, align 8, !tbaa !5
  %217 = load ptr, ptr %6, align 8, !tbaa !5
  call void @luaC_barrierback_(ptr noundef %216, ptr noundef %217)
  br label %218

218:                                              ; preds = %215, %206, %199, %180
  %219 = load ptr, ptr %8, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.Node, ptr %219, i32 0, i32 0
  store ptr %220, ptr %4, align 8
  store i32 1, ptr %15, align 4
  br label %221

221:                                              ; preds = %218, %177
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %222 = load ptr, ptr %4, align 8
  ret ptr %222
}

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

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @getfreepos(ptr noundef) #2

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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, !11, i64 8}
!10 = !{!"lua_TValue", !7, i64 0, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = !{!18, !11, i64 8}
!18 = !{!"Node", !10, i64 0, !7, i64 16}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{i64 0, i64 8, !12, i64 8, i64 4, !22, i64 16, i64 16, !12}
!22 = !{!11, !11, i64 0}
!23 = !{i64 0, i64 8, !12}
!24 = !{!25, !7, i64 9}
!25 = !{!"Table", !6, i64 0, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!26 = !{!27, !7, i64 9}
!27 = !{!"GCObject", !6, i64 0, !7, i64 8, !7, i64 9}


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

@dummynode_ = external hidden constant %struct.Node, align 8
@.str = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [19 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

; 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

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

; Function Attrs: nounwind uwtable
define hidden ptr @luaH_newkey(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct.lua_TValue, align 8
  %5 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  %6 = getelementptr inbounds i8, ptr %2, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !5
  switch i32 %7, label %19 [
    i32 0, label %8
    i32 3, label %9
  ]

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

9:                                                ; preds = %3
  %10 = load double, ptr %2, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %11 = fcmp ord double %10, 0.000000e+00
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  tail call void (ptr, ptr, ...) @luaG_runerror(ptr noundef %0, ptr noundef nonnull @.str.1) #6
  unreachable

13:                                               ; preds = %9
  %14 = call i32 @numisinteger(double noundef %10, ptr noundef nonnull %5)
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %18, label %15

15:                                               ; preds = %13
  %16 = load i64, ptr %5, align 8, !tbaa !11
  store i64 %16, ptr %4, align 8, !tbaa !10
  %17 = getelementptr inbounds i8, ptr %4, i64 8
  store i32 19, ptr %17, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %15, %13
  %.066 = phi ptr [ %4, %15 ], [ %2, %13 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %19

19:                                               ; preds = %3, %18
  %.167 = phi ptr [ %.066, %18 ], [ %2, %3 ]
  %20 = call ptr @mainposition(ptr noundef %1, ptr noundef nonnull %.167)
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  %22 = load i32, ptr %21, align 8, !tbaa !13
  %23 = icmp ne i32 %22, 0
  %24 = icmp eq ptr %20, @dummynode_
  %or.cond = or i1 %24, %23
  br i1 %or.cond, label %25, label %.thread

25:                                               ; preds = %19
  %26 = call ptr @getfreepos(ptr noundef %1)
  %.not84 = icmp eq ptr %26, null
  br i1 %.not84, label %69, label %27

27:                                               ; preds = %25
  %28 = getelementptr inbounds i8, ptr %20, i64 16
  %29 = call ptr @mainposition(ptr noundef %1, ptr noundef nonnull %28)
  %.not80 = icmp eq ptr %29, %20
  br i1 %.not80, label %52, label %.preheader

.preheader:                                       ; preds = %27, %.preheader
  %.071 = phi ptr [ %33, %.preheader ], [ %29, %27 ]
  %30 = getelementptr inbounds i8, ptr %.071, i64 28
  %31 = load i32, ptr %30, align 4, !tbaa !10
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds %struct.Node, ptr %.071, i64 %32
  %.not82 = icmp eq ptr %33, %20
  br i1 %.not82, label %34, label %.preheader, !llvm.loop !15

34:                                               ; preds = %.preheader
  %35 = getelementptr inbounds i8, ptr %.071, i64 28
  %36 = ptrtoint ptr %26 to i64
  %37 = ptrtoint ptr %.071 to i64
  %38 = sub i64 %36, %37
  %39 = lshr exact i64 %38, 5
  %40 = trunc i64 %39 to i32
  store i32 %40, ptr %35, align 4, !tbaa !10
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %26, ptr noundef nonnull align 8 dereferenceable(32) %20, i64 32, i1 false), !tbaa.struct !17
  %41 = getelementptr inbounds i8, ptr %20, i64 28
  %42 = load i32, ptr %41, align 4, !tbaa !10
  %.not83 = icmp eq i32 %42, 0
  br i1 %.not83, label %51, label %43

43:                                               ; preds = %34
  %44 = ptrtoint ptr %20 to i64
  %45 = sub i64 %44, %36
  %46 = lshr exact i64 %45, 5
  %47 = trunc i64 %46 to i32
  %48 = getelementptr inbounds i8, ptr %26, i64 28
  %49 = load i32, ptr %48, align 4, !tbaa !10
  %50 = add nsw i32 %49, %47
  store i32 %50, ptr %48, align 4, !tbaa !10
  store i32 0, ptr %41, align 4, !tbaa !10
  br label %51

51:                                               ; preds = %43, %34
  store i32 0, ptr %21, align 8, !tbaa !13
  br label %.thread

52:                                               ; preds = %27
  %53 = getelementptr inbounds i8, ptr %20, i64 28
  %54 = load i32, ptr %53, align 4, !tbaa !10
  %.not81 = icmp eq i32 %54, 0
  br i1 %.not81, label %._crit_edge, label %55

._crit_edge:                                      ; preds = %52
  %.pre = ptrtoint ptr %26 to i64
  br label %64

55:                                               ; preds = %52
  %56 = sext i32 %54 to i64
  %57 = getelementptr inbounds %struct.Node, ptr %20, i64 %56
  %58 = ptrtoint ptr %57 to i64
  %59 = ptrtoint ptr %26 to i64
  %60 = sub i64 %58, %59
  %61 = lshr exact i64 %60, 5
  %62 = trunc i64 %61 to i32
  %63 = getelementptr inbounds i8, ptr %26, i64 28
  store i32 %62, ptr %63, align 4, !tbaa !10
  br label %64

64:                                               ; preds = %._crit_edge, %55
  %.pre-phi = phi i64 [ %.pre, %._crit_edge ], [ %59, %55 ]
  %65 = ptrtoint ptr %20 to i64
  %66 = sub i64 %.pre-phi, %65
  %67 = lshr exact i64 %66, 5
  %68 = trunc i64 %67 to i32
  store i32 %68, ptr %53, align 4, !tbaa !10
  br label %.thread

69:                                               ; preds = %25
  call void @rehash(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %.167)
  %70 = call ptr @luaH_set(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %.167)
  br label %87

.thread:                                          ; preds = %64, %51, %19
  %.2 = phi ptr [ %20, %19 ], [ %26, %64 ], [ %20, %51 ]
  %71 = getelementptr inbounds i8, ptr %.2, i64 16
  %72 = load i64, ptr %.167, align 8, !tbaa !10
  store i64 %72, ptr %71, align 8, !tbaa !10
  %73 = getelementptr inbounds i8, ptr %.167, i64 8
  %74 = load i32, ptr %73, align 8, !tbaa !5
  %75 = getelementptr inbounds i8, ptr %.2, i64 24
  store i32 %74, ptr %75, align 8, !tbaa !10
  %76 = and i32 %74, 64
  %.not85 = icmp eq i32 %76, 0
  br i1 %.not85, label %87, label %77

77:                                               ; preds = %.thread
  %78 = getelementptr inbounds i8, ptr %1, i64 9
  %79 = load i8, ptr %78, align 1, !tbaa !19
  %80 = and i8 %79, 4
  %.not86 = icmp eq i8 %80, 0
  br i1 %.not86, label %87, label %81

81:                                               ; preds = %77
  %82 = load ptr, ptr %.167, align 8, !tbaa !10
  %83 = getelementptr inbounds i8, ptr %82, i64 9
  %84 = load i8, ptr %83, align 1, !tbaa !22
  %85 = and i8 %84, 3
  %.not87 = icmp eq i8 %85, 0
  br i1 %.not87, label %87, label %86

86:                                               ; preds = %81
  call void @luaC_barrierback_(ptr noundef %0, ptr noundef nonnull %1) #5
  br label %87

87:                                               ; preds = %69, %.thread, %77, %81, %86
  %.1 = phi ptr [ %70, %69 ], [ %.2, %86 ], [ %.2, %81 ], [ %.2, %77 ], [ %.2, %.thread ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  ret ptr %.1
}

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

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

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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 = !{!"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, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !9, i64 8}
!14 = !{!"Node", !6, i64 0, !7, i64 16}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{i64 0, i64 8, !10, i64 8, i64 4, !18, i64 16, i64 16, !10}
!18 = !{!9, !9, i64 0}
!19 = !{!20, !7, i64 9}
!20 = !{!"Table", !21, i64 0, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !9, i64 12, !21, i64 16, !21, i64 24, !21, i64 32, !21, i64 40, !21, i64 48}
!21 = !{!"any pointer", !7, i64 0}
!22 = !{!23, !7, i64 9}
!23 = !{!"GCObject", !21, i64 0, !7, i64 8, !7, i64 9}


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