; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Codeforces Round #817 (Div. 4)/E. Counting Rectangles.ll (Z5solvev)

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

@mat = external dso_local global [1007 x [1007 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.memset.p0.i64(ptr align 16 @mat, i8 0, i64 8112392, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %33, %0
  %17 = load i64, ptr %3, align 8, !tbaa !5
  %18 = load i64, ptr %1, align 8, !tbaa !5
  %19 = icmp slt i64 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %36

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %24 = load i64, ptr %4, align 8, !tbaa !5
  %25 = load i64, ptr %5, align 8, !tbaa !5
  %26 = mul nsw i64 %24, %25
  %27 = load i64, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %27
  %29 = load i64, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds [1007 x i64], ptr %28, i64 0, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !5
  %32 = add nsw i64 %31, %26
  store i64 %32, ptr %30, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %33

33:                                               ; preds = %21
  %34 = load i64, ptr %3, align 8, !tbaa !5
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %3, align 8, !tbaa !5
  br label %16, !llvm.loop !9

36:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 1, ptr %6, align 8, !tbaa !5
  br label %37

37:                                               ; preds = %60, %36
  %38 = load i64, ptr %6, align 8, !tbaa !5
  %39 = icmp slt i64 %38, 1007
  br i1 %39, label %41, label %40

40:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %63

41:                                               ; preds = %37
  %42 = load i64, ptr %6, align 8, !tbaa !5
  %43 = sub nsw i64 %42, 1
  %44 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %43
  %45 = getelementptr inbounds [1007 x i64], ptr %44, i64 0, i64 0
  %46 = load i64, ptr %45, align 8, !tbaa !5
  %47 = load i64, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %47
  %49 = getelementptr inbounds [1007 x i64], ptr %48, i64 0, i64 0
  %50 = load i64, ptr %49, align 8, !tbaa !5
  %51 = add nsw i64 %50, %46
  store i64 %51, ptr %49, align 8, !tbaa !5
  %52 = load i64, ptr %6, align 8, !tbaa !5
  %53 = sub nsw i64 %52, 1
  %54 = getelementptr inbounds [1007 x i64], ptr @mat, i64 0, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !5
  %56 = load i64, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds [1007 x i64], ptr @mat, i64 0, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !5
  %59 = add nsw i64 %58, %55
  store i64 %59, ptr %57, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %41
  %61 = load i64, ptr %6, align 8, !tbaa !5
  %62 = add nsw i64 %61, 1
  store i64 %62, ptr %6, align 8, !tbaa !5
  br label %37, !llvm.loop !11

63:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 1, ptr %7, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %109, %63
  %65 = load i64, ptr %7, align 8, !tbaa !5
  %66 = icmp slt i64 %65, 1007
  br i1 %66, label %68, label %67

67:                                               ; preds = %64
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %112

68:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 1, ptr %9, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %105, %68
  %70 = load i64, ptr %9, align 8, !tbaa !5
  %71 = icmp slt i64 %70, 1007
  br i1 %71, label %73, label %72

72:                                               ; preds = %69
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %108

73:                                               ; preds = %69
  %74 = load i64, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %74
  %76 = load i64, ptr %9, align 8, !tbaa !5
  %77 = getelementptr inbounds [1007 x i64], ptr %75, i64 0, i64 %76
  %78 = load i64, ptr %77, align 8, !tbaa !5
  %79 = load i64, ptr %7, align 8, !tbaa !5
  %80 = sub nsw i64 %79, 1
  %81 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %80
  %82 = load i64, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds [1007 x i64], ptr %81, i64 0, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !5
  %85 = add nsw i64 %78, %84
  %86 = load i64, ptr %7, align 8, !tbaa !5
  %87 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %86
  %88 = load i64, ptr %9, align 8, !tbaa !5
  %89 = sub nsw i64 %88, 1
  %90 = getelementptr inbounds [1007 x i64], ptr %87, i64 0, i64 %89
  %91 = load i64, ptr %90, align 8, !tbaa !5
  %92 = add nsw i64 %85, %91
  %93 = load i64, ptr %7, align 8, !tbaa !5
  %94 = sub nsw i64 %93, 1
  %95 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %94
  %96 = load i64, ptr %9, align 8, !tbaa !5
  %97 = sub nsw i64 %96, 1
  %98 = getelementptr inbounds [1007 x i64], ptr %95, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !5
  %100 = sub nsw i64 %92, %99
  %101 = load i64, ptr %7, align 8, !tbaa !5
  %102 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %101
  %103 = load i64, ptr %9, align 8, !tbaa !5
  %104 = getelementptr inbounds [1007 x i64], ptr %102, i64 0, i64 %103
  store i64 %100, ptr %104, align 8, !tbaa !5
  br label %105

105:                                              ; preds = %73
  %106 = load i64, ptr %9, align 8, !tbaa !5
  %107 = add nsw i64 %106, 1
  store i64 %107, ptr %9, align 8, !tbaa !5
  br label %69, !llvm.loop !12

108:                                              ; preds = %72
  br label %109

109:                                              ; preds = %108
  %110 = load i64, ptr %7, align 8, !tbaa !5
  %111 = add nsw i64 %110, 1
  store i64 %111, ptr %7, align 8, !tbaa !5
  br label %64, !llvm.loop !13

112:                                              ; preds = %67
  br label %113

113:                                              ; preds = %117, %112
  %114 = load i64, ptr %2, align 8, !tbaa !5
  %115 = add nsw i64 %114, -1
  store i64 %115, ptr %2, align 8, !tbaa !5
  %116 = icmp ne i64 %114, 0
  br i1 %116, label %117, label %151

117:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %118 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %119 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %118, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %120 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %119, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %121 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %120, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %122 = load i64, ptr %12, align 8, !tbaa !5
  %123 = sub nsw i64 %122, 1
  %124 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %123
  %125 = load i64, ptr %13, align 8, !tbaa !5
  %126 = sub nsw i64 %125, 1
  %127 = getelementptr inbounds [1007 x i64], ptr %124, i64 0, i64 %126
  %128 = load i64, ptr %127, align 8, !tbaa !5
  %129 = load i64, ptr %10, align 8, !tbaa !5
  %130 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %129
  %131 = load i64, ptr %11, align 8, !tbaa !5
  %132 = getelementptr inbounds [1007 x i64], ptr %130, i64 0, i64 %131
  %133 = load i64, ptr %132, align 8, !tbaa !5
  %134 = add nsw i64 %128, %133
  %135 = load i64, ptr %10, align 8, !tbaa !5
  %136 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %135
  %137 = load i64, ptr %13, align 8, !tbaa !5
  %138 = sub nsw i64 %137, 1
  %139 = getelementptr inbounds [1007 x i64], ptr %136, i64 0, i64 %138
  %140 = load i64, ptr %139, align 8, !tbaa !5
  %141 = sub nsw i64 %134, %140
  %142 = load i64, ptr %12, align 8, !tbaa !5
  %143 = sub nsw i64 %142, 1
  %144 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %143
  %145 = load i64, ptr %11, align 8, !tbaa !5
  %146 = getelementptr inbounds [1007 x i64], ptr %144, i64 0, i64 %145
  %147 = load i64, ptr %146, align 8, !tbaa !5
  %148 = sub nsw i64 %141, %147
  %149 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %148)
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %149, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %113, !llvm.loop !14

151:                                              ; preds = %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

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

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

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

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

; 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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 = !{!"long", !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}


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

@mat = external dso_local local_unnamed_addr global [1007 x [1007 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8112392) @mat, i8 0, i64 8112392, i1 false)
  %11 = load i64, ptr %1, align 8, !tbaa !5
  %12 = icmp sgt i64 %11, 0
  br i1 %12, label %.lr.ph, label %.preheader30

.preheader30.loopexit:                            ; preds = %.lr.ph
  %.pre.pre = load i64, ptr @mat, align 16, !tbaa !5
  br label %.preheader30

.preheader30:                                     ; preds = %.preheader30.loopexit, %0
  %.pre = phi i64 [ %.pre.pre, %.preheader30.loopexit ], [ 0, %0 ]
  br label %24

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.02431 = phi i64 [ %21, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %15 = load i64, ptr %3, align 8, !tbaa !5
  %16 = load i64, ptr %4, align 8, !tbaa !5
  %17 = mul nsw i64 %16, %15
  %18 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %15, i64 %16
  %19 = load i64, ptr %18, align 8, !tbaa !5
  %20 = add nsw i64 %19, %17
  store i64 %20, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  %21 = add nuw nsw i64 %.02431, 1
  %22 = load i64, ptr %1, align 8, !tbaa !5
  %23 = icmp slt i64 %21, %22
  br i1 %23, label %.lr.ph, label %.preheader30.loopexit, !llvm.loop !9

24:                                               ; preds = %24, %.preheader30
  %25 = phi i64 [ %.pre, %.preheader30 ], [ %43, %24 ]
  %.02332 = phi i64 [ 1, %.preheader30 ], [ %44, %24 ]
  %26 = add nsw i64 %.02332, -1
  %27 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %26
  %28 = load i64, ptr %27, align 8, !tbaa !5
  %29 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %.02332
  %30 = load i64, ptr %29, align 8, !tbaa !5
  %31 = add nsw i64 %30, %28
  store i64 %31, ptr %29, align 8, !tbaa !5
  %32 = getelementptr inbounds [1007 x i64], ptr @mat, i64 0, i64 %.02332
  %33 = load i64, ptr %32, align 8, !tbaa !5
  %34 = add nsw i64 %33, %25
  store i64 %34, ptr %32, align 8, !tbaa !5
  %35 = add nuw nsw i64 %.02332, 1
  %36 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %.02332
  %37 = load i64, ptr %36, align 8, !tbaa !5
  %38 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %35
  %39 = load i64, ptr %38, align 8, !tbaa !5
  %40 = add nsw i64 %39, %37
  store i64 %40, ptr %38, align 8, !tbaa !5
  %41 = getelementptr inbounds [1007 x i64], ptr @mat, i64 0, i64 %35
  %42 = load i64, ptr %41, align 8, !tbaa !5
  %43 = add nsw i64 %42, %34
  store i64 %43, ptr %41, align 8, !tbaa !5
  %44 = add nuw nsw i64 %.02332, 2
  %exitcond.not.1 = icmp eq i64 %44, 1007
  br i1 %exitcond.not.1, label %.preheader28, label %24, !llvm.loop !11

.preheader28:                                     ; preds = %24, %48
  %.pre41 = phi i64 [ %.pre39, %48 ], [ %.pre, %24 ]
  %.02234 = phi i64 [ %49, %48 ], [ 1, %24 ]
  %45 = add nsw i64 %.02234, -1
  %.phi.trans.insert = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %.02234, i64 0
  %.pre39 = load i64, ptr %.phi.trans.insert, align 8, !tbaa !5
  br label %50

.preheader:                                       ; preds = %48
  %46 = load i64, ptr %2, align 8, !tbaa !5
  %47 = add nsw i64 %46, -1
  store i64 %47, ptr %2, align 8, !tbaa !5
  %.not35 = icmp eq i64 %46, 0
  br i1 %.not35, label %._crit_edge, label %.lr.ph36

48:                                               ; preds = %50
  %49 = add nuw nsw i64 %.02234, 1
  %exitcond38.not = icmp eq i64 %49, 1007
  br i1 %exitcond38.not, label %.preheader, label %.preheader28, !llvm.loop !12

50:                                               ; preds = %50, %.preheader28
  %51 = phi i64 [ %.pre41, %.preheader28 ], [ %64, %50 ]
  %52 = phi i64 [ %.pre39, %.preheader28 ], [ %67, %50 ]
  %.033 = phi i64 [ 1, %.preheader28 ], [ %68, %50 ]
  %53 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %.02234, i64 %.033
  %54 = load i64, ptr %53, align 8, !tbaa !5
  %55 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %45, i64 %.033
  %56 = load i64, ptr %55, align 8, !tbaa !5
  %57 = add nsw i64 %56, %54
  %58 = add nsw i64 %57, %52
  %59 = sub i64 %58, %51
  store i64 %59, ptr %53, align 8, !tbaa !5
  %60 = add nuw nsw i64 %.033, 1
  %61 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %.02234, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !5
  %63 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %45, i64 %60
  %64 = load i64, ptr %63, align 8, !tbaa !5
  %65 = add nsw i64 %64, %62
  %66 = add nsw i64 %65, %59
  %67 = sub i64 %66, %56
  store i64 %67, ptr %61, align 8, !tbaa !5
  %68 = add nuw nsw i64 %.033, 2
  %exitcond37.not.1 = icmp eq i64 %68, 1007
  br i1 %exitcond37.not.1, label %48, label %50, !llvm.loop !13

.lr.ph36:                                         ; preds = %.preheader, %.lr.ph36
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %69 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %70 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %69, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %71 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %70, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %72 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %71, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %73 = load i64, ptr %7, align 8, !tbaa !5
  %74 = add nsw i64 %73, -1
  %75 = load i64, ptr %8, align 8, !tbaa !5
  %76 = add nsw i64 %75, -1
  %77 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %74, i64 %76
  %78 = load i64, ptr %77, align 8, !tbaa !5
  %79 = load i64, ptr %5, align 8, !tbaa !5
  %80 = load i64, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %79, i64 %80
  %82 = load i64, ptr %81, align 8, !tbaa !5
  %83 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %79, i64 %76
  %84 = load i64, ptr %83, align 8, !tbaa !5
  %85 = getelementptr inbounds [1007 x [1007 x i64]], ptr @mat, i64 0, i64 %74, i64 %80
  %86 = load i64, ptr %85, align 8, !tbaa !5
  %.neg26 = add i64 %82, %78
  %87 = add i64 %84, %86
  %88 = sub i64 %.neg26, %87
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %88)
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %89, ptr noundef nonnull @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  %91 = load i64, ptr %2, align 8, !tbaa !5
  %92 = add nsw i64 %91, -1
  store i64 %92, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i64 %91, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph36, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph36, %.preheader
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret void
}

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

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

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

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 = !{!"long", !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}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass