; LLVM IR from marcinlos/iga-ads :: src/ads (form_matrix)

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

%"struct.ads::basis_data" = type { %"class.std::vector", %"class.std::vector.0", i32, i32, i32, i32, i32, i32, %"class.std::vector.5", %"struct.ads::bspline::basis", ptr, ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = 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 }
%"struct.ads::bspline::basis" = type { %"class.std::vector.5", i32, %"class.std::vector.5" }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK3ads10basis_data8last_dofEi(ptr noundef nonnull align 8 dereferenceable(184), i32 noundef) #2 align 2

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

; 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 @_ZN3ads14gram_matrix_1dERNS_3lin12dense_matrixERKNS_10basis_dataES5_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(184) %1, ptr noundef nonnull align 8 dereferenceable(184) %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %136, %3
  %17 = load i32, ptr %7, align 4, !tbaa !9
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.ads::basis_data", ptr %18, i32 0, i32 3
  %20 = load i32, ptr %19, align 4, !tbaa !11
  %21 = icmp slt i32 %17, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %16
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %139

23:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %132, %23
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.ads::basis_data", ptr %26, i32 0, i32 6
  %28 = load i32, ptr %27, align 8, !tbaa !26
  %29 = icmp slt i32 %25, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %24
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %135

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

32:                                               ; preds = %128, %31
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = call noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %34, i32 noundef %35)
  %37 = add nsw i32 %33, %36
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = call noundef i32 @_ZNK3ads10basis_data8last_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %38, i32 noundef %39)
  %41 = icmp sle i32 %37, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %32
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %131

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

44:                                               ; preds = %124, %43
  %45 = load i32, ptr %11, align 4, !tbaa !9
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = load i32, ptr %7, align 4, !tbaa !9
  %48 = call noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %46, i32 noundef %47)
  %49 = add nsw i32 %45, %48
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i32, ptr %7, align 4, !tbaa !9
  %52 = call noundef i32 @_ZNK3ads10basis_data8last_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %50, i32 noundef %51)
  %53 = icmp sle i32 %49, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %44
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %127

55:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %56 = load i32, ptr %10, align 4, !tbaa !9
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = call noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %57, i32 noundef %58)
  %60 = add nsw i32 %56, %59
  store i32 %60, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %61 = load i32, ptr %11, align 4, !tbaa !9
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = load i32, ptr %7, align 4, !tbaa !9
  %64 = call noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %62, i32 noundef %63)
  %65 = add nsw i32 %61, %64
  store i32 %65, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.ads::basis_data", ptr %66, i32 0, i32 10
  %68 = load ptr, ptr %67, align 8, !tbaa !27
  %69 = load i32, ptr %7, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds ptr, ptr %68, i64 %70
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds ptr, ptr %72, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  %77 = getelementptr inbounds ptr, ptr %76, i64 0
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = load i32, ptr %10, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds double, ptr %78, i64 %80
  %82 = load double, ptr %81, align 8, !tbaa !28
  store double %82, ptr %14, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %"struct.ads::basis_data", ptr %83, i32 0, i32 10
  %85 = load ptr, ptr %84, align 8, !tbaa !27
  %86 = load i32, ptr %7, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds ptr, ptr %85, i64 %87
  %89 = load ptr, ptr %88, align 8, !tbaa !5
  %90 = load i32, ptr %9, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds ptr, ptr %89, i64 %91
  %93 = load ptr, ptr %92, align 8, !tbaa !5
  %94 = getelementptr inbounds ptr, ptr %93, i64 0
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = load i32, ptr %11, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds double, ptr %95, i64 %97
  %99 = load double, ptr %98, align 8, !tbaa !28
  store double %99, ptr %15, align 8, !tbaa !28
  %100 = load double, ptr %14, align 8, !tbaa !28
  %101 = load double, ptr %15, align 8, !tbaa !28
  %102 = fmul double %100, %101
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = getelementptr inbounds %"struct.ads::basis_data", ptr %103, i32 0, i32 12
  %105 = load ptr, ptr %104, align 8, !tbaa !30
  %106 = load i32, ptr %9, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds double, ptr %105, i64 %107
  %109 = load double, ptr %108, align 8, !tbaa !28
  %110 = fmul double %102, %109
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = getelementptr inbounds %"struct.ads::basis_data", ptr %111, i32 0, i32 13
  %113 = load ptr, ptr %112, align 8, !tbaa !31
  %114 = load i32, ptr %7, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds double, ptr %113, i64 %115
  %117 = load double, ptr %116, align 8, !tbaa !28
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = load i32, ptr %12, align 4, !tbaa !9
  %120 = load i32, ptr %13, align 4, !tbaa !9
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3ads3lin12dense_matrixclEii(ptr noundef nonnull align 8 dereferenceable(32) %118, i32 noundef %119, i32 noundef %120)
  %122 = load double, ptr %121, align 8, !tbaa !28
  %123 = call double @llvm.fmuladd.f64(double %110, double %117, double %122)
  store double %123, ptr %121, align 8, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %124

