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

; 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 void @lj_ir_set_(ptr noundef, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext) #1

declare hidden i32 @lj_opt_fold(ptr noundef) #2

; 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_bit64_type(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define hidden i32 @recff_bit64_nary(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 -800
  %17 = getelementptr inbounds %struct.GG_State, ptr %16, i32 0, i32 1
  %18 = getelementptr inbounds %struct.global_State, ptr %17, i32 0, i32 28
  %19 = getelementptr inbounds %struct.MRef, ptr %18, i32 0, i32 0
  %20 = load i32, ptr %19, align 8, !tbaa !9
  %21 = zext i32 %20 to i64
  %22 = inttoptr i64 %21 to ptr
  store ptr %22, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !28
  br label %23

23:                                               ; preds = %47, %2
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.jit_State, ptr %24, i32 0, i32 5
  %26 = load ptr, ptr %25, align 8, !tbaa !29
  %27 = load i32, ptr %8, align 4, !tbaa !28
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr %26, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !28
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %50

32:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.RecordFFData, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !30
  %37 = load i32, ptr %8, align 4, !tbaa !28
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds %union.TValue, ptr %36, i64 %38
  %40 = call i32 @crec_bit64_type(ptr noundef %33, ptr noundef %39)
  store i32 %40, ptr %9, align 4, !tbaa !28
  %41 = load i32, ptr %7, align 4, !tbaa !28
  %42 = load i32, ptr %9, align 4, !tbaa !28
  %43 = icmp ult i32 %41, %42
  br i1 %43, label %44, label %46

44:                                               ; preds = %32
  %45 = load i32, ptr %9, align 4, !tbaa !28
  store i32 %45, ptr %7, align 4, !tbaa !28
  br label %46

46:                                               ; preds = %44, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %47

47:                                               ; preds = %46
  %48 = load i32, ptr %8, align 4, !tbaa !28
  %49 = add i32 %48, 1
  store i32 %49, ptr %8, align 4, !tbaa !28
  br label %23, !llvm.loop !32

50:                                               ; preds = %23
  %51 = load i32, ptr %7, align 4, !tbaa !28
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %129

53:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = load i32, ptr %7, align 4, !tbaa !28
  %56 = call ptr @ctype_get(ptr noundef %54, i32 noundef %55)
  store ptr %56, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.RecordFFData, ptr %57, i32 0, i32 2
  %59 = load i32, ptr %58, align 8, !tbaa !34
  %60 = shl i32 %59, 8
  %61 = load i32, ptr %7, align 4, !tbaa !28
  %62 = sub i32 %61, 11
  %63 = add i32 %62, 21
  %64 = or i32 %60, %63
  store i32 %64, ptr %11, align 4, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.jit_State, ptr %67, i32 0, i32 5
  %69 = load ptr, ptr %68, align 8, !tbaa !29
  %70 = getelementptr inbounds i32, ptr %69, i64 0
  %71 = load i32, ptr %70, align 4, !tbaa !28
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.RecordFFData, ptr %72, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8, !tbaa !30
  %75 = getelementptr inbounds %union.TValue, ptr %74, i64 0
  %76 = call i32 @crec_ct_tv(ptr noundef %65, ptr noundef %66, i32 noundef 0, i32 noundef %71, ptr noundef %75)
  store i32 %76, ptr %12, align 4, !tbaa !28
  store i32 1, ptr %8, align 4, !tbaa !28
  br label %77

77:                                               ; preds = %112, %53
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.jit_State, ptr %78, i32 0, i32 5
  %80 = load ptr, ptr %79, align 8, !tbaa !29
  %81 = load i32, ptr %8, align 4, !tbaa !28
  %82 = zext i32 %81 to i64
  %83 = getelementptr inbounds i32, ptr %80, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !28
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %115

86:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.jit_State, ptr %89, i32 0, i32 5
  %91 = load ptr, ptr %90, align 8, !tbaa !29
  %92 = load i32, ptr %8, align 4, !tbaa !28
  %93 = zext i32 %92 to i64
  %94 = getelementptr inbounds i32, ptr %91, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !28
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.RecordFFData, ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8, !tbaa !30
  %99 = load i32, ptr %8, align 4, !tbaa !28
  %100 = zext i32 %99 to i64
  %101 = getelementptr inbounds %union.TValue, ptr %98, i64 %100
  %102 = call i32 @crec_ct_tv(ptr noundef %87, ptr noundef %88, i32 noundef 0, i32 noundef %95, ptr noundef %101)
  store i32 %102, ptr %13, align 4, !tbaa !28
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = load i32, ptr %11, align 4, !tbaa !28
  %105 = trunc i32 %104 to i16
  %106 = load i32, ptr %12, align 4, !tbaa !28
  %107 = trunc i32 %106 to i16
  %108 = load i32, ptr %13, align 4, !tbaa !28
  %109 = trunc i32 %108 to i16
  call void @lj_ir_set_(ptr noundef %103, i16 noundef zeroext %105, i16 noundef zeroext %107, i16 noundef zeroext %109)
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = call i32 @lj_opt_fold(ptr noundef %110)
  store i32 %111, ptr %12, align 4, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %112

112:                                              ; preds = %86
  %113 = load i32, ptr %8, align 4, !tbaa !28
  %114 = add i32 %113, 1
  store i32 %114, ptr %8, align 4, !tbaa !28
  br label %77, !llvm.loop !35

115:                                              ; preds = %77
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  %118 = load i32, ptr %7, align 4, !tbaa !28
  %119 = call i32 @lj_ir_kint(ptr noundef %117, i32 noundef %118)
  %120 = trunc i32 %119 to i16
  %121 = load i32, ptr %12, align 4, !tbaa !28
  %122 = trunc i32 %121 to i16
  call void @lj_ir_set_(ptr noundef %116, i16 noundef zeroext 21386, i16 noundef zeroext %120, i16 noundef zeroext %122)
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = call i32 @lj_opt_fold(ptr noundef %123)
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.jit_State, ptr %125, i32 0, i32 5
  %127 = load ptr, ptr %126, align 8, !tbaa !29
  %128 = getelementptr inbounds i32, ptr %127, i64 0
  store i32 %124, ptr %128, align 4, !tbaa !28
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %130

129:                                              ; preds = %50
  store i32 0, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %130

130:                                              ; preds = %129, %115
  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 8, ptr %6) #4
  %131 = load i32, ptr %3, align 4
  ret i32 %131
}

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 = !{!13, !13, i64 0}
!29 = !{!21, !6, i64 128}
!30 = !{!31, !6, i64 0}
!31 = !{!"RecordFFData", !6, i64 0, !27, i64 8, !13, i64 16}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!31, !13, i64 16}
!35 = distinct !{!35, !33}


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

%union.TValue = type { i64 }

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @lj_ir_set_(ptr noundef, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #0

declare hidden i32 @lj_opt_fold(ptr noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: nounwind uwtable
define hidden range(i32 0, 2) i32 @recff_bit64_nary(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 -160
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = zext i32 %4 to i64
  %6 = inttoptr i64 %5 to ptr
  %7 = getelementptr inbounds i8, ptr %0, i64 128
  %8 = load ptr, ptr %7, align 8, !tbaa !27
  %9 = load i32, ptr %8, align 4, !tbaa !28
  %.not47 = icmp eq i32 %9, 0
  br i1 %.not47, label %._crit_edge.thread, label %.lr.ph

.lr.ph:                                           ; preds = %2, %.lr.ph
  %10 = phi i64 [ %16, %.lr.ph ], [ 0, %2 ]
  %.04049 = phi i32 [ %spec.select, %.lr.ph ], [ 0, %2 ]
  %.04148 = phi i32 [ %14, %.lr.ph ], [ 0, %2 ]
  %11 = load ptr, ptr %1, align 8, !tbaa !29
  %12 = getelementptr inbounds %union.TValue, ptr %11, i64 %10
  %13 = tail call i32 @crec_bit64_type(ptr noundef %6, ptr noundef %12)
  %spec.select = tail call i32 @llvm.umax.i32(i32 %.04049, i32 %13)
  %14 = add i32 %.04148, 1
  %15 = load ptr, ptr %7, align 8, !tbaa !27
  %16 = zext i32 %14 to i64
  %17 = getelementptr inbounds i32, ptr %15, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !28
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !31

._crit_edge:                                      ; preds = %.lr.ph
  %.not45 = icmp eq i32 %spec.select, 0
  br i1 %.not45, label %._crit_edge.thread, label %19

19:                                               ; preds = %._crit_edge
  %20 = tail call ptr @ctype_get(ptr noundef %6, i32 noundef %spec.select)
  %21 = getelementptr inbounds i8, ptr %1, i64 16
  %22 = load i32, ptr %21, align 8, !tbaa !33
  %23 = load ptr, ptr %7, align 8, !tbaa !27
  %24 = load i32, ptr %23, align 4, !tbaa !28
  %25 = load ptr, ptr %1, align 8, !tbaa !29
  %26 = tail call i32 @crec_ct_tv(ptr noundef nonnull %0, ptr noundef %20, i32 noundef 0, i32 noundef %24, ptr noundef %25)
  %27 = load ptr, ptr %7, align 8, !tbaa !27
  %28 = getelementptr inbounds i8, ptr %27, i64 4
  %29 = load i32, ptr %28, align 4, !tbaa !28
  %.not4650 = icmp eq i32 %29, 0
  br i1 %.not4650, label %._crit_edge55, label %.lr.ph54

.lr.ph54:                                         ; preds = %19
  %30 = shl i32 %22, 8
  %31 = add i32 %spec.select, 10
  %32 = or i32 %30, %31
  %33 = trunc i32 %32 to i16
  br label %34

34:                                               ; preds = %.lr.ph54, %34
  %35 = phi i32 [ %29, %.lr.ph54 ], [ %47, %34 ]
  %36 = phi i64 [ 1, %.lr.ph54 ], [ %45, %34 ]
  %.03952 = phi i32 [ %26, %.lr.ph54 ], [ %42, %34 ]
  %.14251 = phi i32 [ 1, %.lr.ph54 ], [ %43, %34 ]
  %37 = load ptr, ptr %1, align 8, !tbaa !29
  %38 = getelementptr inbounds %union.TValue, ptr %37, i64 %36
  %39 = tail call i32 @crec_ct_tv(ptr noundef nonnull %0, ptr noundef %20, i32 noundef 0, i32 noundef %35, ptr noundef %38)
  %40 = trunc i32 %.03952 to i16
  %41 = trunc i32 %39 to i16
  tail call void @lj_ir_set_(ptr noundef nonnull %0, i16 noundef zeroext %33, i16 noundef zeroext %40, i16 noundef zeroext %41)
  %42 = tail call i32 @lj_opt_fold(ptr noundef nonnull %0) #4
  %43 = add i32 %.14251, 1
  %44 = load ptr, ptr %7, align 8, !tbaa !27
  %45 = zext i32 %43 to i64
  %46 = getelementptr inbounds i32, ptr %44, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !28
  %.not46 = icmp eq i32 %47, 0
  br i1 %.not46, label %._crit_edge55, label %34, !llvm.loop !34

._crit_edge55:                                    ; preds = %34, %19
  %.039.lcssa = phi i32 [ %26, %19 ], [ %42, %34 ]
  %48 = tail call i32 @lj_ir_kint(ptr noundef nonnull %0, i32 noundef %spec.select) #4
  %49 = trunc i32 %48 to i16
  %50 = trunc i32 %.039.lcssa to i16
  tail call void @lj_ir_set_(ptr noundef nonnull %0, i16 noundef zeroext 21386, i16 noundef zeroext %49, i16 noundef zeroext %50)
  %51 = tail call i32 @lj_opt_fold(ptr noundef nonnull %0) #4
  %52 = load ptr, ptr %7, align 8, !tbaa !27
  store i32 %51, ptr %52, align 4, !tbaa !28
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %2, %._crit_edge, %._crit_edge55
  %.0 = phi i32 [ 1, %._crit_edge55 ], [ 0, %._crit_edge ], [ 0, %2 ]
  ret i32 %.0
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #3

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!30, !12, i64 16}
!34 = distinct !{!34, !32}


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