; 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_kint64(ptr noundef, i64 noundef) #2

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

declare hidden i32 @lj_ir_call(ptr noundef, i32 noundef, ...) #2

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

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

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

35:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !9
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.jit_State, ptr %36, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !32
  %39 = call i64 @lj_carith_check64(ptr noundef %38, i32 noundef 2, ptr noundef %13)
  %40 = trunc i64 %39 to i32
  store i32 %40, ptr %12, align 4, !tbaa !9
  %41 = load i32, ptr %13, align 4, !tbaa !9
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %53

43:                                               ; preds = %35
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = call ptr @ctype_get(ptr noundef %45, i32 noundef 9)
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.RecordFFData, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !29
  %51 = getelementptr inbounds %union.TValue, ptr %50, i64 1
  %52 = call i32 @crec_ct_tv(ptr noundef %44, ptr noundef %46, i32 noundef 0, i32 noundef %47, ptr noundef %51)
  store i32 %52, ptr %10, align 4, !tbaa !9
  br label %57

53:                                               ; preds = %35
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load i32, ptr %10, align 4, !tbaa !9
  %56 = call i32 @lj_opt_narrow_tobit(ptr noundef %54, i32 noundef %55)
  store i32 %56, ptr %10, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %53, %43
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = trunc i32 %59 to i16
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = load i32, ptr %12, align 4, !tbaa !9
  %63 = call i32 @lj_ir_kint(ptr noundef %61, i32 noundef %62)
  %64 = trunc i32 %63 to i16
  call void @lj_ir_set_(ptr noundef %58, i16 noundef zeroext 2195, i16 noundef zeroext %60, i16 noundef zeroext %64)
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = call i32 @lj_opt_fold(ptr noundef %65)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %72

67:                                               ; preds = %3
  %68 = load i32, ptr %8, align 4, !tbaa !9
  %69 = icmp ne i32 %68, 0
  %70 = zext i1 %69 to i64
  %71 = select i1 %69, i32 16, i32 8
  store i32 %71, ptr %12, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %67, %57
  %73 = load i32, ptr %12, align 4, !tbaa !9
  %74 = icmp slt i32 %73, 0
  br i1 %74, label %75, label %80

75:                                               ; preds = %72
  %76 = load i32, ptr %12, align 4, !tbaa !9
  %77 = sub nsw i32 0, %76
  store i32 %77, ptr %12, align 4, !tbaa !9
  %78 = load i32, ptr %11, align 4, !tbaa !9
  %79 = or i32 %78, 8192
  store i32 %79, ptr %11, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %75, %72
  %81 = load i32, ptr %12, align 4, !tbaa !9
  %82 = add nsw i32 %81, 1
  %83 = and i32 %82, 255
  %84 = shl i32 %83, 24
  %85 = load i32, ptr %11, align 4, !tbaa !9
  %86 = or i32 %85, %84
  store i32 %86, ptr %11, align 4, !tbaa !9
  %87 = load i32, ptr %8, align 4, !tbaa !9
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %121

89:                                               ; preds = %80
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = load i32, ptr %8, align 4, !tbaa !9
  %93 = call ptr @ctype_get(ptr noundef %91, i32 noundef %92)
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.jit_State, ptr %94, i32 0, i32 5
  %96 = load ptr, ptr %95, align 8, !tbaa !31
  %97 = getelementptr inbounds i32, ptr %96, i64 0
  %98 = load i32, ptr %97, align 4, !tbaa !9
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.RecordFFData, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !29
  %102 = getelementptr inbounds %union.TValue, ptr %101, i64 0
  %103 = call i32 @crec_ct_tv(ptr noundef %90, ptr noundef %93, i32 noundef 0, i32 noundef %98, ptr noundef %102)
  store i32 %103, ptr %9, align 4, !tbaa !9
  %104 = load i32, ptr %12, align 4, !tbaa !9
  %105 = icmp slt i32 %104, 16
  br i1 %105, label %106, label %120

106:                                              ; preds = %89
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = load i32, ptr %9, align 4, !tbaa !9
  %109 = trunc i32 %108 to i16
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = load i32, ptr %12, align 4, !tbaa !9
  %112 = mul nsw i32 4, %111
  %113 = zext i32 %112 to i64
  %114 = shl i64 1, %113
  %115 = sub i64 %114, 1
  %116 = call i32 @lj_ir_kint64(ptr noundef %110, i64 noundef %115)
  %117 = trunc i32 %116 to i16
  call void @lj_ir_set_(ptr noundef %107, i16 noundef zeroext 8470, i16 noundef zeroext %109, i16 noundef zeroext %117)
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = call i32 @lj_opt_fold(ptr noundef %118)
  store i32 %119, ptr %9, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %106, %89
  br label %151

