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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @filter(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i8, align 1
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca [1024 x i8], align 16
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #8
  store i8 0, ptr %4, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = call i32 @lua_type(ptr noundef %17, i32 noundef 1)
  store i32 %18, ptr %6, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = call ptr @lua_tolstring(ptr noundef %19, i32 noundef 1, ptr noundef null)
  store ptr %20, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = call i64 @lua_objlen(ptr noundef %21, i32 noundef 1)
  store i64 %22, ptr %11, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1024, ptr %12) #8
  %23 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %23, i8 0, i64 1024, i1 false)
  %24 = load i32, ptr %6, align 4, !tbaa !10
  %25 = icmp eq i32 %24, 4
  br i1 %25, label %26, label %145

26:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %27 = load i64, ptr %11, align 8, !tbaa !12
  %28 = mul nsw i64 %27, 2
  %29 = call noalias ptr @malloc(i64 noundef %28) #9
  store ptr %29, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %30 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %30, ptr %14, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %129, %26
  %32 = load i64, ptr %11, align 8, !tbaa !12
  %33 = add nsw i64 %32, -1
  store i64 %33, ptr %11, align 8, !tbaa !12
  %34 = icmp sgt i64 %32, 0
  br i1 %34, label %35, label %130

35:                                               ; preds = %31
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %36, i32 1
  store ptr %37, ptr %10, align 8, !tbaa !5
  %38 = load i8, ptr %36, align 1, !tbaa !9
  store i8 %38, ptr %3, align 1, !tbaa !9
  %39 = load i8, ptr %3, align 1, !tbaa !9
  %40 = sext i8 %39 to i32
  %41 = icmp eq i32 %40, 34
  br i1 %41, label %42, label %50

42:                                               ; preds = %35
  %43 = load i32, ptr %9, align 4, !tbaa !10
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %50, label %45

45:                                               ; preds = %42
  %46 = load i32, ptr %8, align 4, !tbaa !10
  %47 = icmp ne i32 %46, 0
  %48 = xor i1 %47, true
  %49 = zext i1 %48 to i32
  store i32 %49, ptr %8, align 4, !tbaa !10
  br label %50

50:                                               ; preds = %45, %42, %35
  %51 = load i32, ptr %8, align 4, !tbaa !10
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %115, label %53

53:                                               ; preds = %50
  %54 = load i8, ptr %3, align 1, !tbaa !9
  %55 = sext i8 %54 to i32
  %56 = icmp eq i32 %55, 123
  br i1 %56, label %57, label %81

57:                                               ; preds = %53
  %58 = load i32, ptr %5, align 4, !tbaa !10
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %5, align 4, !tbaa !10
  %60 = load i8, ptr %4, align 1, !tbaa !9
  %61 = icmp ne i8 %60, 0
  br i1 %61, label %62, label %77

62:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  store ptr @.str, ptr %15, align 8, !tbaa !5
  %63 = load ptr, ptr %14, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %63, i32 -1
  store ptr %64, ptr %14, align 8, !tbaa !5
  %65 = load ptr, ptr %14, align 8, !tbaa !5
  %66 = load ptr, ptr %15, align 8, !tbaa !5
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = call i64 @strlen(ptr noundef %67) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %65, ptr align 1 %66, i64 %68, i1 false)
  %69 = load ptr, ptr %15, align 8, !tbaa !5
  %70 = call i64 @strlen(ptr noundef %69) #10
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 %70
  store ptr %72, ptr %14, align 8, !tbaa !5
  %73 = load i32, ptr %5, align 4, !tbaa !10
  %74 = sub nsw i32 %73, 2
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 %75
  store i8 1, ptr %76, align 1, !tbaa !9
  store i8 0, ptr %4, align 1, !tbaa !9
  store i32 1, ptr %7, align 4, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %77

77:                                               ; preds = %62, %57
  store i8 1, ptr %4, align 1, !tbaa !9
  %78 = load i8, ptr %3, align 1, !tbaa !9
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i32 1
  store ptr %80, ptr %14, align 8, !tbaa !5
  store i8 %78, ptr %79, align 1, !tbaa !9
  br label %114

81:                                               ; preds = %53
  %82 = load i8, ptr %3, align 1, !tbaa !9
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = getelementptr inbounds i8, ptr %83, i32 1
  store ptr %84, ptr %14, align 8, !tbaa !5
  store i8 %82, ptr %83, align 1, !tbaa !9
  %85 = load i32, ptr %5, align 4, !tbaa !10
  %86 = icmp sgt i32 %85, 0
  br i1 %86, label %87, label %113

87:                                               ; preds = %81
  %88 = load i8, ptr %3, align 1, !tbaa !9
  %89 = sext i8 %88 to i32
  %90 = icmp eq i32 %89, 125
  br i1 %90, label %91, label %113

91:                                               ; preds = %87
  %92 = load i32, ptr %5, align 4, !tbaa !10
  %93 = add nsw i32 %92, -1
  store i32 %93, ptr %5, align 4, !tbaa !10
  %94 = load i32, ptr %5, align 4, !tbaa !10
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 %95
  %97 = load i8, ptr %96, align 1, !tbaa !9
  %98 = sext i8 %97 to i32
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %112

100:                                              ; preds = %91
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  store ptr @.str.1, ptr %16, align 8, !tbaa !5
  %101 = load ptr, ptr %14, align 8, !tbaa !5
  %102 = load ptr, ptr %16, align 8, !tbaa !5
  %103 = load ptr, ptr %16, align 8, !tbaa !5
  %104 = call i64 @strlen(ptr noundef %103) #10
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %101, ptr align 1 %102, i64 %104, i1 false)
  %105 = load ptr, ptr %16, align 8, !tbaa !5
  %106 = call i64 @strlen(ptr noundef %105) #10
  %107 = load ptr, ptr %14, align 8, !tbaa !5
  %108 = getelementptr inbounds i8, ptr %107, i64 %106
  store ptr %108, ptr %14, align 8, !tbaa !5
  %109 = load i32, ptr %5, align 4, !tbaa !10
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [1024 x i8], ptr %12, i64 0, i64 %110
  store i8 0, ptr %111, align 1, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %112

112:                                              ; preds = %100, %91
  br label %113

113:                                              ; preds = %112, %87, %81
  store i8 0, ptr %4, align 1, !tbaa !9
  br label %114

114:                                              ; preds = %113, %77
  br label %129

115:                                              ; preds = %50
  %116 = load i8, ptr %3, align 1, !tbaa !9
  %117 = sext i8 %116 to i32
  %118 = icmp eq i32 %117, 92
  br i1 %118, label %119, label %124

119:                                              ; preds = %115
  %120 = load i32, ptr %9, align 4, !tbaa !10
  %121 = icmp ne i32 %120, 0
  %122 = xor i1 %121, true
  %123 = zext i1 %122 to i32
  store i32 %123, ptr %9, align 4, !tbaa !10
  br label %125

124:                                              ; preds = %115
  store i32 0, ptr %9, align 4, !tbaa !10
  br label %125

125:                                              ; preds = %124, %119
  %126 = load i8, ptr %3, align 1, !tbaa !9
  %127 = load ptr, ptr %14, align 8, !tbaa !5
  %128 = getelementptr inbounds i8, ptr %127, i32 1
  store ptr %128, ptr %14, align 8, !tbaa !5
  store i8 %126, ptr %127, align 1, !tbaa !9
  store i8 0, ptr %4, align 1, !tbaa !9
  br label %129

129:                                              ; preds = %125, %114
  br label %31, !llvm.loop !14

130:                                              ; preds = %31
  %131 = load i32, ptr %7, align 4, !tbaa !10
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %143

133:                                              ; preds = %130
  %134 = load ptr, ptr %14, align 8, !tbaa !5
  store i8 0, ptr %134, align 1, !tbaa !9
  %135 = load ptr, ptr %2, align 8, !tbaa !5
  %136 = load ptr, ptr %13, align 8, !tbaa !5
  %137 = load ptr, ptr %14, align 8, !tbaa !5
  %138 = load ptr, ptr %13, align 8, !tbaa !5
  %139 = ptrtoint ptr %137 to i64
  %140 = ptrtoint ptr %138 to i64
  %141 = sub i64 %139, %140
  call void @lua_pushlstring(ptr noundef %135, ptr noundef %136, i64 noundef %141)
  %142 = load ptr, ptr %2, align 8, !tbaa !5
  call void @lua_replace(ptr noundef %142, i32 noundef 1)
  br label %143

143:                                              ; preds = %133, %130
  %144 = load ptr, ptr %13, align 8, !tbaa !5
  call void @free(ptr noundef %144) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %145

145:                                              ; preds = %143, %1
  call void @llvm.lifetime.end.p0(i64 1024, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #8
  ret void
}

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

declare i32 @lua_type(ptr noundef, i32 noundef) #2

declare ptr @lua_tolstring(ptr noundef, i32 noundef, ptr noundef) #2

declare i64 @lua_objlen(ptr noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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

declare void @lua_pushlstring(ptr noundef, ptr noundef, i64 noundef) #2

declare void @lua_replace(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #7

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 = { "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 nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind allocsize(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 #5 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind "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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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

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

; Function Attrs: nounwind uwtable
define dso_local void @filter(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca [1024 x i8], align 16
  %3 = tail call i32 @lua_type(ptr noundef %0, i32 noundef 1) #8
  %4 = tail call ptr @lua_tolstring(ptr noundef %0, i32 noundef 1, ptr noundef null) #8
  %5 = tail call i64 @lua_objlen(ptr noundef %0, i32 noundef 1) #8
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %2) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %2, i8 0, i64 1024, i1 false)
  %6 = icmp eq i32 %3, 4
  br i1 %6, label %7, label %53

7:                                                ; preds = %1
  %8 = shl nsw i64 %5, 1
  %9 = tail call noalias ptr @malloc(i64 noundef %8) #9
  %10 = icmp sgt i64 %5, 0
  br i1 %10, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %7, %46
  %.in = phi i64 [ %11, %46 ], [ %5, %7 ]
  %.077 = phi i8 [ %.1, %46 ], [ 0, %7 ]
  %.05176 = phi i32 [ %.2, %46 ], [ 0, %7 ]
  %.05375 = phi ptr [ %.3, %46 ], [ %9, %7 ]
  %.05674 = phi i32 [ %.258, %46 ], [ 0, %7 ]
  %.06073 = phi ptr [ %12, %46 ], [ %4, %7 ]
  %.06172 = phi i32 [ %.263, %46 ], [ 0, %7 ]
  %.06471 = phi i32 [ %.165, %46 ], [ 0, %7 ]
  %11 = add nsw i64 %.in, -1
  %12 = getelementptr inbounds i8, ptr %.06073, i64 1
  %13 = load i8, ptr %.06073, align 1, !tbaa !5
  %14 = icmp ne i8 %13, 34
  %15 = icmp ne i32 %.06172, 0
  %or.cond = select i1 %14, i1 true, i1 %15
  %.not67 = icmp eq i32 %.06471, 0
  %16 = zext i1 %.not67 to i32
  %.165 = select i1 %or.cond, i32 %.06471, i32 %16
  %.not68 = icmp eq i32 %.165, 0
  br i1 %.not68, label %17, label %42

17:                                               ; preds = %.lr.ph
  %18 = icmp eq i8 %13, 123
  br i1 %18, label %19, label %30

19:                                               ; preds = %17
  %20 = add nsw i32 %.05176, 1
  %.not70 = icmp eq i8 %.077, 0
  br i1 %.not70, label %28, label %21

21:                                               ; preds = %19
  %22 = getelementptr inbounds i8, ptr %.05375, i64 -1
  %23 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @.str) #10
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %22, ptr nonnull align 1 @.str, i64 %23, i1 false)
  %24 = getelementptr inbounds i8, ptr %22, i64 %23
  %25 = add nsw i32 %.05176, -1
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [1024 x i8], ptr %2, i64 0, i64 %26
  store i8 1, ptr %27, align 1, !tbaa !5
  br label %28

