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

; 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

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

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

13:                                               ; preds = %8
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %41, %13
  %15 = load i32, ptr %5, align 4, !tbaa !9
  %16 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 1
  %17 = load i32, ptr %16, align 8, !tbaa !19
  %18 = icmp slt i32 %15, %17
  br i1 %18, label %19, label %44

19:                                               ; preds = %14
  %20 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 11
  %21 = load i32, ptr %5, align 4, !tbaa !9
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %20, i32 noundef %21, i32 noundef %22)
  %24 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 21
  %25 = load ptr, ptr %24, align 8, !tbaa !20
  %26 = load i32, ptr %6, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds double, ptr %25, i64 %27
  %29 = load double, ptr %28, align 8, !tbaa !21
  %30 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 22
  %31 = load ptr, ptr %30, align 8, !tbaa !22
  %32 = load i32, ptr %6, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds double, ptr %31, i64 %33
  %35 = load double, ptr %34, align 8, !tbaa !21
  %36 = call double @llvm.fmuladd.f64(double %23, double %29, double %35)
  store double %36, ptr %3, align 8, !tbaa !21
  %37 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 13
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = load double, ptr %3, align 8, !tbaa !21
  call void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %37, i32 noundef %38, i32 noundef %39, double noundef %40)
  br label %41

41:                                               ; preds = %19
  %42 = load i32, ptr %5, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %5, align 4, !tbaa !9
  br label %14, !llvm.loop !23

44:                                               ; preds = %14
  br label %45

45:                                               ; preds = %44
  %46 = load i32, ptr %6, align 4, !tbaa !9
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %6, align 4, !tbaa !9
  br label %8, !llvm.loop !25

48:                                               ; preds = %8
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %110, %48
  %50 = load i32, ptr %6, align 4, !tbaa !9
  %51 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 3
  %52 = load i32, ptr %51, align 8, !tbaa !26
  %53 = icmp slt i32 %50, %52
  br i1 %53, label %54, label %113

54:                                               ; preds = %49
  store double 0.000000e+00, ptr %4, align 8, !tbaa !21
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %96, %54
  %56 = load i32, ptr %5, align 4, !tbaa !9
  %57 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 1
  %58 = load i32, ptr %57, align 8, !tbaa !19
  %59 = icmp slt i32 %56, %58
  br i1 %59, label %60, label %99

60:                                               ; preds = %55
  %61 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 12
  %62 = load i32, ptr %5, align 4, !tbaa !9
  %63 = load i32, ptr %6, align 4, !tbaa !9
  %64 = call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %61, i32 noundef %62, i32 noundef %63)
  store double %64, ptr %3, align 8, !tbaa !21
  %65 = load double, ptr %3, align 8, !tbaa !21
  %66 = call noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef %65)
  br i1 %66, label %74, label %67

67:                                               ; preds = %60
  %68 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 30
  %69 = load ptr, ptr %68, align 8, !tbaa !27
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds double, ptr %69, i64 %71
  %73 = load double, ptr %72, align 8, !tbaa !21
  store double %73, ptr %3, align 8, !tbaa !21
  br label %74

74:                                               ; preds = %67, %60
  %75 = load double, ptr %3, align 8, !tbaa !21
  %76 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 31
  %77 = load ptr, ptr %76, align 8, !tbaa !28
  %78 = load i32, ptr %6, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds double, ptr %77, i64 %79
  %81 = load double, ptr %80, align 8, !tbaa !21
  %82 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 32
  %83 = load ptr, ptr %82, align 8, !tbaa !29
  %84 = load i32, ptr %6, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds double, ptr %83, i64 %85
  %87 = load double, ptr %86, align 8, !tbaa !21
  %88 = call double @llvm.fmuladd.f64(double %75, double %81, double %87)
  store double %88, ptr %3, align 8, !tbaa !21
  %89 = load double, ptr %3, align 8, !tbaa !21
  %90 = load double, ptr %4, align 8, !tbaa !21
  %91 = fadd double %90, %89
  store double %91, ptr %4, align 8, !tbaa !21
  %92 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 14
  %93 = load i32, ptr %5, align 4, !tbaa !9
  %94 = load i32, ptr %6, align 4, !tbaa !9
  %95 = load double, ptr %3, align 8, !tbaa !21
  call void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %92, i32 noundef %93, i32 noundef %94, double noundef %95)
  br label %96

96:                                               ; preds = %74
  %97 = load i32, ptr %5, align 4, !tbaa !9
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %5, align 4, !tbaa !9
  br label %55, !llvm.loop !30

99:                                               ; preds = %55
  %100 = load double, ptr %4, align 8, !tbaa !21
  %101 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 1
  %102 = load i32, ptr %101, align 8, !tbaa !19
  %103 = sitofp i32 %102 to double
  %104 = fdiv double %100, %103
  %105 = getelementptr inbounds %"class.SGTELIB::TrainingSet", ptr %7, i32 0, i32 35
  %106 = load ptr, ptr %105, align 8, !tbaa !31
  %107 = load i32, ptr %6, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds double, ptr %106, i64 %108
  store double %104, ptr %109, align 8, !tbaa !21
  br label %110

110:                                              ; preds = %99
  %111 = load i32, ptr %6, align 4, !tbaa !9
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %6, align 4, !tbaa !9
  br label %49, !llvm.loop !32

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

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

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

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

declare void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef, double noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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 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 #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, !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 = !{!12, !10, i64 8}
!20 = !{!12, !6, i64 376}
!21 = !{!14, !14, i64 0}
!22 = !{!12, !6, i64 384}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = distinct !{!25, !24}
!26 = !{!12, !10, i64 16}
!27 = !{!12, !6, i64 440}
!28 = !{!12, !6, i64 448}
!29 = !{!12, !6, i64 456}
!30 = distinct !{!30, !24}
!31 = !{!12, !6, i64 480}
!32 = distinct !{!32, !24}


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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7SGTELIB11TrainingSet23compute_scaled_matricesEv(ptr noundef nonnull align 8 dereferenceable(504) %0) local_unnamed_addr #0 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 %.preheader35.lr.ph, label %.preheader34

.preheader35.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 376
  %8 = getelementptr inbounds i8, ptr %0, i64 384
  %9 = getelementptr inbounds i8, ptr %0, i64 176
  %10 = load i32, ptr %5, align 8, !tbaa !17
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.preheader35, label %.preheader34

.preheader35:                                     ; preds = %.preheader35.lr.ph, %._crit_edge
  %12 = phi i32 [ %47, %._crit_edge ], [ %3, %.preheader35.lr.ph ]
  %13 = phi i32 [ %48, %._crit_edge ], [ %10, %.preheader35.lr.ph ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 0, %.preheader35.lr.ph ]
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge

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

.preheader34:                                     ; preds = %._crit_edge, %.preheader35.lr.ph, %1
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  %17 = load i32, ptr %16, align 8, !tbaa !18
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.preheader.lr.ph, label %._crit_edge44

.preheader.lr.ph:                                 ; preds = %.preheader34
  %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 448
  %23 = getelementptr inbounds i8, ptr %0, i64 456
  %24 = getelementptr inbounds i8, ptr %0, i64 232
  %25 = getelementptr inbounds i8, ptr %0, i64 480
  %26 = load i32, ptr %19, align 8, !tbaa !17
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.preheader, label %.preheader.lr.ph.split.us

.preheader.lr.ph.split.us:                        ; preds = %.preheader.lr.ph
  %28 = sitofp i32 %26 to double
  %29 = fdiv double 0.000000e+00, %28
  %30 = load ptr, ptr %25, align 8, !tbaa !19
  %wide.trip.count = zext nneg i32 %17 to i64
  %min.iters.check = icmp ult i32 %17, 4
  br i1 %min.iters.check, label %.preheader.us.preheader, label %vector.ph

vector.ph:                                        ; preds = %.preheader.lr.ph.split.us
  %n.vec = and i64 %wide.trip.count, 2147483644
  %broadcast.splatinsert = insertelement <2 x double> poison, double %29, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %31 = getelementptr inbounds double, ptr %30, i64 %index
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  store <2 x double> %broadcast.splat, ptr %31, align 8, !tbaa !20
  store <2 x double> %broadcast.splat, ptr %32, align 8, !tbaa !20
  %index.next = add nuw i64 %index, 4
  %33 = icmp eq i64 %index.next, %n.vec
  br i1 %33, label %middle.block, label %vector.body, !llvm.loop !21

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge44, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %middle.block, %.preheader.lr.ph.split.us
  %indvars.iv50.ph = phi i64 [ 0, %.preheader.lr.ph.split.us ], [ %n.vec, %middle.block ]
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %.preheader.us
  %indvars.iv50 = phi i64 [ %indvars.iv.next51, %.preheader.us ], [ %indvars.iv50.ph, %.preheader.us.preheader ]
  %34 = getelementptr inbounds double, ptr %30, i64 %indvars.iv50
  store double %29, ptr %34, align 8, !tbaa !20
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge44, label %.preheader.us, !llvm.loop !25

35:                                               ; preds = %.lr.ph, %35
  %.02936 = phi i32 [ 0, %.lr.ph ], [ %44, %35 ]
  %36 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %6, i32 noundef %.02936, i32 noundef %15)
  %37 = load ptr, ptr %7, align 8, !tbaa !26
  %38 = getelementptr inbounds double, ptr %37, i64 %indvars.iv
  %39 = load double, ptr %38, align 8, !tbaa !20
  %40 = load ptr, ptr %8, align 8, !tbaa !27
  %41 = getelementptr inbounds double, ptr %40, i64 %indvars.iv
  %42 = load double, ptr %41, align 8, !tbaa !20
  %43 = tail call double @llvm.fmuladd.f64(double %36, double %39, double %42)
  tail call void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %9, i32 noundef %.02936, i32 noundef %15, double noundef %43)
  %44 = add nuw nsw i32 %.02936, 1
  %45 = load i32, ptr %5, align 8, !tbaa !17
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %35, label %._crit_edge.loopexit, !llvm.loop !28

._crit_edge.loopexit:                             ; preds = %35
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader35
  %47 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %12, %.preheader35 ]
  %48 = phi i32 [ %45, %._crit_edge.loopexit ], [ %13, %.preheader35 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %49 = sext i32 %47 to i64
  %50 = icmp slt i64 %indvars.iv.next, %49
  br i1 %50, label %.preheader35, label %.preheader34, !llvm.loop !29

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge41
  %51 = phi i32 [ %74, %._crit_edge41 ], [ %17, %.preheader.lr.ph ]
  %52 = phi i32 [ %75, %._crit_edge41 ], [ %26, %.preheader.lr.ph ]
  %indvars.iv53 = phi i64 [ %indvars.iv.next54, %._crit_edge41 ], [ 0, %.preheader.lr.ph ]
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %.lr.ph40, label %._crit_edge41

.lr.ph40:                                         ; preds = %.preheader
  %54 = trunc nuw nsw i64 %indvars.iv53 to i32
  br label %55

55:                                               ; preds = %.lr.ph40, %62
  %.13039 = phi i32 [ 0, %.lr.ph40 ], [ %71, %62 ]
  %.03138 = phi double [ 0.000000e+00, %.lr.ph40 ], [ %70, %62 ]
  %56 = tail call noundef double @_ZNK7SGTELIB6Matrix3getEii(ptr noundef nonnull align 8 dereferenceable(56) %20, i32 noundef %.13039, i32 noundef %54)
  %57 = tail call noundef zeroext i1 @_ZN7SGTELIB5isdefEd(double noundef %56)
  br i1 %57, label %62, label %58

58:                                               ; preds = %55
  %59 = load ptr, ptr %21, align 8, !tbaa !31
  %60 = getelementptr inbounds double, ptr %59, i64 %indvars.iv53
  %61 = load double, ptr %60, align 8, !tbaa !20
  br label %62

62:                                               ; preds = %58, %55
  %.032 = phi double [ %56, %55 ], [ %61, %58 ]
  %63 = load ptr, ptr %22, align 8, !tbaa !32
  %64 = getelementptr inbounds double, ptr %63, i64 %indvars.iv53
  %65 = load double, ptr %64, align 8, !tbaa !20
  %66 = load ptr, ptr %23, align 8, !tbaa !33
  %67 = getelementptr inbounds double, ptr %66, i64 %indvars.iv53
  %68 = load double, ptr %67, align 8, !tbaa !20
  %69 = tail call double @llvm.fmuladd.f64(double %.032, double %65, double %68)
  %70 = fadd double %.03138, %69
  tail call void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56) %24, i32 noundef %.13039, i32 noundef %54, double noundef %69)
  %71 = add nuw nsw i32 %.13039, 1
  %72 = load i32, ptr %19, align 8, !tbaa !17
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %55, label %._crit_edge41.loopexit, !llvm.loop !34

._crit_edge41.loopexit:                           ; preds = %62
  %.pre56 = load i32, ptr %16, align 8, !tbaa !18
  br label %._crit_edge41

._crit_edge41:                                    ; preds = %._crit_edge41.loopexit, %.preheader
  %74 = phi i32 [ %51, %.preheader ], [ %.pre56, %._crit_edge41.loopexit ]
  %75 = phi i32 [ %52, %.preheader ], [ %72, %._crit_edge41.loopexit ]
  %.031.lcssa = phi double [ 0.000000e+00, %.preheader ], [ %70, %._crit_edge41.loopexit ]
  %76 = sitofp i32 %75 to double
  %77 = fdiv double %.031.lcssa, %76
  %78 = load ptr, ptr %25, align 8, !tbaa !19
  %79 = getelementptr inbounds double, ptr %78, i64 %indvars.iv53
  store double %77, ptr %79, align 8, !tbaa !20
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %80 = sext i32 %74 to i64
  %81 = icmp slt i64 %indvars.iv.next54, %80
  br i1 %81, label %.preheader, label %._crit_edge44, !llvm.loop !35

._crit_edge44:                                    ; preds = %.preheader.us, %._crit_edge41, %middle.block, %.preheader34
  ret void
}

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

; 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 #2 align 2

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

declare void @_ZN7SGTELIB6Matrix3setEiid(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef, double noundef) local_unnamed_addr #1

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

!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, !7, i64 16}
!19 = !{!6, !11, i64 480}
!20 = !{!12, !12, i64 0}
!21 = distinct !{!21, !22, !23, !24}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!"llvm.loop.isvectorized", i32 1}
!24 = !{!"llvm.loop.unroll.runtime.disable"}
!25 = distinct !{!25, !22, !24, !23}
!26 = !{!6, !11, i64 376}
!27 = !{!6, !11, i64 384}
!28 = distinct !{!28, !22}
!29 = distinct !{!29, !22, !30}
!30 = !{!"llvm.loop.unswitch.partial.disable"}
!31 = !{!6, !11, i64 440}
!32 = !{!6, !11, i64 448}
!33 = !{!6, !11, i64 456}
!34 = distinct !{!34, !22}
!35 = distinct !{!35, !22, !30}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass