; LLVM IR from cfd-rg-solver/FVM-RG-Solver :: src/AbstractSolver.ll (ZN14AbstractSolver11correctDataEv)

; 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.AbstractSolver = type <{ ptr, ptr, ptr, ptr, %struct.Mixture, %struct.solverParams, ptr, ptr, ptr, ptr, %"class.std::vector.0", double, %class.Matrix, i8, i8, [2 x i8], i32, i8, [7 x i8] }>
%struct.Mixture = type <{ %"class.std::vector", i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<MixtureComponent, std::allocator<MixtureComponent>>::_Vector_impl" }
%"struct.std::_Vector_base<MixtureComponent, std::allocator<MixtureComponent>>::_Vector_impl" = type { %"struct.std::_Vector_base<MixtureComponent, std::allocator<MixtureComponent>>::_Vector_impl_data" }
%"struct.std::_Vector_base<MixtureComponent, std::allocator<MixtureComponent>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.solverParams = type { i32, double, double, double, double, double, i32, i32, i32, i32, i32, i32 }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<macroParam, std::allocator<macroParam>>::_Vector_impl" }
%"struct.std::_Vector_base<macroParam, std::allocator<macroParam>>::_Vector_impl" = type { %"struct.std::_Vector_base<macroParam, std::allocator<macroParam>>::_Vector_impl_data" }
%"struct.std::_Vector_base<macroParam, std::allocator<macroParam>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Matrix = type { %"class.std::vector.5" }
%"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.macroParam = type { %struct.Mixture, %"class.std::vector.5", %"class.std::vector.5", double, double, double, double, double, double, double, double, %"class.std::__cxx11::basic_string" }
%"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: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(28) ptr @_ZN7MixtureaSERKS_(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef nonnull align 8 dereferenceable(28)) #0 align 2

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

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

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

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

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

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

5:                                                ; preds = %38, %1
  %6 = load i64, ptr %3, align 8, !tbaa !9
  %7 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 10
  %8 = call noundef i64 @_ZNKSt6vectorI10macroParamSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  %9 = icmp ult i64 %6, %8
  br i1 %9, label %11, label %10

10:                                               ; preds = %5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %41

11:                                               ; preds = %5
  %12 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 4
  %13 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 10
  %14 = load i64, ptr %3, align 8, !tbaa !9
  %15 = call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %14) #5
  %16 = getelementptr inbounds %struct.macroParam, ptr %15, i32 0, i32 0
  %17 = call noundef nonnull align 8 dereferenceable(28) ptr @_ZN7MixtureaSERKS_(ptr noundef nonnull align 8 dereferenceable(28) %16, ptr noundef nonnull align 8 dereferenceable(28) %12)
  %18 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 5
  %19 = getelementptr inbounds %struct.solverParams, ptr %18, i32 0, i32 3
  %20 = load double, ptr %19, align 8, !tbaa !11
  %21 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 10
  %22 = load i64, ptr %3, align 8, !tbaa !9
  %23 = call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef %22) #5
  %24 = getelementptr inbounds %struct.macroParam, ptr %23, i32 0, i32 4
  %25 = load double, ptr %24, align 8, !tbaa !31
  %26 = fmul double %20, %25
  %27 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 10
  %28 = load i64, ptr %3, align 8, !tbaa !9
  %29 = call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %27, i64 noundef %28) #5
  %30 = getelementptr inbounds %struct.macroParam, ptr %29, i32 0, i32 3
  %31 = load double, ptr %30, align 8, !tbaa !35
  %32 = fdiv double %26, %31
  %33 = call double @sqrt(double noundef %32) #5
  %34 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 10
  %35 = load i64, ptr %3, align 8, !tbaa !9
  %36 = call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %34, i64 noundef %35) #5
  %37 = getelementptr inbounds %struct.macroParam, ptr %36, i32 0, i32 10
  store double %33, ptr %37, align 8, !tbaa !36
  br label %38

38:                                               ; preds = %11
  %39 = load i64, ptr %3, align 8, !tbaa !9
  %40 = add i64 %39, 1
  store i64 %40, ptr %3, align 8, !tbaa !9
  br label %5, !llvm.loop !37

41:                                               ; preds = %10
  ret void
}