28:                                               ; preds = %21, %19
  %.157 = phi i32 [ 1, %21 ], [ %.05674, %19 ]
  %.154 = phi ptr [ %24, %21 ], [ %.05375, %19 ]
  %29 = getelementptr inbounds i8, ptr %.154, i64 1
  store i8 123, ptr %.154, align 1, !tbaa !5
  br label %46

30:                                               ; preds = %17
  %31 = getelementptr inbounds i8, ptr %.05375, i64 1
  store i8 %13, ptr %.05375, align 1, !tbaa !5
  %32 = icmp sgt i32 %.05176, 0
  %33 = icmp eq i8 %13, 125
  %or.cond4 = and i1 %32, %33
  br i1 %or.cond4, label %34, label %46

34:                                               ; preds = %30
  %35 = add nsw i32 %.05176, -1
  %36 = zext nneg i32 %35 to i64
  %37 = getelementptr inbounds [1024 x i8], ptr %2, i64 0, i64 %36
  %38 = load i8, ptr %37, align 1, !tbaa !5
  %.not69 = icmp eq i8 %38, 0
  br i1 %.not69, label %46, label %39

39:                                               ; preds = %34
  %40 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @.str.1) #10
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %31, ptr nonnull align 1 @.str.1, i64 %40, i1 false)
  %41 = getelementptr inbounds i8, ptr %31, i64 %40
  store i8 0, ptr %37, align 1, !tbaa !5
  br label %46

42:                                               ; preds = %.lr.ph
  %43 = icmp eq i8 %13, 92
  %44 = xor i1 %15, true
  %narrow = select i1 %43, i1 %44, i1 false
  %.162 = zext i1 %narrow to i32
  %45 = getelementptr inbounds i8, ptr %.05375, i64 1
  store i8 %13, ptr %.05375, align 1, !tbaa !5
  br label %46

46:                                               ; preds = %30, %39, %34, %28, %42
  %.263 = phi i32 [ %.162, %42 ], [ %.06172, %28 ], [ %.06172, %34 ], [ %.06172, %39 ], [ %.06172, %30 ]
  %.258 = phi i32 [ %.05674, %42 ], [ %.157, %28 ], [ %.05674, %34 ], [ %.05674, %39 ], [ %.05674, %30 ]
  %.3 = phi ptr [ %45, %42 ], [ %29, %28 ], [ %31, %34 ], [ %41, %39 ], [ %31, %30 ]
  %.2 = phi i32 [ %.05176, %42 ], [ %20, %28 ], [ %35, %34 ], [ %35, %39 ], [ %.05176, %30 ]
  %.1 = phi i8 [ 0, %42 ], [ 1, %28 ], [ 0, %34 ], [ 0, %39 ], [ 0, %30 ]
  %47 = icmp ugt i64 %.in, 1
  br i1 %47, label %.lr.ph, label %._crit_edge, !llvm.loop !8

._crit_edge:                                      ; preds = %46
  %48 = icmp eq i32 %.258, 0
  br i1 %48, label %._crit_edge.thread, label %49

49:                                               ; preds = %._crit_edge
  store i8 0, ptr %.3, align 1, !tbaa !5
  %50 = ptrtoint ptr %.3 to i64
  %51 = ptrtoint ptr %9 to i64
  %52 = sub i64 %50, %51
  tail call void @lua_pushlstring(ptr noundef %0, ptr noundef %9, i64 noundef %52) #8
  tail call void @lua_replace(ptr noundef %0, i32 noundef 1) #8
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %7, %49, %._crit_edge
  tail call void @free(ptr noundef %9) #8
  br label %53

53:                                               ; preds = %._crit_edge.thread, %1
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %2) #8
  ret void
}

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

declare i32 @lua_type(ptr noundef, i32 noundef) local_unnamed_addr #2

declare ptr @lua_tolstring(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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

declare void @lua_pushlstring(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @lua_replace(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7

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 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { 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 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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