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

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

%union.TValue = type { i64 }
%struct.anon.2 = type { %struct.GCRef, %union.FrameLink }
%struct.GCRef = type { i32 }
%union.FrameLink = type { i32 }
%struct.GCfuncC = type { %struct.GCRef, i8, i8, i8, i8, %struct.GCRef, %struct.GCRef, %struct.MRef, ptr, [1 x %union.TValue] }
%struct.MRef = type { i32 }
%struct.GCfuncL = type { %struct.GCRef, i8, i8, i8, i8, %struct.GCRef, %struct.GCRef, %struct.MRef, [1 x %struct.GCRef] }
%struct.GCproto = type { %struct.GCRef, i8, i8, i8, i8, i32, %struct.GCRef, %struct.MRef, %struct.MRef, i32, i32, i32, i8, i8, i16, %struct.GCRef, i32, i32, %struct.MRef, %struct.MRef, %struct.MRef }
%struct.SBuf = type { %struct.MRef, %struct.MRef, %struct.MRef, %struct.MRef }

@.str.22 = external hidden unnamed_addr constant [10 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @lj_debug_funcname(ptr noundef, ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
define hidden void @lj_debug_dumpstack(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %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
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  %25 = load i32, ptr %8, align 4, !tbaa !9
  %26 = icmp slt i32 %25, 0
  br i1 %26, label %27, label %30

27:                                               ; preds = %4
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = xor i32 %28, -1
  store i32 %29, ptr %9, align 4, !tbaa !9
  store i32 -1, ptr %10, align 4, !tbaa !9
  store i32 -1, ptr %8, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %27, %4
  br label %31

31:                                               ; preds = %222, %30
  %32 = load i32, ptr %9, align 4, !tbaa !9
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = icmp ne i32 %32, %33
  br i1 %34, label %35, label %223

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load i32, ptr %9, align 4, !tbaa !9
  %38 = call ptr @lj_debug_frame(ptr noundef %36, i32 noundef %37, ptr noundef %13)
  store ptr %38, ptr %14, align 8, !tbaa !5
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %207

41:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %42 = load i32, ptr %13, align 4, !tbaa !9
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %49

44:                                               ; preds = %41
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = load i32, ptr %13, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds %union.TValue, ptr %45, i64 %47
  br label %50

49:                                               ; preds = %41
  br label %50

50:                                               ; preds = %49, %44
  %51 = phi ptr [ %48, %44 ], [ null, %49 ]
  store ptr %51, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %52 = load ptr, ptr %14, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.anon.2, ptr %52, i32 0, i32 0
  %54 = getelementptr inbounds %struct.GCRef, ptr %53, i32 0, i32 0
  %55 = load i32, ptr %54, align 8, !tbaa !11
  %56 = zext i32 %55 to i64
  %57 = inttoptr i64 %56 to ptr
  store ptr %57, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %58, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  br label %59

59:                                               ; preds = %205, %50
  %60 = load ptr, ptr %17, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %60, i32 1
  store ptr %61, ptr %17, align 8, !tbaa !5
  %62 = load i8, ptr %60, align 1, !tbaa !11
  %63 = zext i8 %62 to i32
  store i32 %63, ptr %18, align 4, !tbaa !9
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %206

65:                                               ; preds = %59
  %66 = load i32, ptr %18, align 4, !tbaa !9
  switch i32 %66, label %202 [
    i32 112, label %67
    i32 70, label %68
    i32 102, label %68
    i32 108, label %113
    i32 90, label %185
  ]

67:                                               ; preds = %65
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %205

68:                                               ; preds = %65, %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = load ptr, ptr %14, align 8, !tbaa !5
  %71 = call ptr @lj_debug_funcname(ptr noundef %69, ptr noundef %70, ptr noundef %19)
  store ptr %71, ptr %20, align 8, !tbaa !5
  %72 = load ptr, ptr %20, align 8, !tbaa !5
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %109

74:                                               ; preds = %68
  %75 = load i32, ptr %18, align 4, !tbaa !9
  %76 = icmp eq i32 %75, 70
  br i1 %76, label %77, label %102

77:                                               ; preds = %74
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.GCfuncC, ptr %78, i32 0, i32 3
  %80 = load i8, ptr %79, align 2, !tbaa !11
  %81 = zext i8 %80 to i32
  %82 = icmp eq i32 %81, 0
  br i1 %82, label %83, label %102

83:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %84 = load ptr, ptr %16, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.GCfuncL, ptr %84, i32 0, i32 7
  %86 = getelementptr inbounds %struct.MRef, ptr %85, i32 0, i32 0
  %87 = load i32, ptr %86, align 8, !tbaa !11
  %88 = zext i32 %87 to i64
  %89 = inttoptr i64 %88 to ptr
  %90 = getelementptr inbounds i8, ptr %89, i64 -64
  store ptr %90, ptr %21, align 8, !tbaa !5
  %91 = load ptr, ptr %21, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.GCproto, ptr %91, i32 0, i32 16
  %93 = load i32, ptr %92, align 4, !tbaa !12
  %94 = icmp ne i32 %93, -1
  br i1 %94, label %95, label %101

95:                                               ; preds = %83
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = load ptr, ptr %21, align 8, !tbaa !5
  %98 = load i32, ptr %11, align 4, !tbaa !9
  %99 = call i32 @debug_putchunkname(ptr noundef %96, ptr noundef %97, i32 noundef %98)
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  call void @lj_buf_putb(ptr noundef %100, i32 noundef 58)
  br label %101

101:                                              ; preds = %95, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %102

102:                                              ; preds = %101, %77, %74
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = load ptr, ptr %19, align 8, !tbaa !5
  %105 = load ptr, ptr %19, align 8, !tbaa !5
  %106 = call i64 @strlen(ptr noundef %105) #6
  %107 = trunc i64 %106 to i32
  %108 = call ptr @lj_buf_putmem(ptr noundef %103, ptr noundef %104, i32 noundef %107)
  store i32 6, ptr %22, align 4
  br label %110

109:                                              ; preds = %68
  store i32 0, ptr %22, align 4
  br label %110

110:                                              ; preds = %109, %102
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  %111 = load i32, ptr %22, align 4
  switch i32 %111, label %242 [
    i32 0, label %112
    i32 6, label %205
  ]

112:                                              ; preds = %110
  br label %113

113:                                              ; preds = %112, %65
  %114 = load ptr, ptr %16, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.GCfuncC, ptr %114, i32 0, i32 3
  %116 = load i8, ptr %115, align 2, !tbaa !11
  %117 = zext i8 %116 to i32
  %118 = icmp eq i32 %117, 0
  br i1 %118, label %119, label %160

119:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %120 = load ptr, ptr %16, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.GCfuncL, ptr %120, i32 0, i32 7
  %122 = getelementptr inbounds %struct.MRef, ptr %121, i32 0, i32 0
  %123 = load i32, ptr %122, align 8, !tbaa !11
  %124 = zext i32 %123 to i64
  %125 = inttoptr i64 %124 to ptr
  %126 = getelementptr inbounds i8, ptr %125, i64 -64
  store ptr %126, ptr %23, align 8, !tbaa !5
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = load ptr, ptr %23, align 8, !tbaa !5
  %129 = load i32, ptr %11, align 4, !tbaa !9
  %130 = call i32 @debug_putchunkname(ptr noundef %127, ptr noundef %128, i32 noundef %129)
  %131 = icmp ne i32 %130, 0
  br i1 %131, label %132, label %159

132:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  %133 = load i32, ptr %18, align 4, !tbaa !9
  %134 = icmp eq i32 %133, 108
  br i1 %134, label %135, label %140

135:                                              ; preds = %132
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = load ptr, ptr %16, align 8, !tbaa !5
  %138 = load ptr, ptr %15, align 8, !tbaa !5
  %139 = call i32 @debug_frameline(ptr noundef %136, ptr noundef %137, ptr noundef %138)
  br label %144

140:                                              ; preds = %132
  %141 = load ptr, ptr %23, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.GCproto, ptr %141, i32 0, i32 16
  %143 = load i32, ptr %142, align 4, !tbaa !12
  br label %144

144:                                              ; preds = %140, %135
  %145 = phi i32 [ %139, %135 ], [ %143, %140 ]
  store i32 %145, ptr %24, align 4, !tbaa !9
  %146 = load ptr, ptr %6, align 8, !tbaa !5
  call void @lj_buf_putb(ptr noundef %146, i32 noundef 58)
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = load i32, ptr %24, align 4, !tbaa !9
  %149 = icmp sge i32 %148, 0
  br i1 %149, label %150, label %152

150:                                              ; preds = %144
  %151 = load i32, ptr %24, align 4, !tbaa !9
  br label %156

152:                                              ; preds = %144
  %153 = load ptr, ptr %23, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.GCproto, ptr %153, i32 0, i32 16
  %155 = load i32, ptr %154, align 4, !tbaa !12
  br label %156

156:                                              ; preds = %152, %150
  %157 = phi i32 [ %151, %150 ], [ %155, %152 ]
  %158 = call ptr @lj_strfmt_putint(ptr noundef %147, i32 noundef %157)
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %159

159:                                              ; preds = %156, %119
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  br label %184

160:                                              ; preds = %113
  %161 = load ptr, ptr %16, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.GCfuncC, ptr %161, i32 0, i32 3
  %163 = load i8, ptr %162, align 2, !tbaa !11
  %164 = zext i8 %163 to i32
  %165 = icmp sgt i32 %164, 1
  br i1 %165, label %166, label %176

166:                                              ; preds = %160
  %167 = load ptr, ptr %6, align 8, !tbaa !5
  %168 = call ptr @lj_buf_putmem(ptr noundef %167, ptr noundef @.str.22, i32 noundef 9)
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = load ptr, ptr %16, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.GCfuncC, ptr %170, i32 0, i32 3
  %172 = load i8, ptr %171, align 2, !tbaa !11
  %173 = zext i8 %172 to i32
  %174 = call ptr @lj_strfmt_putint(ptr noundef %169, i32 noundef %173)
  %175 = load ptr, ptr %6, align 8, !tbaa !5
  call void @lj_buf_putb(ptr noundef %175, i32 noundef 93)
  br label %183

176:                                              ; preds = %160
  %177 = load ptr, ptr %6, align 8, !tbaa !5
  call void @lj_buf_putb(ptr noundef %177, i32 noundef 64)
  %178 = load ptr, ptr %6, align 8, !tbaa !5
  %179 = load ptr, ptr %16, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.GCfuncC, ptr %179, i32 0, i32 8
  %181 = load ptr, ptr %180, align 8, !tbaa !11
  %182 = call ptr @lj_strfmt_putptr(ptr noundef %178, ptr noundef %181)
  br label %183

183:                                              ; preds = %176, %166
  br label %184

184:                                              ; preds = %183, %159
  br label %205

185:                                              ; preds = %65
  %186 = load ptr, ptr %6, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.SBuf, ptr %186, i32 0, i32 0
  %188 = getelementptr inbounds %struct.MRef, ptr %187, i32 0, i32 0
  %189 = load i32, ptr %188, align 4, !tbaa !17
  %190 = zext i32 %189 to i64
  %191 = inttoptr i64 %190 to ptr
  %192 = load ptr, ptr %6, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.SBuf, ptr %192, i32 0, i32 2
  %194 = getelementptr inbounds %struct.MRef, ptr %193, i32 0, i32 0
  %195 = load i32, ptr %194, align 4, !tbaa !19
  %196 = zext i32 %195 to i64
  %197 = inttoptr i64 %196 to ptr
  %198 = ptrtoint ptr %191 to i64
  %199 = ptrtoint ptr %197 to i64
  %200 = sub i64 %198, %199
  %201 = trunc i64 %200 to i32
  store i32 %201, ptr %12, align 4, !tbaa !9
  br label %205

202:                                              ; preds = %65
  %203 = load ptr, ptr %6, align 8, !tbaa !5
  %204 = load i32, ptr %18, align 4, !tbaa !9
  call void @lj_buf_putb(ptr noundef %203, i32 noundef %204)
  br label %205

205:                                              ; preds = %202, %185, %184, %110, %67
  br label %59, !llvm.loop !20

206:                                              ; preds = %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %216

207:                                              ; preds = %35
  %208 = load i32, ptr %10, align 4, !tbaa !9
  %209 = icmp eq i32 %208, 1
  br i1 %209, label %210, label %211

210:                                              ; preds = %207
  store i32 3, ptr %22, align 4
  br label %220

211:                                              ; preds = %207
  %212 = load i32, ptr %13, align 4, !tbaa !9
  %213 = load i32, ptr %9, align 4, !tbaa !9
  %214 = sub nsw i32 %213, %212
  store i32 %214, ptr %9, align 4, !tbaa !9
  br label %215

215:                                              ; preds = %211
  br label %216

216:                                              ; preds = %215, %206
  %217 = load i32, ptr %10, align 4, !tbaa !9
  %218 = load i32, ptr %9, align 4, !tbaa !9
  %219 = add nsw i32 %218, %217
  store i32 %219, ptr %9, align 4, !tbaa !9
  store i32 0, ptr %22, align 4
  br label %220

220:                                              ; preds = %216, %210
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  %221 = load i32, ptr %22, align 4
  switch i32 %221, label %242 [
    i32 0, label %222
    i32 3, label %223
  ]

222:                                              ; preds = %220
  br label %31, !llvm.loop !22

223:                                              ; preds = %220, %31
  %224 = load i32, ptr %12, align 4, !tbaa !9
  %225 = icmp ne i32 %224, 0
  br i1 %225, label %226, label %241

226:                                              ; preds = %223
  %227 = load ptr, ptr %6, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.SBuf, ptr %227, i32 0, i32 2
  %229 = getelementptr inbounds %struct.MRef, ptr %228, i32 0, i32 0
  %230 = load i32, ptr %229, align 4, !tbaa !19
  %231 = zext i32 %230 to i64
  %232 = inttoptr i64 %231 to ptr
  %233 = load i32, ptr %12, align 4, !tbaa !9
  %234 = zext i32 %233 to i64
  %235 = getelementptr inbounds i8, ptr %232, i64 %234
  %236 = ptrtoint ptr %235 to i64
  %237 = trunc i64 %236 to i32
  %238 = load ptr, ptr %6, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct.SBuf, ptr %238, i32 0, i32 0
  %240 = getelementptr inbounds %struct.MRef, ptr %239, i32 0, i32 0
  store i32 %237, ptr %240, align 4, !tbaa !17
  br label %241

241:                                              ; preds = %226, %223
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret void

242:                                              ; preds = %220, %110
  unreachable
}

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

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

declare hidden ptr @lj_buf_putmem(ptr noundef, ptr noundef, i32 noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

declare hidden ptr @lj_strfmt_putint(ptr noundef, i32 noundef) #3

declare hidden ptr @lj_strfmt_putptr(ptr noundef, ptr noundef) #3

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 willreturn memory(read) "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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 44}
!13 = !{!"GCproto", !14, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !10, i64 8, !14, i64 12, !15, i64 16, !15, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !7, i64 36, !7, i64 37, !16, i64 38, !14, i64 40, !10, i64 44, !10, i64 48, !15, i64 52, !15, i64 56, !15, i64 60}
!14 = !{!"GCRef", !10, i64 0}
!15 = !{!"MRef", !10, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!18, !10, i64 0}
!18 = !{!"SBuf", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!19 = !{!18, !10, i64 8}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


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

@.str.22 = external hidden unnamed_addr constant [10 x i8], align 1

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

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

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

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

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

; Function Attrs: nounwind uwtable
define hidden void @lj_debug_dumpstack(ptr noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = icmp sgt i32 %3, -1
  %.063 = select i1 %7, i32 1, i32 -1
  %8 = tail call i32 @llvm.smin.i32(i32 %3, i32 -1)
  %.060 = xor i32 %8, -1
  %.0 = tail call i32 @llvm.smax.i32(i32 %3, i32 -1)
  %.not101 = icmp eq i32 %.0, %.060
  br i1 %.not101, label %.loopexit98.thread, label %.lr.ph

.lr.ph:                                           ; preds = %4
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  br label %10

10:                                               ; preds = %.lr.ph, %.loopexit
  %.1104 = phi i32 [ %.060, %.lr.ph ], [ %89, %.loopexit ]
  %.064103 = phi i32 [ 1, %.lr.ph ], [ %.367, %.loopexit ]
  %.068102 = phi i32 [ 0, %.lr.ph ], [ %.371, %.loopexit ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %11 = call ptr @lj_debug_frame(ptr noundef %0, i32 noundef %.1104, ptr noundef nonnull %5)
  %.not80 = icmp eq ptr %11, null
  br i1 %.not80, label %85, label %12

12:                                               ; preds = %10
  %13 = load i32, ptr %5, align 4
  %.not81 = icmp eq i32 %13, 0
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds %union.TValue, ptr %11, i64 %14
  %16 = select i1 %.not81, ptr null, ptr %15
  %17 = load i32, ptr %11, align 8, !tbaa !5
  %18 = zext i32 %17 to i64
  %19 = inttoptr i64 %18 to ptr
  %20 = getelementptr inbounds i8, ptr %19, i64 6
  %21 = getelementptr inbounds i8, ptr %19, i64 16
  %22 = getelementptr inbounds i8, ptr %19, i64 24
  br label %23

23:                                               ; preds = %.backedge, %12
  %.073 = phi ptr [ %2, %12 ], [ %24, %.backedge ]
  %.169 = phi i32 [ %.068102, %12 ], [ %.169.be, %.backedge ]
  %.165 = phi i32 [ %.064103, %12 ], [ %.165.be, %.backedge ]
  %24 = getelementptr inbounds i8, ptr %.073, i64 1
  %25 = load i8, ptr %.073, align 1, !tbaa !5
  switch i8 %25, label %83 [
    i8 0, label %.loopexit
    i8 112, label %.backedge
    i8 70, label %26
    i8 102, label %26
    i8 108, label %47
    i8 90, label %79
  ]

26:                                               ; preds = %23, %23
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %27 = call ptr @lj_debug_funcname(ptr noundef %0, ptr noundef nonnull %11, ptr noundef nonnull %6)
  %.not84 = icmp eq ptr %27, null
  br i1 %.not84, label %.thread, label %28

.thread:                                          ; preds = %26
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %47

28:                                               ; preds = %26
  %29 = icmp eq i8 %25, 70
  br i1 %29, label %30, label %42

30:                                               ; preds = %28
  %31 = load i8, ptr %20, align 2, !tbaa !5
  %32 = icmp eq i8 %31, 0
  br i1 %32, label %33, label %42

33:                                               ; preds = %30
  %34 = load i32, ptr %21, align 8, !tbaa !5
  %35 = zext i32 %34 to i64
  %36 = inttoptr i64 %35 to ptr
  %37 = getelementptr inbounds i8, ptr %36, i64 -20
  %38 = load i32, ptr %37, align 4, !tbaa !8
  %.not85 = icmp eq i32 %38, -1
  br i1 %.not85, label %42, label %39

39:                                               ; preds = %33
  %40 = getelementptr inbounds i8, ptr %36, i64 -64
  %41 = call i32 @debug_putchunkname(ptr noundef %1, ptr noundef nonnull %40, i32 noundef %.165)
  call void @lj_buf_putb(ptr noundef %1, i32 noundef 58)
  br label %42

42:                                               ; preds = %28, %30, %39, %33
  %43 = load ptr, ptr %6, align 8, !tbaa !14
  %44 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %43) #7
  %45 = trunc i64 %44 to i32
  %46 = call ptr @lj_buf_putmem(ptr noundef %1, ptr noundef %43, i32 noundef %45) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %.backedge

.backedge:                                        ; preds = %42, %49, %68, %23, %76, %71, %83, %79
  %.169.be = phi i32 [ %.169, %42 ], [ %.169, %49 ], [ %.169, %68 ], [ %.169, %23 ], [ %.169, %76 ], [ %.169, %71 ], [ %.169, %83 ], [ %82, %79 ]
  %.165.be = phi i32 [ %.165, %42 ], [ %.165, %49 ], [ %.165, %68 ], [ 0, %23 ], [ %.165, %76 ], [ %.165, %71 ], [ %.165, %83 ], [ %.165, %79 ]
  br label %23, !llvm.loop !16

47:                                               ; preds = %.thread, %23
  %48 = load i8, ptr %20, align 2, !tbaa !5
  switch i8 %48, label %71 [
    i8 0, label %49
    i8 1, label %76
  ]

49:                                               ; preds = %47
  %50 = load i32, ptr %21, align 8, !tbaa !5
  %51 = zext i32 %50 to i64
  %52 = inttoptr i64 %51 to ptr
  %53 = getelementptr inbounds i8, ptr %52, i64 -64
  %54 = call i32 @debug_putchunkname(ptr noundef %1, ptr noundef nonnull %53, i32 noundef %.165)
  %.not87 = icmp eq i32 %54, 0
  br i1 %.not87, label %.backedge, label %55

55:                                               ; preds = %49
  %56 = icmp eq i8 %25, 108
  br i1 %56, label %57, label %59

57:                                               ; preds = %55
  %58 = call i32 @debug_frameline(ptr noundef %0, ptr noundef nonnull %19, ptr noundef %16)
  br label %62

59:                                               ; preds = %55
  %60 = getelementptr inbounds i8, ptr %52, i64 -20
  %61 = load i32, ptr %60, align 4, !tbaa !8
  br label %62

62:                                               ; preds = %59, %57
  %63 = phi i32 [ %58, %57 ], [ %61, %59 ]
  call void @lj_buf_putb(ptr noundef %1, i32 noundef 58)
  %64 = icmp sgt i32 %63, -1
  br i1 %64, label %68, label %65

65:                                               ; preds = %62
  %66 = getelementptr inbounds i8, ptr %52, i64 -20
  %67 = load i32, ptr %66, align 4, !tbaa !8
  br label %68

68:                                               ; preds = %62, %65
  %69 = phi i32 [ %67, %65 ], [ %63, %62 ]
  %70 = call ptr @lj_strfmt_putint(ptr noundef %1, i32 noundef %69) #6
  br label %.backedge

71:                                               ; preds = %47
  %72 = call ptr @lj_buf_putmem(ptr noundef %1, ptr noundef nonnull @.str.22, i32 noundef 9) #6
  %73 = load i8, ptr %20, align 2, !tbaa !5
  %74 = zext i8 %73 to i32
  %75 = call ptr @lj_strfmt_putint(ptr noundef %1, i32 noundef %74) #6
  call void @lj_buf_putb(ptr noundef %1, i32 noundef 93)
  br label %.backedge

76:                                               ; preds = %47
  call void @lj_buf_putb(ptr noundef %1, i32 noundef 64)
  %77 = load ptr, ptr %22, align 8, !tbaa !5
  %78 = call ptr @lj_strfmt_putptr(ptr noundef %1, ptr noundef %77) #6
  br label %.backedge

79:                                               ; preds = %23
  %80 = load i32, ptr %1, align 4, !tbaa !18
  %81 = load i32, ptr %9, align 4, !tbaa !20
  %82 = sub i32 %80, %81
  br label %.backedge

83:                                               ; preds = %23
  %84 = zext i8 %25 to i32
  call void @lj_buf_putb(ptr noundef %1, i32 noundef %84)
  br label %.backedge

85:                                               ; preds = %10
  br i1 %7, label %.thread92, label %86

.thread92:                                        ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  br label %.loopexit98

86:                                               ; preds = %85
  %87 = load i32, ptr %5, align 4, !tbaa !21
  %88 = sub nsw i32 %.1104, %87
  br label %.loopexit

.loopexit:                                        ; preds = %23, %86
  %.371 = phi i32 [ %.068102, %86 ], [ %.169, %23 ]
  %.367 = phi i32 [ %.064103, %86 ], [ %.165, %23 ]
  %.2 = phi i32 [ %88, %86 ], [ %.1104, %23 ]
  %89 = add nsw i32 %.2, %.063
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  %.not = icmp eq i32 %89, %.0
  br i1 %.not, label %.loopexit98, label %10

.loopexit98:                                      ; preds = %.loopexit, %.thread92
  %.068100 = phi i32 [ %.068102, %.thread92 ], [ %.371, %.loopexit ]
  %.not83 = icmp eq i32 %.068100, 0
  br i1 %.not83, label %.loopexit98.thread, label %90

90:                                               ; preds = %.loopexit98
  %91 = getelementptr inbounds i8, ptr %1, i64 8
  %92 = load i32, ptr %91, align 4, !tbaa !20
  %93 = add i32 %92, %.068100
  store i32 %93, ptr %1, align 4, !tbaa !18
  br label %.loopexit98.thread

.loopexit98.thread:                               ; preds = %4, %90, %.loopexit98
  ret void
}

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

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

declare hidden ptr @lj_buf_putmem(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

declare hidden ptr @lj_strfmt_putint(ptr noundef, i32 noundef) local_unnamed_addr #3

declare hidden ptr @lj_strfmt_putptr(ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

attributes #0 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !11, i64 44}
!9 = !{!"GCproto", !10, i64 0, !6, i64 4, !6, i64 5, !6, i64 6, !6, i64 7, !11, i64 8, !10, i64 12, !12, i64 16, !12, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !6, i64 36, !6, i64 37, !13, i64 38, !10, i64 40, !11, i64 44, !11, i64 48, !12, i64 52, !12, i64 56, !12, i64 60}
!10 = !{!"GCRef", !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = !{!"MRef", !11, i64 0}
!13 = !{!"short", !6, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !6, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !11, i64 0}
!19 = !{!"SBuf", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!20 = !{!19, !11, i64 8}
!21 = !{!11, !11, i64 0}


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