; LLVM IR from kazunetakahashi/atcoder :: 201510_201609/1224_xmas_2015/A.ll (Z12mod_multiply6matrixS_)

; 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::slice_array" = type { i64, i64, %"struct.std::_Array" }
%"struct.std::_Array" = type { ptr }
%"class.std::slice" = type { i64, i64, i64 }
%struct.matrix = type { i32, i32, %"class.std::valarray" }
%"class.std::valarray" = type { i64, ptr }
%"class.std::_Expr" = type { %"struct.std::__detail::_BinClos" }
%"struct.std::__detail::_BinClos" = type { %"class.std::__detail::_BinBase" }
%"class.std::__detail::_BinBase" = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@MOD = external dso_local global i64, align 8
@__PRETTY_FUNCTION__._Z12mod_multiply6matrixS_ = external hidden unnamed_addr constant [36 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { ptr, ptr } @_ZStmlIxESt5_ExprINSt8__detail8_BinClosISt12__multipliesSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt8valarrayIxEixESt5slice(ptr dead_on_unwind noalias writable sret(%"class.std::slice_array") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef byval(%"class.std::slice") align 8) #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt8valarrayIxEC2ERKSt11slice_arrayIxE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt5_ExprINSt8__detail8_BinClosISt12__multipliesSt9_ValArrayS3_xxEExE3sumEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12mod_multiply6matrixS_(ptr dead_on_unwind noalias writable sret(%struct.matrix) align 8 %0, ptr noundef %1, ptr noundef %2) #2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i1, align 1
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::_Expr", align 8
  %13 = alloca %"class.std::valarray", align 8
  %14 = alloca %"class.std::slice_array", align 8
  %15 = alloca %"class.std::slice", align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca %"class.std::valarray", align 8
  %19 = alloca %"class.std::slice_array", align 8
  %20 = alloca %"class.std::slice", align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.matrix, ptr %1, i32 0, i32 1
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = getelementptr inbounds %struct.matrix, ptr %2, i32 0, i32 0
  %24 = load i32, ptr %23, align 8, !tbaa !14
  %25 = icmp eq i32 %22, %24
  br i1 %25, label %26, label %27

26:                                               ; preds = %3
  br label %29

27:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 176, ptr noundef @__PRETTY_FUNCTION__._Z12mod_multiply6matrixS_) #5
  unreachable

28:                                               ; No predecessors!
  br label %29

29:                                               ; preds = %28, %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %30 = getelementptr inbounds %struct.matrix, ptr %1, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !9
  store i32 %31, ptr %7, align 4, !tbaa !15
  store i1 false, ptr %8, align 1
  %32 = getelementptr inbounds %struct.matrix, ptr %1, i32 0, i32 0
  %33 = load i32, ptr %32, align 8, !tbaa !14
  %34 = getelementptr inbounds %struct.matrix, ptr %2, i32 0, i32 1
  %35 = load i32, ptr %34, align 4, !tbaa !9
  call void @_ZN6matrixC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %33, i32 noundef %35)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !15
  br label %36

36:                                               ; preds = %111, %29
  %37 = load i32, ptr %9, align 4, !tbaa !15
  %38 = getelementptr inbounds %struct.matrix, ptr %0, i32 0, i32 0
  %39 = load i32, ptr %38, align 8, !tbaa !14
  %40 = icmp slt i32 %37, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %36
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %114

42:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !15
  br label %43

43:                                               ; preds = %93, %42
  %44 = load i32, ptr %11, align 4, !tbaa !15
  %45 = getelementptr inbounds %struct.matrix, ptr %0, i32 0, i32 1
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = icmp slt i32 %44, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #6
  %50 = getelementptr inbounds %struct.matrix, ptr %1, i32 0, i32 2
  %51 = load i32, ptr %9, align 4, !tbaa !15
  %52 = getelementptr inbounds %struct.matrix, ptr %1, i32 0, i32 1
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = mul nsw i32 %51, %53
  %55 = sext i32 %54 to i64
  %56 = load i32, ptr %7, align 4, !tbaa !15
  %57 = sext i32 %56 to i64
  invoke void @_ZNSt5sliceC2Emmm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %55, i64 noundef %57, i64 noundef 1)
          to label %58 unwind label %96

58:                                               ; preds = %49
  invoke void @_ZNSt8valarrayIxEixESt5slice(ptr dead_on_unwind writable sret(%"class.std::slice_array") align 8 %14, ptr noundef nonnull align 8 dereferenceable(16) %50, ptr noundef byval(%"class.std::slice") align 8 %15)
          to label %59 unwind label %96

59:                                               ; preds = %58
  invoke void @_ZNSt8valarrayIxEC2ERKSt11slice_arrayIxE(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %60 unwind label %96

60:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #6
  %61 = getelementptr inbounds %struct.matrix, ptr %2, i32 0, i32 2
  %62 = load i32, ptr %11, align 4, !tbaa !15
  %63 = sext i32 %62 to i64
  %64 = load i32, ptr %7, align 4, !tbaa !15
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds %struct.matrix, ptr %2, i32 0, i32 1
  %67 = load i32, ptr %66, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  invoke void @_ZNSt5sliceC2Emmm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %63, i64 noundef %65, i64 noundef %68)
          to label %69 unwind label %100

69:                                               ; preds = %60
  invoke void @_ZNSt8valarrayIxEixESt5slice(ptr dead_on_unwind writable sret(%"class.std::slice_array") align 8 %19, ptr noundef nonnull align 8 dereferenceable(16) %61, ptr noundef byval(%"class.std::slice") align 8 %20)
          to label %70 unwind label %100

70:                                               ; preds = %69
  invoke void @_ZNSt8valarrayIxEC2ERKSt11slice_arrayIxE(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 8 dereferenceable(24) %19)
          to label %71 unwind label %100

71:                                               ; preds = %70
  %72 = invoke { ptr, ptr } @_ZStmlIxESt5_ExprINSt8__detail8_BinClosISt12__multipliesSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %18)
          to label %73 unwind label %104

73:                                               ; preds = %71
  %74 = getelementptr inbounds %"class.std::_Expr", ptr %12, i32 0, i32 0
  %75 = getelementptr inbounds %"struct.std::__detail::_BinClos", ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds { ptr, ptr }, ptr %75, i32 0, i32 0
  %77 = extractvalue { ptr, ptr } %72, 0
  store ptr %77, ptr %76, align 8
  %78 = getelementptr inbounds { ptr, ptr }, ptr %75, i32 0, i32 1
  %79 = extractvalue { ptr, ptr } %72, 1
  store ptr %79, ptr %78, align 8
  %80 = invoke noundef i64 @_ZNKSt5_ExprINSt8__detail8_BinClosISt12__multipliesSt9_ValArrayS3_xxEExE3sumEv(ptr noundef nonnull align 8 dereferenceable(16) %12)
          to label %81 unwind label %104

81:                                               ; preds = %73
  %82 = load i64, ptr @MOD, align 8, !tbaa !16
  %83 = srem i64 %80, %82
  %84 = getelementptr inbounds %struct.matrix, ptr %0, i32 0, i32 2
  %85 = load i32, ptr %9, align 4, !tbaa !15
  %86 = getelementptr inbounds %struct.matrix, ptr %0, i32 0, i32 1
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = mul nsw i32 %85, %87
  %89 = load i32, ptr %11, align 4, !tbaa !15
  %90 = add nsw i32 %88, %89
  %91 = sext i32 %90 to i64
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt8valarrayIxEixEm(ptr noundef nonnull align 8 dereferenceable(16) %84, i64 noundef %91) #6
  store i64 %83, ptr %92, align 8, !tbaa !16
  call void @_ZNSt8valarrayIxED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %18) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #6
  call void @_ZNSt8valarrayIxED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  br label %93

93:                                               ; preds = %81
  %94 = load i32, ptr %11, align 4, !tbaa !15
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %11, align 4, !tbaa !15
  br label %43, !llvm.loop !18

96:                                               ; preds = %59, %58, %49
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %16, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %17, align 4
  br label %109

100:                                              ; preds = %70, %69, %60
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %16, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %17, align 4
  br label %108

104:                                              ; preds = %73, %71
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %16, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %17, align 4
  call void @_ZNSt8valarrayIxED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %18) #6
  br label %108

108:                                              ; preds = %104, %100
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #6
  call void @_ZNSt8valarrayIxED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #6
  br label %109

109:                                              ; preds = %108, %96
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @_ZN6matrixD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %118

110:                                              ; preds = %48
  br label %111

111:                                              ; preds = %110
  %112 = load i32, ptr %9, align 4, !tbaa !15
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %9, align 4, !tbaa !15
  br label %36, !llvm.loop !20

114:                                              ; preds = %41
  store i1 true, ptr %8, align 1
  store i32 1, ptr %10, align 4
  %115 = load i1, ptr %8, align 1
  br i1 %115, label %117, label %116

116:                                              ; preds = %114
  call void @_ZN6matrixD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br label %117

117:                                              ; preds = %116, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  ret void

118:                                              ; preds = %109
  %119 = load ptr, ptr %16, align 8
  %120 = load i32, ptr %17, align 4
  %121 = insertvalue { ptr, i32 } poison, ptr %119, 0
  %122 = insertvalue { ptr, i32 } %121, i32 %120, 1
  resume { ptr, i32 } %122
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "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 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 = { noreturn nounwind }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 4}
!10 = !{!"_ZTS6matrix", !11, i64 0, !11, i64 4, !12, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSSt8valarrayIxE", !13, i64 0, !6, i64 8}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !11, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


; 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::slice_array" = type { i64, i64, %"struct.std::_Array" }
%"struct.std::_Array" = type { ptr }
%"class.std::slice" = type { i64, i64, i64 }
%struct.matrix = type { i32, i32, %"class.std::valarray" }
%"class.std::valarray" = type { i64, ptr }
%"class.std::_Expr" = type { %"struct.std::__detail::_BinClos" }
%"struct.std::__detail::_BinClos" = type { %"class.std::__detail::_BinBase" }
%"class.std::__detail::_BinBase" = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@MOD = external dso_local local_unnamed_addr global i64, align 8
@__PRETTY_FUNCTION__._Z12mod_multiply6matrixS_ = external hidden unnamed_addr constant [36 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { ptr, ptr } @_ZStmlIxESt5_ExprINSt8__detail8_BinClosISt12__multipliesSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt8valarrayIxEixESt5slice(ptr dead_on_unwind noalias writable sret(%"class.std::slice_array") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef byval(%"class.std::slice") align 8) local_unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt8valarrayIxEC2ERKSt11slice_arrayIxE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt5_ExprINSt8__detail8_BinClosISt12__multipliesSt9_ValArrayS3_xxEExE3sumEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12mod_multiply6matrixS_(ptr dead_on_unwind noalias writable sret(%struct.matrix) align 8 %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::_Expr", align 8
  %5 = alloca %"class.std::valarray", align 8
  %6 = alloca %"class.std::slice_array", align 8
  %7 = alloca %"class.std::slice", align 8
  %8 = alloca %"class.std::valarray", align 8
  %9 = alloca %"class.std::slice_array", align 8
  %10 = alloca %"class.std::slice", align 8
  %11 = getelementptr inbounds i8, ptr %1, i64 4
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = load i32, ptr %2, align 8, !tbaa !13
  %14 = icmp eq i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 176, ptr noundef nonnull @__PRETTY_FUNCTION__._Z12mod_multiply6matrixS_) #5
  unreachable

16:                                               ; preds = %3
  %17 = load i32, ptr %1, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %2, i64 4
  %19 = load i32, ptr %18, align 4, !tbaa !5
  tail call void @_ZN6matrixC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %17, i32 noundef %19)
  %20 = load i32, ptr %0, align 8, !tbaa !13
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.preheader.lr.ph, label %._crit_edge21

.preheader.lr.ph:                                 ; preds = %16
  %22 = getelementptr inbounds i8, ptr %0, i64 4
  %23 = getelementptr inbounds i8, ptr %1, i64 8
  %24 = sext i32 %12 to i64
  %25 = getelementptr inbounds i8, ptr %2, i64 8
  %26 = getelementptr inbounds i8, ptr %4, i64 8
  %27 = getelementptr inbounds i8, ptr %0, i64 8
  %28 = load i32, ptr %22, align 4, !tbaa !5
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.preheader, label %._crit_edge21

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %30 = phi i32 [ %33, %._crit_edge ], [ %20, %.preheader.lr.ph ]
  %31 = phi i32 [ %34, %._crit_edge ], [ %28, %.preheader.lr.ph ]
  %.01520 = phi i32 [ %35, %._crit_edge ], [ 0, %.preheader.lr.ph ]
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph, label %._crit_edge

._crit_edge.loopexit:                             ; preds = %51
  %.pre = load i32, ptr %0, align 8, !tbaa !13
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %33 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %30, %.preheader ]
  %34 = phi i32 [ %60, %._crit_edge.loopexit ], [ %31, %.preheader ]
  %35 = add nuw nsw i32 %.01520, 1
  %36 = icmp slt i32 %35, %33
  br i1 %36, label %.preheader, label %._crit_edge21, !llvm.loop !14

.lr.ph:                                           ; preds = %.preheader, %51
  %indvars.iv = phi i64 [ %indvars.iv.next, %51 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #6
  %37 = load i32, ptr %11, align 4, !tbaa !5
  %38 = mul nsw i32 %37, %.01520
  %39 = sext i32 %38 to i64
  call void @_ZNSt5sliceC2Emmm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %39, i64 noundef %24, i64 noundef 1)
  invoke void @_ZNSt8valarrayIxEixESt5slice(ptr dead_on_unwind nonnull writable sret(%"class.std::slice_array") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull byval(%"class.std::slice") align 8 %7)
          to label %40 unwind label %63

40:                                               ; preds = %.lr.ph
  invoke void @_ZNSt8valarrayIxEC2ERKSt11slice_arrayIxE(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %41 unwind label %63

41:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #6
  %42 = load i32, ptr %18, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  call void @_ZNSt5sliceC2Emmm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %indvars.iv, i64 noundef %24, i64 noundef %43)
  invoke void @_ZNSt8valarrayIxEixESt5slice(ptr dead_on_unwind nonnull writable sret(%"class.std::slice_array") align 8 %9, ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull byval(%"class.std::slice") align 8 %10)
          to label %44 unwind label %65

44:                                               ; preds = %41
  invoke void @_ZNSt8valarrayIxEC2ERKSt11slice_arrayIxE(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(24) %9)
          to label %45 unwind label %65

45:                                               ; preds = %44
  %46 = invoke { ptr, ptr } @_ZStmlIxESt5_ExprINSt8__detail8_BinClosISt12__multipliesSt9_ValArrayS4_T_S5_EENSt5__funIS3_S5_E11result_typeEERKSt8valarrayIS5_ESE_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %8)
          to label %47 unwind label %67

47:                                               ; preds = %45
  %48 = extractvalue { ptr, ptr } %46, 0
  store ptr %48, ptr %4, align 8
  %49 = extractvalue { ptr, ptr } %46, 1
  store ptr %49, ptr %26, align 8
  %50 = invoke noundef i64 @_ZNKSt5_ExprINSt8__detail8_BinClosISt12__multipliesSt9_ValArrayS3_xxEExE3sumEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %51 unwind label %67

51:                                               ; preds = %47
  %52 = load i64, ptr @MOD, align 8, !tbaa !17
  %53 = srem i64 %50, %52
  %54 = load i32, ptr %22, align 4, !tbaa !5
  %55 = mul nsw i32 %54, %.01520
  %56 = trunc nuw nsw i64 %indvars.iv to i32
  %57 = add nsw i32 %55, %56
  %58 = sext i32 %57 to i64
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt8valarrayIxEixEm(ptr noundef nonnull align 8 dereferenceable(16) %27, i64 noundef %58) #6
  store i64 %53, ptr %59, align 8, !tbaa !17
  call void @_ZNSt8valarrayIxED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  call void @_ZNSt8valarrayIxED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %60 = load i32, ptr %22, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %indvars.iv.next, %61
  br i1 %62, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !19

63:                                               ; preds = %40, %.lr.ph
  %64 = landingpad { ptr, i32 }
          cleanup
  br label %70

65:                                               ; preds = %44, %41
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %69

67:                                               ; preds = %47, %45
  %68 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt8valarrayIxED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #6
  br label %69

69:                                               ; preds = %67, %65
  %.pn = phi { ptr, i32 } [ %68, %67 ], [ %66, %65 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  call void @_ZNSt8valarrayIxED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  br label %70

70:                                               ; preds = %69, %63
  %.pn.pn = phi { ptr, i32 } [ %.pn, %69 ], [ %64, %63 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  call void @_ZN6matrixD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  resume { ptr, i32 } %.pn.pn

._crit_edge21:                                    ; preds = %._crit_edge, %.preheader.lr.ph, %16
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "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 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 = { noreturn nounwind }
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, !7, i64 4}
!6 = !{!"_ZTS6matrix", !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 = !{!"_ZTSSt8valarrayIxE", !11, i64 0, !12, i64 8}
!11 = !{!"long", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !7, i64 0}
!14 = distinct !{!14, !15, !16}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.unswitch.partial.disable"}
!17 = !{!18, !18, i64 0}
!18 = !{!"long long", !8, i64 0}
!19 = distinct !{!19, !15}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass