; LLVM IR from ritikbanger/Hacktoberfest2022-DSA :: 20. Dynamic Programming (longest_palindromic_substring)

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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17longestPalindromeNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca %"class.std::allocator", align 1
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %18 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  %19 = trunc i64 %18 to i32
  store i32 %19, ptr %5, align 4, !tbaa !9
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = zext i32 %20 to i64
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = zext i32 %22 to i64
  %24 = call ptr @llvm.stacksave.p0()
  store ptr %24, ptr %6, align 8
  %25 = mul nuw i64 %21, %23
  %26 = alloca i32, i64 %25, align 16
  store i64 %21, ptr %7, align 8
  store i64 %23, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef @.str, ptr noundef nonnull align 1 dereferenceable(1) %12)
          to label %27 unwind label %33

27:                                               ; preds = %2
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %163, %27
  %29 = load i32, ptr %15, align 4, !tbaa !9
  %30 = load i32, ptr %5, align 4, !tbaa !9
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %37, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %166

33:                                               ; preds = %2
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %13, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %14, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #4
  br label %181

37:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %38 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %38, ptr %17, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %157, %37
  %40 = load i32, ptr %17, align 4, !tbaa !9
  %41 = load i32, ptr %5, align 4, !tbaa !9
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %43, label %162

43:                                               ; preds = %39
  %44 = load i32, ptr %15, align 4, !tbaa !9
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %54

46:                                               ; preds = %43
  %47 = load i32, ptr %16, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = mul nsw i64 %48, %23
  %50 = getelementptr inbounds i32, ptr %26, i64 %49
  %51 = load i32, ptr %17, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr %50, i64 %52
  store i32 1, ptr %53, align 4, !tbaa !9
  br label %136

54:                                               ; preds = %43
  %55 = load i32, ptr %15, align 4, !tbaa !9
  %56 = icmp eq i32 %55, 1
  br i1 %56, label %57, label %92

57:                                               ; preds = %54
  %58 = load i32, ptr %16, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %59)
          to label %61 unwind label %79

61:                                               ; preds = %57
  %62 = load i8, ptr %60, align 1, !tbaa !11
  %63 = sext i8 %62 to i32
  %64 = load i32, ptr %17, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %65)
          to label %67 unwind label %79

67:                                               ; preds = %61
  %68 = load i8, ptr %66, align 1, !tbaa !11
  %69 = sext i8 %68 to i32
  %70 = icmp eq i32 %63, %69
  br i1 %70, label %71, label %83

71:                                               ; preds = %67
  %72 = load i32, ptr %16, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = mul nsw i64 %73, %23
  %75 = getelementptr inbounds i32, ptr %26, i64 %74
  %76 = load i32, ptr %17, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds i32, ptr %75, i64 %77
  store i32 1, ptr %78, align 4, !tbaa !9
  br label %91

79:                                               ; preds = %96, %92, %61, %57
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %13, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %180

83:                                               ; preds = %67
  %84 = load i32, ptr %16, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = mul nsw i64 %85, %23
  %87 = getelementptr inbounds i32, ptr %26, i64 %86
  %88 = load i32, ptr %17, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds i32, ptr %87, i64 %89
  store i32 0, ptr %90, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %83, %71
  br label %135

92:                                               ; preds = %54
  %93 = load i32, ptr %16, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %94)
          to label %96 unwind label %79

96:                                               ; preds = %92
  %97 = load i8, ptr %95, align 1, !tbaa !11
  %98 = sext i8 %97 to i32
  %99 = load i32, ptr %17, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %100)
          to label %102 unwind label %79

102:                                              ; preds = %96
  %103 = load i8, ptr %101, align 1, !tbaa !11
  %104 = sext i8 %103 to i32
  %105 = icmp eq i32 %98, %104
  br i1 %105, label %106, label %126

106:                                              ; preds = %102
  %107 = load i32, ptr %16, align 4, !tbaa !9
  %108 = add nsw i32 %107, 1
  %109 = sext i32 %108 to i64
  %110 = mul nsw i64 %109, %23
  %111 = getelementptr inbounds i32, ptr %26, i64 %110
  %112 = load i32, ptr %17, align 4, !tbaa !9
  %113 = sub nsw i32 %112, 1
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i32, ptr %111, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !9
  %117 = icmp ne i32 %116, 0
  br i1 %117, label %118, label %126

