; LLVM IR from Hunterdii/GeeksforGeeks-POTD :: December 2024 GFG SOLUTION (December-02)

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [34 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @computeLPSArray(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
define dso_local ptr @search(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %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 ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = call i64 @strlen(ptr noundef %15) #8
  %17 = trunc i64 %16 to i32
  store i32 %17, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = call i64 @strlen(ptr noundef %18) #8
  %20 = trunc i64 %19 to i32
  store i32 %20, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = mul i64 %22, 4
  %24 = call noalias ptr @malloc(i64 noundef %23) #9
  store ptr %24, ptr %9, align 8, !tbaa !5
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %30, label %27

27:                                               ; preds = %3
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef @.str) #7
  call void @exit(i32 noundef 1) #10
  unreachable

30:                                               ; preds = %3
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = load i32, ptr %7, align 4, !tbaa !9
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  call void @computeLPSArray(ptr noundef %31, i32 noundef %32, ptr noundef %33)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %34 = call noalias ptr @malloc(i64 noundef 40) #9
  store ptr %34, ptr %10, align 8, !tbaa !5
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %41, label %37

37:                                               ; preds = %30
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef @.str.1) #7
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %40) #7
  call void @exit(i32 noundef 1) #10
  unreachable

41:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 10, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %136, %41
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = load i32, ptr %8, align 4, !tbaa !9
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %46, label %137

46:                                               ; preds = %42
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = load i32, ptr %13, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i8, ptr %47, i64 %49
  %51 = load i8, ptr %50, align 1, !tbaa !11
  %52 = sext i8 %51 to i32
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = load i32, ptr %14, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i8, ptr %53, i64 %55
  %57 = load i8, ptr %56, align 1, !tbaa !11
  %58 = sext i8 %57 to i32
  %59 = icmp eq i32 %52, %58
  br i1 %59, label %60, label %65

60:                                               ; preds = %46
  %61 = load i32, ptr %13, align 4, !tbaa !9
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %13, align 4, !tbaa !9
  %63 = load i32, ptr %14, align 4, !tbaa !9
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %14, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %60, %46
  %66 = load i32, ptr %14, align 4, !tbaa !9
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = icmp eq i32 %66, %67
  br i1 %68, label %69, label %103

69:                                               ; preds = %65
  %70 = load i32, ptr %12, align 4, !tbaa !9
  %71 = load i32, ptr %11, align 4, !tbaa !9
  %72 = icmp sge i32 %70, %71
  br i1 %72, label %73, label %88

73:                                               ; preds = %69
  %74 = load i32, ptr %11, align 4, !tbaa !9
  %75 = mul nsw i32 %74, 2
  store i32 %75, ptr %11, align 4, !tbaa !9
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = load i32, ptr %11, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = mul i64 %78, 4
  %80 = call ptr @realloc(ptr noundef %76, i64 noundef %79) #11
  store ptr %80, ptr %10, align 8, !tbaa !5
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = icmp ne ptr %81, null
  br i1 %82, label %87, label %83

83:                                               ; preds = %73
  %84 = load ptr, ptr @stderr, align 8, !tbaa !5
  %85 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef @.str.2) #7
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %86) #7
  call void @exit(i32 noundef 1) #10
  unreachable

87:                                               ; preds = %73
  br label %88

88:                                               ; preds = %87, %69
  %89 = load i32, ptr %13, align 4, !tbaa !9
  %90 = load i32, ptr %14, align 4, !tbaa !9
  %91 = sub nsw i32 %89, %90
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = load i32, ptr %12, align 4, !tbaa !9
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %12, align 4, !tbaa !9
  %95 = sext i32 %93 to i64
  %96 = getelementptr inbounds i32, ptr %92, i64 %95
  store i32 %91, ptr %96, align 4, !tbaa !9
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  %98 = load i32, ptr %14, align 4, !tbaa !9
  %99 = sub nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds i32, ptr %97, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !9
  store i32 %102, ptr %14, align 4, !tbaa !9
  br label %136

103:                                              ; preds = %65
  %104 = load i32, ptr %13, align 4, !tbaa !9
  %105 = load i32, ptr %8, align 4, !tbaa !9
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %107, label %135

107:                                              ; preds = %103
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = load i32, ptr %13, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds i8, ptr %108, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !11
  %113 = sext i8 %112 to i32
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = load i32, ptr %14, align 4, !tbaa !9
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds i8, ptr %114, i64 %116
  %118 = load i8, ptr %117, align 1, !tbaa !11
  %119 = sext i8 %118 to i32
  %120 = icmp ne i32 %113, %119
  br i1 %120, label %121, label %135

121:                                              ; preds = %107
  %122 = load i32, ptr %14, align 4, !tbaa !9
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %131

124:                                              ; preds = %121
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = load i32, ptr %14, align 4, !tbaa !9
  %127 = sub nsw i32 %126, 1
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds i32, ptr %125, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !9
  store i32 %130, ptr %14, align 4, !tbaa !9
  br label %134

131:                                              ; preds = %121
  %132 = load i32, ptr %13, align 4, !tbaa !9
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %13, align 4, !tbaa !9
  br label %134

134:                                              ; preds = %131, %124
  br label %135

135:                                              ; preds = %134, %107, %103
  br label %136

136:                                              ; preds = %135, %88
  br label %42, !llvm.loop !12

137:                                              ; preds = %42
  %138 = load i32, ptr %12, align 4, !tbaa !9
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 %138, ptr %139, align 4, !tbaa !9
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %140) #7
  %141 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  ret ptr %141
}

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

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #5

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

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #6

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 = { 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 #3 = { 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 #4 = { 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 #5 = { noreturn 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 #6 = { nounwind allocsize(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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { noreturn nounwind }
attributes #11 = { nounwind allocsize(1) }

!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 = distinct !{!12, !13}
!13 = !{!"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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [34 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @computeLPSArray(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noalias ptr @search(ptr noundef %0, ptr nocapture noundef readonly %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 {
  %4 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #7
  %5 = trunc i64 %4 to i32
  %6 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #7
  %7 = trunc i64 %6 to i32
  %sext = shl i64 %4, 32
  %8 = ashr exact i64 %sext, 30
  %9 = tail call noalias ptr @malloc(i64 noundef %8) #8
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %10, label %13

10:                                               ; preds = %3
  %11 = load ptr, ptr @stderr, align 8, !tbaa !5
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str) #9
  tail call void @exit(i32 noundef 1) #10
  unreachable

13:                                               ; preds = %3
  tail call void @computeLPSArray(ptr noundef %0, i32 noundef %5, ptr noundef nonnull %9)
  %14 = tail call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #8
  %.not60 = icmp eq ptr %14, null
  br i1 %.not60, label %17, label %.preheader

.preheader:                                       ; preds = %13
  %invariant.gep = getelementptr i8, ptr %9, i64 -4
  %15 = icmp sgt i32 %7, 0
  br i1 %15, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader
  %sext75 = shl i64 %4, 32
  %16 = ashr exact i64 %sext75, 30
  %gep68 = getelementptr i8, ptr %invariant.gep, i64 %16
  br label %.lr.ph

17:                                               ; preds = %13
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.1) #9
  tail call void @free(ptr noundef nonnull %9) #11
  tail call void @exit(i32 noundef 1) #10
  unreachable

.lr.ph:                                           ; preds = %.lr.ph.preheader, %58
  %.073 = phi i32 [ %.2, %58 ], [ 0, %.lr.ph.preheader ]
  %.04572 = phi i32 [ %.247, %58 ], [ 0, %.lr.ph.preheader ]
  %.04871 = phi i32 [ %.149, %58 ], [ 0, %.lr.ph.preheader ]
  %.05070 = phi i32 [ %.252, %58 ], [ 10, %.lr.ph.preheader ]
  %.05369 = phi ptr [ %.255, %58 ], [ %14, %.lr.ph.preheader ]
  %20 = sext i32 %.04572 to i64
  %21 = getelementptr inbounds i8, ptr %1, i64 %20
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %23 = sext i32 %.073 to i64
  %24 = getelementptr inbounds i8, ptr %0, i64 %23
  %25 = load i8, ptr %24, align 1, !tbaa !9
  %26 = icmp eq i8 %22, %25
  %27 = zext i1 %26 to i32
  %.146 = add nsw i32 %.04572, %27
  %.1 = add nsw i32 %.073, %27
  %28 = icmp eq i32 %.1, %5
  br i1 %28, label %29, label %44

29:                                               ; preds = %.lr.ph
  %.not63 = icmp slt i32 %.04871, %.05070
  br i1 %.not63, label %38, label %30

30:                                               ; preds = %29
  %31 = shl nsw i32 %.05070, 1
  %32 = sext i32 %31 to i64
  %33 = shl nsw i64 %32, 2
  %34 = tail call ptr @realloc(ptr noundef %.05369, i64 noundef %33) #12
  %.not64 = icmp eq ptr %34, null
  br i1 %.not64, label %35, label %38

35:                                               ; preds = %30
  %36 = load ptr, ptr @stderr, align 8, !tbaa !5
  %37 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef nonnull @.str.2) #9
  tail call void @free(ptr noundef %9) #11
  tail call void @exit(i32 noundef 1) #10
  unreachable

38:                                               ; preds = %30, %29
  %.154 = phi ptr [ %34, %30 ], [ %.05369, %29 ]
  %.151 = phi i32 [ %31, %30 ], [ %.05070, %29 ]
  %39 = sub nsw i32 %.146, %5
  %40 = add nsw i32 %.04871, 1
  %41 = sext i32 %.04871 to i64
  %42 = getelementptr inbounds i32, ptr %.154, i64 %41
  store i32 %39, ptr %42, align 4, !tbaa !10
  %43 = load i32, ptr %gep68, align 4, !tbaa !10
  br label %58

44:                                               ; preds = %.lr.ph
  %45 = icmp slt i32 %.146, %7
  br i1 %45, label %46, label %58

46:                                               ; preds = %44
  %47 = sext i32 %.146 to i64
  %48 = getelementptr inbounds i8, ptr %1, i64 %47
  %49 = load i8, ptr %48, align 1, !tbaa !9
  %50 = sext i32 %.1 to i64
  %51 = getelementptr inbounds i8, ptr %0, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !9
  %.not61 = icmp eq i8 %49, %52
  br i1 %.not61, label %58, label %53

53:                                               ; preds = %46
  %.not62 = icmp eq i32 %.1, 0
  br i1 %.not62, label %56, label %54

54:                                               ; preds = %53
  %gep = getelementptr i32, ptr %invariant.gep, i64 %50
  %55 = load i32, ptr %gep, align 4, !tbaa !10
  br label %58

56:                                               ; preds = %53
  %57 = add nsw i32 %.146, 1
  br label %58

58:                                               ; preds = %44, %46, %56, %54, %38
  %.255 = phi ptr [ %.154, %38 ], [ %.05369, %54 ], [ %.05369, %56 ], [ %.05369, %46 ], [ %.05369, %44 ]
  %.252 = phi i32 [ %.151, %38 ], [ %.05070, %54 ], [ %.05070, %56 ], [ %.05070, %46 ], [ %.05070, %44 ]
  %.149 = phi i32 [ %40, %38 ], [ %.04871, %54 ], [ %.04871, %56 ], [ %.04871, %46 ], [ %.04871, %44 ]
  %.247 = phi i32 [ %.146, %38 ], [ %.146, %54 ], [ %57, %56 ], [ %.146, %46 ], [ %.146, %44 ]
  %.2 = phi i32 [ %43, %38 ], [ %55, %54 ], [ 0, %56 ], [ %.1, %46 ], [ %.1, %44 ]
  %59 = icmp slt i32 %.247, %7
  br i1 %59, label %.lr.ph, label %._crit_edge, !llvm.loop !12

._crit_edge:                                      ; preds = %58, %.preheader
  %.053.lcssa = phi ptr [ %14, %.preheader ], [ %.255, %58 ]
  %.048.lcssa = phi i32 [ 0, %.preheader ], [ %.149, %58 ]
  store i32 %.048.lcssa, ptr %2, align 4, !tbaa !10
  tail call void @free(ptr noundef %9) #11
  ret ptr %.053.lcssa
}

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #6

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 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 #2 = { 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 #3 = { nofree 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 #4 = { noreturn 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 #5 = { 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 #6 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) 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 #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { cold nounwind }
attributes #10 = { noreturn nounwind }
attributes #11 = { nounwind }
attributes #12 = { nounwind allocsize(1) }

!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 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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