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

; 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.macroParam = type { %struct.Mixture, %"class.std::vector.0", %"class.std::vector.0", double, double, double, double, double, double, double, double, %"class.std::__cxx11::basic_string" }
%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 }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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 }
%"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(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

declare noundef double @_ZN7Mixture9molarMassEm(ptr noundef nonnull align 8 dereferenceable(28), i64 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN21CoeffSolver2Comp1Temp2XcE10macroParamm(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %1, i64 noundef %2) #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca double, align 8
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %15 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %16 = getelementptr inbounds %struct.macroParam, ptr %1, i32 0, i32 1
  %17 = load i64, ptr %6, align 8, !tbaa !9
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %17) #4
  %19 = load double, ptr %18, align 8, !tbaa !11
  store double %19, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %20 = getelementptr inbounds %struct.macroParam, ptr %1, i32 0, i32 0
  %21 = load i64, ptr %6, align 8, !tbaa !9
  %22 = call noundef double @_ZN7Mixture9molarMassEm(ptr noundef nonnull align 8 dereferenceable(28) %20, i64 noundef %21)
  store double %22, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store double 0.000000e+00, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !13
  br label %23

23:                                               ; preds = %62, %3
  %24 = load i32, ptr %10, align 4, !tbaa !13
  %25 = getelementptr inbounds %struct.macroParam, ptr %1, i32 0, i32 0
  %26 = getelementptr inbounds %struct.Mixture, ptr %25, i32 0, i32 1
  %27 = load i32, ptr %26, align 8, !tbaa !15
  %28 = icmp slt i32 %24, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %23
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %65

30:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %31 = getelementptr inbounds %struct.macroParam, ptr %1, i32 0, i32 1
  %32 = load i32, ptr %10, align 4, !tbaa !13
  %33 = sext i32 %32 to i64
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %33) #4
  %35 = load double, ptr %34, align 8, !tbaa !11
  store double %35, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !13
  br label %36

36:                                               ; preds = %55, %30
  %37 = load i32, ptr %13, align 4, !tbaa !13
  %38 = getelementptr inbounds %struct.macroParam, ptr %1, i32 0, i32 0
  %39 = getelementptr inbounds %struct.Mixture, ptr %38, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !15
  %41 = icmp slt i32 %37, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %36
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %58

43:                                               ; preds = %36
  %44 = load i32, ptr %13, align 4, !tbaa !13
  %45 = load i32, ptr %10, align 4, !tbaa !13
  %46 = icmp eq i32 %44, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %43
  br label %55

48:                                               ; preds = %43
  %49 = getelementptr inbounds %struct.macroParam, ptr %1, i32 0, i32 0
  %50 = load i32, ptr %13, align 4, !tbaa !13
  %51 = sext i32 %50 to i64
  %52 = call noundef double @_ZN7Mixture9molarMassEm(ptr noundef nonnull align 8 dereferenceable(28) %49, i64 noundef %51)
  %53 = load double, ptr %12, align 8, !tbaa !11
  %54 = fmul double %53, %52
  store double %54, ptr %12, align 8, !tbaa !11
  br label %55

55:                                               ; preds = %48, %47
  %56 = load i32, ptr %13, align 4, !tbaa !13
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %13, align 4, !tbaa !13
  br label %36, !llvm.loop !28

58:                                               ; preds = %42
  %59 = load double, ptr %12, align 8, !tbaa !11
  %60 = load double, ptr %9, align 8, !tbaa !11
  %61 = fadd double %60, %59
  store double %61, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %62

62:                                               ; preds = %58
  %63 = load i32, ptr %10, align 4, !tbaa !13
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %10, align 4, !tbaa !13
  br label %23, !llvm.loop !30

65:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %66 = load double, ptr %7, align 8, !tbaa !11
  %67 = load double, ptr %8, align 8, !tbaa !11
  %68 = fmul double %66, %67
  %69 = load double, ptr %9, align 8, !tbaa !11
  %70 = fdiv double %68, %69
  store double %70, ptr %14, align 8, !tbaa !11
  %71 = load double, ptr %14, align 8, !tbaa !11
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret double %71
}

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 = { "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, !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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !14, i64 24}
!16 = !{!"_ZTS10macroParam", !17, i64 0, !22, i64 32, !22, i64 56, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !26, i64 144}
!17 = !{!"_ZTS7Mixture", !18, i64 0, !14, i64 24}
!18 = !{!"_ZTSSt6vectorI16MixtureComponentSaIS0_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseI16MixtureComponentSaIS0_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseI16MixtureComponentSaIS0_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseI16MixtureComponentSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTSSt6vectorIdSaIdEE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !27, i64 0, !10, i64 8, !7, i64 16}
!27 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = distinct !{!30, !29}


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

declare noundef double @_ZN7Mixture9molarMassEm(ptr noundef nonnull align 8 dereferenceable(28), i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN21CoeffSolver2Comp1Temp2XcE10macroParamm(ptr nocapture noundef nonnull readnone align 8 dereferenceable(8) %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #2 align 2 {
  %4 = getelementptr inbounds i8, ptr %1, i64 32
  %5 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %2) #3
  %6 = load double, ptr %5, align 8, !tbaa !5
  %7 = tail call noundef double @_ZN7Mixture9molarMassEm(ptr noundef nonnull align 8 dereferenceable(28) %1, i64 noundef %2)
  %8 = getelementptr inbounds i8, ptr %1, i64 24
  %9 = load i32, ptr %8, align 8, !tbaa !9
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph25, label %._crit_edge26

._crit_edge26:                                    ; preds = %._crit_edge, %3
  %.0.lcssa = phi double [ 0.000000e+00, %3 ], [ %17, %._crit_edge ]
  %11 = fmul double %6, %7
  %12 = fdiv double %11, %.0.lcssa
  ret double %12

.lr.ph25:                                         ; preds = %3, %._crit_edge
  %indvars.iv29 = phi i64 [ %indvars.iv.next30, %._crit_edge ], [ 0, %3 ]
  %.023 = phi double [ %17, %._crit_edge ], [ 0.000000e+00, %3 ]
  %13 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv29) #3
  %14 = load double, ptr %13, align 8, !tbaa !5
  %15 = load i32, ptr %8, align 8, !tbaa !9
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %.lr.ph25.._crit_edge_crit_edge

.lr.ph25.._crit_edge_crit_edge:                   ; preds = %.lr.ph25
  %.pre32 = sext i32 %15 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %24, %.lr.ph25.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre32, %.lr.ph25.._crit_edge_crit_edge ], [ %26, %24 ]
  %.018.lcssa = phi double [ %14, %.lr.ph25.._crit_edge_crit_edge ], [ %.1, %24 ]
  %17 = fadd double %.023, %.018.lcssa
  %indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
  %18 = icmp slt i64 %indvars.iv.next30, %.pre-phi
  br i1 %18, label %.lr.ph25, label %._crit_edge26, !llvm.loop !25

.lr.ph:                                           ; preds = %.lr.ph25, %24
  %19 = phi i32 [ %25, %24 ], [ %15, %.lr.ph25 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %24 ], [ 0, %.lr.ph25 ]
  %.01820 = phi double [ %.1, %24 ], [ %14, %.lr.ph25 ]
  %20 = icmp eq i64 %indvars.iv, %indvars.iv29
  br i1 %20, label %24, label %21

21:                                               ; preds = %.lr.ph
  %22 = tail call noundef double @_ZN7Mixture9molarMassEm(ptr noundef nonnull align 8 dereferenceable(28) %1, i64 noundef %indvars.iv)
  %23 = fmul double %.01820, %22
  %.pre = load i32, ptr %8, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %.lr.ph, %21
  %25 = phi i32 [ %19, %.lr.ph ], [ %.pre, %21 ]
  %.1 = phi double [ %.01820, %.lr.ph ], [ %23, %21 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next, %26
  br i1 %27, label %.lr.ph, label %._crit_edge, !llvm.loop !27
}

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 = { "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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !17, i64 24}
!10 = !{!"_ZTS10macroParam", !11, i64 0, !18, i64 32, !18, i64 56, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !22, i64 144}
!11 = !{!"_ZTS7Mixture", !12, i64 0, !17, 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", !16, i64 0, !16, i64 8, !16, i64 16}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!"_ZTSSt6vectorIdSaIdEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !16, i64 0, !16, i64 8, !16, i64 16}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !24, i64 8, !7, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !16, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}


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