attributes #0 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #4 = { 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 #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 = !{!"long", !7, i64 0}
!11 = !{!12, !20, i64 88}
!12 = !{!"_ZTS14AbstractSolver", !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !19, i64 64, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !21, i64 168, !20, i64 192, !25, i64 200, !30, i64 224, !30, i64 225, !18, i64 228, !30, i64 232}
!13 = !{!"_ZTS7Mixture", !14, i64 0, !18, i64 24}
!14 = !{!"_ZTSSt6vectorI16MixtureComponentSaIS0_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseI16MixtureComponentSaIS0_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseI16MixtureComponentSaIS0_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseI16MixtureComponentSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"int", !7, i64 0}
!19 = !{!"_ZTS12solverParams", !18, i64 0, !20, i64 8, !20, i64 16, !20, i64 24, !20, i64 32, !20, i64 40, !18, i64 48, !18, i64 52, !18, i64 56, !18, i64 60, !18, i64 64, !18, i64 68}
!20 = !{!"double", !7, i64 0}
!21 = !{!"_ZTSSt6vectorI10macroParamSaIS0_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseI10macroParamSaIS0_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseI10macroParamSaIS0_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseI10macroParamSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"_ZTS6Matrix", !26, i64 0}
!26 = !{!"_ZTSSt6vectorIdSaIdEE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!30 = !{!"bool", !7, i64 0}
!31 = !{!32, !20, i64 88}
!32 = !{!"_ZTS10macroParam", !13, i64 0, !26, i64 32, !26, i64 56, !20, i64 80, !20, i64 88, !20, i64 96, !20, i64 104, !20, i64 112, !20, i64 120, !20, i64 128, !20, i64 136, !33, i64 144}
!33 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !34, i64 0, !10, i64 8, !7, i64 16}
!34 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!35 = !{!32, !20, i64 80}
!36 = !{!32, !20, i64 136}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}


; 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: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(28) ptr @_ZN7MixtureaSERKS_(ptr noundef nonnull align 8 dereferenceable(28), ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #0 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14AbstractSolver11correctDataEv(ptr noundef nonnull align 8 dereferenceable(233) %0) unnamed_addr #3 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 168
  %3 = tail call noundef i64 @_ZNKSt6vectorI10macroParamSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #4
  %.not = icmp eq i64 %3, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  br label %6

._crit_edge:                                      ; preds = %6, %1
  ret void

6:                                                ; preds = %.lr.ph, %6
  %.06 = phi i64 [ 0, %.lr.ph ], [ %21, %6 ]
  %7 = tail call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.06) #4
  %8 = tail call noundef nonnull align 8 dereferenceable(28) ptr @_ZN7MixtureaSERKS_(ptr noundef nonnull align 8 dereferenceable(28) %7, ptr noundef nonnull align 8 dereferenceable(28) %4)
  %9 = load double, ptr %5, align 8, !tbaa !5
  %10 = tail call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.06) #4
  %11 = getelementptr inbounds i8, ptr %10, i64 88
  %12 = load double, ptr %11, align 8, !tbaa !28
  %13 = fmul double %9, %12
  %14 = tail call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.06) #4
  %15 = getelementptr inbounds i8, ptr %14, i64 80
  %16 = load double, ptr %15, align 8, !tbaa !33
  %17 = fdiv double %13, %16
  %18 = tail call double @sqrt(double noundef %17) #4
  %19 = tail call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.06) #4
  %20 = getelementptr inbounds i8, ptr %19, i64 136
  store double %18, ptr %20, align 8, !tbaa !34
  %21 = add nuw i64 %.06, 1
  %22 = tail call noundef i64 @_ZNKSt6vectorI10macroParamSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #4
  %23 = icmp ult i64 %21, %22
  br i1 %23, label %6, label %._crit_edge, !llvm.loop !35
}

attributes #0 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 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 #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 = { 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, !17, i64 88}
!6 = !{!"_ZTS14AbstractSolver", !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !16, i64 64, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !18, i64 168, !17, i64 192, !22, i64 200, !27, i64 224, !27, i64 225, !15, i64 228, !27, i64 232}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS7Mixture", !11, i64 0, !15, i64 24}
!11 = !{!"_ZTSSt6vectorI16MixtureComponentSaIS0_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseI16MixtureComponentSaIS0_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseI16MixtureComponentSaIS0_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseI16MixtureComponentSaIS0_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!15 = !{!"int", !8, i64 0}
!16 = !{!"_ZTS12solverParams", !15, i64 0, !17, i64 8, !17, i64 16, !17, i64 24, !17, i64 32, !17, i64 40, !15, i64 48, !15, i64 52, !15, i64 56, !15, i64 60, !15, i64 64, !15, i64 68}
!17 = !{!"double", !8, i64 0}
!18 = !{!"_ZTSSt6vectorI10macroParamSaIS0_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseI10macroParamSaIS0_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseI10macroParamSaIS0_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseI10macroParamSaIS0_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!22 = !{!"_ZTS6Matrix", !23, i64 0}
!23 = !{!"_ZTSSt6vectorIdSaIdEE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!27 = !{!"bool", !8, i64 0}
!28 = !{!29, !17, i64 88}
!29 = !{!"_ZTS10macroParam", !10, i64 0, !23, i64 32, !23, i64 56, !17, i64 80, !17, i64 88, !17, i64 96, !17, i64 104, !17, i64 112, !17, i64 120, !17, i64 128, !17, i64 136, !30, i64 144}
!30 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !31, i64 0, !32, i64 8, !8, i64 16}
!31 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!32 = !{!"long", !8, i64 0}
!33 = !{!29, !17, i64 80}
!34 = !{!29, !17, i64 136}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


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