124:                                              ; preds = %55
  %125 = load i32, ptr %11, align 4, !tbaa !9
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %11, align 4, !tbaa !9
  br label %44, !llvm.loop !32

127:                                              ; preds = %54
  br label %128

128:                                              ; preds = %127
  %129 = load i32, ptr %10, align 4, !tbaa !9
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %10, align 4, !tbaa !9
  br label %32, !llvm.loop !34

131:                                              ; preds = %42
  br label %132

132:                                              ; preds = %131
  %133 = load i32, ptr %9, align 4, !tbaa !9
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %9, align 4, !tbaa !9
  br label %24, !llvm.loop !35

135:                                              ; preds = %30
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %7, align 4, !tbaa !9
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %7, align 4, !tbaa !9
  br label %16, !llvm.loop !36

139:                                              ; preds = %22
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 52}
!12 = !{!"_ZTSN3ads10basis_dataE", !13, i64 0, !17, i64 24, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !21, i64 72, !25, i64 96, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!13 = !{!"_ZTSSt6vectorIiSaIiEE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"_ZTSSt6vectorISt4pairIiiESaIS1_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseISt4pairIiiESaIS1_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseISt4pairIiiESaIS1_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseISt4pairIiiESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_ZTSSt6vectorIdSaIdEE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"_ZTSN3ads7bspline5basisE", !21, i64 0, !10, i64 24, !21, i64 32}
!26 = !{!12, !10, i64 64}
!27 = !{!12, !6, i64 152}
!28 = !{!29, !29, i64 0}
!29 = !{!"double", !7, i64 0}
!30 = !{!12, !6, i64 168}
!31 = !{!12, !6, i64 176}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = distinct !{!34, !33}
!35 = distinct !{!35, !33}
!36 = distinct !{!36, !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"

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNK3ads10basis_data8last_dofEi(ptr noundef nonnull align 8 dereferenceable(184), i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3ads14gram_matrix_1dERNS_3lin12dense_matrixERKNS_10basis_dataES5_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(184) %1, ptr noundef nonnull align 8 dereferenceable(184) %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %2, i64 52
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.preheader45.lr.ph, label %._crit_edge54

.preheader45.lr.ph:                               ; preds = %3
  %7 = getelementptr inbounds i8, ptr %2, i64 64
  %8 = getelementptr inbounds i8, ptr %2, i64 152
  %9 = getelementptr inbounds i8, ptr %1, i64 152
  %10 = getelementptr inbounds i8, ptr %2, i64 168
  %11 = getelementptr inbounds i8, ptr %2, i64 176
  %12 = load i32, ptr %7, align 8, !tbaa !24
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.preheader45, label %._crit_edge54

.preheader45:                                     ; preds = %.preheader45.lr.ph, %._crit_edge52
  %14 = phi i32 [ %20, %._crit_edge52 ], [ %5, %.preheader45.lr.ph ]
  %15 = phi i32 [ %21, %._crit_edge52 ], [ %12, %.preheader45.lr.ph ]
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %._crit_edge52 ], [ 0, %.preheader45.lr.ph ]
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.preheader44.lr.ph, label %._crit_edge52

.preheader44.lr.ph:                               ; preds = %.preheader45
  %17 = trunc nuw nsw i64 %indvars.iv63 to i32
  br label %.preheader44

._crit_edge54:                                    ; preds = %._crit_edge52, %.preheader45.lr.ph, %3
  ret void

.preheader44:                                     ; preds = %.preheader44.lr.ph, %._crit_edge50
  %indvars.iv60 = phi i64 [ 0, %.preheader44.lr.ph ], [ %indvars.iv.next61, %._crit_edge50 ]
  %18 = tail call noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %2, i32 noundef %17)
  %19 = tail call noundef i32 @_ZNK3ads10basis_data8last_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %2, i32 noundef %17)
  %.not48 = icmp sgt i32 %18, %19
  br i1 %.not48, label %._crit_edge50, label %.preheader

._crit_edge52.loopexit:                           ; preds = %._crit_edge50
  %.pre = load i32, ptr %4, align 4, !tbaa !5
  br label %._crit_edge52

._crit_edge52:                                    ; preds = %._crit_edge52.loopexit, %.preheader45
  %20 = phi i32 [ %.pre, %._crit_edge52.loopexit ], [ %14, %.preheader45 ]
  %21 = phi i32 [ %27, %._crit_edge52.loopexit ], [ %15, %.preheader45 ]
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %22 = sext i32 %20 to i64
  %23 = icmp slt i64 %indvars.iv.next64, %22
  br i1 %23, label %.preheader45, label %._crit_edge54, !llvm.loop !25

.preheader:                                       ; preds = %.preheader44, %._crit_edge
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %._crit_edge ], [ 0, %.preheader44 ]
  %24 = tail call noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %1, i32 noundef %17)
  %25 = tail call noundef i32 @_ZNK3ads10basis_data8last_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %1, i32 noundef %17)
  %.not4346 = icmp sgt i32 %24, %25
  br i1 %.not4346, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %26 = trunc nuw nsw i64 %indvars.iv57 to i32
  br label %34

._crit_edge50:                                    ; preds = %._crit_edge, %.preheader44
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %27 = load i32, ptr %7, align 8, !tbaa !24
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next61, %28
  br i1 %29, label %.preheader44, label %._crit_edge52.loopexit, !llvm.loop !28

._crit_edge:                                      ; preds = %34, %.preheader
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %30 = tail call noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %2, i32 noundef %17)
  %31 = trunc nuw i64 %indvars.iv.next58 to i32
  %32 = add nsw i32 %30, %31
  %33 = tail call noundef i32 @_ZNK3ads10basis_data8last_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %2, i32 noundef %17)
  %.not = icmp sgt i32 %32, %33
  br i1 %.not, label %._crit_edge50, label %.preheader, !llvm.loop !29

34:                                               ; preds = %.lr.ph, %34
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %34 ]
  %35 = tail call noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %2, i32 noundef %17)
  %36 = add nsw i32 %35, %26
  %37 = tail call noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %1, i32 noundef %17)
  %38 = trunc nuw nsw i64 %indvars.iv to i32
  %39 = add nsw i32 %37, %38
  %40 = load ptr, ptr %8, align 8, !tbaa !30
  %41 = getelementptr inbounds ptr, ptr %40, i64 %indvars.iv63
  %42 = load ptr, ptr %41, align 8, !tbaa !31
  %43 = getelementptr inbounds ptr, ptr %42, i64 %indvars.iv60
  %44 = load ptr, ptr %43, align 8, !tbaa !31
  %45 = load ptr, ptr %44, align 8, !tbaa !31
  %46 = getelementptr inbounds double, ptr %45, i64 %indvars.iv57
  %47 = load double, ptr %46, align 8, !tbaa !32
  %48 = load ptr, ptr %9, align 8, !tbaa !30
  %49 = getelementptr inbounds ptr, ptr %48, i64 %indvars.iv63
  %50 = load ptr, ptr %49, align 8, !tbaa !31
  %51 = getelementptr inbounds ptr, ptr %50, i64 %indvars.iv60
  %52 = load ptr, ptr %51, align 8, !tbaa !31
  %53 = load ptr, ptr %52, align 8, !tbaa !31
  %54 = getelementptr inbounds double, ptr %53, i64 %indvars.iv
  %55 = load double, ptr %54, align 8, !tbaa !32
  %56 = fmul double %47, %55
  %57 = load ptr, ptr %10, align 8, !tbaa !34
  %58 = getelementptr inbounds double, ptr %57, i64 %indvars.iv60
  %59 = load double, ptr %58, align 8, !tbaa !32
  %60 = fmul double %56, %59
  %61 = load ptr, ptr %11, align 8, !tbaa !35
  %62 = getelementptr inbounds double, ptr %61, i64 %indvars.iv63
  %63 = load double, ptr %62, align 8, !tbaa !32
  %64 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3ads3lin12dense_matrixclEii(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %36, i32 noundef %39)
  %65 = load double, ptr %64, align 8, !tbaa !32
  %66 = tail call double @llvm.fmuladd.f64(double %60, double %63, double %65)
  store double %66, ptr %64, align 8, !tbaa !32
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %67 = tail call noundef i32 @_ZNK3ads10basis_data9first_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %1, i32 noundef %17)
  %68 = trunc nuw i64 %indvars.iv.next to i32
  %69 = add nsw i32 %67, %68
  %70 = tail call noundef i32 @_ZNK3ads10basis_data8last_dofEi(ptr noundef nonnull align 8 dereferenceable(184) %1, i32 noundef %17)
  %.not43 = icmp sgt i32 %69, %70
  br i1 %.not43, label %._crit_edge, label %34, !llvm.loop !36
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3ads3lin12dense_matrixclEii(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef) local_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 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, !18, i64 52}
!6 = !{!"_ZTSN3ads10basis_dataE", !7, i64 0, !14, i64 24, !18, i64 48, !18, i64 52, !18, i64 56, !18, i64 60, !18, i64 64, !18, i64 68, !19, i64 72, !23, i64 96, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176}
!7 = !{!"_ZTSSt6vectorIiSaIiEE", !8, i64 0}
!8 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !9, i64 0}
!9 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSSt6vectorISt4pairIiiESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseISt4pairIiiESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseISt4pairIiiESaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseISt4pairIiiESaIS1_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!18 = !{!"int", !12, i64 0}
!19 = !{!"_ZTSSt6vectorIdSaIdEE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!23 = !{!"_ZTSN3ads7bspline5basisE", !19, i64 0, !18, i64 24, !19, i64 32}
!24 = !{!6, !18, i64 64}
!25 = distinct !{!25, !26, !27}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!"llvm.loop.unswitch.partial.disable"}
!28 = distinct !{!28, !26}
!29 = distinct !{!29, !26}
!30 = !{!6, !11, i64 152}
!31 = !{!11, !11, i64 0}
!32 = !{!33, !33, i64 0}
!33 = !{!"double", !12, i64 0}
!34 = !{!6, !11, i64 168}
!35 = !{!6, !11, i64 176}
!36 = distinct !{!36, !26}


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