121:                                              ; preds = %80
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.jit_State, ptr %123, i32 0, i32 5
  %125 = load ptr, ptr %124, align 8, !tbaa !31
  %126 = getelementptr inbounds i32, ptr %125, i64 0
  %127 = load i32, ptr %126, align 4, !tbaa !9
  %128 = call i32 @lj_opt_narrow_tobit(ptr noundef %122, i32 noundef %127)
  store i32 %128, ptr %9, align 4, !tbaa !9
  %129 = load i32, ptr %12, align 4, !tbaa !9
  %130 = icmp slt i32 %129, 8
  br i1 %130, label %131, label %144

131:                                              ; preds = %121
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = load i32, ptr %9, align 4, !tbaa !9
  %134 = trunc i32 %133 to i16
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = load i32, ptr %12, align 4, !tbaa !9
  %137 = mul nsw i32 4, %136
  %138 = shl i32 1, %137
  %139 = sub i32 %138, 1
  %140 = call i32 @lj_ir_kint(ptr noundef %135, i32 noundef %139)
  %141 = trunc i32 %140 to i16
  call void @lj_ir_set_(ptr noundef %132, i16 noundef zeroext 8467, i16 noundef zeroext %134, i16 noundef zeroext %141)
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  %143 = call i32 @lj_opt_fold(ptr noundef %142)
  store i32 %143, ptr %9, align 4, !tbaa !9
  br label %144

144:                                              ; preds = %131, %121
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = load i32, ptr %9, align 4, !tbaa !9
  %147 = trunc i32 %146 to i16
  call void @lj_ir_set_(ptr noundef %145, i16 noundef zeroext 23062, i16 noundef zeroext %147, i16 noundef zeroext 723)
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = call i32 @lj_opt_fold(ptr noundef %148)
  store i32 %149, ptr %9, align 4, !tbaa !9
  %150 = load ptr, ptr %4, align 8, !tbaa !5
  br label %151

151:                                              ; preds = %144, %120
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = load i32, ptr %6, align 4, !tbaa !9
  %154 = load ptr, ptr %4, align 8, !tbaa !5
  %155 = load i32, ptr %11, align 4, !tbaa !9
  %156 = call i32 @lj_ir_kint(ptr noundef %154, i32 noundef %155)
  %157 = load i32, ptr %9, align 4, !tbaa !9
  %158 = call i32 (ptr, i32, ...) @lj_ir_call(ptr noundef %152, i32 noundef 10, i32 noundef %153, i32 noundef %156, i32 noundef %157)
  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 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret i32 %158
}

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


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

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

; 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_kint64(ptr noundef, i64 noundef) local_unnamed_addr #2

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

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

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

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

