; LLVM IR from buresjan/optim_lbm :: nomad/ext/sgtelib/src/TrainingSet.ll (ZN7SGTELIB11TrainingSet16compute_mean_stdEv)

; 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.SGTELIB::TrainingSet" = type { ptr, i32, i32, i32, i8, ptr, i8, i32, double, double, i32, %"class.SGTELIB::Matrix", %"class.SGTELIB::Matrix", %"class.SGTELIB::Matrix", %"class.SGTELIB::Matrix", %"class.SGTELIB::Matrix", i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, double }
%"class.SGTELIB::Matrix" = type { ptr, %"class.std::__cxx11::basic_string", i32, i32, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

; 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

declare noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7SGTELIB11TrainingSet16compute_mean_stdEv(ptr noundef nonnull align 8 dereferenceable(504) %0) #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %9

9:                                                ; preds = %77, %1
  %10 = load i32, ptr %4, align 4, !tbaa !9
  %11 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 2
  %12 = load i32, ptr %11, align 4, !tbaa !11
  %13 = icmp slt i32 %10, %12
  br i1 %13, label %14, label %80

14:                                               ; preds = %9
  store double 0.000000e+00, ptr %6, align 8, !tbaa !19
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %27, %14
  %16 = load i32, ptr %3, align 4, !tbaa !9
  %17 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 1
  %18 = load i32, ptr %17, align 8, !tbaa !20
  %19 = icmp slt i32 %16, %18
  br i1 %19, label %20, label %30

20:                                               ; preds = %15
  %21 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 11
  %22 = load i32, ptr %3, align 4, !tbaa !9
  %23 = load i32, ptr %4, align 4, !tbaa !9
  %24 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %21, i32 noundef %22, i32 noundef %23)
  %25 = load double, ptr %6, align 8, !tbaa !19
  %26 = fadd double %25, %24
  store double %26, ptr %6, align 8, !tbaa !19
  br label %27

27:                                               ; preds = %20
  %28 = load i32, ptr %3, align 4, !tbaa !9
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %3, align 4, !tbaa !9
  br label %15, !llvm.loop !21

30:                                               ; preds = %15
  %31 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 1
  %32 = load i32, ptr %31, align 8, !tbaa !20
  %33 = sitofp i32 %32 to double
  %34 = load double, ptr %6, align 8, !tbaa !19
  %35 = fdiv double %34, %33
  store double %35, ptr %6, align 8, !tbaa !19
  %36 = load double, ptr %6, align 8, !tbaa !19
  %37 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 23
  %38 = load ptr, ptr %37, align 8, !tbaa !23
  %39 = load i32, ptr %4, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds double, ptr %38, i64 %40
  store double %36, ptr %41, align 8, !tbaa !19
  store double 0.000000e+00, ptr %7, align 8, !tbaa !19
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %60, %30
  %43 = load i32, ptr %3, align 4, !tbaa !9
  %44 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 1
  %45 = load i32, ptr %44, align 8, !tbaa !20
  %46 = icmp slt i32 %43, %45
  br i1 %46, label %47, label %63

47:                                               ; preds = %42
  %48 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 11
  %49 = load i32, ptr %3, align 4, !tbaa !9
  %50 = load i32, ptr %4, align 4, !tbaa !9
  %51 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %48, i32 noundef %49, i32 noundef %50)
  store double %51, ptr %5, align 8, !tbaa !19
  %52 = load double, ptr %5, align 8, !tbaa !19
  %53 = load double, ptr %6, align 8, !tbaa !19
  %54 = fsub double %52, %53
  %55 = load double, ptr %5, align 8, !tbaa !19
  %56 = load double, ptr %6, align 8, !tbaa !19
  %57 = fsub double %55, %56
  %58 = load double, ptr %7, align 8, !tbaa !19
  %59 = call double @llvm.fmuladd.f64(double %54, double %57, double %58)
  store double %59, ptr %7, align 8, !tbaa !19
  br label %60

