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

; 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: 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14AbstractSolver18prepareVectorSizesEv(ptr noundef nonnull align 8 dereferenceable(233) %0) unnamed_addr #2 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
  %5 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 10
  %6 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 5
  %7 = getelementptr inbounds %struct.solverParams, ptr %6, i32 0, i32 0
  %8 = load i32, ptr %7, align 8, !tbaa !9
  %9 = sext i32 %8 to i64
  call void @_ZNSt6vectorI10macroParamSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %9)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store i64 0, ptr %3, align 8, !tbaa !29
  br label %10

10:                                               ; preds = %33, %1
  %11 = load i64, ptr %3, align 8, !tbaa !29
  %12 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 10
  %13 = call noundef i64 @_ZNKSt6vectorI10macroParamSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #3
  %14 = icmp ult i64 %11, %13
  br i1 %14, label %16, label %15

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

16:                                               ; preds = %10
  %17 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 10
  %18 = load i64, ptr %3, align 8, !tbaa !29
  %19 = call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %18) #3
  %20 = getelementptr inbounds %struct.macroParam, ptr %19, i32 0, i32 1
  %21 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 4
  %22 = getelementptr inbounds %struct.Mixture, ptr %21, i32 0, i32 1
  %23 = load i32, ptr %22, align 8, !tbaa !31
  %24 = sext i32 %23 to i64
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %24)
  %25 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 10
  %26 = load i64, ptr %3, align 8, !tbaa !29
  %27 = call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %26) #3
  %28 = getelementptr inbounds %struct.macroParam, ptr %27, i32 0, i32 2
  %29 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 4
  %30 = getelementptr inbounds %struct.Mixture, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 8, !tbaa !31
  %32 = sext i32 %31 to i64
  call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef %32)
  br label %33

33:                                               ; preds = %16
  %34 = load i64, ptr %3, align 8, !tbaa !29
  %35 = add i64 %34, 1
  store i64 %35, ptr %3, align 8, !tbaa !29
  br label %10, !llvm.loop !32

36:                                               ; preds = %15
  %37 = getelementptr inbounds %struct.AbstractSolver, ptr %4, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !34
  %39 = load ptr, ptr %38, align 8, !tbaa !35
  %40 = getelementptr inbounds ptr, ptr %39, i64 9
  %41 = load ptr, ptr %40, align 8
  call void %41(ptr noundef nonnull align 8 dereferenceable(296) %38)
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 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 = { 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, !16, i64 64}
!10 = !{!"_ZTS14AbstractSolver", !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !17, i64 64, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !19, i64 168, !18, i64 192, !23, i64 200, !28, i64 224, !28, i64 225, !16, i64 228, !28, i64 232}
!11 = !{!"_ZTS7Mixture", !12, i64 0, !16, i64 24}
!12 = !{!"_ZTSSt6vectorI16MixtureComponentSaIS0_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseI16MixtureComponentSaIS0_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseI16MixtureComponentSaIS0_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseI16MixtureComponentSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTS12solverParams", !16, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !18, i64 32, !18, i64 40, !16, i64 48, !16, i64 52, !16, i64 56, !16, i64 60, !16, i64 64, !16, i64 68}
!18 = !{!"double", !7, i64 0}
!19 = !{!"_ZTSSt6vectorI10macroParamSaIS0_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseI10macroParamSaIS0_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseI10macroParamSaIS0_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseI10macroParamSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"_ZTS6Matrix", !24, i64 0}
!24 = !{!"_ZTSSt6vectorIdSaIdEE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!"bool", !7, i64 0}
!29 = !{!30, !30, i64 0}
!30 = !{!"long", !7, i64 0}
!31 = !{!10, !16, i64 56}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!10, !6, i64 8}
!35 = !{!36, !36, i64 0}
!36 = !{!"vtable pointer", !8, i64 0}


; 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 nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14AbstractSolver18prepareVectorSizesEv(ptr noundef nonnull align 8 dereferenceable(233) %0) unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 168
  %3 = getelementptr inbounds i8, ptr %0, i64 64
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = sext i32 %4 to i64
  tail call void @_ZNSt6vectorI10macroParamSaIS0_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %5)
  %6 = tail call noundef i64 @_ZNKSt6vectorI10macroParamSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #2
  %.not = icmp eq i64 %6, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 56
  br label %13

._crit_edge:                                      ; preds = %13, %1
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !28
  %10 = load ptr, ptr %9, align 8, !tbaa !29
  %11 = getelementptr inbounds i8, ptr %10, i64 72
  %12 = load ptr, ptr %11, align 8
  tail call void %12(ptr noundef nonnull align 8 dereferenceable(296) %9)
  ret void

13:                                               ; preds = %.lr.ph, %13
  %.04 = phi i64 [ 0, %.lr.ph ], [ %22, %13 ]
  %14 = tail call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.04) #2
  %15 = getelementptr inbounds i8, ptr %14, i64 32
  %16 = load i32, ptr %7, align 8, !tbaa !31
  %17 = sext i32 %16 to i64
  tail call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %17)
  %18 = tail call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorI10macroParamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.04) #2
  %19 = getelementptr inbounds i8, ptr %18, i64 56
  %20 = load i32, ptr %7, align 8, !tbaa !31
  %21 = sext i32 %20 to i64
  tail call void @_ZNSt6vectorIdSaIdEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %21)
  %22 = add nuw i64 %.04, 1
  %23 = tail call noundef i64 @_ZNKSt6vectorI10macroParamSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #2
  %24 = icmp ult i64 %22, %23
  br i1 %24, label %13, label %._crit_edge, !llvm.loop !32
}

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

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

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 = { 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, !15, i64 64}
!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 = !{!6, !7, i64 8}
!29 = !{!30, !30, i64 0}
!30 = !{!"vtable pointer", !9, i64 0}
!31 = !{!6, !15, i64 56}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


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