; Function Attrs: nounwind uwtable
define hidden i32 @recff_bit64_tohex(ptr noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #3 {
  %4 = alloca i32, align 4
  %5 = getelementptr inbounds i8, ptr %0, i64 -160
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = zext i32 %6 to i64
  %8 = inttoptr i64 %7 to ptr
  %9 = load ptr, ptr %1, align 8, !tbaa !27
  %10 = tail call i32 @crec_bit64_type(ptr noundef %8, ptr noundef %9)
  %11 = getelementptr inbounds i8, ptr %0, i64 128
  %12 = load ptr, ptr %11, align 8, !tbaa !29
  %13 = getelementptr inbounds i8, ptr %12, i64 4
  %14 = load i32, ptr %13, align 4, !tbaa !30
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %33, label %15

15:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 0, ptr %4, align 4, !tbaa !30
  %16 = getelementptr inbounds i8, ptr %0, i64 96
  %17 = load ptr, ptr %16, align 8, !tbaa !31
  %18 = call i64 @lj_carith_check64(ptr noundef %17, i32 noundef 2, ptr noundef nonnull %4) #5
  %19 = trunc i64 %18 to i32
  %20 = load i32, ptr %4, align 4, !tbaa !30
  %.not58 = icmp eq i32 %20, 0
  br i1 %.not58, label %26, label %21

21:                                               ; preds = %15
  %22 = call ptr @ctype_get(ptr noundef %8, i32 noundef 9)
  %23 = load ptr, ptr %1, align 8, !tbaa !27
  %24 = getelementptr inbounds i8, ptr %23, i64 8
  %25 = call i32 @crec_ct_tv(ptr noundef nonnull %0, ptr noundef %22, i32 noundef 0, i32 noundef %14, ptr noundef nonnull %24)
  br label %28

26:                                               ; preds = %15
  %27 = call i32 @lj_opt_narrow_tobit(ptr noundef nonnull %0, i32 noundef %14) #5
  br label %28

28:                                               ; preds = %26, %21
  %.052 = phi i32 [ %25, %21 ], [ %27, %26 ]
  %29 = trunc i32 %.052 to i16
  %30 = call i32 @lj_ir_kint(ptr noundef nonnull %0, i32 noundef %19) #5
  %31 = trunc i32 %30 to i16
  call void @lj_ir_set_(ptr noundef nonnull %0, i16 noundef zeroext 2195, i16 noundef zeroext %29, i16 noundef zeroext %31)
  %32 = call i32 @lj_opt_fold(ptr noundef nonnull %0) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  br label %35

33:                                               ; preds = %3
  %.not57 = icmp eq i32 %10, 0
  %34 = select i1 %.not57, i32 8, i32 16
  br label %35

35:                                               ; preds = %33, %28
  %.0 = phi i32 [ %19, %28 ], [ %34, %33 ]
  %spec.select61 = call i32 @llvm.abs.i32(i32 %.0, i1 true)
  %.not59 = icmp eq i32 %10, 0
  br i1 %.not59, label %50, label %36

36:                                               ; preds = %35
  %37 = call ptr @ctype_get(ptr noundef %8, i32 noundef %10)
  %38 = load ptr, ptr %11, align 8, !tbaa !29
  %39 = load i32, ptr %38, align 4, !tbaa !30
  %40 = load ptr, ptr %1, align 8, !tbaa !27
  %41 = call i32 @crec_ct_tv(ptr noundef nonnull %0, ptr noundef %37, i32 noundef 0, i32 noundef %39, ptr noundef %40)
  %42 = icmp ult i32 %spec.select61, 16
  br i1 %42, label %43, label %65

43:                                               ; preds = %36
  %44 = trunc i32 %41 to i16
  %45 = shl nuw nsw i32 %spec.select61, 2
  %46 = zext nneg i32 %45 to i64
  %notmask60 = shl nsw i64 -1, %46
  %47 = xor i64 %notmask60, -1
  %48 = call i32 @lj_ir_kint64(ptr noundef nonnull %0, i64 noundef %47) #5
  %49 = trunc i32 %48 to i16
  call void @lj_ir_set_(ptr noundef nonnull %0, i16 noundef zeroext 8470, i16 noundef zeroext %44, i16 noundef zeroext %49)
  br label %.sink.split

50:                                               ; preds = %35
  %51 = load ptr, ptr %11, align 8, !tbaa !29
  %52 = load i32, ptr %51, align 4, !tbaa !30
  %53 = call i32 @lj_opt_narrow_tobit(ptr noundef nonnull %0, i32 noundef %52) #5
  %54 = icmp ult i32 %spec.select61, 8
  br i1 %54, label %55, label %62

55:                                               ; preds = %50
  %56 = trunc i32 %53 to i16
  %57 = shl nuw nsw i32 %spec.select61, 2
  %notmask = shl nsw i32 -1, %57
  %58 = xor i32 %notmask, -1
  %59 = call i32 @lj_ir_kint(ptr noundef nonnull %0, i32 noundef %58) #5
  %60 = trunc i32 %59 to i16
  call void @lj_ir_set_(ptr noundef nonnull %0, i16 noundef zeroext 8467, i16 noundef zeroext %56, i16 noundef zeroext %60)
  %61 = call i32 @lj_opt_fold(ptr noundef nonnull %0) #5
  br label %62

62:                                               ; preds = %55, %50
  %.053 = phi i32 [ %61, %55 ], [ %53, %50 ]
  %63 = trunc i32 %.053 to i16
  call void @lj_ir_set_(ptr noundef nonnull %0, i16 noundef zeroext 23062, i16 noundef zeroext %63, i16 noundef zeroext 723)
  br label %.sink.split

.sink.split:                                      ; preds = %62, %43
  %64 = call i32 @lj_opt_fold(ptr noundef nonnull %0) #5
  br label %65

65:                                               ; preds = %.sink.split, %36
  %.154 = phi i32 [ %41, %36 ], [ %64, %.sink.split ]
  %66 = icmp slt i32 %.0, 0
  %spec.select = select i1 %66, i32 8212, i32 20
  %67 = shl i32 %spec.select61, 24
  %68 = add i32 %67, 16777216
  %69 = or disjoint i32 %68, %spec.select
  %70 = call i32 @lj_ir_kint(ptr noundef nonnull %0, i32 noundef %69) #5
  %71 = call i32 (ptr, i32, ...) @lj_ir_call(ptr noundef nonnull %0, i32 noundef 10, i32 noundef %2, i32 noundef %70, i32 noundef %.154) #5
  ret i32 %71
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 = !{!28, !11, i64 0}
!28 = !{!"RecordFFData", !11, i64 0, !26, i64 8, !12, i64 16}
!29 = !{!20, !11, i64 128}
!30 = !{!12, !12, i64 0}
!31 = !{!20, !11, i64 96}


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