; LLVM IR from UtkarshPathrabe/Competitive-Coding :: Model Algorithms/Pattern Searching (Rabin Karp Pattern Searching)

; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8RKsearchNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_i(ptr noundef %0, ptr noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %16 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  %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) #5
  %18 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #5
  %19 = trunc i64 %18 to i32
  store i32 %19, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %31, %3
  %21 = load i32, ptr %12, align 4, !tbaa !9
  %22 = load i32, ptr %8, align 4, !tbaa !9
  %23 = sub nsw i32 %22, 1
  %24 = icmp slt i32 %21, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %34

26:                                               ; preds = %20
  %27 = load i32, ptr %11, align 4, !tbaa !9
  %28 = mul nsw i32 %27, 256
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = srem i32 %28, %29
  store i32 %30, ptr %11, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %26
  %32 = load i32, ptr %12, align 4, !tbaa !9
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %12, align 4, !tbaa !9
  br label %20, !llvm.loop !11

34:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %61, %34
  %36 = load i32, ptr %13, align 4, !tbaa !9
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %64

40:                                               ; preds = %35
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = mul nsw i32 256, %41
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %44)
  %46 = load i8, ptr %45, align 1, !tbaa !13
  %47 = sext i8 %46 to i32
  %48 = add nsw i32 %42, %47
  %49 = load i32, ptr %6, align 4, !tbaa !9
  %50 = srem i32 %48, %49
  store i32 %50, ptr %9, align 4, !tbaa !9
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = mul nsw i32 256, %51
  %53 = load i32, ptr %13, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %54)
  %56 = load i8, ptr %55, align 1, !tbaa !13
  %57 = sext i8 %56 to i32
  %58 = add nsw i32 %52, %57
  %59 = load i32, ptr %6, align 4, !tbaa !9
  %60 = srem i32 %58, %59
  store i32 %60, ptr %10, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %40
  %62 = load i32, ptr %13, align 4, !tbaa !9
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %13, align 4, !tbaa !9
  br label %35, !llvm.loop !14

64:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %145, %64
  %66 = load i32, ptr %14, align 4, !tbaa !9
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = load i32, ptr %8, align 4, !tbaa !9
  %69 = sub nsw i32 %67, %68
  %70 = icmp sle i32 %66, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %148

72:                                               ; preds = %65
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = load i32, ptr %10, align 4, !tbaa !9
  %75 = icmp eq i32 %73, %74
  br i1 %75, label %76, label %110

76:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %97, %76
  %78 = load i32, ptr %15, align 4, !tbaa !9
  %79 = load i32, ptr %8, align 4, !tbaa !9
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %81, label %100

81:                                               ; preds = %77
  %82 = load i32, ptr %14, align 4, !tbaa !9
  %83 = load i32, ptr %15, align 4, !tbaa !9
  %84 = add nsw i32 %82, %83
  %85 = sext i32 %84 to i64
  %86 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %85)
  %87 = load i8, ptr %86, align 1, !tbaa !13
  %88 = sext i8 %87 to i32
  %89 = load i32, ptr %15, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %90)
  %92 = load i8, ptr %91, align 1, !tbaa !13
  %93 = sext i8 %92 to i32
  %94 = icmp ne i32 %88, %93
  br i1 %94, label %95, label %96

95:                                               ; preds = %81
  br label %100

96:                                               ; preds = %81
  br label %97

97:                                               ; preds = %96
  %98 = load i32, ptr %15, align 4, !tbaa !9
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %15, align 4, !tbaa !9
  br label %77, !llvm.loop !15

100:                                              ; preds = %95, %77
  %101 = load i32, ptr %15, align 4, !tbaa !9
  %102 = load i32, ptr %8, align 4, !tbaa !9
  %103 = icmp eq i32 %101, %102
  br i1 %103, label %104, label %109

104:                                              ; preds = %100
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %106 = load i32, ptr %14, align 4, !tbaa !9
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %105, i32 noundef %106)
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %107, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %109

109:                                              ; preds = %104, %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %110

110:                                              ; preds = %109, %72
  %111 = load i32, ptr %14, align 4, !tbaa !9
  %112 = load i32, ptr %7, align 4, !tbaa !9
  %113 = load i32, ptr %8, align 4, !tbaa !9
  %114 = sub nsw i32 %112, %113
  %115 = icmp slt i32 %111, %114
  br i1 %115, label %116, label %144