60:                                               ; preds = %47
  %61 = load i32, ptr %3, align 4, !tbaa !9
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %3, align 4, !tbaa !9
  br label %42, !llvm.loop !24

63:                                               ; preds = %42
  %64 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 1
  %65 = load i32, ptr %64, align 8, !tbaa !20
  %66 = sub nsw i32 %65, 1
  %67 = sitofp i32 %66 to double
  %68 = load double, ptr %7, align 8, !tbaa !19
  %69 = fdiv double %68, %67
  store double %69, ptr %7, align 8, !tbaa !19
  %70 = load double, ptr %7, align 8, !tbaa !19
  %71 = call double @sqrt(double noundef %70) #6
  %72 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 24
  %73 = load ptr, ptr %72, align 8, !tbaa !25
  %74 = load i32, ptr %4, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds double, ptr %73, i64 %75
  store double %71, ptr %76, align 8, !tbaa !19
  br label %77

77:                                               ; preds = %63
  %78 = load i32, ptr %4, align 4, !tbaa !9
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %4, align 4, !tbaa !9
  br label %9, !llvm.loop !26

80:                                               ; preds = %9
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %81

81:                                               ; preds = %170, %80
  %82 = load i32, ptr %4, align 4, !tbaa !9
  %83 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 3
  %84 = load i32, ptr %83, align 8, !tbaa !27
  %85 = icmp slt i32 %82, %84
  br i1 %85, label %86, label %173

86:                                               ; preds = %81
  store double 0.000000e+00, ptr %6, align 8, !tbaa !19
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %87

87:                                               ; preds = %110, %86
  %88 = load i32, ptr %3, align 4, !tbaa !9
  %89 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 1
  %90 = load i32, ptr %89, align 8, !tbaa !20
  %91 = icmp slt i32 %88, %90
  br i1 %91, label %92, label %113

92:                                               ; preds = %87
  %93 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 12
  %94 = load i32, ptr %3, align 4, !tbaa !9
  %95 = load i32, ptr %4, align 4, !tbaa !9
  %96 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %93, i32 noundef %94, i32 noundef %95)
  store double %96, ptr %5, align 8, !tbaa !19
  %97 = load double, ptr %5, align 8, !tbaa !19
  %98 = call noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef %97)
  br i1 %98, label %106, label %99

99:                                               ; preds = %92
  %100 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 30
  %101 = load ptr, ptr %100, align 8, !tbaa !28
  %102 = load i32, ptr %4, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds double, ptr %101, i64 %103
  %105 = load double, ptr %104, align 8, !tbaa !19
  store double %105, ptr %5, align 8, !tbaa !19
  br label %106

106:                                              ; preds = %99, %92
  %107 = load double, ptr %5, align 8, !tbaa !19
  %108 = load double, ptr %6, align 8, !tbaa !19
  %109 = fadd double %108, %107
  store double %109, ptr %6, align 8, !tbaa !19
  br label %110

110:                                              ; preds = %106
  %111 = load i32, ptr %3, align 4, !tbaa !9
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %3, align 4, !tbaa !9
  br label %87, !llvm.loop !29

113:                                              ; preds = %87
  %114 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 1
  %115 = load i32, ptr %114, align 8, !tbaa !20
  %116 = sitofp i32 %115 to double
  %117 = load double, ptr %6, align 8, !tbaa !19
  %118 = fdiv double %117, %116
  store double %118, ptr %6, align 8, !tbaa !19
  %119 = load double, ptr %6, align 8, !tbaa !19
  %120 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 33
  %121 = load ptr, ptr %120, align 8, !tbaa !30
  %122 = load i32, ptr %4, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds double, ptr %121, i64 %123
  store double %119, ptr %124, align 8, !tbaa !19
  store double 0.000000e+00, ptr %7, align 8, !tbaa !19
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %125

125:                                              ; preds = %153, %113
  %126 = load i32, ptr %3, align 4, !tbaa !9
  %127 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 1
  %128 = load i32, ptr %127, align 8, !tbaa !20
  %129 = icmp slt i32 %126, %128
  br i1 %129, label %130, label %156

130:                                              ; preds = %125
  %131 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 12
  %132 = load i32, ptr %3, align 4, !tbaa !9
  %133 = load i32, ptr %4, align 4, !tbaa !9
  %134 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %131, i32 noundef %132, i32 noundef %133)
  store double %134, ptr %5, align 8, !tbaa !19
  %135 = load double, ptr %5, align 8, !tbaa !19
  %136 = call noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef %135)
  br i1 %136, label %144, label %137

137:                                              ; preds = %130
  %138 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 30
  %139 = load ptr, ptr %138, align 8, !tbaa !28
  %140 = load i32, ptr %4, align 4, !tbaa !9
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds double, ptr %139, i64 %141
  %143 = load double, ptr %142, align 8, !tbaa !19
  store double %143, ptr %5, align 8, !tbaa !19
  br label %144

144:                                              ; preds = %137, %130
  %145 = load double, ptr %5, align 8, !tbaa !19
  %146 = load double, ptr %6, align 8, !tbaa !19
  %147 = fsub double %145, %146
  %148 = load double, ptr %5, align 8, !tbaa !19
  %149 = load double, ptr %6, align 8, !tbaa !19
  %150 = fsub double %148, %149
  %151 = load double, ptr %7, align 8, !tbaa !19
  %152 = call double @llvm.fmuladd.f64(double %147, double %150, double %151)
  store double %152, ptr %7, align 8, !tbaa !19
  br label %153

153:                                              ; preds = %144
  %154 = load i32, ptr %3, align 4, !tbaa !9
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %3, align 4, !tbaa !9
  br label %125, !llvm.loop !31

156:                                              ; preds = %125
  %157 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 1
  %158 = load i32, ptr %157, align 8, !tbaa !20
  %159 = sub nsw i32 %158, 1
  %160 = sitofp i32 %159 to double
  %161 = load double, ptr %7, align 8, !tbaa !19
  %162 = fdiv double %161, %160
  store double %162, ptr %7, align 8, !tbaa !19
  %163 = load double, ptr %7, align 8, !tbaa !19
  %164 = call double @sqrt(double noundef %163) #6
  %165 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %8, i32 0, i32 34
  %166 = load ptr, ptr %165, align 8, !tbaa !32
  %167 = load i32, ptr %4, align 4, !tbaa !9
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds double, ptr %166, i64 %168
  store double %164, ptr %169, align 8, !tbaa !19
  br label %170

170:                                              ; preds = %156
  %171 = load i32, ptr %4, align 4, !tbaa !9
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %4, align 4, !tbaa !9
  br label %81, !llvm.loop !33

173:                                              ; preds = %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  ret void
}

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #3 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 12}
!12 = !{!"_ZTSN7SGTELIB11TrainingSetE", !10, i64 8, !10, i64 12, !10, i64 16, !13, i64 20, !6, i64 24, !13, i64 32, !10, i64 36, !14, i64 40, !14, i64 48, !10, i64 56, !15, i64 64, !15, i64 120, !15, i64 176, !15, i64 232, !15, i64 288, !10, i64 344, !10, i64 348, !10, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !6, i64 400, !6, i64 408, !10, i64 416, !10, i64 420, !6, i64 424, !6, i64 432, !6, i64 440, !6, i64 448, !6, i64 456, !6, i64 464, !6, i64 472, !6, i64 480, !6, i64 488, !14, i64 496}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTSN7SGTELIB6MatrixE", !16, i64 8, !10, i64 40, !10, i64 44, !6, i64 48}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !18, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!14, !14, i64 0}
!20 = !{!12, !10, i64 8}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!12, !6, i64 392}
!24 = distinct !{!24, !22}
!25 = !{!12, !6, i64 400}
!26 = distinct !{!26, !22}
!27 = !{!12, !10, i64 16}
!28 = !{!12, !6, i64 440}
!29 = distinct !{!29, !22}
!30 = !{!12, !6, i64 464}
!31 = distinct !{!31, !22}
!32 = !{!12, !6, i64 472}
!33 = distinct !{!33, !22}


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

declare noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7SGTELIB11TrainingSet16compute_mean_stdEv(ptr noundef nonnull align 8 dereferenceable(504) %0) local_unnamed_addr #2 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 12
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.preheader62.lr.ph, label %.preheader61

.preheader62.lr.ph:                               ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = getelementptr inbounds i8, ptr %0, i64 64
  %7 = getelementptr inbounds i8, ptr %0, i64 392
  %8 = getelementptr inbounds i8, ptr %0, i64 400
  br label %.preheader62

.preheader62:                                     ; preds = %.preheader62.lr.ph, %._crit_edge75
  %indvars.iv = phi i64 [ 0, %.preheader62.lr.ph ], [ %indvars.iv.next, %._crit_edge75 ]
  %9 = load i32, ptr %5, align 8, !tbaa !17
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph.preheader, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader62
  %11 = sitofp i32 %9 to double
  %12 = fdiv double 0.000000e+00, %11
  %13 = load ptr, ptr %7, align 8, !tbaa !18
  %14 = getelementptr inbounds double, ptr %13, i64 %indvars.iv
  store double %12, ptr %14, align 8, !tbaa !19
  br label %._crit_edge75

.lr.ph.preheader:                                 ; preds = %.preheader62
  %15 = trunc nuw nsw i64 %indvars.iv to i32
  br label %.lr.ph

.preheader61:                                     ; preds = %._crit_edge75, %1
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  %17 = load i32, ptr %16, align 8, !tbaa !20
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.preheader.lr.ph, label %._crit_edge93

.preheader.lr.ph:                                 ; preds = %.preheader61
  %19 = getelementptr inbounds i8, ptr %0, i64 8
  %20 = getelementptr inbounds i8, ptr %0, i64 120
  %21 = getelementptr inbounds i8, ptr %0, i64 440
  %22 = getelementptr inbounds i8, ptr %0, i64 464
  %23 = getelementptr inbounds i8, ptr %0, i64 472
  br label %.preheader

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.04969 = phi double [ %25, %.lr.ph ], [ 0.000000e+00, %.lr.ph.preheader ]
  %.05568 = phi i32 [ %26, %.lr.ph ], [ 0, %.lr.ph.preheader ]
  %24 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %6, i32 noundef %.05568, i32 noundef %15)
  %25 = fadd double %.04969, %24
  %26 = add nuw nsw i32 %.05568, 1
  %27 = load i32, ptr %5, align 8, !tbaa !17
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !21

._crit_edge:                                      ; preds = %.lr.ph
  %29 = sitofp i32 %27 to double
  %30 = fdiv double %25, %29
  %31 = load ptr, ptr %7, align 8, !tbaa !18
  %32 = getelementptr inbounds double, ptr %31, i64 %indvars.iv
  store double %30, ptr %32, align 8, !tbaa !19
  %33 = icmp sgt i32 %27, 0
  br i1 %33, label %.lr.ph74.preheader, label %._crit_edge75

.lr.ph74.preheader:                               ; preds = %._crit_edge
  %34 = trunc nuw nsw i64 %indvars.iv to i32
  br label %.lr.ph74

.lr.ph74:                                         ; preds = %.lr.ph74.preheader, %.lr.ph74
  %.072 = phi double [ %37, %.lr.ph74 ], [ 0.000000e+00, %.lr.ph74.preheader ]
  %.15671 = phi i32 [ %38, %.lr.ph74 ], [ 0, %.lr.ph74.preheader ]
  %35 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %6, i32 noundef %.15671, i32 noundef %34)
  %36 = fsub double %35, %30
  %37 = tail call double @llvm.fmuladd.f64(double %36, double %36, double %.072)
  %38 = add nuw nsw i32 %.15671, 1
  %39 = load i32, ptr %5, align 8, !tbaa !17
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %.lr.ph74, label %._crit_edge75, !llvm.loop !23

._crit_edge75:                                    ; preds = %.lr.ph74, %._crit_edge.thread, %._crit_edge
  %.0.lcssa = phi double [ 0.000000e+00, %._crit_edge ], [ 0.000000e+00, %._crit_edge.thread ], [ %37, %.lr.ph74 ]
  %.lcssa67 = phi i32 [ %27, %._crit_edge ], [ %9, %._crit_edge.thread ], [ %39, %.lr.ph74 ]
  %41 = add nsw i32 %.lcssa67, -1
  %42 = sitofp i32 %41 to double
  %43 = fdiv double %.0.lcssa, %42
  %44 = tail call double @sqrt(double noundef %43) #5
  %45 = load ptr, ptr %8, align 8, !tbaa !24
  %46 = getelementptr inbounds double, ptr %45, i64 %indvars.iv
  store double %44, ptr %46, align 8, !tbaa !19
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = icmp slt i64 %indvars.iv.next, %48
  br i1 %49, label %.preheader62, label %.preheader61, !llvm.loop !25

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge89
  %indvars.iv103 = phi i64 [ 0, %.preheader.lr.ph ], [ %indvars.iv.next104, %._crit_edge89 ]
  %50 = load i32, ptr %19, align 8, !tbaa !17
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %.lr.ph81, label %._crit_edge82.thread

._crit_edge82.thread:                             ; preds = %.preheader
  %52 = sitofp i32 %50 to double
  %53 = fdiv double 0.000000e+00, %52
  %54 = load ptr, ptr %22, align 8, !tbaa !26
  %55 = getelementptr inbounds double, ptr %54, i64 %indvars.iv103
  store double %53, ptr %55, align 8, !tbaa !19
  br label %._crit_edge89

.lr.ph81:                                         ; preds = %.preheader
  %56 = trunc nuw nsw i64 %indvars.iv103 to i32
  br label %57

57:                                               ; preds = %.lr.ph81, %64
  %.15080 = phi double [ 0.000000e+00, %.lr.ph81 ], [ %65, %64 ]
  %.279 = phi i32 [ 0, %.lr.ph81 ], [ %66, %64 ]
  %58 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %20, i32 noundef %.279, i32 noundef %56)
  %59 = tail call noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef %58)
  br i1 %59, label %64, label %60

60:                                               ; preds = %57
  %61 = load ptr, ptr %21, align 8, !tbaa !27
  %62 = getelementptr inbounds double, ptr %61, i64 %indvars.iv103
  %63 = load double, ptr %62, align 8, !tbaa !19
  br label %64

64:                                               ; preds = %60, %57
  %.051 = phi double [ %58, %57 ], [ %63, %60 ]
  %65 = fadd double %.15080, %.051
  %66 = add nuw nsw i32 %.279, 1
  %67 = load i32, ptr %19, align 8, !tbaa !17
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %57, label %._crit_edge82, !llvm.loop !28

._crit_edge82:                                    ; preds = %64
  %69 = sitofp i32 %67 to double
  %70 = fdiv double %65, %69
  %71 = load ptr, ptr %22, align 8, !tbaa !26
  %72 = getelementptr inbounds double, ptr %71, i64 %indvars.iv103
  store double %70, ptr %72, align 8, !tbaa !19
  %73 = icmp sgt i32 %67, 0
  br i1 %73, label %.lr.ph88.preheader, label %._crit_edge89

.lr.ph88.preheader:                               ; preds = %._crit_edge82
  %74 = trunc nuw nsw i64 %indvars.iv103 to i32
  br label %.lr.ph88

.lr.ph88:                                         ; preds = %.lr.ph88.preheader, %81
  %.186 = phi double [ %83, %81 ], [ 0.000000e+00, %.lr.ph88.preheader ]
  %.385 = phi i32 [ %84, %81 ], [ 0, %.lr.ph88.preheader ]
  %75 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %20, i32 noundef %.385, i32 noundef %74)
  %76 = tail call noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef %75)
  br i1 %76, label %81, label %77

77:                                               ; preds = %.lr.ph88
  %78 = load ptr, ptr %21, align 8, !tbaa !27
  %79 = getelementptr inbounds double, ptr %78, i64 %indvars.iv103
  %80 = load double, ptr %79, align 8, !tbaa !19
  br label %81

81:                                               ; preds = %77, %.lr.ph88
  %.152 = phi double [ %75, %.lr.ph88 ], [ %80, %77 ]
  %82 = fsub double %.152, %70
  %83 = tail call double @llvm.fmuladd.f64(double %82, double %82, double %.186)
  %84 = add nuw nsw i32 %.385, 1
  %85 = load i32, ptr %19, align 8, !tbaa !17
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %.lr.ph88, label %._crit_edge89, !llvm.loop !29

._crit_edge89:                                    ; preds = %81, %._crit_edge82.thread, %._crit_edge82
  %.1.lcssa = phi double [ 0.000000e+00, %._crit_edge82 ], [ 0.000000e+00, %._crit_edge82.thread ], [ %83, %81 ]
  %.lcssa64 = phi i32 [ %67, %._crit_edge82 ], [ %50, %._crit_edge82.thread ], [ %85, %81 ]
  %87 = add nsw i32 %.lcssa64, -1
  %88 = sitofp i32 %87 to double
  %89 = fdiv double %.1.lcssa, %88
  %90 = tail call double @sqrt(double noundef %89) #5
  %91 = load ptr, ptr %23, align 8, !tbaa !30
  %92 = getelementptr inbounds double, ptr %91, i64 %indvars.iv103
  store double %90, ptr %92, align 8, !tbaa !19
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %93 = load i32, ptr %16, align 8, !tbaa !20
  %94 = sext i32 %93 to i64
  %95 = icmp slt i64 %indvars.iv.next104, %94
  br i1 %95, label %.preheader, label %._crit_edge93, !llvm.loop !31

._crit_edge93:                                    ; preds = %._crit_edge89, %.preheader61
  ret void
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4

attributes #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 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "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 12}
!6 = !{!"_ZTSN7SGTELIB11TrainingSetE", !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 20, !11, i64 24, !10, i64 32, !7, i64 36, !12, i64 40, !12, i64 48, !7, i64 56, !13, i64 64, !13, i64 120, !13, i64 176, !13, i64 232, !13, i64 288, !7, i64 344, !7, i64 348, !7, i64 352, !11, i64 360, !11, i64 368, !11, i64 376, !11, i64 384, !11, i64 392, !11, i64 400, !11, i64 408, !7, i64 416, !7, i64 420, !11, i64 424, !11, i64 432, !11, i64 440, !11, i64 448, !11, i64 456, !11, i64 464, !11, i64 472, !11, i64 480, !11, i64 488, !12, i64 496}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!"_ZTSN7SGTELIB6MatrixE", !14, i64 8, !7, i64 40, !7, i64 44, !11, i64 48}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !8, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !11, i64 0}
!16 = !{!"long", !8, i64 0}
!17 = !{!6, !7, i64 8}
!18 = !{!6, !11, i64 392}
!19 = !{!12, !12, i64 0}
!20 = !{!6, !7, i64 16}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = !{!6, !11, i64 400}
!25 = distinct !{!25, !22}
!26 = !{!6, !11, i64 464}
!27 = !{!6, !11, i64 440}
!28 = distinct !{!28, !22}
!29 = distinct !{!29, !22}
!30 = !{!6, !11, i64 472}
!31 = distinct !{!31, !22}


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