; LLVM IR from tezc/sc :: string (sc_str)

; 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.sc_str = type { i32, [0 x i8] }

@.str = external hidden unnamed_addr constant [32 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [57 x i8], align 1
@__PRETTY_FUNCTION__.sc_str_replace = external hidden unnamed_addr constant [58 x i8], align 1

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

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

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

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

; 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) #3

; Function Attrs: nounwind uwtable
declare dso_local void @sc_str_destroy(ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @sc_str_replace(ptr noundef %0, ptr noundef %1, ptr noundef %2) #4 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = 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
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %26

22:                                               ; preds = %3
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %26

25:                                               ; preds = %22
  br label %27

26:                                               ; preds = %22, %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 355, ptr noundef @__PRETTY_FUNCTION__.sc_str_replace) #6
  unreachable

27:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %27
  store i1 true, ptr %4, align 1
  store i32 1, ptr %19, align 4
  br label %166

32:                                               ; preds = %27
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = call i64 @strlen(ptr noundef %33) #8
  store i64 %34, ptr %9, align 8, !tbaa !9
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = call i64 @strlen(ptr noundef %35) #8
  store i64 %36, ptr %10, align 8, !tbaa !9
  %37 = load i64, ptr %9, align 8, !tbaa !9
  %38 = icmp uge i64 %37, 4294967295
  br i1 %38, label %42, label %39

39:                                               ; preds = %32
  %40 = load i64, ptr %10, align 8, !tbaa !9
  %41 = icmp uge i64 %40, 4294967295
  br i1 %41, label %42, label %43

42:                                               ; preds = %39, %32
  store i1 false, ptr %4, align 1
  store i32 1, ptr %19, align 4
  br label %166

43:                                               ; preds = %39
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 -4
  store ptr %46, ptr %15, align 8, !tbaa !5
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  store ptr %48, ptr %17, align 8, !tbaa !5
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  %51 = load ptr, ptr %15, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.sc_str, ptr %51, i32 0, i32 0
  %53 = load i32, ptr %52, align 4, !tbaa !11
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds i8, ptr %50, i64 %54
  store ptr %55, ptr %18, align 8, !tbaa !5
  %56 = load i64, ptr %10, align 8, !tbaa !9
  %57 = load i64, ptr %9, align 8, !tbaa !9
  %58 = sub nsw i64 %56, %57
  store i64 %58, ptr %8, align 8, !tbaa !9
  %59 = load i64, ptr %8, align 8, !tbaa !9
  %60 = icmp eq i64 %59, 0
  br i1 %60, label %61, label %75

61:                                               ; preds = %43
  br label %62

62:                                               ; preds = %67, %61
  %63 = load ptr, ptr %17, align 8, !tbaa !5
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = call ptr @strstr(ptr noundef %63, ptr noundef %64) #8
  store ptr %65, ptr %17, align 8, !tbaa !5
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %74

67:                                               ; preds = %62
  %68 = load ptr, ptr %17, align 8, !tbaa !5
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = load i64, ptr %9, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %68, ptr align 1 %69, i64 %70, i1 false)
  %71 = load i64, ptr %9, align 8, !tbaa !9
  %72 = load ptr, ptr %17, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %72, i64 %71
  store ptr %73, ptr %17, align 8, !tbaa !5
  br label %62, !llvm.loop !13

74:                                               ; preds = %62
  store i1 true, ptr %4, align 1
  store i32 1, ptr %19, align 4
  br label %166

75:                                               ; preds = %43
  %76 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %76, ptr %16, align 8, !tbaa !5
  %77 = load ptr, ptr %15, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.sc_str, ptr %77, i32 0, i32 0
  %79 = load i32, ptr %78, align 4, !tbaa !11
  %80 = zext i32 %79 to i64
  store i64 %80, ptr %13, align 8, !tbaa !9
  store i64 0, ptr %12, align 8, !tbaa !9
  br label %81

81:                                               ; preds = %99, %75
  %82 = load ptr, ptr %16, align 8, !tbaa !5
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = call ptr @strstr(ptr noundef %82, ptr noundef %83) #8
  store ptr %84, ptr %16, align 8, !tbaa !5
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %102

86:                                               ; preds = %81
  %87 = load i64, ptr %9, align 8, !tbaa !9
  %88 = load ptr, ptr %16, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %88, i64 %87
  store ptr %89, ptr %16, align 8, !tbaa !5
  %90 = load i64, ptr %13, align 8, !tbaa !9
  %91 = load i64, ptr %8, align 8, !tbaa !9
  %92 = sub nsw i64 4294967290, %91
  %93 = icmp sgt i64 %90, %92
  br i1 %93, label %94, label %95

94:                                               ; preds = %86
  store i1 false, ptr %4, align 1
  store i32 1, ptr %19, align 4
  br label %166

95:                                               ; preds = %86
  %96 = load i64, ptr %8, align 8, !tbaa !9
  %97 = load i64, ptr %13, align 8, !tbaa !9
  %98 = add i64 %97, %96
  store i64 %98, ptr %13, align 8, !tbaa !9
  br label %99

99:                                               ; preds = %95
  %100 = load i64, ptr %12, align 8, !tbaa !9
  %101 = add i64 %100, 1
  store i64 %101, ptr %12, align 8, !tbaa !9
  br label %81, !llvm.loop !15

102:                                              ; preds = %81
  %103 = load i64, ptr %12, align 8, !tbaa !9
  %104 = icmp eq i64 %103, 0
  br i1 %104, label %105, label %106

105:                                              ; preds = %102
  store i1 true, ptr %4, align 1
  store i32 1, ptr %19, align 4
  br label %166

106:                                              ; preds = %102
  %107 = load i64, ptr %13, align 8, !tbaa !9
  %108 = add i64 %107, 4
  %109 = add i64 %108, 1
  %110 = call noalias ptr @malloc(i64 noundef %109) #9
  store ptr %110, ptr %14, align 8, !tbaa !5
  %111 = load ptr, ptr %14, align 8, !tbaa !5
  %112 = icmp ne ptr %111, null
  br i1 %112, label %114, label %113

113:                                              ; preds = %106
  store i1 false, ptr %4, align 1
  store i32 1, ptr %19, align 4
  br label %166

114:                                              ; preds = %106
  %115 = load i64, ptr %13, align 8, !tbaa !9
  %116 = trunc i64 %115 to i32
  %117 = load ptr, ptr %14, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.sc_str, ptr %117, i32 0, i32 0
  store i32 %116, ptr %118, align 4, !tbaa !11
  %119 = load ptr, ptr %14, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.sc_str, ptr %119, i32 0, i32 1
  %121 = getelementptr inbounds [0 x i8], ptr %120, i64 0, i64 0
  store ptr %121, ptr %16, align 8, !tbaa !5
  br label %122

122:                                              ; preds = %126, %114
  %123 = load i64, ptr %12, align 8, !tbaa !9
  %124 = add i64 %123, -1
  store i64 %124, ptr %12, align 8, !tbaa !9
  %125 = icmp ne i64 %123, 0
  br i1 %125, label %126, label %152

126:                                              ; preds = %122
  %127 = load ptr, ptr %17, align 8, !tbaa !5
  %128 = load ptr, ptr %6, align 8, !tbaa !5
  %129 = call ptr @strstr(ptr noundef %127, ptr noundef %128) #8
  %130 = load ptr, ptr %17, align 8, !tbaa !5
  %131 = ptrtoint ptr %129 to i64
  %132 = ptrtoint ptr %130 to i64
  %133 = sub i64 %131, %132
  store i64 %133, ptr %11, align 8, !tbaa !9
  %134 = load ptr, ptr %16, align 8, !tbaa !5
  %135 = load ptr, ptr %17, align 8, !tbaa !5
  %136 = load i64, ptr %11, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %134, ptr align 1 %135, i64 %136, i1 false)
  %137 = load i64, ptr %11, align 8, !tbaa !9
  %138 = load ptr, ptr %16, align 8, !tbaa !5
  %139 = getelementptr inbounds i8, ptr %138, i64 %137
  store ptr %139, ptr %16, align 8, !tbaa !5
  %140 = load ptr, ptr %16, align 8, !tbaa !5
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = load i64, ptr %10, align 8, !tbaa !9
  %143 = add i64 %142, 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %140, ptr align 1 %141, i64 %143, i1 false)
  %144 = load i64, ptr %10, align 8, !tbaa !9
  %145 = load ptr, ptr %16, align 8, !tbaa !5
  %146 = getelementptr inbounds i8, ptr %145, i64 %144
  store ptr %146, ptr %16, align 8, !tbaa !5
  %147 = load i64, ptr %11, align 8, !tbaa !9
  %148 = load i64, ptr %9, align 8, !tbaa !9
  %149 = add i64 %147, %148
  %150 = load ptr, ptr %17, align 8, !tbaa !5
  %151 = getelementptr inbounds i8, ptr %150, i64 %149
  store ptr %151, ptr %17, align 8, !tbaa !5
  br label %122, !llvm.loop !16

