; LLVM IR from sp-nitech/SPTK :: src/math (statistics_accumulation)

; 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.sptk::SymmetricMatrix::Row" = type <{ ptr, ptr, i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.sptk::StatisticsAccumulation" = type <{ ptr, i32, i32, i8, i8, i8, [5 x i8] }>
%"class.sptk::StatisticsAccumulation::Buffer" = type { ptr, i32, %"class.std::vector", %"class.sptk::SymmetricMatrix", %"class.std::vector" }
%"class.sptk::SymmetricMatrix" = type { ptr, i32, %"class.std::vector", %"class.std::vector.0" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<double *, std::allocator<double *>>::_Vector_impl" }
%"struct.std::_Vector_base<double *, std::allocator<double *>>::_Vector_impl" = type { %"struct.std::_Vector_base<double *, std::allocator<double *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double *, std::allocator<double *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK4sptk22StatisticsAccumulation7GetMeanERKNS0_6BufferEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(19), ptr noundef nonnull align 8 dereferenceable(128), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4sptk22StatisticsAccumulation21GetDiagonalCovarianceERKNS0_6BufferEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(19) %0, ptr noundef nonnull align 8 dereferenceable(128) %1, ptr noundef %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.sptk::SymmetricMatrix::Row", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.std::vector", align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca %"class.sptk::SymmetricMatrix::Row", align 8
  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
  %19 = load ptr, ptr %5, align 8
  %20 = getelementptr inbounds %"class.sptk::StatisticsAccumulation", ptr %19, i32 0, i32 5
  %21 = load i8, ptr %20, align 2, !tbaa !9, !range !13, !noundef !14
  %22 = trunc i8 %21 to i1
  br i1 %22, label %23, label %35

23:                                               ; preds = %3
  %24 = getelementptr inbounds %"class.sptk::StatisticsAccumulation", ptr %19, i32 0, i32 2
  %25 = load i32, ptr %24, align 4, !tbaa !15
  %26 = icmp slt i32 %25, 2
  br i1 %26, label %35, label %27

27:                                               ; preds = %23
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.sptk::StatisticsAccumulation::Buffer", ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 8, !tbaa !16
  %31 = icmp sle i32 %30, 0
  br i1 %31, label %35, label %32

32:                                               ; preds = %27
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = icmp eq ptr null, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %32, %27, %23, %3
  store i1 false, ptr %4, align 1
  br label %154

36:                                               ; preds = %32
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %37) #5
  %39 = getelementptr inbounds %"class.sptk::StatisticsAccumulation", ptr %19, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !27
  %41 = add nsw i32 %40, 1
  %42 = sext i32 %41 to i64
  %43 = icmp ne i64 %38, %42
  br i1 %43, label %44, label %50

44:                                               ; preds = %36
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.sptk::StatisticsAccumulation", ptr %19, i32 0, i32 1
  %47 = load i32, ptr %46, align 8, !tbaa !27
  %48 = add nsw i32 %47, 1
  %49 = sext i32 %48 to i64
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %45, i64 noundef %49)
  br label %50

50:                                               ; preds = %44, %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %"class.sptk::StatisticsAccumulation::Buffer", ptr %51, i32 0, i32 1
  %53 = load i32, ptr %52, align 8, !tbaa !16
  %54 = sitofp i32 %53 to double
  %55 = fdiv double 1.000000e+00, %54
  store double %55, ptr %8, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %56, i64 noundef 0) #5
  store ptr %57, ptr %9, align 8, !tbaa !5
  %58 = getelementptr inbounds %"class.sptk::StatisticsAccumulation", ptr %19, i32 0, i32 4
  %59 = load i8, ptr %58, align 1, !tbaa !30, !range !13, !noundef !14
  %60 = trunc i8 %59 to i1
  br i1 %60, label %61, label %90

61:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !31
  br label %62

62:                                               ; preds = %82, %61
  %63 = load i32, ptr %10, align 4, !tbaa !31
  %64 = getelementptr inbounds %"class.sptk::StatisticsAccumulation", ptr %19, i32 0, i32 1
  %65 = load i32, ptr %64, align 8, !tbaa !27
  %66 = icmp sle i32 %63, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %89

68:                                               ; preds = %62
  %69 = load double, ptr %8, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #5
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %"class.sptk::StatisticsAccumulation::Buffer", ptr %70, i32 0, i32 3
  %72 = load i32, ptr %10, align 4, !tbaa !31
  call void @_ZNK4sptk15SymmetricMatrixixEi(ptr dead_on_unwind writable sret(%"class.sptk::SymmetricMatrix::Row") align 8 %11, ptr noundef nonnull align 8 dereferenceable(64) %71, i32 noundef %72)
  %73 = load i32, ptr %10, align 4, !tbaa !31
  %74 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4sptk15SymmetricMatrix3RowixEi(ptr noundef nonnull align 8 dereferenceable(20) %11, i32 noundef %73)
          to label %75 unwind label %85

75:                                               ; preds = %68
  %76 = load double, ptr %74, align 8, !tbaa !28
  %77 = fmul double %69, %76
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = load i32, ptr %10, align 4, !tbaa !31
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds double, ptr %78, i64 %80
  store double %77, ptr %81, align 8, !tbaa !28
  call void @_ZN4sptk15SymmetricMatrix3RowD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %11) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #5
  br label %82

82:                                               ; preds = %75
  %83 = load i32, ptr %10, align 4, !tbaa !31
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %10, align 4, !tbaa !31
  br label %62, !llvm.loop !32

85:                                               ; preds = %68
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %12, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %13, align 4
  call void @_ZN4sptk15SymmetricMatrix3RowD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %11) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %153

89:                                               ; preds = %67
  br label %151

90:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #5
  call void @_ZNSt6vectorIdSaIdEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #5
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = invoke noundef zeroext i1 @_ZNK4sptk22StatisticsAccumulation7GetMeanERKNS0_6BufferEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(19) %19, ptr noundef nonnull align 8 dereferenceable(128) %91, ptr noundef %14)
          to label %93 unwind label %95

93:                                               ; preds = %90
  br i1 %92, label %99, label %94

94:                                               ; preds = %93
  store i1 false, ptr %4, align 1
  store i32 1, ptr %15, align 4
  br label %147

95:                                               ; preds = %90
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %12, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %13, align 4
  br label %150

99:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef 0) #5
  store ptr %100, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !31
  br label %101

101:                                              ; preds = %134, %99
  %102 = load i32, ptr %17, align 4, !tbaa !31
  %103 = getelementptr inbounds %"class.sptk::StatisticsAccumulation", ptr %19, i32 0, i32 1
  %104 = load i32, ptr %103, align 8, !tbaa !27
  %105 = icmp sle i32 %102, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %101
  store i32 5, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %146

107:                                              ; preds = %101
  %108 = load double, ptr %8, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #5
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %"class.sptk::StatisticsAccumulation::Buffer", ptr %109, i32 0, i32 3
  %111 = load i32, ptr %17, align 4, !tbaa !31
  invoke void @_ZNK4sptk15SymmetricMatrixixEi(ptr dead_on_unwind writable sret(%"class.sptk::SymmetricMatrix::Row") align 8 %18, ptr noundef nonnull align 8 dereferenceable(64) %110, i32 noundef %111)
          to label %112 unwind label %137

112:                                              ; preds = %107
  %113 = load i32, ptr %17, align 4, !tbaa !31
  %114 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4sptk15SymmetricMatrix3RowixEi(ptr noundef nonnull align 8 dereferenceable(20) %18, i32 noundef %113)
          to label %115 unwind label %141

115:                                              ; preds = %112
  %116 = load double, ptr %114, align 8, !tbaa !28
  %117 = load ptr, ptr %16, align 8, !tbaa !5
  %118 = load i32, ptr %17, align 4, !tbaa !31
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds double, ptr %117, i64 %119
  %121 = load double, ptr %120, align 8, !tbaa !28
  %122 = load ptr, ptr %16, align 8, !tbaa !5
  %123 = load i32, ptr %17, align 4, !tbaa !31
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds double, ptr %122, i64 %124
  %126 = load double, ptr %125, align 8, !tbaa !28
  %127 = fmul double %121, %126
  %128 = fneg double %127
  %129 = call double @llvm.fmuladd.f64(double %108, double %116, double %128)
  %130 = load ptr, ptr %9, align 8, !tbaa !5
  %131 = load i32, ptr %17, align 4, !tbaa !31
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds double, ptr %130, i64 %132
  store double %129, ptr %133, align 8, !tbaa !28
  call void @_ZN4sptk15SymmetricMatrix3RowD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %18) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #5
  br label %134

134:                                              ; preds = %115
  %135 = load i32, ptr %17, align 4, !tbaa !31
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %17, align 4, !tbaa !31
  br label %101, !llvm.loop !34

137:                                              ; preds = %107
  %138 = landingpad { ptr, i32 }
          cleanup
  %139 = extractvalue { ptr, i32 } %138, 0
  store ptr %139, ptr %12, align 8
  %140 = extractvalue { ptr, i32 } %138, 1
  store i32 %140, ptr %13, align 4
  br label %145

141:                                              ; preds = %112
  %142 = landingpad { ptr, i32 }
          cleanup
  %143 = extractvalue { ptr, i32 } %142, 0
  store ptr %143, ptr %12, align 8
  %144 = extractvalue { ptr, i32 } %142, 1
  store i32 %144, ptr %13, align 4
  call void @_ZN4sptk15SymmetricMatrix3RowD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %18) #5
  br label %145

145:                                              ; preds = %141, %137
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %150

146:                                              ; preds = %106
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  store i32 0, ptr %15, align 4
  br label %147

147:                                              ; preds = %146, %94
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #5
  %148 = load i32, ptr %15, align 4
  switch i32 %148, label %152 [
    i32 0, label %149
  ]

149:                                              ; preds = %147
  br label %151

150:                                              ; preds = %145, %95
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #5
  br label %153

151:                                              ; preds = %149, %89
  store i1 true, ptr %4, align 1
  store i32 1, ptr %15, align 4
  br label %152

152:                                              ; preds = %151, %147
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %154

153:                                              ; preds = %150, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %156

154:                                              ; preds = %152, %35
  %155 = load i1, ptr %4, align 1
  ret i1 %155

156:                                              ; preds = %153
  %157 = load ptr, ptr %12, align 8
  %158 = load i32, ptr %13, align 4
  %159 = insertvalue { ptr, i32 } poison, ptr %157, 0
  %160 = insertvalue { ptr, i32 } %159, i32 %158, 1
  resume { ptr, i32 } %160
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK4sptk15SymmetricMatrixixEi(ptr dead_on_unwind noalias writable sret(%"class.sptk::SymmetricMatrix::Row") align 8, ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) #1 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4sptk15SymmetricMatrix3RowixEi(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4sptk15SymmetricMatrix3RowD2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #0 align 2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

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

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !12, i64 18}
!10 = !{!"_ZTSN4sptk22StatisticsAccumulationE", !11, i64 8, !11, i64 12, !12, i64 16, !12, i64 17, !12, i64 18}
!11 = !{!"int", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!10, !11, i64 12}
!16 = !{!17, !11, i64 8}
!17 = !{!"_ZTSN4sptk22StatisticsAccumulation6BufferE", !11, i64 8, !18, i64 16, !22, i64 40, !18, i64 104}
!18 = !{!"_ZTSSt6vectorIdSaIdEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTSN4sptk15SymmetricMatrixE", !11, i64 8, !18, i64 16, !23, i64 40}
!23 = !{!"_ZTSSt6vectorIPdSaIS0_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIPdSaIS0_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIPdSaIS0_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIPdSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!27 = !{!10, !11, i64 8}
!28 = !{!29, !29, i64 0}
!29 = !{!"double", !7, i64 0}
!30 = !{!10, !12, i64 17}
!31 = !{!11, !11, i64 0}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = distinct !{!34, !33}


; 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.sptk::SymmetricMatrix::Row" = type <{ ptr, ptr, i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK4sptk22StatisticsAccumulation7GetMeanERKNS0_6BufferEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(19), ptr noundef nonnull align 8 dereferenceable(128), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4sptk22StatisticsAccumulation21GetDiagonalCovarianceERKNS0_6BufferEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(19) %0, ptr noundef nonnull align 8 dereferenceable(128) %1, ptr noundef %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.sptk::SymmetricMatrix::Row", align 8
  %5 = alloca %"class.std::vector", align 8
  %6 = alloca %"class.sptk::SymmetricMatrix::Row", align 8
  %7 = getelementptr inbounds i8, ptr %0, i64 18
  %8 = load i8, ptr %7, align 2, !tbaa !5, !range !11, !noundef !12
  %9 = trunc nuw i8 %8 to i1
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  %11 = load i32, ptr %10, align 4
  %12 = icmp sgt i32 %11, 1
  %or.cond52.not = select i1 %9, i1 %12, i1 false
  br i1 %or.cond52.not, label %13, label %.loopexit

13:                                               ; preds = %3
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  %15 = load i32, ptr %14, align 8, !tbaa !13
  %16 = icmp slt i32 %15, 1
  %17 = icmp eq ptr %2, null
  %or.cond = or i1 %17, %16
  br i1 %or.cond, label %.loopexit, label %18

18:                                               ; preds = %13
  %19 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  %21 = load i32, ptr %20, align 8, !tbaa !25
  %22 = add nsw i32 %21, 1
  %23 = sext i32 %22 to i64
  %.not = icmp eq i64 %19, %23
  br i1 %.not, label %25, label %24

24:                                               ; preds = %18
  tail call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %23)
  br label %25

25:                                               ; preds = %24, %18
  %26 = load i32, ptr %14, align 8, !tbaa !13
  %27 = sitofp i32 %26 to double
  %28 = fdiv double 1.000000e+00, %27
  %29 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 0) #5
  %30 = getelementptr inbounds i8, ptr %0, i64 17
  %31 = load i8, ptr %30, align 1, !tbaa !26, !range !11, !noundef !12
  %32 = trunc nuw i8 %31 to i1
  br i1 %32, label %.preheader, label %46

.preheader:                                       ; preds = %25
  %33 = load i32, ptr %20, align 8, !tbaa !25
  %.not4656 = icmp slt i32 %33, 0
  br i1 %.not4656, label %.loopexit, label %.lr.ph58

.lr.ph58:                                         ; preds = %.preheader
  %34 = getelementptr inbounds i8, ptr %1, i64 40
  br label %35

35:                                               ; preds = %.lr.ph58, %38
  %indvars.iv60 = phi i64 [ 0, %.lr.ph58 ], [ %indvars.iv.next61, %38 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  %36 = trunc nuw nsw i64 %indvars.iv60 to i32
  call void @_ZNK4sptk15SymmetricMatrixixEi(ptr dead_on_unwind nonnull writable sret(%"class.sptk::SymmetricMatrix::Row") align 8 %4, ptr noundef nonnull align 8 dereferenceable(64) %34, i32 noundef %36)
  %37 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4sptk15SymmetricMatrix3RowixEi(ptr noundef nonnull align 8 dereferenceable(20) %4, i32 noundef %36)
          to label %38 unwind label %44

38:                                               ; preds = %35
  %39 = load double, ptr %37, align 8, !tbaa !27
  %40 = fmul double %28, %39
  %41 = getelementptr inbounds double, ptr %29, i64 %indvars.iv60
  store double %40, ptr %41, align 8, !tbaa !27
  call void @_ZN4sptk15SymmetricMatrix3RowD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %42 = load i32, ptr %20, align 8, !tbaa !25
  %43 = sext i32 %42 to i64
  %.not46.not = icmp slt i64 %indvars.iv60, %43
  br i1 %.not46.not, label %35, label %.loopexit, !llvm.loop !29

44:                                               ; preds = %35
  %45 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4sptk15SymmetricMatrix3RowD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  br label %75

46:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  call void @_ZNSt6vectorIdSaIdEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  %47 = invoke noundef zeroext i1 @_ZNK4sptk22StatisticsAccumulation7GetMeanERKNS0_6BufferEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(19) %0, ptr noundef nonnull align 8 dereferenceable(128) %1, ptr noundef nonnull %5)
          to label %48 unwind label %49

48:                                               ; preds = %46
  br i1 %47, label %51, label %.critedge

49:                                               ; preds = %46
  %50 = landingpad { ptr, i32 }
          cleanup
  br label %74

51:                                               ; preds = %48
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef 0) #5
  %53 = load i32, ptr %20, align 8, !tbaa !25
  %.not4354 = icmp slt i32 %53, 0
  br i1 %.not4354, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %51
  %54 = getelementptr inbounds i8, ptr %1, i64 40
  br label %55

55:                                               ; preds = %.lr.ph, %59
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %59 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  %56 = trunc nuw nsw i64 %indvars.iv to i32
  invoke void @_ZNK4sptk15SymmetricMatrixixEi(ptr dead_on_unwind nonnull writable sret(%"class.sptk::SymmetricMatrix::Row") align 8 %6, ptr noundef nonnull align 8 dereferenceable(64) %54, i32 noundef %56)
          to label %57 unwind label %69

57:                                               ; preds = %55
  %58 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4sptk15SymmetricMatrix3RowixEi(ptr noundef nonnull align 8 dereferenceable(20) %6, i32 noundef %56)
          to label %59 unwind label %71

59:                                               ; preds = %57
  %60 = load double, ptr %58, align 8, !tbaa !27
  %61 = getelementptr inbounds double, ptr %52, i64 %indvars.iv
  %62 = load double, ptr %61, align 8, !tbaa !27
  %63 = fneg double %62
  %64 = fmul double %62, %63
  %65 = call double @llvm.fmuladd.f64(double %28, double %60, double %64)
  %66 = getelementptr inbounds double, ptr %29, i64 %indvars.iv
  store double %65, ptr %66, align 8, !tbaa !27
  call void @_ZN4sptk15SymmetricMatrix3RowD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %67 = load i32, ptr %20, align 8, !tbaa !25
  %68 = sext i32 %67 to i64
  %.not43.not = icmp slt i64 %indvars.iv, %68
  br i1 %.not43.not, label %55, label %._crit_edge, !llvm.loop !31

69:                                               ; preds = %55
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %73

71:                                               ; preds = %57
  %72 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4sptk15SymmetricMatrix3RowD2Ev(ptr noundef nonnull align 8 dereferenceable(20) %6) #5
  br label %73

73:                                               ; preds = %71, %69
  %.pn = phi { ptr, i32 } [ %72, %71 ], [ %70, %69 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  br label %74

._crit_edge:                                      ; preds = %59, %51
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  br label %.loopexit

74:                                               ; preds = %73, %49
  %.pn.pn = phi { ptr, i32 } [ %.pn, %73 ], [ %50, %49 ]
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  br label %75

.critedge:                                        ; preds = %48
  call void @_ZNSt6vectorIdSaIdEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  br label %.loopexit

75:                                               ; preds = %74, %44
  %.pn47 = phi { ptr, i32 } [ %45, %44 ], [ %.pn.pn, %74 ]
  resume { ptr, i32 } %.pn47

.loopexit:                                        ; preds = %38, %.preheader, %._crit_edge, %.critedge, %3, %13
  %.2 = phi i1 [ false, %13 ], [ false, %3 ], [ false, %.critedge ], [ true, %._crit_edge ], [ true, %.preheader ], [ true, %38 ]
  ret i1 %.2
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK4sptk15SymmetricMatrixixEi(ptr dead_on_unwind noalias writable sret(%"class.sptk::SymmetricMatrix::Row") align 8, ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) local_unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNK4sptk15SymmetricMatrix3RowixEi(ptr noundef nonnull align 8 dereferenceable(20), i32 noundef) local_unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4sptk15SymmetricMatrix3RowD2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

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

attributes #0 = { 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !10, i64 18}
!6 = !{!"_ZTSN4sptk22StatisticsAccumulationE", !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 17, !10, i64 18}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !7, i64 8}
!14 = !{!"_ZTSN4sptk22StatisticsAccumulation6BufferE", !7, i64 8, !15, i64 16, !20, i64 40, !15, i64 104}
!15 = !{!"_ZTSSt6vectorIdSaIdEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !19, i64 0, !19, i64 8, !19, i64 16}
!19 = !{!"any pointer", !8, i64 0}
!20 = !{!"_ZTSN4sptk15SymmetricMatrixE", !7, i64 8, !15, i64 16, !21, i64 40}
!21 = !{!"_ZTSSt6vectorIPdSaIS0_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIPdSaIS0_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIPdSaIS0_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIPdSaIS0_EE17_Vector_impl_dataE", !19, i64 0, !19, i64 8, !19, i64 16}
!25 = !{!6, !7, i64 8}
!26 = !{!6, !10, i64 17}
!27 = !{!28, !28, i64 0}
!28 = !{!"double", !8, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}


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