; LLVM IR from sbshah97/DS-Algo-Handbook :: Algorithms/Graph_Algorithms/Floyd_Warshall/Floyd-Warshall.ll (Z2FWv)

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

@v = external dso_local global i32, align 4
@graph = external dso_local global [50 x [50 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [59 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2FWv() #0 {
  %1 = alloca ptr, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %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 = load i32, ptr @v, align 4, !tbaa !5
  %13 = zext i32 %12 to i64
  %14 = load i32, ptr @v, align 4, !tbaa !5
  %15 = zext i32 %14 to i64
  %16 = call ptr @llvm.stacksave.p0()
  store ptr %16, ptr %1, align 8
  %17 = mul nuw i64 %13, %15
  %18 = alloca i32, i64 %17, align 16
  store i64 %13, ptr %2, align 8
  store i64 %15, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %49, %0
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = load i32, ptr @v, align 4, !tbaa !5
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %52

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

25:                                               ; preds = %45, %24
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = load i32, ptr @v, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

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

30:                                               ; preds = %25
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [50 x [50 x i32]], ptr @graph, i64 0, i64 %32
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [50 x i32], ptr %33, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = mul nsw i64 %39, %15
  %41 = getelementptr inbounds i32, ptr %18, i64 %40
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr %41, i64 %43
  store i32 %37, ptr %44, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %30
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %6, align 4, !tbaa !5
  br label %25, !llvm.loop !9

48:                                               ; preds = %29
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %4, align 4, !tbaa !5
  br label %19, !llvm.loop !11

52:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %131, %52
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = load i32, ptr @v, align 4, !tbaa !5
  %56 = icmp slt i32 %54, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %134

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

59:                                               ; preds = %127, %58
  %60 = load i32, ptr %8, align 4, !tbaa !5
  %61 = load i32, ptr @v, align 4, !tbaa !5
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %130

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

65:                                               ; preds = %123, %64
  %66 = load i32, ptr %9, align 4, !tbaa !5
  %67 = load i32, ptr @v, align 4, !tbaa !5
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %70, label %69

69:                                               ; preds = %65
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %126

70:                                               ; preds = %65
  %71 = load i32, ptr %8, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = mul nsw i64 %72, %15
  %74 = getelementptr inbounds i32, ptr %18, i64 %73
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i32, ptr %74, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = mul nsw i64 %80, %15
  %82 = getelementptr inbounds i32, ptr %18, i64 %81
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i32, ptr %82, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = add nsw i32 %78, %86
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = mul nsw i64 %89, %15
  %91 = getelementptr inbounds i32, ptr %18, i64 %90
  %92 = load i32, ptr %9, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds i32, ptr %91, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = icmp slt i32 %87, %95
  br i1 %96, label %97, label %122

97:                                               ; preds = %70
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = mul nsw i64 %99, %15
  %101 = getelementptr inbounds i32, ptr %18, i64 %100
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds i32, ptr %101, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = mul nsw i64 %107, %15
  %109 = getelementptr inbounds i32, ptr %18, i64 %108
  %110 = load i32, ptr %9, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds i32, ptr %109, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = add nsw i32 %105, %113
  %115 = load i32, ptr %8, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = mul nsw i64 %116, %15
  %118 = getelementptr inbounds i32, ptr %18, i64 %117
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds i32, ptr %118, i64 %120
  store i32 %114, ptr %121, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %97, %70
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %9, align 4, !tbaa !5
  br label %65, !llvm.loop !12

126:                                              ; preds = %69
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %8, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %8, align 4, !tbaa !5
  br label %59, !llvm.loop !13

130:                                              ; preds = %63
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %7, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %7, align 4, !tbaa !5
  br label %53, !llvm.loop !14

134:                                              ; preds = %57
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %176, %134
  %137 = load i32, ptr %10, align 4, !tbaa !5
  %138 = load i32, ptr @v, align 4, !tbaa !5
  %139 = icmp slt i32 %137, %138
  br i1 %139, label %141, label %140

140:                                              ; preds = %136
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %179

141:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %171, %141
  %143 = load i32, ptr %11, align 4, !tbaa !5
  %144 = load i32, ptr @v, align 4, !tbaa !5
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 20, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %174

147:                                              ; preds = %142
  %148 = load i32, ptr %10, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = mul nsw i64 %149, %15
  %151 = getelementptr inbounds i32, ptr %18, i64 %150
  %152 = load i32, ptr %11, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds i32, ptr %151, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = icmp eq i32 %155, 9999
  br i1 %156, label %157, label %159

157:                                              ; preds = %147
  %158 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  br label %170

159:                                              ; preds = %147
  %160 = load i32, ptr %10, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = mul nsw i64 %161, %15
  %163 = getelementptr inbounds i32, ptr %18, i64 %162
  %164 = load i32, ptr %11, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds i32, ptr %163, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %167)
  %169 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %168, ptr noundef @.str.2)
  br label %170

170:                                              ; preds = %159, %157
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %11, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %11, align 4, !tbaa !5
  br label %142, !llvm.loop !15

174:                                              ; preds = %146
  %175 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %176

176:                                              ; preds = %174
  %177 = load i32, ptr %10, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %10, align 4, !tbaa !5
  br label %136, !llvm.loop !16

179:                                              ; preds = %140
  %180 = load ptr, ptr %1, align 8
  call void @llvm.stackrestore.p0(ptr %180)
  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: 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

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


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

@v = external dso_local local_unnamed_addr global i32, align 4
@graph = external dso_local local_unnamed_addr global [50 x [50 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [59 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z2FWv() local_unnamed_addr #0 {
  %1 = load i32, ptr @v, align 4, !tbaa !5
  %2 = zext i32 %1 to i64
  %3 = mul nuw i64 %2, %2
  %4 = alloca i32, i64 %3, align 16
  %5 = icmp sgt i32 %1, 0
  br i1 %5, label %.preheader45.us.preheader, label %._crit_edge

.preheader45.us.preheader:                        ; preds = %0
  %6 = shl nuw nsw i64 %2, 2
  %xtraiter = and i64 %2, 1
  %7 = icmp eq i32 %1, 1
  br i1 %7, label %.preheader44.unr-lcssa, label %.preheader45.us.preheader.new

.preheader45.us.preheader.new:                    ; preds = %.preheader45.us.preheader
  %unroll_iter = and i64 %2, 2147483646
  br label %.preheader45.us

.preheader45.us:                                  ; preds = %.preheader45.us, %.preheader45.us.preheader.new
  %indvar = phi i64 [ 0, %.preheader45.us.preheader.new ], [ %indvar.next.1, %.preheader45.us ]
  %niter = phi i64 [ 0, %.preheader45.us.preheader.new ], [ %niter.next.1, %.preheader45.us ]
  %8 = mul nuw nsw i64 %6, %indvar
  %scevgep = getelementptr i8, ptr %4, i64 %8
  %9 = mul nuw nsw i64 %indvar, 200
  %scevgep57 = getelementptr i8, ptr @graph, i64 %9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %scevgep, ptr align 16 %scevgep57, i64 %6, i1 false), !tbaa !5
  %indvar.next = or disjoint i64 %indvar, 1
  %10 = mul nuw nsw i64 %6, %indvar.next
  %scevgep.1 = getelementptr i8, ptr %4, i64 %10
  %11 = mul nuw nsw i64 %indvar.next, 200
  %scevgep57.1 = getelementptr i8, ptr @graph, i64 %11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep.1, ptr align 8 %scevgep57.1, i64 %6, i1 false), !tbaa !5
  %indvar.next.1 = add nuw nsw i64 %indvar, 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 %.preheader44.unr-lcssa, label %.preheader45.us, !llvm.loop !9

.preheader44.unr-lcssa:                           ; preds = %.preheader45.us, %.preheader45.us.preheader
  %indvar.unr = phi i64 [ 0, %.preheader45.us.preheader ], [ %indvar.next.1, %.preheader45.us ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader44, label %.preheader45.us.epil

.preheader45.us.epil:                             ; preds = %.preheader44.unr-lcssa
  %12 = mul nuw nsw i64 %6, %indvar.unr
  %scevgep.epil = getelementptr i8, ptr %4, i64 %12
  %13 = mul nuw nsw i64 %indvar.unr, 200
  %scevgep57.epil = getelementptr i8, ptr @graph, i64 %13
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %scevgep.epil, ptr align 8 %scevgep57.epil, i64 %6, i1 false), !tbaa !5
  br label %.preheader44

.preheader44:                                     ; preds = %.preheader44.unr-lcssa, %.preheader45.us.epil
  br i1 %5, label %.preheader43.us.preheader, label %._crit_edge

.preheader43.us.preheader:                        ; preds = %.preheader44
  %14 = mul nuw nsw i64 %2, %2
  %15 = shl nuw i64 %14, 2
  %scevgep79 = getelementptr i8, ptr %4, i64 %15
  %16 = add nuw nsw i64 %2, 4611686018427387903
  %17 = mul i64 %16, %2
  %18 = shl i64 %17, 2
  %19 = shl nuw nsw i64 %2, 2
  %20 = shl nuw nsw i64 %2, 2
  %21 = getelementptr i8, ptr %4, i64 %18
  %22 = getelementptr i8, ptr %21, i64 4
  %23 = getelementptr i8, ptr %4, i64 %20
  %min.iters.check = icmp ult i32 %1, 8
  %n.vec = and i64 %2, 2147483640
  %cmp.n = icmp eq i64 %n.vec, %2
  %xtraiter92 = and i64 %2, 1
  %lcmp.mod93.not = icmp eq i64 %xtraiter92, 0
  %24 = add nsw i64 %2, -1
  br label %.preheader43.us

.preheader43.us:                                  ; preds = %.preheader43.us.preheader, %._crit_edge50.split.us.us
  %indvars.iv68 = phi i64 [ %indvars.iv.next69, %._crit_edge50.split.us.us ], [ 0, %.preheader43.us.preheader ]
  %25 = shl nuw nsw i64 %indvars.iv68, 2
  %scevgep80 = getelementptr i8, ptr %4, i64 %25
  %scevgep81 = getelementptr i8, ptr %22, i64 %25
  %26 = mul i64 %19, %indvars.iv68
  %scevgep82 = getelementptr i8, ptr %4, i64 %26
  %scevgep83 = getelementptr i8, ptr %23, i64 %26
  %27 = mul nuw nsw i64 %indvars.iv68, %2
  %28 = getelementptr inbounds i32, ptr %4, i64 %27
  %bound0 = icmp ult ptr %4, %scevgep81
  %bound1 = icmp ult ptr %scevgep80, %scevgep79
  %found.conflict = and i1 %bound0, %bound1
  %bound084 = icmp ult ptr %4, %scevgep83
  %bound185 = icmp ult ptr %scevgep82, %scevgep79
  %found.conflict86 = and i1 %bound084, %bound185
  %conflict.rdx = or i1 %found.conflict, %found.conflict86
  br label %.preheader42.us.us

.preheader42.us.us:                               ; preds = %._crit_edge.us51.us, %.preheader43.us
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %._crit_edge.us51.us ], [ 0, %.preheader43.us ]
  %29 = mul nuw nsw i64 %indvars.iv63, %2
  %30 = getelementptr inbounds i32, ptr %4, i64 %29
  %31 = getelementptr inbounds i32, ptr %30, i64 %indvars.iv68
  %brmerge = select i1 %min.iters.check, i1 true, i1 %conflict.rdx
  br i1 %brmerge, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.preheader42.us.us
  %32 = load i32, ptr %31, align 4, !tbaa !5, !alias.scope !11
  %broadcast.splatinsert88 = insertelement <4 x i32> poison, i32 %32, i64 0
  %broadcast.splat89 = shufflevector <4 x i32> %broadcast.splatinsert88, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %33 = getelementptr inbounds i32, ptr %28, i64 %index
  %34 = getelementptr inbounds i8, ptr %33, i64 16
  %wide.load = load <4 x i32>, ptr %33, align 4, !tbaa !5, !alias.scope !14
  %wide.load87 = load <4 x i32>, ptr %34, align 4, !tbaa !5, !alias.scope !14
  %35 = add nsw <4 x i32> %wide.load, %broadcast.splat89
  %36 = add nsw <4 x i32> %wide.load87, %broadcast.splat89
  %37 = getelementptr inbounds i32, ptr %30, i64 %index
  %38 = getelementptr inbounds i8, ptr %37, i64 16
  %wide.load90 = load <4 x i32>, ptr %37, align 4, !tbaa !5, !alias.scope !16, !noalias !18
  %wide.load91 = load <4 x i32>, ptr %38, align 4, !tbaa !5, !alias.scope !16, !noalias !18
  %39 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %35, <4 x i32> %wide.load90)
  %40 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %36, <4 x i32> %wide.load91)
  store <4 x i32> %39, ptr %37, align 4, !alias.scope !16, !noalias !18
  store <4 x i32> %40, ptr %38, align 4, !alias.scope !16, !noalias !18
  %index.next = add nuw i64 %index, 8
  %41 = icmp eq i64 %index.next, %n.vec
  br i1 %41, label %middle.block, label %vector.body, !llvm.loop !19

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge.us51.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.preheader42.us.us, %middle.block
  %indvars.iv.ph = phi i64 [ 0, %.preheader42.us.us ], [ %n.vec, %middle.block ]
  br i1 %lcmp.mod93.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader
  %42 = load i32, ptr %31, align 4, !tbaa !5
  %43 = getelementptr inbounds i32, ptr %28, i64 %indvars.iv.ph
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = add nsw i32 %44, %42
  %46 = getelementptr inbounds i32, ptr %30, i64 %indvars.iv.ph
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %spec.store.select.us.us.prol = tail call i32 @llvm.smin.i32(i32 %45, i32 %47)
  store i32 %spec.store.select.us.us.prol, ptr %46, align 4
  %indvars.iv.next.prol = or disjoint i64 %indvars.iv.ph, 1
  br label %scalar.ph.prol.loopexit

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %scalar.ph.preheader ], [ %indvars.iv.next.prol, %scalar.ph.prol ]
  %48 = icmp eq i64 %indvars.iv.ph, %24
  br i1 %48, label %._crit_edge.us51.us, label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %scalar.ph ], [ %indvars.iv.unr, %scalar.ph.prol.loopexit ]
  %49 = load i32, ptr %31, align 4, !tbaa !5
  %50 = getelementptr inbounds i32, ptr %28, i64 %indvars.iv
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, %49
  %53 = getelementptr inbounds i32, ptr %30, i64 %indvars.iv
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %spec.store.select.us.us = tail call i32 @llvm.smin.i32(i32 %52, i32 %54)
  store i32 %spec.store.select.us.us, ptr %53, align 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %55 = load i32, ptr %31, align 4, !tbaa !5
  %56 = getelementptr inbounds i32, ptr %28, i64 %indvars.iv.next
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add nsw i32 %57, %55
  %59 = getelementptr inbounds i32, ptr %30, i64 %indvars.iv.next
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %spec.store.select.us.us.1 = tail call i32 @llvm.smin.i32(i32 %58, i32 %60)
  store i32 %spec.store.select.us.us.1, ptr %59, align 4
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond62.not.1 = icmp eq i64 %indvars.iv.next.1, %2
  br i1 %exitcond62.not.1, label %._crit_edge.us51.us, label %scalar.ph, !llvm.loop !22

._crit_edge.us51.us:                              ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %exitcond67.not = icmp eq i64 %indvars.iv.next64, %2
  br i1 %exitcond67.not, label %._crit_edge50.split.us.us, label %.preheader42.us.us, !llvm.loop !23

._crit_edge50.split.us.us:                        ; preds = %._crit_edge.us51.us
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %exitcond72.not = icmp eq i64 %indvars.iv.next69, %2
  br i1 %exitcond72.not, label %._crit_edge, label %.preheader43.us, !llvm.loop !24

._crit_edge:                                      ; preds = %._crit_edge50.split.us.us, %0, %.preheader44
  %61 = 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)
  %62 = load i32, ptr @v, align 4, !tbaa !5
  %63 = icmp sgt i32 %62, 0
  br i1 %63, label %.preheader, label %._crit_edge56

.preheader:                                       ; preds = %._crit_edge, %._crit_edge54
  %64 = phi i32 [ %69, %._crit_edge54 ], [ %62, %._crit_edge ]
  %indvars.iv76 = phi i64 [ %indvars.iv.next77, %._crit_edge54 ], [ 0, %._crit_edge ]
  %65 = icmp sgt i32 %64, 0
  br i1 %65, label %.lr.ph, label %._crit_edge54

.lr.ph:                                           ; preds = %.preheader
  %66 = mul nuw nsw i64 %indvars.iv76, %2
  %67 = getelementptr inbounds i32, ptr %4, i64 %66
  br label %72

._crit_edge56:                                    ; preds = %._crit_edge54, %._crit_edge
  ret void

._crit_edge54:                                    ; preds = %81, %.preheader
  %68 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %69 = load i32, ptr @v, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = icmp slt i64 %indvars.iv.next77, %70
  br i1 %71, label %.preheader, label %._crit_edge56, !llvm.loop !25

72:                                               ; preds = %.lr.ph, %81
  %indvars.iv73 = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next74, %81 ]
  %73 = getelementptr inbounds i32, ptr %67, i64 %indvars.iv73
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = icmp eq i32 %74, 9999
  br i1 %75, label %76, label %78

76:                                               ; preds = %72
  %77 = 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.1)
  br label %81

78:                                               ; preds = %72
  %79 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %74)
  %80 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %79, ptr noundef nonnull @.str.2)
  br label %81

81:                                               ; preds = %76, %78
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %82 = load i32, ptr @v, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = icmp slt i64 %indvars.iv.next74, %83
  br i1 %84, label %72, label %._crit_edge54, !llvm.loop !26
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <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: readwrite) }

!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 = !{!12}
!12 = distinct !{!12, !13}
!13 = distinct !{!13, !"LVerDomain"}
!14 = !{!15}
!15 = distinct !{!15, !13}
!16 = !{!17}
!17 = distinct !{!17, !13}
!18 = !{!12, !15}
!19 = distinct !{!19, !10, !20, !21}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = !{!"llvm.loop.unroll.runtime.disable"}
!22 = distinct !{!22, !10, !20}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}


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