118:                                              ; preds = %106
  %119 = load i32, ptr %16, align 4, !tbaa !9
  %120 = sext i32 %119 to i64
  %121 = mul nsw i64 %120, %23
  %122 = getelementptr inbounds i32, ptr %26, i64 %121
  %123 = load i32, ptr %17, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds i32, ptr %122, i64 %124
  store i32 1, ptr %125, align 4, !tbaa !9
  br label %134

126:                                              ; preds = %106, %102
  %127 = load i32, ptr %16, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = mul nsw i64 %128, %23
  %130 = getelementptr inbounds i32, ptr %26, i64 %129
  %131 = load i32, ptr %17, align 4, !tbaa !9
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds i32, ptr %130, i64 %132
  store i32 0, ptr %133, align 4, !tbaa !9
  br label %134

134:                                              ; preds = %126, %118
  br label %135

135:                                              ; preds = %134, %91
  br label %136

136:                                              ; preds = %135, %46
  %137 = load i32, ptr %16, align 4, !tbaa !9
  %138 = sext i32 %137 to i64
  %139 = mul nsw i64 %138, %23
  %140 = getelementptr inbounds i32, ptr %26, i64 %139
  %141 = load i32, ptr %17, align 4, !tbaa !9
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds i32, ptr %140, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !9
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %157

146:                                              ; preds = %136
  %147 = load i32, ptr %17, align 4, !tbaa !9
  %148 = load i32, ptr %16, align 4, !tbaa !9
  %149 = sub nsw i32 %147, %148
  %150 = load i32, ptr %9, align 4, !tbaa !9
  %151 = load i32, ptr %10, align 4, !tbaa !9
  %152 = sub nsw i32 %150, %151
  %153 = icmp sgt i32 %149, %152
  br i1 %153, label %154, label %157

154:                                              ; preds = %146
  %155 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %155, ptr %9, align 4, !tbaa !9
  %156 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %156, ptr %10, align 4, !tbaa !9
  br label %157

157:                                              ; preds = %154, %146, %136
  %158 = load i32, ptr %16, align 4, !tbaa !9
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %16, align 4, !tbaa !9
  %160 = load i32, ptr %17, align 4, !tbaa !9
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %17, align 4, !tbaa !9
  br label %39, !llvm.loop !12

162:                                              ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %163

163:                                              ; preds = %162
  %164 = load i32, ptr %15, align 4, !tbaa !9
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %15, align 4, !tbaa !9
  br label %28, !llvm.loop !14

166:                                              ; preds = %32
  %167 = load i32, ptr %10, align 4, !tbaa !9
  %168 = sext i32 %167 to i64
  %169 = load i32, ptr %9, align 4, !tbaa !9
  %170 = load i32, ptr %10, align 4, !tbaa !9
  %171 = sub nsw i32 %169, %170
  %172 = add nsw i32 %171, 1
  %173 = sext i32 %172 to i64
  invoke void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %168, i64 noundef %173)
          to label %174 unwind label %176

174:                                              ; preds = %166
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  %175 = load ptr, ptr %6, align 8
  call void @llvm.stackrestore.p0(ptr %175)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void

176:                                              ; preds = %166
  %177 = landingpad { ptr, i32 }
          cleanup
  %178 = extractvalue { ptr, i32 } %177, 0
  store ptr %178, ptr %13, align 8
  %179 = extractvalue { ptr, i32 } %177, 1
  store i32 %179, ptr %14, align 4
  br label %180

180:                                              ; preds = %176, %79
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #4
  br label %181

181:                                              ; preds = %180, %33
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %182

182:                                              ; preds = %181
  %183 = load ptr, ptr %13, align 8
  %184 = load i32, ptr %14, align 4
  %185 = insertvalue { ptr, i32 } poison, ptr %183, 0
  %186 = insertvalue { ptr, i32 } %185, i32 %184, 1
  resume { ptr, i32 } %186
}

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

attributes #0 = { mustprogress 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 = { mustprogress 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 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17longestPalindromeNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef nonnull %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca %"class.std::allocator", align 1
  %5 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #3
  %6 = trunc i64 %5 to i32
  %7 = and i64 %5, 4294967295
  %8 = mul nuw i64 %7, %7
  %9 = alloca i32, i64 %8, align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #3
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #3
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull @.str, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %10 unwind label %45

10:                                               ; preds = %2
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #3
  %11 = icmp sgt i32 %6, 0
  br i1 %11, label %.preheader.preheader, label %._crit_edge

.preheader.preheader:                             ; preds = %10
  %wide.trip.count107 = and i64 %5, 2147483647
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.split.us
  %indvars.iv86 = phi i32 [ %6, %.preheader.preheader ], [ %indvars.iv.next87, %.split.us ]
  %indvars.iv = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next, %.split.us ]
  %.04573 = phi i32 [ 0, %.preheader.preheader ], [ %.us-phi57, %.split.us ]
  %.04672 = phi i32 [ 0, %.preheader.preheader ], [ %.us-phi, %.split.us ]
  %12 = zext i32 %indvars.iv86 to i64
  %indvars106 = trunc i64 %indvars.iv to i32
  %wide.trip.count104 = zext i32 %indvars.iv86 to i64
  switch i32 %indvars106, label %.preheader.split [
    i32 0, label %.preheader.split.us.preheader.preheader
    i32 1, label %.preheader.split.us58
  ]

.preheader.split.us.preheader.preheader:          ; preds = %.preheader
  %xtraiter = and i64 %12, 1
  %13 = icmp eq i32 %indvars.iv86, 1
  br i1 %13, label %.split.us.loopexit119.unr-lcssa, label %.preheader.split.us.preheader.preheader.new

.preheader.split.us.preheader.preheader.new:      ; preds = %.preheader.split.us.preheader.preheader
  %unroll_iter = and i64 %12, 4294967294
  br label %.preheader.split.us.preheader

.preheader.split.us.preheader:                    ; preds = %.preheader.split.us.preheader, %.preheader.split.us.preheader.preheader.new
  %indvars.iv90 = phi i64 [ 0, %.preheader.split.us.preheader.preheader.new ], [ %indvars.iv.next91.1, %.preheader.split.us.preheader ]
  %indvars.iv88 = phi i64 [ %indvars.iv, %.preheader.split.us.preheader.preheader.new ], [ %indvars.iv.next89.1, %.preheader.split.us.preheader ]
  %.154.us = phi i32 [ %.04573, %.preheader.split.us.preheader.preheader.new ], [ %spec.select52.us.1, %.preheader.split.us.preheader ]
  %.14753.us = phi i32 [ %.04672, %.preheader.split.us.preheader.preheader.new ], [ %spec.select.us.1, %.preheader.split.us.preheader ]
  %niter = phi i64 [ 0, %.preheader.split.us.preheader.preheader.new ], [ %niter.next.1, %.preheader.split.us.preheader ]
  %14 = mul nuw nsw i64 %7, %indvars.iv90
  %15 = getelementptr inbounds i32, ptr %9, i64 %14
  %16 = getelementptr inbounds i32, ptr %15, i64 %indvars.iv88
  store i32 1, ptr %16, align 4, !tbaa !5
  %17 = icmp slt i32 %.14753.us, %.154.us
  %18 = trunc nuw nsw i64 %indvars.iv88 to i32
  %spec.select.us = select i1 %17, i32 %18, i32 %.14753.us
  %19 = trunc nuw nsw i64 %indvars.iv90 to i32
  %spec.select52.us = select i1 %17, i32 %19, i32 %.154.us
  %indvars.iv.next91 = or disjoint i64 %indvars.iv90, 1
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %20 = mul nuw nsw i64 %7, %indvars.iv.next91
  %21 = getelementptr inbounds i32, ptr %9, i64 %20
  %22 = getelementptr inbounds i32, ptr %21, i64 %indvars.iv.next89
  store i32 1, ptr %22, align 4, !tbaa !5
  %23 = icmp slt i32 %spec.select.us, %spec.select52.us
  %24 = trunc nuw nsw i64 %indvars.iv.next89 to i32
  %spec.select.us.1 = select i1 %23, i32 %24, i32 %spec.select.us
  %25 = trunc nuw nsw i64 %indvars.iv.next91 to i32
  %spec.select52.us.1 = select i1 %23, i32 %25, i32 %spec.select52.us
  %indvars.iv.next91.1 = add nuw nsw i64 %indvars.iv90, 2
  %indvars.iv.next89.1 = add nuw nsw i64 %indvars.iv88, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.split.us.loopexit119.unr-lcssa, label %.preheader.split.us.preheader, !llvm.loop !9

.preheader.split.us58:                            ; preds = %.preheader, %.preheader.split.us58
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %.preheader.split.us58 ], [ 0, %.preheader ]
  %indvars.iv79 = phi i64 [ %indvars.iv.next80, %.preheader.split.us58 ], [ %indvars.iv, %.preheader ]
  %.154.us61 = phi i32 [ %.2.us67, %.preheader.split.us58 ], [ %.04573, %.preheader ]
  %.14753.us62 = phi i32 [ %.248.us66, %.preheader.split.us58 ], [ %.04672, %.preheader ]
  %26 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %indvars.iv81)
  %27 = load i8, ptr %26, align 1, !tbaa !11
  %28 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %indvars.iv79)
  %29 = load i8, ptr %28, align 1, !tbaa !11
  %30 = icmp eq i8 %27, %29
  %31 = mul nuw nsw i64 %7, %indvars.iv81
  %32 = getelementptr inbounds i32, ptr %9, i64 %31
  %33 = getelementptr inbounds i32, ptr %32, i64 %indvars.iv79
  %. = zext i1 %30 to i32
  store i32 %., ptr %33, align 4, !tbaa !5
  %34 = getelementptr inbounds i32, ptr %9, i64 %31
  %35 = getelementptr inbounds i32, ptr %34, i64 %indvars.iv79
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %.not51.us63 = icmp eq i32 %36, 0
  %.not110 = icmp sgt i32 %.14753.us62, %.154.us61
  %37 = trunc nuw nsw i64 %indvars.iv79 to i32
  %38 = trunc nuw nsw i64 %indvars.iv81 to i32
  %39 = select i1 %.not51.us63, i1 true, i1 %.not110
  %.248.us66 = select i1 %39, i32 %.14753.us62, i32 %37
  %40 = select i1 %.not51.us63, i1 true, i1 %.not110
  %.2.us67 = select i1 %40, i32 %.154.us61, i32 %38
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count104
  br i1 %exitcond.not, label %.split.us, label %.preheader.split.us58, !llvm.loop !9

._crit_edge.loopexit:                             ; preds = %.split.us
  %41 = add i32 %.us-phi, 1
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %10
  %.046.lcssa = phi i32 [ 1, %10 ], [ %41, %._crit_edge.loopexit ]
  %.045.lcssa = phi i32 [ 0, %10 ], [ %.us-phi57, %._crit_edge.loopexit ]
  %42 = sext i32 %.045.lcssa to i64
  %43 = sub i32 %.046.lcssa, %.045.lcssa
  %44 = sext i32 %43 to i64
  invoke void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %42, i64 noundef %44)
          to label %77 unwind label %78

45:                                               ; preds = %2
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #3
  br label %80

.preheader.split:                                 ; preds = %.preheader, %60
  %indvars.iv99 = phi i64 [ %indvars.iv.next100, %60 ], [ 0, %.preheader ]
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %60 ], [ %indvars.iv, %.preheader ]
  %.154 = phi i32 [ %.2, %60 ], [ %.04573, %.preheader ]
  %.14753 = phi i32 [ %.248, %60 ], [ %.04672, %.preheader ]
  %47 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %indvars.iv99)
  %48 = load i8, ptr %47, align 1, !tbaa !11
  %49 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %indvars.iv97)
  %50 = load i8, ptr %49, align 1, !tbaa !11
  %51 = icmp eq i8 %48, %50
  br i1 %51, label %52, label %59

52:                                               ; preds = %.preheader.split
  %53 = add nuw nsw i64 %indvars.iv99, 1
  %54 = mul nuw nsw i64 %7, %53
  %55 = getelementptr inbounds i32, ptr %9, i64 %54
  %56 = getelementptr i32, ptr %55, i64 %indvars.iv97
  %57 = getelementptr i8, ptr %56, i64 -4
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %.not = icmp eq i32 %58, 0
  br i1 %.not, label %59, label %60

59:                                               ; preds = %52, %.preheader.split
  br label %60

60:                                               ; preds = %52, %59
  %.sink113 = phi i32 [ 0, %59 ], [ 1, %52 ]
  %61 = mul nuw nsw i64 %7, %indvars.iv99
  %62 = getelementptr inbounds i32, ptr %9, i64 %61
  %63 = getelementptr inbounds i32, ptr %62, i64 %indvars.iv97
  store i32 %.sink113, ptr %63, align 4, !tbaa !5
  %64 = getelementptr inbounds i32, ptr %9, i64 %61
  %65 = getelementptr inbounds i32, ptr %64, i64 %indvars.iv97
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %.not51 = icmp eq i32 %66, 0
  %67 = sub nsw i32 %.14753, %.154
  %68 = icmp slt i32 %67, %indvars106
  %69 = trunc nuw nsw i64 %indvars.iv97 to i32
  %spec.select = select i1 %68, i32 %69, i32 %.14753
  %70 = trunc nuw nsw i64 %indvars.iv99 to i32
  %spec.select52 = select i1 %68, i32 %70, i32 %.154
  %.248 = select i1 %.not51, i32 %.14753, i32 %spec.select
  %.2 = select i1 %.not51, i32 %.154, i32 %spec.select52
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %exitcond105.not = icmp eq i64 %indvars.iv.next100, %wide.trip.count104
  br i1 %exitcond105.not, label %.split.us, label %.preheader.split, !llvm.loop !9

.split.us.loopexit119.unr-lcssa:                  ; preds = %.preheader.split.us.preheader, %.preheader.split.us.preheader.preheader
  %spec.select.us.lcssa.ph = phi i32 [ poison, %.preheader.split.us.preheader.preheader ], [ %spec.select.us.1, %.preheader.split.us.preheader ]
  %spec.select52.us.lcssa.ph = phi i32 [ poison, %.preheader.split.us.preheader.preheader ], [ %spec.select52.us.1, %.preheader.split.us.preheader ]
  %indvars.iv90.unr = phi i64 [ 0, %.preheader.split.us.preheader.preheader ], [ %indvars.iv.next91.1, %.preheader.split.us.preheader ]
  %indvars.iv88.unr = phi i64 [ %indvars.iv, %.preheader.split.us.preheader.preheader ], [ %indvars.iv.next89.1, %.preheader.split.us.preheader ]
  %.154.us.unr = phi i32 [ %.04573, %.preheader.split.us.preheader.preheader ], [ %spec.select52.us.1, %.preheader.split.us.preheader ]
  %.14753.us.unr = phi i32 [ %.04672, %.preheader.split.us.preheader.preheader ], [ %spec.select.us.1, %.preheader.split.us.preheader ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.split.us, label %.preheader.split.us.preheader.epil

.preheader.split.us.preheader.epil:               ; preds = %.split.us.loopexit119.unr-lcssa
  %71 = mul nuw nsw i64 %7, %indvars.iv90.unr
  %72 = getelementptr inbounds i32, ptr %9, i64 %71
  %73 = getelementptr inbounds i32, ptr %72, i64 %indvars.iv88.unr
  store i32 1, ptr %73, align 4, !tbaa !5
  %74 = icmp slt i32 %.14753.us.unr, %.154.us.unr
  %75 = trunc nuw nsw i64 %indvars.iv88.unr to i32
  %spec.select.us.epil = select i1 %74, i32 %75, i32 %.14753.us.unr
  %76 = trunc nuw nsw i64 %indvars.iv90.unr to i32
  %spec.select52.us.epil = select i1 %74, i32 %76, i32 %.154.us.unr
  br label %.split.us

.split.us:                                        ; preds = %.preheader.split.us58, %.preheader.split.us.preheader.epil, %.split.us.loopexit119.unr-lcssa, %60
  %.us-phi = phi i32 [ %.248, %60 ], [ %spec.select.us.lcssa.ph, %.split.us.loopexit119.unr-lcssa ], [ %spec.select.us.epil, %.preheader.split.us.preheader.epil ], [ %.248.us66, %.preheader.split.us58 ]
  %.us-phi57 = phi i32 [ %.2, %60 ], [ %spec.select52.us.lcssa.ph, %.split.us.loopexit119.unr-lcssa ], [ %spec.select52.us.epil, %.preheader.split.us.preheader.epil ], [ %.2.us67, %.preheader.split.us58 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %indvars.iv.next87 = add i32 %indvars.iv86, -1
  %exitcond108.not = icmp eq i64 %indvars.iv.next, %wide.trip.count107
  br i1 %exitcond108.not, label %._crit_edge.loopexit, label %.preheader, !llvm.loop !12

77:                                               ; preds = %._crit_edge
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #3
  ret void

78:                                               ; preds = %._crit_edge
  %79 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #3
  br label %80

80:                                               ; preds = %78, %45
  %.pn = phi { ptr, i32 } [ %79, %78 ], [ %46, %45 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #3
  resume { ptr, i32 } %.pn
}

; 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 nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

attributes #0 = { mustprogress 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 = { mustprogress 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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass