; LLVM IR from next-step-for-interview-prep/Coding-Ninjas-DSA-course_code_and_notes_cpp :: Milestone-2=Intro_to_C++/questions and solutions/Lec-10=Character-arrays_and_2D-arra_2bbb861d (Z11findLargestPPiii)

; 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 [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11findLargestPPiii(ptr noundef %0, i32 noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %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
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = add nsw i32 %19, %20
  %22 = zext i32 %21 to i64
  %23 = call ptr @llvm.stacksave.p0()
  store ptr %23, ptr %7, align 8
  %24 = alloca i32, i64 %22, align 16
  store i64 %22, ptr %8, align 8
  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 -2147483648, 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 -1, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %56, %3
  %26 = load i32, ptr %13, align 4, !tbaa !9
  %27 = load i32, ptr %5, align 4, !tbaa !9
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 2, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %59

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

31:                                               ; preds = %48, %30
  %32 = load i32, ptr %15, align 4, !tbaa !9
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  store i32 5, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %51

36:                                               ; preds = %31
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = load i32, ptr %13, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds ptr, ptr %37, i64 %39
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = load i32, ptr %15, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr %41, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = load i32, ptr %9, align 4, !tbaa !9
  %47 = add nsw i32 %46, %45
  store i32 %47, ptr %9, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %36
  %49 = load i32, ptr %15, align 4, !tbaa !9
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %15, align 4, !tbaa !9
  br label %31, !llvm.loop !11

51:                                               ; preds = %35
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = load i32, ptr %13, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr %24, i64 %54
  store i32 %52, ptr %55, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %51
  %57 = load i32, ptr %13, align 4, !tbaa !9
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %13, align 4, !tbaa !9
  br label %25, !llvm.loop !13

59:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %93, %59
  %61 = load i32, ptr %16, align 4, !tbaa !9
  %62 = load i32, ptr %6, align 4, !tbaa !9
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 8, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %96

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

66:                                               ; preds = %83, %65
  %67 = load i32, ptr %17, align 4, !tbaa !9
  %68 = load i32, ptr %5, align 4, !tbaa !9
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  store i32 11, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %86

71:                                               ; preds = %66
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = load i32, ptr %17, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds ptr, ptr %72, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  %77 = load i32, ptr %16, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i32, ptr %76, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !9
  %81 = load i32, ptr %9, align 4, !tbaa !9
  %82 = add nsw i32 %81, %80
  store i32 %82, ptr %9, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %71
  %84 = load i32, ptr %17, align 4, !tbaa !9
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %17, align 4, !tbaa !9
  br label %66, !llvm.loop !14

86:                                               ; preds = %70
  %87 = load i32, ptr %9, align 4, !tbaa !9
  %88 = load i32, ptr %5, align 4, !tbaa !9
  %89 = load i32, ptr %16, align 4, !tbaa !9
  %90 = add nsw i32 %88, %89
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i32, ptr %24, i64 %91
  store i32 %87, ptr %92, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %93

93:                                               ; preds = %86
  %94 = load i32, ptr %16, align 4, !tbaa !9
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %16, align 4, !tbaa !9
  br label %60, !llvm.loop !15

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

97:                                               ; preds = %127, %96
  %98 = load i32, ptr %18, align 4, !tbaa !9
  %99 = load i32, ptr %6, align 4, !tbaa !9
  %100 = load i32, ptr %5, align 4, !tbaa !9
  %101 = add nsw i32 %99, %100
  %102 = icmp slt i32 %98, %101
  br i1 %102, label %104, label %103

103:                                              ; preds = %97
  store i32 14, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %130

104:                                              ; preds = %97
  %105 = load i32, ptr %18, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds i32, ptr %24, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = load i32, ptr %10, align 4, !tbaa !9
  %110 = icmp sgt i32 %108, %109
  br i1 %110, label %111, label %126

111:                                              ; preds = %104
  %112 = load i32, ptr %18, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds i32, ptr %24, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !9
  store i32 %115, ptr %10, align 4, !tbaa !9
  %116 = load i32, ptr %18, align 4, !tbaa !9
  %117 = load i32, ptr %5, align 4, !tbaa !9
  %118 = icmp sge i32 %116, %117
  br i1 %118, label %119, label %123

119:                                              ; preds = %111
  %120 = load i32, ptr %18, align 4, !tbaa !9
  %121 = load i32, ptr %5, align 4, !tbaa !9
  %122 = sub nsw i32 %120, %121
  store i32 %122, ptr %12, align 4, !tbaa !9
  store i32 -1, ptr %11, align 4, !tbaa !9
  br label %125

123:                                              ; preds = %111
  %124 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %124, ptr %11, align 4, !tbaa !9
  store i32 -1, ptr %12, align 4, !tbaa !9
  br label %125

125:                                              ; preds = %123, %119
  br label %126

126:                                              ; preds = %125, %104
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %18, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %18, align 4, !tbaa !9
  br label %97, !llvm.loop !16

130:                                              ; preds = %103
  %131 = load i32, ptr %12, align 4, !tbaa !9
  %132 = icmp eq i32 %131, -1
  br i1 %132, label %133, label %143

133:                                              ; preds = %130
  %134 = load i32, ptr %11, align 4, !tbaa !9
  %135 = icmp ne i32 %134, -1
  br i1 %135, label %136, label %143

136:                                              ; preds = %133
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %138 = load i32, ptr %11, align 4, !tbaa !9
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %137, i32 noundef %138)
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %139, ptr noundef @.str.1)
  %141 = load i32, ptr %10, align 4, !tbaa !9
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %140, i32 noundef %141)
  br label %163

143:                                              ; preds = %133, %130
  %144 = load i32, ptr %12, align 4, !tbaa !9
  %145 = icmp ne i32 %144, -1
  br i1 %145, label %146, label %156

146:                                              ; preds = %143
  %147 = load i32, ptr %11, align 4, !tbaa !9
  %148 = icmp eq i32 %147, -1
  br i1 %148, label %149, label %156

149:                                              ; preds = %146
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  %151 = load i32, ptr %12, align 4, !tbaa !9
  %152 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %150, i32 noundef %151)
  %153 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %152, ptr noundef @.str.1)
  %154 = load i32, ptr %10, align 4, !tbaa !9
  %155 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %153, i32 noundef %154)
  br label %162

156:                                              ; preds = %146, %143
  %157 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %158 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %157, i32 noundef 0)
  %159 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %158, ptr noundef @.str.1)
  %160 = load i32, ptr %10, align 4, !tbaa !9
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %159, i32 noundef %160)
  br label %162

162:                                              ; preds = %156, %149
  br label %163

163:                                              ; preds = %162, %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  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
  %164 = load ptr, ptr %7, align 8
  call void @llvm.stackrestore.p0(ptr %164)
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #1

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 }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!13, !12}
!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 [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11findLargestPPiii(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = add i32 %2, %1
  %5 = zext i32 %4 to i64
  %6 = alloca i32, i64 %5, align 16
  %7 = icmp sgt i32 %1, 0
  %8 = icmp sgt i32 %2, 0
  br i1 %7, label %.preheader67.lr.ph, label %.preheader66.thread110

.preheader67.lr.ph:                               ; preds = %3
  %wide.trip.count90 = zext nneg i32 %1 to i64
  br i1 %8, label %.preheader67.us.preheader, label %.preheader66.thread

.preheader66.thread:                              ; preds = %.preheader67.lr.ph
  %9 = shl nuw nsw i64 %wide.trip.count90, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %6, i8 0, i64 %9, i1 false), !tbaa !5
  br label %.preheader

.preheader67.us.preheader:                        ; preds = %.preheader67.lr.ph
  %wide.trip.count = zext nneg i32 %2 to i64
  %min.iters.check = icmp ult i32 %2, 8
  %n.vec = and i64 %wide.trip.count, 2147483640
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br label %.preheader67.us

.preheader67.us:                                  ; preds = %.preheader67.us.preheader, %._crit_edge.us
  %indvars.iv87 = phi i64 [ 0, %.preheader67.us.preheader ], [ %indvars.iv.next88, %._crit_edge.us ]
  %10 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv87
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

vector.body:                                      ; preds = %.preheader67.us, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader67.us ]
  %vec.phi = phi <4 x i32> [ %14, %vector.body ], [ zeroinitializer, %.preheader67.us ]
  %vec.phi128 = phi <4 x i32> [ %15, %vector.body ], [ zeroinitializer, %.preheader67.us ]
  %12 = getelementptr inbounds i32, ptr %11, i64 %index
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  %wide.load = load <4 x i32>, ptr %12, align 4, !tbaa !5
  %wide.load129 = load <4 x i32>, ptr %13, align 4, !tbaa !5
  %14 = add <4 x i32> %wide.load, %vec.phi
  %15 = add <4 x i32> %wide.load129, %vec.phi128
  %index.next = add nuw i64 %index, 8
  %16 = icmp eq i64 %index.next, %n.vec
  br i1 %16, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %15, %14
  %17 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  br i1 %cmp.n, label %._crit_edge.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader67.us
  %indvars.iv.ph = phi i64 [ 0, %.preheader67.us ], [ %n.vec, %middle.block ]
  %.16168.us.ph = phi i32 [ 0, %.preheader67.us ], [ %17, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %.16168.us = phi i32 [ %20, %scalar.ph ], [ %.16168.us.ph, %scalar.ph.preheader ]
  %18 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = add nsw i32 %19, %.16168.us
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.us, label %scalar.ph, !llvm.loop !15

._crit_edge.us:                                   ; preds = %scalar.ph, %middle.block
  %.lcssa127 = phi i32 [ %17, %middle.block ], [ %20, %scalar.ph ]
  %21 = getelementptr inbounds i32, ptr %6, i64 %indvars.iv87
  store i32 %.lcssa127, ptr %21, align 4, !tbaa !5
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %exitcond91.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count90
  br i1 %exitcond91.not, label %.preheader65.lr.ph, label %.preheader67.us, !llvm.loop !16

.preheader66.thread110:                           ; preds = %3
  br i1 %8, label %.preheader65.preheader, label %.preheader

.preheader65.lr.ph:                               ; preds = %._crit_edge.us
  br i1 %7, label %.preheader65.us.preheader, label %.preheader65.preheader

.preheader65.preheader:                           ; preds = %.preheader66.thread110, %.preheader65.lr.ph
  %22 = sext i32 %1 to i64
  %23 = shl nsw i64 %22, 2
  %scevgep = getelementptr i8, ptr %6, i64 %23
  %24 = zext nneg i32 %2 to i64
  %25 = shl nuw nsw i64 %24, 2
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep, i8 0, i64 %25, i1 false), !tbaa !5
  br label %.preheader

.preheader65.us.preheader:                        ; preds = %.preheader65.lr.ph
  %26 = zext nneg i32 %1 to i64
  %wide.trip.count103 = zext nneg i32 %2 to i64
  %invariant.gep = getelementptr inbounds i32, ptr %6, i64 %26
  %xtraiter = and i64 %wide.trip.count90, 3
  %27 = icmp ult i32 %1, 4
  %unroll_iter = and i64 %wide.trip.count90, 2147483644
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader65.us

.preheader65.us:                                  ; preds = %.preheader65.us.preheader, %._crit_edge.us74
  %indvars.iv100 = phi i64 [ 0, %.preheader65.us.preheader ], [ %indvars.iv.next101, %._crit_edge.us74 ]
  br i1 %27, label %._crit_edge.us74.unr-lcssa, label %.preheader65.us.new

.preheader65.us.new:                              ; preds = %.preheader65.us, %.preheader65.us.new
  %indvars.iv95 = phi i64 [ %indvars.iv.next96.3, %.preheader65.us.new ], [ 0, %.preheader65.us ]
  %.371.us = phi i32 [ %47, %.preheader65.us.new ], [ 0, %.preheader65.us ]
  %niter = phi i64 [ %niter.next.3, %.preheader65.us.new ], [ 0, %.preheader65.us ]
  %28 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv95
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = getelementptr inbounds i32, ptr %29, i64 %indvars.iv100
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = add nsw i32 %31, %.371.us
  %indvars.iv.next96 = or disjoint i64 %indvars.iv95, 1
  %33 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv.next96
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  %35 = getelementptr inbounds i32, ptr %34, i64 %indvars.iv100
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = add nsw i32 %36, %32
  %indvars.iv.next96.1 = or disjoint i64 %indvars.iv95, 2
  %38 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv.next96.1
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  %40 = getelementptr inbounds i32, ptr %39, i64 %indvars.iv100
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, %37
  %indvars.iv.next96.2 = or disjoint i64 %indvars.iv95, 3
  %43 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv.next96.2
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = getelementptr inbounds i32, ptr %44, i64 %indvars.iv100
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = add nsw i32 %46, %42
  %indvars.iv.next96.3 = add nuw nsw i64 %indvars.iv95, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.us74.unr-lcssa, label %.preheader65.us.new, !llvm.loop !17

._crit_edge.us74.unr-lcssa:                       ; preds = %.preheader65.us.new, %.preheader65.us
  %.lcssa.ph = phi i32 [ poison, %.preheader65.us ], [ %47, %.preheader65.us.new ]
  %indvars.iv95.unr = phi i64 [ 0, %.preheader65.us ], [ %indvars.iv.next96.3, %.preheader65.us.new ]
  %.371.us.unr = phi i32 [ 0, %.preheader65.us ], [ %47, %.preheader65.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us74, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.us74.unr-lcssa, %.epil.preheader
  %indvars.iv95.epil = phi i64 [ %indvars.iv.next96.epil, %.epil.preheader ], [ %indvars.iv95.unr, %._crit_edge.us74.unr-lcssa ]
  %.371.us.epil = phi i32 [ %52, %.epil.preheader ], [ %.371.us.unr, %._crit_edge.us74.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.us74.unr-lcssa ]
  %48 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv95.epil
  %49 = load ptr, ptr %48, align 8, !tbaa !9
  %50 = getelementptr inbounds i32, ptr %49, i64 %indvars.iv100
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, %.371.us.epil
  %indvars.iv.next96.epil = add nuw nsw i64 %indvars.iv95.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge.us74, label %.epil.preheader, !llvm.loop !18

._crit_edge.us74:                                 ; preds = %.epil.preheader, %._crit_edge.us74.unr-lcssa
  %.lcssa = phi i32 [ %.lcssa.ph, %._crit_edge.us74.unr-lcssa ], [ %52, %.epil.preheader ]
  %gep = getelementptr inbounds i32, ptr %invariant.gep, i64 %indvars.iv100
  store i32 %.lcssa, ptr %gep, align 4, !tbaa !5
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %exitcond104.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count103
  br i1 %exitcond104.not, label %.preheader, label %.preheader65.us, !llvm.loop !20

.preheader:                                       ; preds = %._crit_edge.us74, %.preheader66.thread110, %.preheader66.thread, %.preheader65.preheader
  %53 = icmp sgt i32 %4, 0
  br i1 %53, label %.lr.ph.preheader, label %.thread

.lr.ph.preheader:                                 ; preds = %.preheader
  %54 = sext i32 %1 to i64
  %xtraiter134 = and i64 %5, 1
  %55 = icmp eq i32 %4, 1
  br i1 %55, label %._crit_edge.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter140 = and i64 %5, 2147483646
  br label %.lr.ph

._crit_edge.unr-lcssa:                            ; preds = %.lr.ph, %.lr.ph.preheader
  %.159.lcssa.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %.159.1, %.lr.ph ]
  %.157.lcssa.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %.157.1, %.lr.ph ]
  %.1.lcssa.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %.1.1, %.lr.ph ]
  %indvars.iv105.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next106.1, %.lr.ph ]
  %.05578.unr = phi i32 [ -1, %.lr.ph.preheader ], [ %.1.1, %.lr.ph ]
  %.05677.unr = phi i32 [ -1, %.lr.ph.preheader ], [ %.157.1, %.lr.ph ]
  %.05876.unr = phi i32 [ -2147483648, %.lr.ph.preheader ], [ %.159.1, %.lr.ph ]
  %lcmp.mod136.not = icmp eq i64 %xtraiter134, 0
  br i1 %lcmp.mod136.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.unr-lcssa
  %56 = getelementptr inbounds i32, ptr %6, i64 %indvars.iv105.unr
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = icmp sgt i32 %57, %.05876.unr
  %.not.epil = icmp slt i64 %indvars.iv105.unr, %54
  %59 = trunc nuw nsw i64 %indvars.iv105.unr to i32
  %spec.select.epil = select i1 %.not.epil, i32 %59, i32 -1
  %60 = trunc i64 %indvars.iv105.unr to i32
  %61 = sub i32 %60, %1
  %spec.select64.epil = select i1 %.not.epil, i32 -1, i32 %61
  %.159.epil = tail call i32 @llvm.smax.i32(i32 %57, i32 %.05876.unr)
  %.157.epil = select i1 %58, i32 %spec.select.epil, i32 %.05677.unr
  %.1.epil = select i1 %58, i32 %spec.select64.epil, i32 %.05578.unr
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.unr-lcssa, %.lr.ph.epil
  %.159.lcssa = phi i32 [ %.159.lcssa.ph, %._crit_edge.unr-lcssa ], [ %.159.epil, %.lr.ph.epil ]
  %.157.lcssa = phi i32 [ %.157.lcssa.ph, %._crit_edge.unr-lcssa ], [ %.157.epil, %.lr.ph.epil ]
  %.1.lcssa = phi i32 [ %.1.lcssa.ph, %._crit_edge.unr-lcssa ], [ %.1.epil, %.lr.ph.epil ]
  %62 = icmp eq i32 %.1.lcssa, -1
  %63 = icmp ne i32 %.157.lcssa, -1
  %or.cond = select i1 %62, i1 %63, i1 false
  br i1 %or.cond, label %.thread, label %76

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv105 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next106.1, %.lr.ph ]
  %.05578 = phi i32 [ -1, %.lr.ph.preheader.new ], [ %.1.1, %.lr.ph ]
  %.05677 = phi i32 [ -1, %.lr.ph.preheader.new ], [ %.157.1, %.lr.ph ]
  %.05876 = phi i32 [ -2147483648, %.lr.ph.preheader.new ], [ %.159.1, %.lr.ph ]
  %niter141 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter141.next.1, %.lr.ph ]
  %64 = getelementptr inbounds i32, ptr %6, i64 %indvars.iv105
  %65 = load i32, ptr %64, align 8, !tbaa !5
  %66 = icmp sgt i32 %65, %.05876
  %.not = icmp slt i64 %indvars.iv105, %54
  %67 = trunc nuw nsw i64 %indvars.iv105 to i32
  %spec.select = select i1 %.not, i32 %67, i32 -1
  %68 = trunc i64 %indvars.iv105 to i32
  %69 = sub i32 %68, %1
  %spec.select64 = select i1 %.not, i32 -1, i32 %69
  %.159 = tail call i32 @llvm.smax.i32(i32 %65, i32 %.05876)
  %.157 = select i1 %66, i32 %spec.select, i32 %.05677
  %.1 = select i1 %66, i32 %spec.select64, i32 %.05578
  %indvars.iv.next106 = or disjoint i64 %indvars.iv105, 1
  %70 = getelementptr inbounds i32, ptr %6, i64 %indvars.iv.next106
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = icmp sgt i32 %71, %.159
  %.not.1 = icmp slt i64 %indvars.iv.next106, %54
  %73 = trunc nuw nsw i64 %indvars.iv.next106 to i32
  %spec.select.1 = select i1 %.not.1, i32 %73, i32 -1
  %74 = trunc i64 %indvars.iv.next106 to i32
  %75 = sub i32 %74, %1
  %spec.select64.1 = select i1 %.not.1, i32 -1, i32 %75
  %.159.1 = tail call i32 @llvm.smax.i32(i32 %71, i32 %.159)
  %.157.1 = select i1 %72, i32 %spec.select.1, i32 %.157
  %.1.1 = select i1 %72, i32 %spec.select64.1, i32 %.1
  %indvars.iv.next106.1 = add nuw nsw i64 %indvars.iv105, 2
  %niter141.next.1 = add i64 %niter141, 2
  %niter141.ncmp.1 = icmp eq i64 %niter141.next.1, %unroll_iter140
  br i1 %niter141.ncmp.1, label %._crit_edge.unr-lcssa, label %.lr.ph, !llvm.loop !21

76:                                               ; preds = %._crit_edge
  %77 = icmp ne i32 %.1.lcssa, -1
  %78 = icmp eq i32 %.157.lcssa, -1
  %or.cond3 = select i1 %77, i1 %78, i1 false
  %spec.select125 = select i1 %or.cond3, ptr @.str.2, ptr @.str
  %spec.select126 = select i1 %or.cond3, i32 %.1.lcssa, i32 0
  br label %.thread

.thread:                                          ; preds = %76, %.preheader, %._crit_edge
  %.str.2.sink = phi ptr [ @.str, %._crit_edge ], [ @.str, %.preheader ], [ %spec.select125, %76 ]
  %.1.lcssa.sink = phi i32 [ %.157.lcssa, %._crit_edge ], [ 0, %.preheader ], [ %spec.select126, %76 ]
  %.159.lcssa.sink = phi i32 [ %.159.lcssa, %._crit_edge ], [ -2147483648, %.preheader ], [ %.159.lcssa, %76 ]
  %79 = 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.2.sink)
  %80 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %79, i32 noundef %.1.lcssa.sink)
  %81 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef nonnull @.str.1)
  %82 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %81, i32 noundef %.159.lcssa.sink)
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #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 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}


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