116:                                              ; preds = %110
  %117 = load i32, ptr %10, align 4, !tbaa !9
  %118 = load i32, ptr %14, align 4, !tbaa !9
  %119 = sext i32 %118 to i64
  %120 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %119)
  %121 = load i8, ptr %120, align 1, !tbaa !13
  %122 = sext i8 %121 to i32
  %123 = load i32, ptr %11, align 4, !tbaa !9
  %124 = mul nsw i32 %122, %123
  %125 = sub nsw i32 %117, %124
  %126 = mul nsw i32 256, %125
  %127 = load i32, ptr %14, align 4, !tbaa !9
  %128 = load i32, ptr %8, align 4, !tbaa !9
  %129 = add nsw i32 %127, %128
  %130 = sext i32 %129 to i64
  %131 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %130)
  %132 = load i8, ptr %131, align 1, !tbaa !13
  %133 = sext i8 %132 to i32
  %134 = add nsw i32 %126, %133
  %135 = load i32, ptr %6, align 4, !tbaa !9
  %136 = srem i32 %134, %135
  store i32 %136, ptr %10, align 4, !tbaa !9
  %137 = load i32, ptr %10, align 4, !tbaa !9
  %138 = icmp slt i32 %137, 0
  br i1 %138, label %139, label %143

139:                                              ; preds = %116
  %140 = load i32, ptr %10, align 4, !tbaa !9
  %141 = load i32, ptr %6, align 4, !tbaa !9
  %142 = add nsw i32 %140, %141
  store i32 %142, ptr %10, align 4, !tbaa !9
  br label %143

143:                                              ; preds = %139, %116
  br label %144

144:                                              ; preds = %143, %110
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %14, align 4, !tbaa !9
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %14, align 4, !tbaa !9
  br label %65, !llvm.loop !16

148:                                              ; preds = %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void
}

; 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 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: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

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 = { inlinehint 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 #4 = { "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 }

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


; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8RKsearchNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_i(ptr noundef nonnull %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %5 = trunc i64 %4 to i32
  %6 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  %7 = trunc i64 %6 to i32
  %8 = icmp sgt i32 %7, 1
  br i1 %8, label %.lr.ph.preheader, label %.preheader53

.lr.ph.preheader:                                 ; preds = %3
  %9 = add nsw i32 %7, -2
  %10 = add nsw i32 %7, -1
  %xtraiter = and i32 %10, 3
  %11 = icmp ult i32 %9, 3
  br i1 %11, label %.preheader53.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i32 %10, -4
  br label %.lr.ph

.preheader53.loopexit.unr-lcssa:                  ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa116.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %22, %.lr.ph ]
  %.04454.unr = phi i32 [ 1, %.lr.ph.preheader ], [ %22, %.lr.ph ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader53, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader53.loopexit.unr-lcssa, %.lr.ph.epil
  %.04454.epil = phi i32 [ %13, %.lr.ph.epil ], [ %.04454.unr, %.preheader53.loopexit.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %.preheader53.loopexit.unr-lcssa ]
  %12 = shl nsw i32 %.04454.epil, 8
  %13 = srem i32 %12, %2
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader53, label %.lr.ph.epil, !llvm.loop !5

.preheader53:                                     ; preds = %.preheader53.loopexit.unr-lcssa, %.lr.ph.epil, %3
  %.044.lcssa = phi i32 [ 1, %3 ], [ %.lcssa116.ph, %.preheader53.loopexit.unr-lcssa ], [ %13, %.lr.ph.epil ]
  %14 = icmp sgt i32 %7, 0
  br i1 %14, label %.lr.ph59.preheader, label %.preheader52.thread

.lr.ph59.preheader:                               ; preds = %.preheader53
  %wide.trip.count = and i64 %6, 2147483647
  br label %.lr.ph59

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.04454 = phi i32 [ 1, %.lr.ph.preheader.new ], [ %22, %.lr.ph ]
  %niter = phi i32 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %15 = shl nsw i32 %.04454, 8
  %16 = srem i32 %15, %2
  %17 = shl nsw i32 %16, 8
  %18 = srem i32 %17, %2
  %19 = shl nsw i32 %18, 8
  %20 = srem i32 %19, %2
  %21 = shl nsw i32 %20, 8
  %22 = srem i32 %21, %2
  %niter.next.3 = add i32 %niter, 4
  %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader53.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !7

.preheader52:                                     ; preds = %.lr.ph59
  %23 = sub nsw i32 %5, %7
  %.not67 = icmp slt i32 %23, 0
  br i1 %.not67, label %._crit_edge71, label %.lr.ph70

.preheader52.thread:                              ; preds = %.preheader53
  %24 = sub nsw i32 %5, %7
  %.not6796 = icmp slt i32 %24, 0
  br i1 %.not6796, label %._crit_edge71, label %.lr.ph70.split

.lr.ph70:                                         ; preds = %.preheader52
  br i1 %14, label %.lr.ph70.split.us.preheader, label %.lr.ph70.split

.lr.ph70.split.us.preheader:                      ; preds = %.lr.ph70
  %25 = zext nneg i32 %23 to i64
  %26 = and i64 %6, 2147483647
  %27 = add i64 %4, 1
  %28 = sub i64 %27, %6
  %wide.trip.count92 = and i64 %28, 4294967295
  br label %.lr.ph70.split.us

.lr.ph70.split.us:                                ; preds = %.lr.ph70.split.us.preheader, %58
  %indvars.iv89 = phi i64 [ 0, %.lr.ph70.split.us.preheader ], [ %indvars.iv.next90, %58 ]
  %.168.us = phi i32 [ %77, %.lr.ph70.split.us.preheader ], [ %.2.us, %58 ]
  %29 = icmp eq i32 %71, %.168.us
  br i1 %29, label %.preheader.us, label %41

.preheader.us:                                    ; preds = %.lr.ph70.split.us, %59
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %59 ], [ 0, %.lr.ph70.split.us ]
  %30 = add nuw nsw i64 %indvars.iv84, %indvars.iv89
  %31 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %30)
  %32 = load i8, ptr %31, align 1, !tbaa !9
  %33 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %indvars.iv84)
  %34 = load i8, ptr %33, align 1, !tbaa !9
  %.not51.us = icmp eq i8 %32, %34
  br i1 %.not51.us, label %59, label %._crit_edge.us

._crit_edge.us:                                   ; preds = %.preheader.us
  %35 = trunc nuw nsw i64 %indvars.iv84 to i32
  %36 = icmp eq i32 %35, %7
  br i1 %36, label %._crit_edge.us.thread, label %41

._crit_edge.us.thread:                            ; preds = %59, %._crit_edge.us
  %37 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %38 = trunc nuw nsw i64 %indvars.iv89 to i32
  %39 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %37, i32 noundef %38)
  %40 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %39, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %41

41:                                               ; preds = %._crit_edge.us.thread, %._crit_edge.us, %.lr.ph70.split.us
  %42 = icmp ult i64 %indvars.iv89, %25
  br i1 %42, label %43, label %58

43:                                               ; preds = %41
  %44 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv89)
  %45 = load i8, ptr %44, align 1, !tbaa !9
  %46 = sext i8 %45 to i32
  %47 = mul nsw i32 %.044.lcssa, %46
  %48 = sub nsw i32 %.168.us, %47
  %49 = shl nsw i32 %48, 8
  %50 = add nuw nsw i64 %indvars.iv89, %26
  %51 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %50)
  %52 = load i8, ptr %51, align 1, !tbaa !9
  %53 = sext i8 %52 to i32
  %54 = add nsw i32 %49, %53
  %55 = srem i32 %54, %2
  %56 = icmp slt i32 %55, 0
  %57 = select i1 %56, i32 %2, i32 0
  %spec.select.us = add nsw i32 %57, %55
  br label %58

58:                                               ; preds = %43, %41
  %.2.us = phi i32 [ %.168.us, %41 ], [ %spec.select.us, %43 ]
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %exitcond93.not = icmp eq i64 %indvars.iv.next90, %wide.trip.count92
  br i1 %exitcond93.not, label %._crit_edge71, label %.lr.ph70.split.us, !llvm.loop !12

59:                                               ; preds = %.preheader.us
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %exitcond88.not = icmp eq i64 %indvars.iv.next85, %26
  br i1 %exitcond88.not, label %._crit_edge.us.thread, label %.preheader.us, !llvm.loop !13

.lr.ph70.split:                                   ; preds = %.preheader52.thread, %.lr.ph70
  %.046.lcssa97102 = phi i32 [ %71, %.lr.ph70 ], [ 0, %.preheader52.thread ]
  %.045.lcssa98101 = phi i32 [ %77, %.lr.ph70 ], [ 0, %.preheader52.thread ]
  %60 = phi i32 [ %23, %.lr.ph70 ], [ %24, %.preheader52.thread ]
  %61 = icmp ne i32 %7, 0
  %sext = shl i64 %6, 32
  %62 = ashr exact i64 %sext, 32
  %63 = zext nneg i32 %60 to i64
  %64 = add i64 %4, 1
  %65 = sub i64 %64, %6
  %wide.trip.count82 = and i64 %65, 4294967295
  br label %78

.lr.ph59:                                         ; preds = %.lr.ph59.preheader, %.lr.ph59
  %indvars.iv = phi i64 [ 0, %.lr.ph59.preheader ], [ %indvars.iv.next, %.lr.ph59 ]
  %.04557 = phi i32 [ 0, %.lr.ph59.preheader ], [ %77, %.lr.ph59 ]
  %.04656 = phi i32 [ 0, %.lr.ph59.preheader ], [ %71, %.lr.ph59 ]
  %66 = shl nsw i32 %.04656, 8
  %67 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %indvars.iv)
  %68 = load i8, ptr %67, align 1, !tbaa !9
  %69 = sext i8 %68 to i32
  %70 = add nsw i32 %66, %69
  %71 = srem i32 %70, %2
  %72 = shl nsw i32 %.04557, 8
  %73 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %74 = load i8, ptr %73, align 1, !tbaa !9
  %75 = sext i8 %74 to i32
  %76 = add nsw i32 %72, %75
  %77 = srem i32 %76, %2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond78.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond78.not, label %.preheader52, label %.lr.ph59, !llvm.loop !14

._crit_edge71:                                    ; preds = %102, %58, %.preheader52.thread, %.preheader52
  ret void

78:                                               ; preds = %.lr.ph70.split, %102
  %indvars.iv79 = phi i64 [ 0, %.lr.ph70.split ], [ %indvars.iv.next80, %102 ]
  %.168 = phi i32 [ %.045.lcssa98101, %.lr.ph70.split ], [ %.2, %102 ]
  %79 = icmp ne i32 %.046.lcssa97102, %.168
  %brmerge = or i1 %79, %61
  br i1 %brmerge, label %85, label %80

80:                                               ; preds = %78
  %81 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %82 = trunc nuw nsw i64 %indvars.iv79 to i32
  %83 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %81, i32 noundef %82)
  %84 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %83, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %85

85:                                               ; preds = %78, %80
  %86 = icmp ult i64 %indvars.iv79, %63
  br i1 %86, label %87, label %102

87:                                               ; preds = %85
  %88 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv79)
  %89 = load i8, ptr %88, align 1, !tbaa !9
  %90 = sext i8 %89 to i32
  %91 = mul nsw i32 %.044.lcssa, %90
  %92 = sub nsw i32 %.168, %91
  %93 = shl nsw i32 %92, 8
  %94 = add nsw i64 %indvars.iv79, %62
  %95 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %94)
  %96 = load i8, ptr %95, align 1, !tbaa !9
  %97 = sext i8 %96 to i32
  %98 = add nsw i32 %93, %97
  %99 = srem i32 %98, %2
  %100 = icmp slt i32 %99, 0
  %101 = select i1 %100, i32 %2, i32 0
  %spec.select = add nsw i32 %101, %99
  br label %102

102:                                              ; preds = %87, %85
  %.2 = phi i32 [ %.168, %85 ], [ %spec.select, %87 ]
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %exitcond83.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count82
  br i1 %exitcond83.not, label %._crit_edge71, label %78, !llvm.loop !12
}

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

; 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 #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 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 #2 = { inlinehint 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.unroll.disable"}
!7 = distinct !{!7, !8}
!8 = !{!"llvm.loop.mustprogress"}
!9 = !{!10, !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = distinct !{!12, !8}
!13 = distinct !{!13, !8}
!14 = distinct !{!14, !8}


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