152:                                              ; preds = %122
  %153 = load ptr, ptr %16, align 8, !tbaa !5
  %154 = load ptr, ptr %17, align 8, !tbaa !5
  %155 = load ptr, ptr %18, align 8, !tbaa !5
  %156 = load ptr, ptr %17, align 8, !tbaa !5
  %157 = ptrtoint ptr %155 to i64
  %158 = ptrtoint ptr %156 to i64
  %159 = sub i64 %157, %158
  %160 = add nsw i64 %159, 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %153, ptr align 1 %154, i64 %160, i1 false)
  %161 = load ptr, ptr %5, align 8, !tbaa !5
  call void @sc_str_destroy(ptr noundef %161)
  %162 = load ptr, ptr %14, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.sc_str, ptr %162, i32 0, i32 1
  %164 = getelementptr inbounds [0 x i8], ptr %163, i64 0, i64 0
  %165 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %164, ptr %165, align 8, !tbaa !5
  store i1 true, ptr %4, align 1
  store i32 1, ptr %19, align 4
  br label %166

166:                                              ; preds = %152, %113, %105, %94, %74, %42, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, 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 8, ptr %8) #7
  %167 = load i1, ptr %4, align 1
  ret i1 %167
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strstr(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { noreturn nounwind }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind allocsize(0) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


; 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 [32 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [57 x i8], align 1
@__PRETTY_FUNCTION__.sc_str_replace = external hidden unnamed_addr constant [58 x i8], align 1

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

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

; 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) #2

; Function Attrs: nounwind uwtable
declare dso_local void @sc_str_destroy(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @sc_str_replace(ptr noundef %0, ptr noundef readonly %1, ptr noundef readonly %2) local_unnamed_addr #3 {
  %4 = icmp ne ptr %1, null
  %5 = icmp ne ptr %2, null
  %or.cond = and i1 %4, %5
  br i1 %or.cond, label %7, label %6

6:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 355, ptr noundef nonnull @__PRETTY_FUNCTION__.sc_str_replace) #5
  unreachable

7:                                                ; preds = %3
  %8 = load ptr, ptr %0, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %.loopexit, label %10

10:                                               ; preds = %7
  %11 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #6
  %12 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %2) #6
  %13 = icmp ugt i64 %11, 4294967294
  %14 = icmp ugt i64 %12, 4294967294
  %or.cond3 = select i1 %13, i1 true, i1 %14
  br i1 %or.cond3, label %.loopexit, label %15

15:                                               ; preds = %10
  %16 = getelementptr inbounds i8, ptr %8, i64 -4
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = zext i32 %17 to i64
  %19 = getelementptr inbounds i8, ptr %8, i64 %18
  %20 = sub nsw i64 %12, %11
  %21 = icmp eq i64 %12, %11
  %22 = tail call ptr @strstr(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) %1) #6
  %.not8294 = icmp eq ptr %22, null
  br i1 %21, label %.preheader, label %.preheader83

.preheader83:                                     ; preds = %15
  br i1 %.not8294, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader83
  %23 = sub nsw i64 4294967290, %20
  br label %27

.preheader:                                       ; preds = %15
  br i1 %.not8294, label %.loopexit, label %.lr.ph95

.lr.ph95:                                         ; preds = %.preheader, %.lr.ph95
  %24 = phi ptr [ %26, %.lr.ph95 ], [ %22, %.preheader ]
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %24, ptr nonnull align 1 %2, i64 %11, i1 false)
  %25 = getelementptr inbounds i8, ptr %24, i64 %11
  %26 = tail call ptr @strstr(ptr noundef nonnull dereferenceable(1) %25, ptr noundef nonnull dereferenceable(1) %1) #6
  %.not82 = icmp eq ptr %26, null
  br i1 %.not82, label %.loopexit, label %.lr.ph95, !llvm.loop !11

27:                                               ; preds = %.lr.ph, %30
  %28 = phi ptr [ %22, %.lr.ph ], [ %34, %30 ]
  %.06889 = phi i64 [ 0, %.lr.ph ], [ %33, %30 ]
  %.07088 = phi i64 [ %18, %.lr.ph ], [ %32, %30 ]
  %29 = icmp sgt i64 %.07088, %23
  br i1 %29, label %.loopexit, label %30

30:                                               ; preds = %27
  %31 = getelementptr inbounds i8, ptr %28, i64 %11
  %32 = add i64 %.07088, %20
  %33 = add i64 %.06889, 1
  %34 = tail call ptr @strstr(ptr noundef nonnull dereferenceable(1) %31, ptr noundef nonnull dereferenceable(1) %1) #6
  %.not = icmp eq ptr %34, null
  br i1 %.not, label %._crit_edge, label %27, !llvm.loop !13

._crit_edge:                                      ; preds = %30
  %35 = icmp eq i64 %33, 0
  br i1 %35, label %.loopexit, label %36

36:                                               ; preds = %._crit_edge
  %37 = add i64 %32, 5
  %38 = tail call noalias ptr @malloc(i64 noundef %37) #7
  %.not80 = icmp eq ptr %38, null
  br i1 %.not80, label %.loopexit, label %39

39:                                               ; preds = %36
  %40 = trunc i64 %32 to i32
  store i32 %40, ptr %38, align 4, !tbaa !9
  %41 = getelementptr inbounds i8, ptr %38, i64 4
  %42 = add nuw nsw i64 %12, 1
  br label %43

43:                                               ; preds = %39, %43
  %.193 = phi ptr [ %8, %39 ], [ %52, %43 ]
  %.16792 = phi ptr [ %41, %39 ], [ %50, %43 ]
  %.16991 = phi i64 [ %33, %39 ], [ %44, %43 ]
  %44 = add i64 %.16991, -1
  %45 = tail call ptr @strstr(ptr noundef nonnull dereferenceable(1) %.193, ptr noundef nonnull dereferenceable(1) %1) #6
  %46 = ptrtoint ptr %45 to i64
  %47 = ptrtoint ptr %.193 to i64
  %48 = sub i64 %46, %47
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %.16792, ptr align 1 %.193, i64 %48, i1 false)
  %49 = getelementptr inbounds i8, ptr %.16792, i64 %48
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %49, ptr noundef nonnull align 1 dereferenceable(1) %2, i64 %42, i1 false)
  %50 = getelementptr inbounds i8, ptr %49, i64 %12
  %51 = add i64 %48, %11
  %52 = getelementptr inbounds i8, ptr %.193, i64 %51
  %.not81 = icmp eq i64 %44, 0
  br i1 %.not81, label %53, label %43, !llvm.loop !14

53:                                               ; preds = %43
  %54 = ptrtoint ptr %19 to i64
  %55 = ptrtoint ptr %52 to i64
  %56 = add i64 %54, 1
  %57 = sub i64 %56, %55
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %50, ptr align 1 %52, i64 %57, i1 false)
  tail call void @sc_str_destroy(ptr noundef nonnull %0)
  store ptr %41, ptr %0, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %27, %.lr.ph95, %.preheader83, %.preheader, %36, %._crit_edge, %10, %7, %53
  %.0 = phi i1 [ true, %53 ], [ true, %7 ], [ false, %10 ], [ true, %._crit_edge ], [ false, %36 ], [ true, %.preheader ], [ true, %.preheader83 ], [ true, %.lr.ph95 ], [ false, %27 ]
  ret i1 %.0
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #0

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { noreturn nounwind }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { nounwind allocsize(0) }

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


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