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

; 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.GG_State = type { %struct.lua_State, %struct.global_State, %struct.jit_State, [64 x i16], [243 x ptr], [57 x i32] }
%struct.lua_State = type { %union.anon.4 }
%union.anon.4 = type { %struct.anon.5, [320 x i8] }
%struct.anon.5 = type { %struct.GCRef, i8, i8, i8, i8, %struct.MRef, %struct.GCRef, ptr, ptr, %struct.MRef, %struct.MRef, %struct.GCRef, %struct.GCRef, ptr, i32 }
%struct.MRef = type { i32 }
%struct.GCRef = type { i32 }
%struct.global_State = type { ptr, i32, i32, ptr, ptr, %struct.GCState, i32, %struct.SBuf, %struct.GCstr, i8, i8, i8, i8, %struct.GCRef, %union.TValue, %union.TValue, %union.TValue, %struct.Node, %struct.GCupval, i32, i32, ptr, ptr, ptr, i32, i32, %struct.GCRef, %struct.MRef, %struct.MRef, [38 x %struct.GCRef] }
%struct.GCState = type { i32, i32, i8, i8, i8, i8, i32, %struct.GCRef, %struct.MRef, %struct.GCRef, %struct.GCRef, %struct.GCRef, %struct.GCRef, i32, i32, i32, i32 }
%struct.SBuf = type { %struct.MRef, %struct.MRef, %struct.MRef, %struct.MRef }
%struct.GCstr = type { %struct.GCRef, i8, i8, i8, i8, i32, i32 }
%union.TValue = type { i64 }
%struct.Node = type { %union.TValue, %union.TValue, %struct.MRef, %struct.MRef }
%struct.GCupval = type { %struct.GCRef, i8, i8, i8, i8, %union.anon.6, %struct.MRef, i32 }
%union.anon.6 = type { %union.TValue }
%struct.jit_State = type { %struct.GCtrace, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i8, i8, %struct.IRType1, i8, %struct.FoldState, ptr, i32, i32, i32, i32, i32, i32, i32, %struct.MRef, [5 x %union.TValue], ptr, i32, i32, i32, i32, ptr, ptr, i32, i32, i8, ptr, i32, i32, ptr, [100 x i16], [255 x i32], [15 x i32], [16 x ptr], [64 x %struct.HotPenalty], i32, i32, [16 x %struct.BPropEntry], i32, %struct.ScEvEntry, ptr, i32, i32, ptr, i32, i32, ptr, ptr, ptr, i64, i64, %union.TValue, ptr, i32, i32 }
%struct.GCtrace = type { %struct.GCRef, i8, i8, i8, i8, i32, %struct.GCRef, ptr, i32, i16, i16, ptr, ptr, %struct.GCRef, %struct.MRef, i32, i32, ptr, i32, i16, i16, i16, i16, i16, i16, i16, i8, i8 }
%struct.IRType1 = type { i8 }
%struct.FoldState = type { %union.IRIns, %union.IRIns, %union.IRIns }
%union.IRIns = type { %struct.anon.0 }
%struct.anon.0 = type { i32, %struct.IRType1, i8, i8, i8 }
%struct.HotPenalty = type { %struct.MRef, i16, i16 }
%struct.BPropEntry = type { i16, i16, i32 }
%struct.ScEvEntry = type { %struct.MRef, i16, i16, i16, i16, %struct.IRType1, i8 }
%struct.RecordFFData = type { ptr, i64, i32 }
%struct.anon.1 = type { %union.anon, i32 }
%union.anon = type { %struct.GCRef }
%struct.GCcdata = type { %struct.GCRef, i8, i8, i16 }
%struct.CType = type { i32, i32, i16, i16, %struct.GCRef }
%struct.CTState = type { ptr, i32, i32, ptr, ptr, ptr, ptr, %struct.CCallback, [128 x i16] }
%struct.CCallback = type { [8 x %union.FPRCBArg], [8 x i64], ptr, ptr, ptr, i32, i32, i32 }
%union.FPRCBArg = type { double }

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden ptr @ctype_raw(ptr noundef, i32 noundef) #1

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

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

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden ptr @ctype_get(ptr noundef, i32 noundef) #1

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

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

; Function Attrs: nounwind uwtable
define hidden void @recff_ffi_fill(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 -800
  %14 = getelementptr inbounds %struct.GG_State, ptr %13, i32 0, i32 1
  %15 = getelementptr inbounds %struct.global_State, ptr %14, i32 0, i32 28
  %16 = getelementptr inbounds %struct.MRef, ptr %15, i32 0, i32 0
  %17 = load i32, ptr %16, align 8, !tbaa !9
  %18 = zext i32 %17 to i64
  %19 = inttoptr i64 %18 to ptr
  store ptr %19, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.jit_State, ptr %20, i32 0, i32 5
  %22 = load ptr, ptr %21, align 8, !tbaa !28
  %23 = getelementptr inbounds i32, ptr %22, i64 0
  %24 = load i32, ptr %23, align 4, !tbaa !29
  store i32 %24, ptr %6, align 4, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.jit_State, ptr %25, i32 0, i32 5
  %27 = load ptr, ptr %26, align 8, !tbaa !28
  %28 = getelementptr inbounds i32, ptr %27, i64 1
  %29 = load i32, ptr %28, align 4, !tbaa !29
  store i32 %29, ptr %7, align 4, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.jit_State, ptr %30, i32 0, i32 5
  %32 = load ptr, ptr %31, align 8, !tbaa !28
  %33 = getelementptr inbounds i32, ptr %32, i64 2
  %34 = load i32, ptr %33, align 4, !tbaa !29
  store i32 %34, ptr %8, align 4, !tbaa !29
  %35 = load i32, ptr %6, align 4, !tbaa !29
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %127

37:                                               ; preds = %2
  %38 = load i32, ptr %7, align 4, !tbaa !29
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %127

40:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 1, ptr %9, align 4, !tbaa !29
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.RecordFFData, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !30
  %44 = getelementptr inbounds %union.TValue, ptr %43, i64 0
  %45 = getelementptr inbounds %struct.anon.1, ptr %44, i32 0, i32 1
  %46 = load i32, ptr %45, align 4, !tbaa !32
  %47 = icmp eq i32 %46, -11
  br i1 %47, label %48, label %87

48:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.RecordFFData, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !30
  %53 = getelementptr inbounds %union.TValue, ptr %52, i64 0
  %54 = getelementptr inbounds %struct.anon.1, ptr %53, i32 0, i32 0
  %55 = getelementptr inbounds %struct.GCRef, ptr %54, i32 0, i32 0
  %56 = load i32, ptr %55, align 8, !tbaa !32
  %57 = zext i32 %56 to i64
  %58 = inttoptr i64 %57 to ptr
  %59 = getelementptr inbounds %struct.GCcdata, ptr %58, i32 0, i32 3
  %60 = load i16, ptr %59, align 2, !tbaa !32
  %61 = zext i16 %60 to i32
  %62 = call ptr @ctype_raw(ptr noundef %49, i32 noundef %61)
  store ptr %62, ptr %11, align 8, !tbaa !5
  %63 = load ptr, ptr %11, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.CType, ptr %63, i32 0, i32 0
  %65 = load i32, ptr %64, align 4, !tbaa !33
  %66 = lshr i32 %65, 28
  %67 = icmp eq i32 %66, 2
  br i1 %67, label %68, label %72

68:                                               ; preds = %48
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = load ptr, ptr %11, align 8, !tbaa !5
  %71 = call ptr @ctype_rawchild(ptr noundef %69, ptr noundef %70)
  store ptr %71, ptr %11, align 8, !tbaa !5
  br label %72

72:                                               ; preds = %68, %48
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.CTState, ptr %75, i32 0, i32 0
  %77 = load ptr, ptr %76, align 8, !tbaa !35
  %78 = ptrtoint ptr %74 to i64
  %79 = ptrtoint ptr %77 to i64
  %80 = sub i64 %78, %79
  %81 = sdiv exact i64 %80, 16
  %82 = trunc i64 %81 to i32
  %83 = call i32 @lj_ctype_info(ptr noundef %73, i32 noundef %82, ptr noundef %10)
  %84 = lshr i32 %83, 16
  %85 = and i32 %84, 15
  %86 = shl i32 1, %85
  store i32 %86, ptr %9, align 4, !tbaa !29
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %87

87:                                               ; preds = %72, %40
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = call ptr @ctype_get(ptr noundef %89, i32 noundef 17)
  %91 = load i32, ptr %6, align 4, !tbaa !29
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.RecordFFData, ptr %92, i32 0, i32 0
  %94 = load ptr, ptr %93, align 8, !tbaa !30
  %95 = getelementptr inbounds %union.TValue, ptr %94, i64 0
  %96 = call i32 @crec_ct_tv(ptr noundef %88, ptr noundef %90, i32 noundef 0, i32 noundef %91, ptr noundef %95)
  store i32 %96, ptr %6, align 4, !tbaa !29
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = load i32, ptr %7, align 4, !tbaa !29
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.RecordFFData, ptr %100, i32 0, i32 0
  %102 = load ptr, ptr %101, align 8, !tbaa !30
  %103 = getelementptr inbounds %union.TValue, ptr %102, i64 1
  %104 = call i32 @crec_toint(ptr noundef %97, ptr noundef %98, i32 noundef %99, ptr noundef %103)
  store i32 %104, ptr %7, align 4, !tbaa !29
  %105 = load i32, ptr %8, align 4, !tbaa !29
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %116

107:                                              ; preds = %87
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = load i32, ptr %8, align 4, !tbaa !29
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.RecordFFData, ptr %111, i32 0, i32 0
  %113 = load ptr, ptr %112, align 8, !tbaa !30
  %114 = getelementptr inbounds %union.TValue, ptr %113, i64 2
  %115 = call i32 @crec_toint(ptr noundef %108, ptr noundef %109, i32 noundef %110, ptr noundef %114)
  store i32 %115, ptr %8, align 4, !tbaa !29
  br label %119

116:                                              ; preds = %87
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = call i32 @lj_ir_kint(ptr noundef %117, i32 noundef 0)
  store i32 %118, ptr %8, align 4, !tbaa !29
  br label %119

119:                                              ; preds = %116, %107
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.RecordFFData, ptr %120, i32 0, i32 1
  store i64 0, ptr %121, align 8, !tbaa !38
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = load i32, ptr %6, align 4, !tbaa !29
  %124 = load i32, ptr %7, align 4, !tbaa !29
  %125 = load i32, ptr %8, align 4, !tbaa !29
  %126 = load i32, ptr %9, align 4, !tbaa !29
  call void @crec_fill(ptr noundef %122, i32 noundef %123, i32 noundef %124, i32 noundef %125, i32 noundef %126)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %127

127:                                              ; preds = %119, %37, %2
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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, !13, i64 640}
!10 = !{!"GG_State", !11, i64 0, !12, i64 384, !21, i64 800, !7, i64 3312, !7, i64 3440, !7, i64 5384}
!11 = !{!"lua_State", !7, i64 0}
!12 = !{!"global_State", !6, i64 0, !13, i64 8, !13, i64 12, !6, i64 16, !6, i64 24, !14, i64 32, !13, i64 88, !17, i64 92, !18, i64 108, !7, i64 124, !7, i64 125, !7, i64 126, !7, i64 127, !15, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !19, i64 160, !20, i64 184, !13, i64 208, !13, i64 212, !6, i64 216, !6, i64 224, !6, i64 232, !13, i64 240, !13, i64 244, !15, i64 248, !16, i64 252, !16, i64 256, !7, i64 260}
!13 = !{!"int", !7, i64 0}
!14 = !{!"GCState", !13, i64 0, !13, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !13, i64 12, !15, i64 16, !16, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52}
!15 = !{!"GCRef", !13, i64 0}
!16 = !{!"MRef", !13, i64 0}
!17 = !{!"SBuf", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12}
!18 = !{!"GCstr", !15, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !13, i64 8, !13, i64 12}
!19 = !{!"Node", !7, i64 0, !7, i64 8, !16, i64 16, !16, i64 20}
!20 = !{!"GCupval", !15, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !16, i64 16, !13, i64 20}
!21 = !{!"jit_State", !22, i64 0, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !13, i64 136, !13, i64 140, !13, i64 144, !7, i64 148, !7, i64 149, !24, i64 150, !7, i64 151, !25, i64 152, !6, i64 176, !13, i64 184, !13, i64 188, !13, i64 192, !13, i64 196, !13, i64 200, !13, i64 204, !13, i64 208, !16, i64 212, !7, i64 216, !6, i64 256, !13, i64 264, !13, i64 268, !13, i64 272, !13, i64 276, !6, i64 280, !6, i64 288, !13, i64 296, !13, i64 300, !7, i64 304, !6, i64 312, !13, i64 320, !13, i64 324, !6, i64 328, !7, i64 336, !7, i64 536, !7, i64 1556, !7, i64 1616, !7, i64 1744, !13, i64 2256, !13, i64 2260, !7, i64 2264, !13, i64 2392, !26, i64 2396, !6, i64 2416, !13, i64 2424, !13, i64 2428, !6, i64 2432, !13, i64 2440, !13, i64 2444, !6, i64 2448, !6, i64 2456, !6, i64 2464, !27, i64 2472, !27, i64 2480, !7, i64 2488, !6, i64 2496, !13, i64 2504, !13, i64 2508}
!22 = !{!"GCtrace", !15, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !13, i64 8, !15, i64 12, !6, i64 16, !13, i64 24, !23, i64 28, !23, i64 30, !6, i64 32, !6, i64 40, !15, i64 48, !16, i64 52, !13, i64 56, !13, i64 60, !6, i64 64, !13, i64 72, !23, i64 76, !23, i64 78, !23, i64 80, !23, i64 82, !23, i64 84, !23, i64 86, !23, i64 88, !7, i64 90, !7, i64 91}
!23 = !{!"short", !7, i64 0}
!24 = !{!"IRType1", !7, i64 0}
!25 = !{!"FoldState", !7, i64 0, !7, i64 8, !7, i64 16}
!26 = !{!"ScEvEntry", !16, i64 0, !23, i64 4, !23, i64 6, !23, i64 8, !23, i64 10, !24, i64 12, !7, i64 13}
!27 = !{!"long", !7, i64 0}
!28 = !{!21, !6, i64 128}
!29 = !{!13, !13, i64 0}
!30 = !{!31, !6, i64 0}
!31 = !{!"RecordFFData", !6, i64 0, !27, i64 8, !13, i64 16}
!32 = !{!7, !7, i64 0}
!33 = !{!34, !13, i64 0}
!34 = !{!"CType", !13, i64 0, !13, i64 4, !23, i64 8, !23, i64 10, !15, i64 12}
!35 = !{!36, !6, i64 0}
!36 = !{!"CTState", !6, i64 0, !13, i64 8, !13, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !37, i64 48, !7, i64 216}
!37 = !{!"CCallback", !7, i64 0, !7, i64 64, !6, i64 128, !6, i64 136, !6, i64 144, !13, i64 152, !13, i64 156, !13, i64 160}
!38 = !{!31, !27, i64 8}


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

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define hidden void @recff_ffi_fill(ptr noundef %0, ptr nocapture noundef %1) local_unnamed_addr #3 {
  %3 = alloca i32, align 4
  %4 = getelementptr inbounds i8, ptr %0, i64 -160
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = zext i32 %5 to i64
  %7 = inttoptr i64 %6 to ptr
  %8 = getelementptr inbounds i8, ptr %0, i64 128
  %9 = load ptr, ptr %8, align 8, !tbaa !27
  %10 = load i32, ptr %9, align 4, !tbaa !28
  %11 = getelementptr inbounds i8, ptr %9, i64 4
  %12 = load i32, ptr %11, align 4, !tbaa !28
  %13 = getelementptr inbounds i8, ptr %9, i64 8
  %14 = load i32, ptr %13, align 4, !tbaa !28
  %15 = icmp ne i32 %10, 0
  %16 = icmp ne i32 %12, 0
  %or.cond = select i1 %15, i1 %16, i1 false
  br i1 %or.cond, label %17, label %60

17:                                               ; preds = %2
  %18 = load ptr, ptr %1, align 8, !tbaa !29
  %19 = getelementptr inbounds i8, ptr %18, i64 4
  %20 = load i32, ptr %19, align 4, !tbaa !31
  %21 = icmp eq i32 %20, -11
  br i1 %21, label %22, label %45

22:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %23 = load i32, ptr %18, align 8, !tbaa !31
  %24 = zext i32 %23 to i64
  %25 = inttoptr i64 %24 to ptr
  %26 = getelementptr inbounds i8, ptr %25, i64 6
  %27 = load i16, ptr %26, align 2, !tbaa !31
  %28 = zext i16 %27 to i32
  %29 = tail call ptr @ctype_raw(ptr noundef %7, i32 noundef %28)
  %30 = load i32, ptr %29, align 4, !tbaa !32
  %.mask = and i32 %30, -268435456
  %31 = icmp eq i32 %.mask, 536870912
  br i1 %31, label %32, label %34

32:                                               ; preds = %22
  %33 = tail call ptr @ctype_rawchild(ptr noundef %7, ptr noundef nonnull %29)
  br label %34

34:                                               ; preds = %32, %22
  %.0 = phi ptr [ %33, %32 ], [ %29, %22 ]
  %35 = load ptr, ptr %7, align 8, !tbaa !34
  %36 = ptrtoint ptr %.0 to i64
  %37 = ptrtoint ptr %35 to i64
  %38 = sub i64 %36, %37
  %39 = lshr exact i64 %38, 4
  %40 = trunc i64 %39 to i32
  %41 = call i32 @lj_ctype_info(ptr noundef nonnull %7, i32 noundef %40, ptr noundef nonnull %3) #4
  %42 = lshr i32 %41, 16
  %43 = and i32 %42, 15
  %44 = shl nuw nsw i32 1, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  br label %45

45:                                               ; preds = %34, %17
  %.035 = phi i32 [ %44, %34 ], [ 1, %17 ]
  %46 = call ptr @ctype_get(ptr noundef %7, i32 noundef 17)
  %47 = load ptr, ptr %1, align 8, !tbaa !29
  %48 = call i32 @crec_ct_tv(ptr noundef nonnull %0, ptr noundef %46, i32 noundef 0, i32 noundef %10, ptr noundef %47)
  %49 = load ptr, ptr %1, align 8, !tbaa !29
  %50 = getelementptr inbounds i8, ptr %49, i64 8
  %51 = call i32 @crec_toint(ptr noundef nonnull %0, ptr noundef %7, i32 noundef %12, ptr noundef nonnull %50)
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %56, label %52

52:                                               ; preds = %45
  %53 = load ptr, ptr %1, align 8, !tbaa !29
  %54 = getelementptr inbounds i8, ptr %53, i64 16
  %55 = call i32 @crec_toint(ptr noundef nonnull %0, ptr noundef %7, i32 noundef %14, ptr noundef nonnull %54)
  br label %58

56:                                               ; preds = %45
  %57 = call i32 @lj_ir_kint(ptr noundef nonnull %0, i32 noundef 0) #4
  br label %58

58:                                               ; preds = %56, %52
  %.036 = phi i32 [ %55, %52 ], [ %57, %56 ]
  %59 = getelementptr inbounds i8, ptr %1, i64 8
  store i64 0, ptr %59, align 8, !tbaa !37
  call void @crec_fill(ptr noundef nonnull %0, i32 noundef %48, i32 noundef %51, i32 noundef %.036, i32 noundef %.035)
  br label %60

60:                                               ; preds = %58, %2
  ret void
}

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 640}
!6 = !{!"GG_State", !7, i64 0, !10, i64 384, !20, i64 800, !8, i64 3312, !8, i64 3440, !8, i64 5384}
!7 = !{!"lua_State", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"global_State", !11, i64 0, !12, i64 8, !12, i64 12, !11, i64 16, !11, i64 24, !13, i64 32, !12, i64 88, !16, i64 92, !17, i64 108, !8, i64 124, !8, i64 125, !8, i64 126, !8, i64 127, !14, i64 128, !8, i64 136, !8, i64 144, !8, i64 152, !18, i64 160, !19, i64 184, !12, i64 208, !12, i64 212, !11, i64 216, !11, i64 224, !11, i64 232, !12, i64 240, !12, i64 244, !14, i64 248, !15, i64 252, !15, i64 256, !8, i64 260}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"GCState", !12, i64 0, !12, i64 4, !8, i64 8, !8, i64 9, !8, i64 10, !8, i64 11, !12, i64 12, !14, i64 16, !15, i64 20, !14, i64 24, !14, i64 28, !14, i64 32, !14, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52}
!14 = !{!"GCRef", !12, i64 0}
!15 = !{!"MRef", !12, i64 0}
!16 = !{!"SBuf", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!17 = !{!"GCstr", !14, i64 0, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !12, i64 8, !12, i64 12}
!18 = !{!"Node", !8, i64 0, !8, i64 8, !15, i64 16, !15, i64 20}
!19 = !{!"GCupval", !14, i64 0, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !8, i64 8, !15, i64 16, !12, i64 20}
!20 = !{!"jit_State", !21, i64 0, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !12, i64 136, !12, i64 140, !12, i64 144, !8, i64 148, !8, i64 149, !23, i64 150, !8, i64 151, !24, i64 152, !11, i64 176, !12, i64 184, !12, i64 188, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !12, i64 208, !15, i64 212, !8, i64 216, !11, i64 256, !12, i64 264, !12, i64 268, !12, i64 272, !12, i64 276, !11, i64 280, !11, i64 288, !12, i64 296, !12, i64 300, !8, i64 304, !11, i64 312, !12, i64 320, !12, i64 324, !11, i64 328, !8, i64 336, !8, i64 536, !8, i64 1556, !8, i64 1616, !8, i64 1744, !12, i64 2256, !12, i64 2260, !8, i64 2264, !12, i64 2392, !25, i64 2396, !11, i64 2416, !12, i64 2424, !12, i64 2428, !11, i64 2432, !12, i64 2440, !12, i64 2444, !11, i64 2448, !11, i64 2456, !11, i64 2464, !26, i64 2472, !26, i64 2480, !8, i64 2488, !11, i64 2496, !12, i64 2504, !12, i64 2508}
!21 = !{!"GCtrace", !14, i64 0, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !12, i64 8, !14, i64 12, !11, i64 16, !12, i64 24, !22, i64 28, !22, i64 30, !11, i64 32, !11, i64 40, !14, i64 48, !15, i64 52, !12, i64 56, !12, i64 60, !11, i64 64, !12, i64 72, !22, i64 76, !22, i64 78, !22, i64 80, !22, i64 82, !22, i64 84, !22, i64 86, !22, i64 88, !8, i64 90, !8, i64 91}
!22 = !{!"short", !8, i64 0}
!23 = !{!"IRType1", !8, i64 0}
!24 = !{!"FoldState", !8, i64 0, !8, i64 8, !8, i64 16}
!25 = !{!"ScEvEntry", !15, i64 0, !22, i64 4, !22, i64 6, !22, i64 8, !22, i64 10, !23, i64 12, !8, i64 13}
!26 = !{!"long", !8, i64 0}
!27 = !{!20, !11, i64 128}
!28 = !{!12, !12, i64 0}
!29 = !{!30, !11, i64 0}
!30 = !{!"RecordFFData", !11, i64 0, !26, i64 8, !12, i64 16}
!31 = !{!8, !8, i64 0}
!32 = !{!33, !12, i64 0}
!33 = !{!"CType", !12, i64 0, !12, i64 4, !22, i64 8, !22, i64 10, !14, i64 12}
!34 = !{!35, !11, i64 0}
!35 = !{!"CTState", !11, i64 0, !12, i64 8, !12, i64 12, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !36, i64 48, !8, i64 216}
!36 = !{!"CCallback", !8, i64 0, !8, i64 64, !11, i64 128, !11, i64 136, !11, i64 144, !12, i64 152, !12, i64 156, !12, i64 160}
!37 = !{!30, !26, i64 8}


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