; 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_shift(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 i32, align 4
  %11 = 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
  %12 = load ptr, ptr %4, 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 %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !28
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.jit_State, ptr %20, i32 0, i32 5
  %22 = load ptr, ptr %21, align 8, !tbaa !29
  %23 = getelementptr inbounds i32, ptr %22, i64 0
  %24 = load i32, ptr %23, align 4, !tbaa !28
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %71

26:                                               ; preds = %2
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.jit_State, ptr %27, i32 0, i32 5
  %29 = load ptr, ptr %28, align 8, !tbaa !29
  %30 = getelementptr inbounds i32, ptr %29, i64 1
  %31 = load i32, ptr %30, align 4, !tbaa !28
  %32 = and i32 %31, 520093696
  %33 = icmp eq i32 %32, 167772160
  br i1 %33, label %34, label %71

34:                                               ; preds = %26
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = call ptr @ctype_get(ptr noundef %36, i32 noundef 11)
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.jit_State, ptr %38, i32 0, i32 5
  %40 = load ptr, ptr %39, align 8, !tbaa !29
  %41 = getelementptr inbounds i32, ptr %40, i64 1
  %42 = load i32, ptr %41, align 4, !tbaa !28
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.RecordFFData, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !30
  %46 = getelementptr inbounds %union.TValue, ptr %45, i64 1
  %47 = call i32 @crec_ct_tv(ptr noundef %35, ptr noundef %37, i32 noundef 0, i32 noundef %42, ptr noundef %46)
  store i32 %47, ptr %8, align 4, !tbaa !28
  %48 = load i32, ptr %8, align 4, !tbaa !28
  %49 = lshr i32 %48, 24
  %50 = and i32 %49, 31
  %51 = sub i32 %50, 15
  %52 = icmp ule i32 %51, 4
  br i1 %52, label %65, label %53

53:                                               ; preds = %34
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load i32, ptr %8, align 4, !tbaa !28
  %56 = trunc i32 %55 to i16
  %57 = load i32, ptr %8, align 4, !tbaa !28
  %58 = lshr i32 %57, 24
  %59 = and i32 %58, 31
  %60 = or i32 %59, 608
  %61 = or i32 %60, 0
  %62 = trunc i32 %61 to i16
  call void @lj_ir_set_(ptr noundef %54, i16 noundef zeroext 23059, i16 noundef zeroext %56, i16 noundef zeroext %62)
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = call i32 @lj_opt_fold(ptr noundef %63)
  store i32 %64, ptr %8, align 4, !tbaa !28
  br label %65

65:                                               ; preds = %53, %34
  %66 = load i32, ptr %8, align 4, !tbaa !28
  %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 1
  store i32 %66, ptr %70, align 4, !tbaa !28
  br label %71

71:                                               ; preds = %65, %26, %2
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.RecordFFData, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !30
  %76 = getelementptr inbounds %union.TValue, ptr %75, i64 0
  %77 = call i32 @crec_bit64_type(ptr noundef %72, ptr noundef %76)
  store i32 %77, ptr %7, align 4, !tbaa !28
  %78 = load i32, ptr %7, align 4, !tbaa !28
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %155

80:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = load i32, ptr %7, align 4, !tbaa !28
  %84 = call ptr @ctype_get(ptr noundef %82, i32 noundef %83)
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.jit_State, ptr %85, i32 0, i32 5
  %87 = load ptr, ptr %86, align 8, !tbaa !29
  %88 = getelementptr inbounds i32, ptr %87, i64 0
  %89 = load i32, ptr %88, align 4, !tbaa !28
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.RecordFFData, ptr %90, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !30
  %93 = getelementptr inbounds %union.TValue, ptr %92, i64 0
  %94 = call i32 @crec_ct_tv(ptr noundef %81, ptr noundef %84, i32 noundef 0, i32 noundef %89, ptr noundef %93)
  store i32 %94, ptr %9, align 4, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.RecordFFData, ptr %95, i32 0, i32 2
  %97 = load i32, ptr %96, align 8, !tbaa !32
  store i32 %97, ptr %10, align 4, !tbaa !28
  %98 = load i32, ptr %8, align 4, !tbaa !28
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %108, label %100

100:                                              ; preds = %80
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.jit_State, ptr %102, i32 0, i32 5
  %104 = load ptr, ptr %103, align 8, !tbaa !29
  %105 = getelementptr inbounds i32, ptr %104, i64 1
  %106 = load i32, ptr %105, align 4, !tbaa !28
  %107 = call i32 @lj_opt_narrow_tobit(ptr noundef %101, i32 noundef %106)
  store i32 %107, ptr %8, align 4, !tbaa !28
  br label %108

108:                                              ; preds = %100, %80
  %109 = load i32, ptr %10, align 4, !tbaa !28
  %110 = icmp ult i32 %109, 39
  br i1 %110, label %111, label %112

111:                                              ; preds = %108
  br i1 true, label %127, label %113

112:                                              ; preds = %108
  br i1 true, label %127, label %113

113:                                              ; preds = %112, %111
  %114 = load i32, ptr %8, align 4, !tbaa !28
  %115 = trunc i32 %114 to i16
  %116 = zext i16 %115 to i32
  %117 = icmp slt i32 %116, 32768
  br i1 %117, label %127, label %118

118:                                              ; preds = %113
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = load i32, ptr %8, align 4, !tbaa !28
  %121 = trunc i32 %120 to i16
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = call i32 @lj_ir_kint(ptr noundef %122, i32 noundef 63)
  %124 = trunc i32 %123 to i16
  call void @lj_ir_set_(ptr noundef %119, i16 noundef zeroext 8467, i16 noundef zeroext %121, i16 noundef zeroext %124)
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = call i32 @lj_opt_fold(ptr noundef %125)
  store i32 %126, ptr %8, align 4, !tbaa !28
  br label %127

127:                                              ; preds = %118, %113, %112, %111
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = load i32, ptr %10, align 4, !tbaa !28
  %130 = shl i32 %129, 8
  %131 = load i32, ptr %7, align 4, !tbaa !28
  %132 = sub i32 %131, 11
  %133 = add i32 %132, 21
  %134 = or i32 %130, %133
  %135 = trunc i32 %134 to i16
  %136 = load i32, ptr %9, align 4, !tbaa !28
  %137 = trunc i32 %136 to i16
  %138 = load i32, ptr %8, align 4, !tbaa !28
  %139 = trunc i32 %138 to i16
  call void @lj_ir_set_(ptr noundef %128, i16 noundef zeroext %135, i16 noundef zeroext %137, i16 noundef zeroext %139)
  %140 = load ptr, ptr %4, align 8, !tbaa !5
  %141 = call i32 @lj_opt_fold(ptr noundef %140)
  store i32 %141, ptr %9, align 4, !tbaa !28
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = load i32, ptr %7, align 4, !tbaa !28
  %145 = call i32 @lj_ir_kint(ptr noundef %143, i32 noundef %144)
  %146 = trunc i32 %145 to i16
  %147 = load i32, ptr %9, align 4, !tbaa !28
  %148 = trunc i32 %147 to i16
  call void @lj_ir_set_(ptr noundef %142, i16 noundef zeroext 21386, i16 noundef zeroext %146, i16 noundef zeroext %148)
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = call i32 @lj_opt_fold(ptr noundef %149)
  %151 = load ptr, ptr %4, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.jit_State, ptr %151, i32 0, i32 5
  %153 = load ptr, ptr %152, align 8, !tbaa !29
  %154 = getelementptr inbounds i32, ptr %153, i64 0
  store i32 %150, ptr %154, align 4, !tbaa !28
  store i32 1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %156

155:                                              ; preds = %71
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %156

156:                                              ; preds = %155, %127
  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
  %157 = load i32, ptr %3, align 4
  ret i32 %157
}

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

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 = !{!31, !13, i64 16}


