; LLVM IR from ritikbanger/Hacktoberfest2022-DSA :: 07. Matrix (sum_of_rows_column_of_an_array)

; 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_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %14 = load i32, ptr %3, align 4, !tbaa !5
  %15 = zext i32 %14 to i64
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = zext i32 %16 to i64
  %18 = call ptr @llvm.stacksave.p0()
  store ptr %18, ptr %8, align 8
  %19 = mul nuw i64 %15, %17
  %20 = alloca i32, i64 %19, align 16
  store i64 %15, ptr %9, align 8
  store i64 %17, ptr %10, align 8
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = add nsw i32 %21, %22
  %24 = zext i32 %23 to i64
  %25 = alloca i32, i64 %24, align 16
  store i64 %24, ptr %11, align 8
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %63, %0
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %30, label %66

30:                                               ; preds = %26
  store i32 0, ptr %6, align 4, !tbaa !5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %54, %30
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %35, label %57

35:                                               ; preds = %31
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = mul nsw i64 %37, %17
  %39 = getelementptr inbounds i32, ptr %20, i64 %38
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds i32, ptr %39, i64 %41
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %42)
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = mul nsw i64 %45, %17
  %47 = getelementptr inbounds i32, ptr %20, i64 %46
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr %47, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = add nsw i32 %52, %51
  store i32 %53, ptr %6, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %35
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %5, align 4, !tbaa !5
  br label %31, !llvm.loop !9

57:                                               ; preds = %31
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = load i32, ptr %7, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %7, align 4, !tbaa !5
  %61 = sext i32 %59 to i64
  %62 = getelementptr inbounds i32, ptr %25, i64 %61
  store i32 %58, ptr %62, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %57
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %4, align 4, !tbaa !5
  br label %26, !llvm.loop !11

66:                                               ; preds = %26
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %96, %66
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = load i32, ptr %2, align 4, !tbaa !5
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %71, label %99

71:                                               ; preds = %67
  store i32 0, ptr %6, align 4, !tbaa !5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %87, %71
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = icmp slt i32 %73, %74
  br i1 %75, label %76, label %90

76:                                               ; preds = %72
  %77 = load i32, ptr %5, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = mul nsw i64 %78, %17
  %80 = getelementptr inbounds i32, ptr %20, i64 %79
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i32, ptr %80, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = add nsw i32 %85, %84
  store i32 %86, ptr %6, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %76
  %88 = load i32, ptr %5, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %5, align 4, !tbaa !5
  br label %72, !llvm.loop !12

90:                                               ; preds = %72
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %7, align 4, !tbaa !5
  %94 = sext i32 %92 to i64
  %95 = getelementptr inbounds i32, ptr %25, i64 %94
  store i32 %91, ptr %95, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %90
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %4, align 4, !tbaa !5
  br label %67, !llvm.loop !13

99:                                               ; preds = %67
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %116, %99
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = load i32, ptr %3, align 4, !tbaa !5
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %104, label %119

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 %4, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %105, i32 noundef %107)
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %108, ptr noundef @.str.1)
  %110 = load i32, ptr %4, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds i32, ptr %25, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %109, i32 noundef %113)
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %114, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %116

116:                                              ; preds = %104
  %117 = load i32, ptr %4, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %4, align 4, !tbaa !5
  br label %100, !llvm.loop !14

119:                                              ; preds = %100
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %138, %119
  %121 = load i32, ptr %4, align 4, !tbaa !5
  %122 = load i32, ptr %3, align 4, !tbaa !5
  %123 = load i32, ptr %2, align 4, !tbaa !5
  %124 = add nsw i32 %122, %123
  %125 = icmp slt i32 %121, %124
  br i1 %125, label %126, label %141

126:                                              ; preds = %120
  %127 = 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)
  %128 = load i32, ptr %7, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %7, align 4, !tbaa !5
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %127, i32 noundef %128)
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %130, ptr noundef @.str.1)
  %132 = load i32, ptr %4, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds i32, ptr %25, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %131, i32 noundef %135)
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %136, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %138

138:                                              ; preds = %126
  %139 = load i32, ptr %4, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %4, align 4, !tbaa !5
  br label %120, !llvm.loop !15

141:                                              ; preds = %120
  store i32 0, ptr %1, align 4
  %142 = load ptr, ptr %8, align 8
  call void @llvm.stackrestore.p0(ptr %142)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %143 = load i32, ptr %1, align 4
  ret i32 %143
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5 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)) #4

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

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

attributes #0 = { mustprogress norecurse 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 #5 = { 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 #6 = { 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}


; 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_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %3 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %5 = load i32, ptr %2, align 4, !tbaa !5
  %6 = zext i32 %5 to i64
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %8 = zext i32 %7 to i64
  %9 = call ptr @llvm.stacksave.p0()
  %10 = mul nuw i64 %8, %6
  %11 = alloca i32, i64 %10, align 16
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = add nsw i32 %13, %12
  %15 = zext i32 %14 to i64
  %16 = alloca i32, i64 %15, align 16
  %17 = icmp sgt i32 %12, 0
  br i1 %17, label %.preheader39.lr.ph, label %.preheader38

.preheader39.lr.ph:                               ; preds = %0
  %18 = icmp sgt i32 %13, 0
  br i1 %18, label %.preheader39, label %.preheader36.thread

.preheader36.thread:                              ; preds = %.preheader39.lr.ph
  %19 = zext nneg i32 %12 to i64
  %20 = shl nuw nsw i64 %19, 2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %16, i8 0, i64 %20, i1 false), !tbaa !5
  br label %.lr.ph55.preheader

.preheader39:                                     ; preds = %.preheader39.lr.ph, %._crit_edge
  %21 = phi i32 [ %66, %._crit_edge ], [ %12, %.preheader39.lr.ph ]
  %22 = phi i32 [ %67, %._crit_edge ], [ %13, %.preheader39.lr.ph ]
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %._crit_edge ], [ 0, %.preheader39.lr.ph ]
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader39
  %24 = mul nuw nsw i64 %indvars.iv74, %8
  %25 = getelementptr inbounds i32, ptr %11, i64 %24
  br label %58

.preheader38.loopexit:                            ; preds = %._crit_edge
  %26 = and i64 %indvars.iv.next75, 4294967295
  br label %.preheader38

.preheader38:                                     ; preds = %.preheader38.loopexit, %0
  %27 = phi i32 [ %13, %0 ], [ %67, %.preheader38.loopexit ]
  %.033.lcssa = phi i64 [ 0, %0 ], [ %26, %.preheader38.loopexit ]
  %28 = phi i32 [ %12, %0 ], [ %66, %.preheader38.loopexit ]
  %29 = icmp sgt i32 %27, 0
  br i1 %29, label %.preheader37.lr.ph, label %.preheader36

.preheader37.lr.ph:                               ; preds = %.preheader38
  %30 = icmp sgt i32 %28, 0
  br i1 %30, label %.preheader37.us.preheader, label %.preheader36.thread103

.preheader36.thread103:                           ; preds = %.preheader37.lr.ph
  %31 = shl nuw nsw i64 %.033.lcssa, 2
  %scevgep = getelementptr i8, ptr %16, i64 %31
  %32 = zext nneg i32 %27 to i64
  %33 = shl nuw nsw i64 %32, 2
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep, i8 0, i64 %33, i1 false), !tbaa !5
  br label %.preheader

.preheader37.us.preheader:                        ; preds = %.preheader37.lr.ph
  %wide.trip.count93 = zext nneg i32 %27 to i64
  %wide.trip.count85 = zext nneg i32 %28 to i64
  %min.iters.check = icmp ugt i32 %28, 7
  %ident.check.not = icmp eq i32 %7, 1
  %or.cond = select i1 %min.iters.check, i1 %ident.check.not, i1 false
  %n.vec = and i64 %wide.trip.count85, 2147483640
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count85
  %xtraiter = and i64 %wide.trip.count85, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader37.us

.preheader37.us:                                  ; preds = %.preheader37.us.preheader, %._crit_edge50.us
  %indvars.iv88 = phi i64 [ %.033.lcssa, %.preheader37.us.preheader ], [ %indvars.iv.next89, %._crit_edge50.us ]
  %indvars.iv86 = phi i64 [ 0, %.preheader37.us.preheader ], [ %indvars.iv.next87, %._crit_edge50.us ]
  %invariant.gep.us = getelementptr inbounds i32, ptr %11, i64 %indvars.iv86
  br i1 %or.cond, label %vector.body, label %scalar.ph.preheader

vector.body:                                      ; preds = %.preheader37.us, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader37.us ]
  %vec.phi = phi <4 x i32> [ %36, %vector.body ], [ zeroinitializer, %.preheader37.us ]
  %vec.phi116 = phi <4 x i32> [ %37, %vector.body ], [ zeroinitializer, %.preheader37.us ]
  %34 = getelementptr inbounds i32, ptr %invariant.gep.us, i64 %index
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  %wide.load = load <4 x i32>, ptr %34, align 4, !tbaa !5
  %wide.load117 = load <4 x i32>, ptr %35, align 4, !tbaa !5
  %36 = add <4 x i32> %wide.load, %vec.phi
  %37 = add <4 x i32> %wide.load117, %vec.phi116
  %index.next = add nuw i64 %index, 8
  %38 = icmp eq i64 %index.next, %n.vec
  br i1 %38, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %37, %36
  %39 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  br i1 %cmp.n, label %._crit_edge50.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader37.us
  %indvars.iv82.ph = phi i64 [ 0, %.preheader37.us ], [ %n.vec, %middle.block ]
  %.13247.us.ph = phi i32 [ 0, %.preheader37.us ], [ %39, %middle.block ]
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %indvars.iv82.prol = phi i64 [ %indvars.iv.next83.prol, %scalar.ph.prol ], [ %indvars.iv82.ph, %scalar.ph.preheader ]
  %.13247.us.prol = phi i32 [ %42, %scalar.ph.prol ], [ %.13247.us.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %40 = mul nuw nsw i64 %indvars.iv82.prol, %8
  %gep.us.prol = getelementptr inbounds i32, ptr %invariant.gep.us, i64 %40
  %41 = load i32, ptr %gep.us.prol, align 4, !tbaa !5
  %42 = add nsw i32 %41, %.13247.us.prol
  %indvars.iv.next83.prol = add nuw nsw i64 %indvars.iv82.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !13

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %.lcssa121.unr = phi i32 [ poison, %scalar.ph.preheader ], [ %42, %scalar.ph.prol ]
  %indvars.iv82.unr = phi i64 [ %indvars.iv82.ph, %scalar.ph.preheader ], [ %indvars.iv.next83.prol, %scalar.ph.prol ]
  %.13247.us.unr = phi i32 [ %.13247.us.ph, %scalar.ph.preheader ], [ %42, %scalar.ph.prol ]
  %43 = sub nsw i64 %indvars.iv82.ph, %wide.trip.count85
  %44 = icmp ugt i64 %43, -4
  br i1 %44, label %._crit_edge50.us, label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv82 = phi i64 [ %indvars.iv.next83.3, %scalar.ph ], [ %indvars.iv82.unr, %scalar.ph.prol.loopexit ]
  %.13247.us = phi i32 [ %56, %scalar.ph ], [ %.13247.us.unr, %scalar.ph.prol.loopexit ]
  %45 = mul nuw nsw i64 %indvars.iv82, %8
  %gep.us = getelementptr inbounds i32, ptr %invariant.gep.us, i64 %45
  %46 = load i32, ptr %gep.us, align 4, !tbaa !5
  %47 = add nsw i32 %46, %.13247.us
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %48 = mul nuw nsw i64 %indvars.iv.next83, %8
  %gep.us.1 = getelementptr inbounds i32, ptr %invariant.gep.us, i64 %48
  %49 = load i32, ptr %gep.us.1, align 4, !tbaa !5
  %50 = add nsw i32 %49, %47
  %indvars.iv.next83.1 = add nuw nsw i64 %indvars.iv82, 2
  %51 = mul nuw nsw i64 %indvars.iv.next83.1, %8
  %gep.us.2 = getelementptr inbounds i32, ptr %invariant.gep.us, i64 %51
  %52 = load i32, ptr %gep.us.2, align 4, !tbaa !5
  %53 = add nsw i32 %52, %50
  %indvars.iv.next83.2 = add nuw nsw i64 %indvars.iv82, 3
  %54 = mul nuw nsw i64 %indvars.iv.next83.2, %8
  %gep.us.3 = getelementptr inbounds i32, ptr %invariant.gep.us, i64 %54
  %55 = load i32, ptr %gep.us.3, align 4, !tbaa !5
  %56 = add nsw i32 %55, %53
  %indvars.iv.next83.3 = add nuw nsw i64 %indvars.iv82, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next83.3, %wide.trip.count85
  br i1 %exitcond.not.3, label %._crit_edge50.us, label %scalar.ph, !llvm.loop !15

._crit_edge50.us:                                 ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block
  %.lcssa111 = phi i32 [ %39, %middle.block ], [ %.lcssa121.unr, %scalar.ph.prol.loopexit ], [ %56, %scalar.ph ]
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %57 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv88
  store i32 %.lcssa111, ptr %57, align 4, !tbaa !5
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %exitcond94.not = icmp eq i64 %indvars.iv.next87, %wide.trip.count93
  br i1 %exitcond94.not, label %.preheader36, label %.preheader37.us, !llvm.loop !16

58:                                               ; preds = %.lr.ph, %58
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %58 ]
  %.03140 = phi i32 [ 0, %.lr.ph ], [ %62, %58 ]
  %59 = getelementptr inbounds i32, ptr %25, i64 %indvars.iv
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %59)
  %61 = load i32, ptr %59, align 4, !tbaa !5
  %62 = add nsw i32 %61, %.03140
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %63 = load i32, ptr %1, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = icmp slt i64 %indvars.iv.next, %64
  br i1 %65, label %58, label %._crit_edge.loopexit, !llvm.loop !17

._crit_edge.loopexit:                             ; preds = %58
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader39
  %66 = phi i32 [ %21, %.preheader39 ], [ %.pre, %._crit_edge.loopexit ]
  %67 = phi i32 [ %22, %.preheader39 ], [ %63, %._crit_edge.loopexit ]
  %.031.lcssa = phi i32 [ 0, %.preheader39 ], [ %62, %._crit_edge.loopexit ]
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %68 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv74
  store i32 %.031.lcssa, ptr %68, align 4, !tbaa !5
  %69 = sext i32 %66 to i64
  %70 = icmp slt i64 %indvars.iv.next75, %69
  br i1 %70, label %.preheader39, label %.preheader38.loopexit, !llvm.loop !18

.preheader36:                                     ; preds = %._crit_edge50.us, %.preheader38
  %71 = icmp sgt i32 %28, 0
  br i1 %71, label %.lr.ph55.preheader, label %.preheader

.lr.ph55.preheader:                               ; preds = %.preheader36.thread, %.preheader36
  br label %.lr.ph55

.preheader.loopexit:                              ; preds = %.lr.ph55
  %.pre101 = load i32, ptr %1, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader36.thread103, %.preheader.loopexit, %.preheader36
  %72 = phi i32 [ %27, %.preheader36 ], [ %.pre101, %.preheader.loopexit ], [ %27, %.preheader36.thread103 ]
  %73 = phi i32 [ %28, %.preheader36 ], [ %85, %.preheader.loopexit ], [ %28, %.preheader36.thread103 ]
  %.2.lcssa = phi i32 [ 0, %.preheader36 ], [ %78, %.preheader.loopexit ], [ 0, %.preheader36.thread103 ]
  %74 = add nsw i32 %72, %73
  %75 = icmp slt i32 %.2.lcssa, %74
  br i1 %75, label %.lr.ph59.preheader, label %._crit_edge60

.lr.ph59.preheader:                               ; preds = %.preheader
  %76 = zext nneg i32 %.2.lcssa to i64
  br label %.lr.ph59

.lr.ph55:                                         ; preds = %.lr.ph55.preheader, %.lr.ph55
  %indvars.iv95 = phi i64 [ %indvars.iv.next96, %.lr.ph55 ], [ 0, %.lr.ph55.preheader ]
  %77 = 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)
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %78 = trunc nuw nsw i64 %indvars.iv.next96 to i32
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %77, i32 noundef %78)
  %80 = 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.1)
  %81 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv95
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %80, i32 noundef %82)
  %84 = 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_)
  %85 = load i32, ptr %2, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = icmp slt i64 %indvars.iv.next96, %86
  br i1 %87, label %.lr.ph55, label %.preheader.loopexit, !llvm.loop !20

.lr.ph59:                                         ; preds = %.lr.ph59.preheader, %.lr.ph59
  %indvars.iv98 = phi i64 [ %76, %.lr.ph59.preheader ], [ %indvars.iv.next99, %.lr.ph59 ]
  %.23557 = phi i32 [ 1, %.lr.ph59.preheader ], [ %89, %.lr.ph59 ]
  %88 = 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)
  %89 = add nuw nsw i32 %.23557, 1
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %88, i32 noundef %.23557)
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %90, ptr noundef nonnull @.str.1)
  %92 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv98
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %91, i32 noundef %93)
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %94, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %96 = load i32, ptr %2, align 4, !tbaa !5
  %97 = load i32, ptr %1, align 4, !tbaa !5
  %98 = add nsw i32 %97, %96
  %99 = trunc nuw i64 %indvars.iv.next99 to i32
  %100 = icmp sgt i32 %98, %99
  br i1 %100, label %.lr.ph59, label %._crit_edge60, !llvm.loop !21

._crit_edge60:                                    ; preds = %.lr.ph59, %.preheader
  call void @llvm.stackrestore.p0(ptr %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

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

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 #5 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)) #4

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #7

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 #5 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !11}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !19}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


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