; LLVM IR from ShahjalalShohag/code-library :: Math/Freivalds Algorithm.ll (Z9Freivalds3MatS_S_)

; 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::mersenne_twister_engine" = type { [624 x i64], i64 }
%struct.Mat = type { i32, i32, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@rnd = external dso_local global %"class.std::mersenne_twister_engine", align 8

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z9Freivalds3MatS_S_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %struct.Mat, align 8
  %11 = alloca %struct.Mat, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct.Mat, align 8
  %16 = alloca %struct.Mat, align 8
  %17 = alloca %struct.Mat, align 8
  %18 = alloca %struct.Mat, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %20 = getelementptr inbounds %struct.Mat, ptr %0, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !9
  store i32 %21, ptr %8, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 40, ptr %9, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #5
  %22 = load i32, ptr %8, align 4, !tbaa !16
  call void @_ZN3MatC2Eii(ptr noundef nonnull align 8 dereferenceable(32) %10, i32 noundef %22, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #5
  %23 = load i32, ptr %8, align 4, !tbaa !16
  invoke void @_ZN3MatC2Eii(ptr noundef nonnull align 8 dereferenceable(32) %11, i32 noundef %23, i32 noundef 1)
          to label %24 unwind label %35

24:                                               ; preds = %3
  br label %25

25:                                               ; preds = %90, %24
  %26 = load i32, ptr %9, align 4, !tbaa !16
  %27 = add nsw i32 %26, -1
  store i32 %27, ptr %9, align 4, !tbaa !16
  %28 = icmp ne i32 %26, 0
  br i1 %28, label %29, label %92

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

30:                                               ; preds = %49, %29
  %31 = load i32, ptr %14, align 4, !tbaa !16
  %32 = load i32, ptr %8, align 4, !tbaa !16
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %39, label %34

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

35:                                               ; preds = %3
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %12, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %13, align 4
  br label %96

39:                                               ; preds = %30
  %40 = invoke noundef i64 @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv(ptr noundef nonnull align 8 dereferenceable(5000) @rnd)
          to label %41 unwind label %52

41:                                               ; preds = %39
  %42 = urem i64 %40, 2
  %43 = trunc i64 %42 to i32
  %44 = getelementptr inbounds %struct.Mat, ptr %11, i32 0, i32 2
  %45 = load i32, ptr %14, align 4, !tbaa !16
  %46 = sext i32 %45 to i64
  %47 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %44, i64 noundef %46) #5
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %47, i64 noundef 0) #5
  store i32 %43, ptr %48, align 4, !tbaa !16
  br label %49

49:                                               ; preds = %41
  %50 = load i32, ptr %14, align 4, !tbaa !16
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %14, align 4, !tbaa !16
  br label %30, !llvm.loop !17

52:                                               ; preds = %39
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %12, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %95

56:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #5
  invoke void @_ZN3MatmlERKS_(ptr dead_on_unwind writable sret(%struct.Mat) align 8 %17, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %57 unwind label %64

57:                                               ; preds = %56
  invoke void @_ZN3MatmlERKS_(ptr dead_on_unwind writable sret(%struct.Mat) align 8 %16, ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %17)
          to label %58 unwind label %68

58:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 32, ptr %18) #5
  invoke void @_ZN3MatmlERKS_(ptr dead_on_unwind writable sret(%struct.Mat) align 8 %18, ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %59 unwind label %72

59:                                               ; preds = %58
  invoke void @_ZN3MatmiERKS_(ptr dead_on_unwind writable sret(%struct.Mat) align 8 %15, ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull align 8 dereferenceable(32) %18)
          to label %60 unwind label %76

60:                                               ; preds = %59
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #5
  %61 = invoke noundef zeroext i1 @_ZN3MatneERKS_(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %62 unwind label %83

62:                                               ; preds = %60
  br i1 %61, label %63, label %87

63:                                               ; preds = %62
  store i32 0, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %88

64:                                               ; preds = %56
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %12, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %13, align 4
  br label %82

68:                                               ; preds = %57
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %12, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %13, align 4
  br label %81

72:                                               ; preds = %58
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %12, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %13, align 4
  br label %80

76:                                               ; preds = %59
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %12, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %13, align 4
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #5
  br label %80

80:                                               ; preds = %76, %72
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %16) #5
  br label %81

81:                                               ; preds = %80, %68
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %17) #5
  br label %82

82:                                               ; preds = %81, %64
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %16) #5
  br label %91

83:                                               ; preds = %60
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %12, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %13, align 4
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #5
  br label %91

87:                                               ; preds = %62
  store i32 0, ptr %19, align 4
  br label %88

88:                                               ; preds = %87, %63
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #5
  %89 = load i32, ptr %19, align 4
  switch i32 %89, label %93 [
    i32 0, label %90
  ]

90:                                               ; preds = %88
  br label %25, !llvm.loop !19

91:                                               ; preds = %83, %82
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #5
  br label %95

92:                                               ; preds = %25
  store i32 1, ptr %4, align 4
  store i32 1, ptr %19, align 4
  br label %93

93:                                               ; preds = %92, %88
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %94 = load i32, ptr %4, align 4
  ret i32 %94

95:                                               ; preds = %91, %52
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #5
  br label %96

96:                                               ; preds = %95, %35
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %97

97:                                               ; preds = %96
  %98 = load ptr, ptr %12, align 8
  %99 = load i32, ptr %13, align 4
  %100 = insertvalue { ptr, i32 } poison, ptr %98, 0
  %101 = insertvalue { ptr, i32 } %100, i32 %99, 1
  resume { ptr, i32 } %101
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3MatC2Eii(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv(ptr noundef nonnull align 8 dereferenceable(5000)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3MatmlERKS_(ptr dead_on_unwind noalias writable sret(%struct.Mat) align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3MatmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.Mat) align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3MatneERKS_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS3Mat", !11, i64 0, !11, i64 4, !12, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSSt6vectorIS_IiSaIiEESaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!11, !11, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


; 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::mersenne_twister_engine" = type { [624 x i64], i64 }
%struct.Mat = type { i32, i32, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@rnd = external dso_local global %"class.std::mersenne_twister_engine", align 8

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z9Freivalds3MatS_S_(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %4 = alloca %struct.Mat, align 8
  %5 = alloca %struct.Mat, align 8
  %6 = alloca %struct.Mat, align 8
  %7 = alloca %struct.Mat, align 8
  %8 = alloca %struct.Mat, align 8
  %9 = alloca %struct.Mat, align 8
  %10 = load i32, ptr %0, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #5
  call void @_ZN3MatC2Eii(ptr noundef nonnull align 8 dereferenceable(32) %4, i32 noundef %10, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  invoke void @_ZN3MatC2Eii(ptr noundef nonnull align 8 dereferenceable(32) %5, i32 noundef %10, i32 noundef 1)
          to label %.preheader30 unwind label %33

.preheader30:                                     ; preds = %3
  %11 = icmp sgt i32 %10, 0
  %12 = getelementptr inbounds i8, ptr %5, i64 8
  br i1 %11, label %.preheader30.split.us.preheader, label %.preheader30.split

.preheader30.split.us.preheader:                  ; preds = %.preheader30
  %wide.trip.count = zext nneg i32 %10 to i64
  br label %.preheader30.split.us

.preheader30.split.us:                            ; preds = %.preheader30.split.us.preheader, %19
  %.018.us = phi i32 [ %13, %19 ], [ 40, %.preheader30.split.us.preheader ]
  %13 = add nsw i32 %.018.us, -1
  %.not.us = icmp eq i32 %.018.us, 0
  br i1 %.not.us, label %.split.us, label %.preheader.us

14:                                               ; preds = %._crit_edge.us
  invoke void @_ZN3MatmlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Mat) align 8 %7, ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %15 unwind label %.split36.us

15:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #5
  invoke void @_ZN3MatmlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Mat) align 8 %9, ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %16 unwind label %.split39.us

16:                                               ; preds = %15
  invoke void @_ZN3MatmiERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Mat) align 8 %6, ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %17 unwind label %.split42.us

17:                                               ; preds = %16
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  %18 = invoke noundef zeroext i1 @_ZN3MatneERKS_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %19 unwind label %.split45.us

19:                                               ; preds = %17
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #5
  br i1 %18, label %.split.us, label %.preheader30.split.us, !llvm.loop !15

.preheader.us:                                    ; preds = %.preheader30.split.us, %21
  %indvars.iv = phi i64 [ %indvars.iv.next, %21 ], [ 0, %.preheader30.split.us ]
  %20 = invoke noundef i64 @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv(ptr noundef nonnull align 8 dereferenceable(5000) @rnd)
          to label %21 unwind label %.split48.us

21:                                               ; preds = %.preheader.us
  %22 = trunc i64 %20 to i32
  %23 = and i32 %22, 1
  %24 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %indvars.iv) #5
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef 0) #5
  store i32 %23, ptr %25, align 4, !tbaa !17
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.us, label %.preheader.us, !llvm.loop !18

._crit_edge.us:                                   ; preds = %21
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #5
  invoke void @_ZN3MatmlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Mat) align 8 %8, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %14 unwind label %.split33.us

.split33.us:                                      ; preds = %._crit_edge.us
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %47

.split36.us:                                      ; preds = %14
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %46

.split39.us:                                      ; preds = %15
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %45

.split42.us:                                      ; preds = %16
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %44

.split45.us:                                      ; preds = %17
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %49

.split48.us:                                      ; preds = %.preheader.us
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %52

.preheader30.split:                               ; preds = %.preheader30, %50
  %.018 = phi i32 [ %32, %50 ], [ 40, %.preheader30 ]
  %32 = add nsw i32 %.018, -1
  %.not = icmp eq i32 %.018, 0
  br i1 %.not, label %.split.us, label %.preheader

.preheader:                                       ; preds = %.preheader30.split
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #5
  invoke void @_ZN3MatmlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Mat) align 8 %8, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %35 unwind label %.split33

33:                                               ; preds = %3
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %53

35:                                               ; preds = %.preheader
  invoke void @_ZN3MatmlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Mat) align 8 %7, ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %36 unwind label %.split36

36:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #5
  invoke void @_ZN3MatmlERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Mat) align 8 %9, ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %37 unwind label %.split39

37:                                               ; preds = %36
  invoke void @_ZN3MatmiERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Mat) align 8 %6, ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %38 unwind label %.split42

38:                                               ; preds = %37
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  %39 = invoke noundef zeroext i1 @_ZN3MatneERKS_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %50 unwind label %.split45

.split33:                                         ; preds = %.preheader
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %47

.split36:                                         ; preds = %35
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %46

.split39:                                         ; preds = %36
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %45

.split42:                                         ; preds = %37
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %44

44:                                               ; preds = %.split42.us, %.split42
  %.us-phi43 = phi { ptr, i32 } [ %43, %.split42 ], [ %29, %.split42.us ]
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  br label %45

45:                                               ; preds = %.split39, %.split39.us, %44
  %.pn = phi { ptr, i32 } [ %.us-phi43, %44 ], [ %42, %.split39 ], [ %28, %.split39.us ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  br label %46

46:                                               ; preds = %.split36, %.split36.us, %45
  %.pn.pn = phi { ptr, i32 } [ %.pn, %45 ], [ %41, %.split36 ], [ %27, %.split36.us ]
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #5
  br label %47

47:                                               ; preds = %.split33, %.split33.us, %46
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %46 ], [ %40, %.split33 ], [ %26, %.split33.us ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  br label %51

.split45:                                         ; preds = %38
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %49

49:                                               ; preds = %.split45.us, %.split45
  %.us-phi46 = phi { ptr, i32 } [ %48, %.split45 ], [ %30, %.split45.us ]
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #5
  br label %51

50:                                               ; preds = %38
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #5
  br i1 %39, label %.split.us, label %.preheader30.split, !llvm.loop !15

51:                                               ; preds = %49, %47
  %.pn25 = phi { ptr, i32 } [ %.us-phi46, %49 ], [ %.pn.pn.pn, %47 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #5
  br label %52

.split.us:                                        ; preds = %50, %.preheader30.split, %.preheader30.split.us, %19
  %.us-phi = phi i32 [ 0, %19 ], [ 1, %.preheader30.split.us ], [ 0, %50 ], [ 1, %.preheader30.split ]
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  ret i32 %.us-phi

52:                                               ; preds = %51, %.split48.us
  %.pn27 = phi { ptr, i32 } [ %31, %.split48.us ], [ %.pn25, %51 ]
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  br label %53

53:                                               ; preds = %52, %33
  %.pn27.pn = phi { ptr, i32 } [ %.pn27, %52 ], [ %34, %33 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  call void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  resume { ptr, i32 } %.pn27.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3MatC2Eii(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv(ptr noundef nonnull align 8 dereferenceable(5000)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3MatmlERKS_(ptr dead_on_unwind noalias writable sret(%struct.Mat) align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3MatmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.Mat) align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3MatD2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3MatneERKS_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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, !7, i64 0}
!6 = !{!"_ZTS3Mat", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorIS_IiSaIiEESaIS1_EE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"any pointer", !8, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !16}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass