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

; 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.GCtab = type { %struct.GCRef, i8, i8, i8, i8, %struct.MRef, %struct.GCRef, %struct.GCRef, ptr, %struct.MRef, i32, i32 }
%struct.GCRef = type { i32 }
%struct.MRef = type { i32 }
%struct.Node = type { %union.TValue, %union.TValue, %struct.MRef, %struct.MRef }
%union.TValue = type { i64 }
%struct.Cache = type { %struct.Node, %struct.MRef, i32 }
%struct.anon = type { %union.anon, i32 }
%union.anon = type { %struct.GCRef }
%struct.GChead = type { %struct.GCRef, i8, i8, i8, i8, %struct.GCRef, %struct.GCRef, %struct.GCRef }
%struct.lua_State = type { %union.anon.2 }
%union.anon.2 = type { %struct.anon.3, [320 x i8] }
%struct.anon.3 = type { %struct.GCRef, i8, i8, i8, i8, %struct.MRef, %struct.GCRef, ptr, ptr, %struct.MRef, %struct.MRef, %struct.GCRef, %struct.GCRef, ptr, i32 }

; 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

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

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

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

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

; Function Attrs: nounwind uwtable
define hidden ptr @lj_tab_newkey(ptr noundef %0, ptr noundef %1, ptr noundef %2) #3 {
  %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 ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = 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) #6
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.GCtab, ptr %14, i32 0, i32 8
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %59

18:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = call ptr @lj_mem_realloc(ptr noundef %19, ptr noundef null, i32 noundef 0, i32 noundef 24)
  store ptr %20, ptr %9, align 8, !tbaa !5
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.Node, ptr %21, i32 0, i32 2
  %23 = getelementptr inbounds %struct.MRef, ptr %22, i32 0, i32 0
  store i32 0, ptr %23, align 8, !tbaa !14
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = ptrtoint ptr %24 to i64
  %26 = trunc i64 %25 to i32
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.GCtab, ptr %27, i32 0, i32 8
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = getelementptr inbounds %struct.Cache, ptr %29, i32 0, i32 1
  %31 = getelementptr inbounds %struct.MRef, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 8, !tbaa !16
  %33 = zext i32 %32 to i64
  %34 = inttoptr i64 %33 to ptr
  %35 = getelementptr inbounds %struct.Node, ptr %34, i32 0, i32 2
  %36 = getelementptr inbounds %struct.MRef, ptr %35, i32 0, i32 0
  store i32 %26, ptr %36, align 8, !tbaa !14
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = ptrtoint ptr %37 to i64
  %39 = trunc i64 %38 to i32
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.GCtab, ptr %40, i32 0, i32 8
  %42 = load ptr, ptr %41, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.Cache, ptr %42, i32 0, i32 1
  %44 = getelementptr inbounds %struct.MRef, ptr %43, i32 0, i32 0
  store i32 %39, ptr %44, align 8, !tbaa !16
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.Node, ptr %45, i32 0, i32 0
  %47 = getelementptr inbounds %struct.anon, ptr %46, i32 0, i32 1
  store i32 -1, ptr %47, align 4, !tbaa !18
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.Node, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %49, ptr align 8 %50, i64 8, i1 false), !tbaa.struct !19
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.GCtab, ptr %51, i32 0, i32 8
  %53 = load ptr, ptr %52, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.Cache, ptr %53, i32 0, i32 2
  %55 = load i32, ptr %54, align 4, !tbaa !20
  %56 = add i32 %55, 1
  store i32 %56, ptr %54, align 4, !tbaa !20
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.Node, ptr %57, i32 0, i32 0
  store ptr %58, ptr %4, align 8
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %225

59:                                               ; preds = %3
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = call ptr @hashkey(ptr noundef %60, ptr noundef %61)
  store ptr %62, ptr %8, align 8, !tbaa !5
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.Node, ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds %struct.anon, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !18
  %67 = icmp eq i32 %66, -1
  br i1 %67, label %68, label %73

68:                                               ; preds = %59
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.GCtab, ptr %69, i32 0, i32 11
  %71 = load i32, ptr %70, align 8, !tbaa !21
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %182

73:                                               ; preds = %68, %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.GCtab, ptr %74, i32 0, i32 9
  %76 = getelementptr inbounds %struct.MRef, ptr %75, i32 0, i32 0
  %77 = load i32, ptr %76, align 8, !tbaa !22
  %78 = zext i32 %77 to i64
  %79 = inttoptr i64 %78 to ptr
  store ptr %79, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.Node, ptr %80, i32 0, i32 3
  %82 = getelementptr inbounds %struct.MRef, ptr %81, i32 0, i32 0
  %83 = load i32, ptr %82, align 4, !tbaa !23
  %84 = zext i32 %83 to i64
  %85 = inttoptr i64 %84 to ptr
  store ptr %85, ptr %13, align 8, !tbaa !5
  br label %86

86:                                               ; preds = %99, %73
  %87 = load ptr, ptr %13, align 8, !tbaa !5
  %88 = load ptr, ptr %11, align 8, !tbaa !5
  %89 = icmp eq ptr %87, %88
  br i1 %89, label %90, label %98

90:                                               ; preds = %86
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  call void @rehashtab(ptr noundef %91, ptr noundef %92, ptr noundef %93)
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = call ptr @lj_tab_set(ptr noundef %94, ptr noundef %95, ptr noundef %96)
  store ptr %97, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %179

98:                                               ; preds = %86
  br label %99

99:                                               ; preds = %98
  %100 = load ptr, ptr %13, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.Node, ptr %100, i32 -1
  store ptr %101, ptr %13, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.Node, ptr %101, i32 0, i32 1
  %103 = getelementptr inbounds %struct.anon, ptr %102, i32 0, i32 1
  %104 = load i32, ptr %103, align 4, !tbaa !18
  %105 = icmp eq i32 %104, -1
  %106 = xor i1 %105, true
  br i1 %106, label %86, label %107, !llvm.loop !24

107:                                              ; preds = %99
  %108 = load ptr, ptr %13, align 8, !tbaa !5
  %109 = ptrtoint ptr %108 to i64
  %110 = trunc i64 %109 to i32
  %111 = load ptr, ptr %11, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.Node, ptr %111, i32 0, i32 3
  %113 = getelementptr inbounds %struct.MRef, ptr %112, i32 0, i32 0
  store i32 %110, ptr %113, align 4, !tbaa !23
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = load ptr, ptr %8, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.Node, ptr %115, i32 0, i32 1
  %117 = call ptr @hashkey(ptr noundef %114, ptr noundef %116)
  store ptr %117, ptr %12, align 8, !tbaa !5
  %118 = load ptr, ptr %12, align 8, !tbaa !5
  %119 = load ptr, ptr %8, align 8, !tbaa !5
  %120 = icmp ne ptr %118, %119
  br i1 %120, label %121, label %163

121:                                              ; preds = %107
  br label %122

122:                                              ; preds = %131, %121
  %123 = load ptr, ptr %12, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.Node, ptr %123, i32 0, i32 2
  %125 = getelementptr inbounds %struct.MRef, ptr %124, i32 0, i32 0
  %126 = load i32, ptr %125, align 8, !tbaa !14
  %127 = zext i32 %126 to i64
  %128 = inttoptr i64 %127 to ptr
  %129 = load ptr, ptr %8, align 8, !tbaa !5
  %130 = icmp ne ptr %128, %129
  br i1 %130, label %131, label %138

131:                                              ; preds = %122
  %132 = load ptr, ptr %12, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.Node, ptr %132, i32 0, i32 2
  %134 = getelementptr inbounds %struct.MRef, ptr %133, i32 0, i32 0
  %135 = load i32, ptr %134, align 8, !tbaa !14
  %136 = zext i32 %135 to i64
  %137 = inttoptr i64 %136 to ptr
  store ptr %137, ptr %12, align 8, !tbaa !5
  br label %122, !llvm.loop !26

138:                                              ; preds = %122
  %139 = load ptr, ptr %13, align 8, !tbaa !5
  %140 = ptrtoint ptr %139 to i64
  %141 = trunc i64 %140 to i32
  %142 = load ptr, ptr %12, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.Node, ptr %142, i32 0, i32 2
  %144 = getelementptr inbounds %struct.MRef, ptr %143, i32 0, i32 0
  store i32 %141, ptr %144, align 8, !tbaa !14
  %145 = load ptr, ptr %13, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.Node, ptr %145, i32 0, i32 0
  %147 = load ptr, ptr %8, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.Node, ptr %147, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %146, ptr align 8 %148, i64 8, i1 false), !tbaa.struct !19
  %149 = load ptr, ptr %13, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.Node, ptr %149, i32 0, i32 1
  %151 = load ptr, ptr %8, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.Node, ptr %151, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %150, ptr align 8 %152, i64 8, i1 false), !tbaa.struct !19
  %153 = load ptr, ptr %13, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.Node, ptr %153, i32 0, i32 2
  %155 = load ptr, ptr %8, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.Node, ptr %155, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %154, ptr align 8 %156, i64 4, i1 false), !tbaa.struct !27
  %157 = load ptr, ptr %8, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.Node, ptr %157, i32 0, i32 2
  %159 = getelementptr inbounds %struct.MRef, ptr %158, i32 0, i32 0
  store i32 0, ptr %159, align 8, !tbaa !14
  %160 = load ptr, ptr %8, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.Node, ptr %160, i32 0, i32 0
  %162 = getelementptr inbounds %struct.anon, ptr %161, i32 0, i32 1
  store i32 -1, ptr %162, align 4, !tbaa !18
  br label %178

163:                                              ; preds = %107
  %164 = load ptr, ptr %8, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.Node, ptr %164, i32 0, i32 2
  %166 = getelementptr inbounds %struct.MRef, ptr %165, i32 0, i32 0
  %167 = load i32, ptr %166, align 8, !tbaa !14
  %168 = load ptr, ptr %13, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.Node, ptr %168, i32 0, i32 2
  %170 = getelementptr inbounds %struct.MRef, ptr %169, i32 0, i32 0
  store i32 %167, ptr %170, align 8, !tbaa !14
  %171 = load ptr, ptr %13, align 8, !tbaa !5
  %172 = ptrtoint ptr %171 to i64
  %173 = trunc i64 %172 to i32
  %174 = load ptr, ptr %8, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.Node, ptr %174, i32 0, i32 2
  %176 = getelementptr inbounds %struct.MRef, ptr %175, i32 0, i32 0
  store i32 %173, ptr %176, align 8, !tbaa !14
  %177 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %177, ptr %8, align 8, !tbaa !5
  br label %178

178:                                              ; preds = %163, %138
  store i32 0, ptr %10, align 4
  br label %179

179:                                              ; preds = %178, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  %180 = load i32, ptr %10, align 4
  switch i32 %180, label %225 [
    i32 0, label %181
  ]

181:                                              ; preds = %179
  br label %182

182:                                              ; preds = %181, %68
  %183 = load ptr, ptr %7, align 8, !tbaa !5
  %184 = load i64, ptr %183, align 8, !tbaa !18
  %185 = load ptr, ptr %8, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.Node, ptr %185, i32 0, i32 1
  store i64 %184, ptr %186, align 8, !tbaa !18
  %187 = load ptr, ptr %8, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.Node, ptr %187, i32 0, i32 1
  %189 = load i64, ptr %188, align 8, !tbaa !18
  %190 = icmp eq i64 %189, -9223372036854775808
  %191 = xor i1 %190, true
  %192 = xor i1 %191, true
  %193 = zext i1 %192 to i32
  %194 = sext i32 %193 to i64
  %195 = call i64 @llvm.expect.i64(i64 %194, i64 0)
  %196 = icmp ne i64 %195, 0
  br i1 %196, label %197, label %200

197:                                              ; preds = %182
  %198 = load ptr, ptr %8, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.Node, ptr %198, i32 0, i32 1
  store i64 0, ptr %199, align 8, !tbaa !18
  br label %200

200:                                              ; preds = %197, %182
  %201 = load ptr, ptr %6, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.GChead, ptr %201, i32 0, i32 1
  %203 = load i8, ptr %202, align 4, !tbaa !18
  %204 = zext i8 %203 to i32
  %205 = and i32 %204, 4
  %206 = icmp ne i32 %205, 0
  %207 = xor i1 %206, true
  %208 = xor i1 %207, true
  %209 = zext i1 %208 to i32
  %210 = sext i32 %209 to i64
  %211 = call i64 @llvm.expect.i64(i64 %210, i64 0)
  %212 = icmp ne i64 %211, 0
  br i1 %212, label %213, label %222

213:                                              ; preds = %200
  %214 = load ptr, ptr %5, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.lua_State, ptr %214, i32 0, i32 0
  %216 = getelementptr inbounds %struct.anon.3, ptr %215, i32 0, i32 5
  %217 = getelementptr inbounds %struct.MRef, ptr %216, i32 0, i32 0
  %218 = load i32, ptr %217, align 8, !tbaa !18
  %219 = zext i32 %218 to i64
  %220 = inttoptr i64 %219 to ptr
  %221 = load ptr, ptr %6, align 8, !tbaa !5
  call void @lj_gc_barrierback(ptr noundef %220, ptr noundef %221)
  br label %222

222:                                              ; preds = %213, %200
  %223 = load ptr, ptr %8, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.Node, ptr %223, i32 0, i32 0
  store ptr %224, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %225

225:                                              ; preds = %222, %179, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %226 = load ptr, ptr %4, align 8
  ret ptr %226
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @lj_gc_barrierback(ptr noundef, ptr noundef) #5

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

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

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

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

; Function Attrs: nounwind uwtable
define hidden ptr @lj_tab_newkey(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %1, i64 24
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %24, label %6

6:                                                ; preds = %3
  %7 = tail call ptr @lj_mem_realloc(ptr noundef %0, ptr noundef null, i32 noundef 0, i32 noundef 24) #3
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  store i32 0, ptr %8, align 8, !tbaa !13
  %9 = ptrtoint ptr %7 to i64
  %10 = trunc i64 %9 to i32
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 24
  %13 = load i32, ptr %12, align 8, !tbaa !15
  %14 = zext i32 %13 to i64
  %15 = inttoptr i64 %14 to ptr
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  store i32 %10, ptr %16, align 8, !tbaa !13
  store i32 %10, ptr %12, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %7, i64 4
  store i32 -1, ptr %17, align 4, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %7, i64 8
  %19 = load i64, ptr %2, align 8, !tbaa !17
  store i64 %19, ptr %18, align 8, !tbaa !17
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 28
  %22 = load i32, ptr %21, align 4, !tbaa !18
  %23 = add i32 %22, 1
  store i32 %23, ptr %21, align 4, !tbaa !18
  br label %82

24:                                               ; preds = %3
  %25 = tail call ptr @hashkey(ptr noundef nonnull %1, ptr noundef %2)
  %26 = getelementptr inbounds i8, ptr %25, i64 4
  %27 = load i32, ptr %26, align 4, !tbaa !17
  %28 = icmp eq i32 %27, -1
  br i1 %28, label %29, label %33

29:                                               ; preds = %24
  %30 = getelementptr inbounds i8, ptr %1, i64 40
  %31 = load i32, ptr %30, align 8, !tbaa !19
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %68

33:                                               ; preds = %29, %24
  %34 = getelementptr inbounds i8, ptr %1, i64 32
  %35 = load i32, ptr %34, align 8, !tbaa !20
  %36 = zext i32 %35 to i64
  %37 = inttoptr i64 %36 to ptr
  %38 = getelementptr inbounds i8, ptr %37, i64 20
  %39 = load i32, ptr %38, align 4, !tbaa !21
  %40 = zext i32 %39 to i64
  %41 = inttoptr i64 %40 to ptr
  br label %42

42:                                               ; preds = %44, %33
  %.0 = phi ptr [ %41, %33 ], [ %45, %44 ]
  %.not72 = icmp eq ptr %.0, %37
  br i1 %.not72, label %.thread, label %44

.thread:                                          ; preds = %42
  tail call void @rehashtab(ptr noundef %0, ptr noundef %1, ptr noundef %2)
  %43 = tail call ptr @lj_tab_set(ptr noundef %0, ptr noundef %1, ptr noundef %2)
  br label %82

44:                                               ; preds = %42
  %45 = getelementptr inbounds i8, ptr %.0, i64 -24
  %46 = getelementptr inbounds i8, ptr %.0, i64 -12
  %47 = load i32, ptr %46, align 4, !tbaa !17
  %.not69 = icmp eq i32 %47, -1
  br i1 %.not69, label %48, label %42, !llvm.loop !22

48:                                               ; preds = %44
  %49 = getelementptr inbounds i8, ptr %.0, i64 -16
  %50 = ptrtoint ptr %45 to i64
  %51 = trunc i64 %50 to i32
  store i32 %51, ptr %38, align 4, !tbaa !21
  %52 = getelementptr inbounds i8, ptr %25, i64 8
  %53 = tail call ptr @hashkey(ptr noundef %1, ptr noundef nonnull %52)
  %.not70 = icmp eq ptr %53, %25
  br i1 %.not70, label %.thread76, label %.preheader

.preheader:                                       ; preds = %48, %.preheader
  %.060 = phi ptr [ %57, %.preheader ], [ %53, %48 ]
  %54 = getelementptr inbounds i8, ptr %.060, i64 16
  %55 = load i32, ptr %54, align 8, !tbaa !13
  %56 = zext i32 %55 to i64
  %57 = inttoptr i64 %56 to ptr
  %.not71 = icmp eq ptr %25, %57
  br i1 %.not71, label %61, label %.preheader, !llvm.loop !24

.thread76:                                        ; preds = %48
  %58 = getelementptr inbounds i8, ptr %25, i64 16
  %59 = load i32, ptr %58, align 8, !tbaa !13
  %60 = getelementptr inbounds i8, ptr %.0, i64 -8
  store i32 %59, ptr %60, align 8, !tbaa !13
  store i32 %51, ptr %58, align 8, !tbaa !13
  br label %68

61:                                               ; preds = %.preheader
  %62 = getelementptr inbounds i8, ptr %.060, i64 16
  store i32 %51, ptr %62, align 8, !tbaa !13
  %63 = load i64, ptr %25, align 8, !tbaa !17
  store i64 %63, ptr %45, align 8, !tbaa !17
  %64 = load i64, ptr %52, align 8, !tbaa !17
  store i64 %64, ptr %49, align 8, !tbaa !17
  %65 = getelementptr inbounds i8, ptr %.0, i64 -8
  %66 = getelementptr inbounds i8, ptr %25, i64 16
  %67 = load i32, ptr %66, align 8, !tbaa !25
  store i32 %67, ptr %65, align 8, !tbaa !25
  store i32 0, ptr %66, align 8, !tbaa !13
  store i32 -1, ptr %26, align 4, !tbaa !17
  br label %68

68:                                               ; preds = %61, %.thread76, %29
  %.2 = phi ptr [ %25, %61 ], [ %25, %29 ], [ %45, %.thread76 ]
  %69 = load i64, ptr %2, align 8, !tbaa !17
  %70 = getelementptr inbounds i8, ptr %.2, i64 8
  %71 = icmp eq i64 %69, -9223372036854775808
  br i1 %71, label %72, label %73, !prof !26

72:                                               ; preds = %68
  br label %73

73:                                               ; preds = %72, %68
  %storemerge = phi i64 [ 0, %72 ], [ %69, %68 ]
  store i64 %storemerge, ptr %70, align 8, !tbaa !17
  %74 = getelementptr inbounds i8, ptr %1, i64 4
  %75 = load i8, ptr %74, align 4, !tbaa !17
  %76 = and i8 %75, 4
  %.not73 = icmp eq i8 %76, 0
  br i1 %.not73, label %82, label %77, !prof !27

77:                                               ; preds = %73
  %78 = getelementptr inbounds i8, ptr %0, i64 8
  %79 = load i32, ptr %78, align 8, !tbaa !17
  %80 = zext i32 %79 to i64
  %81 = inttoptr i64 %80 to ptr
  tail call void @lj_gc_barrierback(ptr noundef %81, ptr noundef nonnull %1)
  br label %82

82:                                               ; preds = %.thread, %73, %77, %6
  %.1 = phi ptr [ %7, %6 ], [ %.2, %77 ], [ %.2, %73 ], [ %43, %.thread ]
  ret ptr %.1
}

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

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 = { 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 #2 = { 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 #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, !12, i64 24}
!6 = !{!"GCtab", !7, i64 0, !9, i64 4, !9, i64 5, !9, i64 6, !9, i64 7, !11, i64 8, !7, i64 12, !7, i64 16, !12, i64 24, !11, i64 32, !8, i64 36, !8, i64 40}
!7 = !{!"GCRef", !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"MRef", !8, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!14, !8, i64 16}
!14 = !{!"Node", !9, i64 0, !9, i64 8, !11, i64 16, !11, i64 20}
!15 = !{!16, !8, i64 24}
!16 = !{!"", !14, i64 0, !11, i64 24, !8, i64 28}
!17 = !{!9, !9, i64 0}
!18 = !{!16, !8, i64 28}
!19 = !{!6, !8, i64 40}
!20 = !{!6, !8, i64 32}
!21 = !{!14, !8, i64 20}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = !{!8, !8, i64 0}
!26 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!27 = !{!"branch_weights", !"expected", i32 2000, i32 1}


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