; 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: 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_shift(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
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %35, label %10

10:                                               ; preds = %2
  %11 = getelementptr inbounds i8, ptr %8, i64 4
  %12 = load i32, ptr %11, align 4, !tbaa !28
  %13 = and i32 %12, 520093696
  %14 = icmp eq i32 %13, 167772160
  br i1 %14, label %15, label %35

15:                                               ; preds = %10
  %16 = tail call ptr @ctype_get(ptr noundef %6, i32 noundef 11)
  %17 = load ptr, ptr %7, align 8, !tbaa !27
  %18 = getelementptr inbounds i8, ptr %17, i64 4
  %19 = load i32, ptr %18, align 4, !tbaa !28
  %20 = load ptr, ptr %1, align 8, !tbaa !29
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  %22 = tail call i32 @crec_ct_tv(ptr noundef nonnull %0, ptr noundef %16, i32 noundef 0, i32 noundef %19, ptr noundef nonnull %21)
  %23 = lshr i32 %22, 24
  %24 = and i32 %23, 31
  %25 = add nsw i32 %24, -15
  %26 = icmp ult i32 %25, 5
  br i1 %26, label %32, label %27

27:                                               ; preds = %15
  %28 = trunc i32 %22 to i16
  %29 = trunc nuw nsw i32 %24 to i16
  %30 = or disjoint i16 %29, 608
  tail call void @lj_ir_set_(ptr noundef nonnull %0, i16 noundef zeroext 23059, i16 noundef zeroext %28, i16 noundef zeroext %30)
  %31 = tail call i32 @lj_opt_fold(ptr noundef nonnull %0) #3
  br label %32

32:                                               ; preds = %27, %15
  %.038 = phi i32 [ %22, %15 ], [ %31, %27 ]
  %33 = load ptr, ptr %7, align 8, !tbaa !27
  %34 = getelementptr inbounds i8, ptr %33, i64 4
  store i32 %.038, ptr %34, align 4, !tbaa !28
  br label %35

35:                                               ; preds = %32, %10, %2
  %.1 = phi i32 [ %.038, %32 ], [ 0, %10 ], [ 0, %2 ]
  %36 = load ptr, ptr %1, align 8, !tbaa !29
  %37 = tail call i32 @crec_bit64_type(ptr noundef %6, ptr noundef %36)
  %.not40 = icmp eq i32 %37, 0
  br i1 %.not40, label %64, label %38

38:                                               ; preds = %35
  %39 = tail call ptr @ctype_get(ptr noundef %6, i32 noundef %37)
  %40 = load ptr, ptr %7, align 8, !tbaa !27
  %41 = load i32, ptr %40, align 4, !tbaa !28
  %42 = load ptr, ptr %1, align 8, !tbaa !29
  %43 = tail call i32 @crec_ct_tv(ptr noundef nonnull %0, ptr noundef %39, i32 noundef 0, i32 noundef %41, ptr noundef %42)
  %44 = getelementptr inbounds i8, ptr %1, i64 16
  %45 = load i32, ptr %44, align 8, !tbaa !31
  %.not41 = icmp eq i32 %.1, 0
  br i1 %.not41, label %46, label %51

46:                                               ; preds = %38
  %47 = load ptr, ptr %7, align 8, !tbaa !27
  %48 = getelementptr inbounds i8, ptr %47, i64 4
  %49 = load i32, ptr %48, align 4, !tbaa !28
  %50 = tail call i32 @lj_opt_narrow_tobit(ptr noundef nonnull %0, i32 noundef %49) #3
  br label %51

51:                                               ; preds = %38, %46
  %.2 = phi i32 [ %.1, %38 ], [ %50, %46 ]
  %52 = shl i32 %45, 8
  %53 = add i32 %37, 10
  %54 = or i32 %52, %53
  %55 = trunc i32 %54 to i16
  %56 = trunc i32 %43 to i16
  %57 = trunc i32 %.2 to i16
  tail call void @lj_ir_set_(ptr noundef nonnull %0, i16 noundef zeroext %55, i16 noundef zeroext %56, i16 noundef zeroext %57)
  %58 = tail call i32 @lj_opt_fold(ptr noundef nonnull %0) #3
  %59 = tail call i32 @lj_ir_kint(ptr noundef nonnull %0, i32 noundef %37) #3
  %60 = trunc i32 %59 to i16
  %61 = trunc i32 %58 to i16
  tail call void @lj_ir_set_(ptr noundef nonnull %0, i16 noundef zeroext 21386, i16 noundef zeroext %60, i16 noundef zeroext %61)
  %62 = tail call i32 @lj_opt_fold(ptr noundef nonnull %0) #3
  %63 = load ptr, ptr %7, align 8, !tbaa !27
  store i32 %62, ptr %63, align 4, !tbaa !28
  br label %64

64:                                               ; preds = %35, %51
  %.0 = phi i32 [ 1, %51 ], [ 0, %35 ]
  ret i32 %.0
}

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

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 = { 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 = !{!30, !12, i64 16}


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