; LLVM IR from Eydcao/Yan-CG-SnowSim :: src/SimDomain.ll (ZN9SimDomain15correctedDeltaTEv)

; 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.SimDomain = type { float, ptr, ptr }
%class.SnowParticleSet = type <{ %"class.std::vector.13", float, [4 x i8] }>
%"class.std::vector.13" = type { %"struct.std::_Vector_base.14" }
%"struct.std::_Vector_base.14" = type { %"struct.std::_Vector_base<SnowParticle *, std::allocator<SnowParticle *>>::_Vector_impl" }
%"struct.std::_Vector_base<SnowParticle *, std::allocator<SnowParticle *>>::_Vector_impl" = type { %"struct.std::_Vector_base<SnowParticle *, std::allocator<SnowParticle *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<SnowParticle *, std::allocator<SnowParticle *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.GridMesh = type { %class.Bounds3, %class.Bounds3, %"class.Eigen::Matrix.3", %"class.Eigen::Matrix", ptr, float, i32, %"class.std::vector", i32, %"class.std::vector" }
%class.Bounds3 = type { %"class.Eigen::Matrix", %"class.Eigen::Matrix" }
%"class.Eigen::Matrix.3" = type { %"class.Eigen::PlainObjectBase.4" }
%"class.Eigen::PlainObjectBase.4" = type { %"class.Eigen::DenseStorage.11" }
%"class.Eigen::DenseStorage.11" = type { %"struct.Eigen::internal::plain_array.12" }
%"struct.Eigen::internal::plain_array.12" = type { [3 x i32] }
%"class.Eigen::Matrix" = type { %"class.Eigen::PlainObjectBase" }
%"class.Eigen::PlainObjectBase" = type { %"class.Eigen::DenseStorage" }
%"class.Eigen::DenseStorage" = type { %"struct.Eigen::internal::plain_array" }
%"struct.Eigen::internal::plain_array" = type { [3 x float] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<GridCell *, std::allocator<GridCell *>>::_Vector_impl" }
%"struct.std::_Vector_base<GridCell *, std::allocator<GridCell *>>::_Vector_impl" = type { %"struct.std::_Vector_base<GridCell *, std::allocator<GridCell *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<GridCell *, std::allocator<GridCell *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN9SimDomain15correctedDeltaTEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, 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 4, ptr %3) #4
  %8 = getelementptr inbounds %class.SimDomain, ptr %7, i32 0, i32 1
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds %class.SnowParticleSet, ptr %9, i32 0, i32 1
  %11 = load float, ptr %10, align 8, !tbaa !12
  store float %11, ptr %3, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %12 = load float, ptr %3, align 4, !tbaa !18
  %13 = fpext float %12 to double
  %14 = fcmp ogt double %13, 1.000000e-08
  br i1 %14, label %15, label %45

15:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %16 = getelementptr inbounds %class.SimDomain, ptr %7, i32 0, i32 2
  %17 = load ptr, ptr %16, align 8, !tbaa !19
  %18 = getelementptr inbounds %class.GridMesh, ptr %17, i32 0, i32 3
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5Eigen15DenseCoeffsBaseINS_6MatrixIfLi3ELi1ELi0ELi3ELi1EEELi1EEixEl(ptr noundef nonnull align 1 dereferenceable(1) %18, i64 noundef 0)
  %20 = getelementptr inbounds %class.SimDomain, ptr %7, i32 0, i32 2
  %21 = load ptr, ptr %20, align 8, !tbaa !19
  %22 = getelementptr inbounds %class.GridMesh, ptr %21, i32 0, i32 3
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5Eigen15DenseCoeffsBaseINS_6MatrixIfLi3ELi1ELi0ELi3ELi1EEELi1EEixEl(ptr noundef nonnull align 1 dereferenceable(1) %22, i64 noundef 1)
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %23)
  %25 = getelementptr inbounds %class.SimDomain, ptr %7, i32 0, i32 2
  %26 = load ptr, ptr %25, align 8, !tbaa !19
  %27 = getelementptr inbounds %class.GridMesh, ptr %26, i32 0, i32 3
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5Eigen15DenseCoeffsBaseINS_6MatrixIfLi3ELi1ELi0ELi3ELi1EEELi1EEixEl(ptr noundef nonnull align 1 dereferenceable(1) %27, i64 noundef 2)
  %29 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %24, ptr noundef nonnull align 4 dereferenceable(4) %28)
  %30 = load float, ptr %29, align 4, !tbaa !18
  store float %30, ptr %5, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %31 = load float, ptr %5, align 4, !tbaa !18
  %32 = fmul float 0x3FA47AE140000000, %31
  %33 = load float, ptr %3, align 4, !tbaa !18
  %34 = fdiv float %32, %33
  store float %34, ptr %6, align 4, !tbaa !18
  %35 = load float, ptr %6, align 4, !tbaa !18
  %36 = fpext float %35 to double
  %37 = fcmp ogt double %36, 0x3F91111111111111
  br i1 %37, label %38, label %39

38:                                               ; preds = %15
  br label %42

39:                                               ; preds = %15
  %40 = load float, ptr %6, align 4, !tbaa !18
  %41 = fpext float %40 to double
  br label %42

42:                                               ; preds = %39, %38
  %43 = phi double [ 0x3F91111111111111, %38 ], [ %41, %39 ]
  %44 = fptrunc double %43 to float
  store float %44, ptr %6, align 4, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %46

45:                                               ; preds = %1
  store float 0x3F91111120000000, ptr %4, align 4, !tbaa !18
  br label %46

46:                                               ; preds = %45, %42
  %47 = load float, ptr %4, align 4, !tbaa !18
  %48 = fcmp ogt float %47, 0x3F0A36E2E0000000
  br i1 %48, label %49, label %50

49:                                               ; preds = %46
  br label %52

50:                                               ; preds = %46
  %51 = load float, ptr %4, align 4, !tbaa !18
  br label %52

52:                                               ; preds = %50, %49
  %53 = phi float [ 0x3F0A36E2E0000000, %49 ], [ %51, %50 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret float %53
}

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN5Eigen15DenseCoeffsBaseINS_6MatrixIfLi3ELi1ELi0ELi3ELi1EEELi1EEixEl(ptr noundef nonnull align 1 dereferenceable(1), i64 noundef) #3 align 2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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, !6, i64 8}
!10 = !{!"_ZTS9SimDomain", !11, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !11, i64 24}
!13 = !{!"_ZTS15SnowParticleSet", !14, i64 0, !11, i64 24}
!14 = !{!"_ZTSSt6vectorIP12SnowParticleSaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIP12SnowParticleSaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIP12SnowParticleSaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP12SnowParticleSaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!11, !11, i64 0}
!19 = !{!10, !6, i64 16}


; 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 noundef float @_ZN9SimDomain15correctedDeltaTEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 24
  %5 = load float, ptr %4, align 8, !tbaa !11
  %6 = fpext float %5 to double
  %7 = fcmp ogt double %6, 1.000000e-08
  br i1 %7, label %8, label %21

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load ptr, ptr %9, align 8, !tbaa !17
  %11 = getelementptr inbounds i8, ptr %10, i64 60
  %12 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5Eigen15DenseCoeffsBaseINS_6MatrixIfLi3ELi1ELi0ELi3ELi1EEELi1EEixEl(ptr noundef nonnull align 1 dereferenceable(1) %11, i64 noundef 0)
  %13 = load ptr, ptr %9, align 8, !tbaa !17
  %14 = getelementptr inbounds i8, ptr %13, i64 60
  %15 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5Eigen15DenseCoeffsBaseINS_6MatrixIfLi3ELi1ELi0ELi3ELi1EEELi1EEixEl(ptr noundef nonnull align 1 dereferenceable(1) %14, i64 noundef 1)
  %16 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %17 = load ptr, ptr %9, align 8, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %17, i64 60
  %19 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5Eigen15DenseCoeffsBaseINS_6MatrixIfLi3ELi1ELi0ELi3ELi1EEELi1EEixEl(ptr noundef nonnull align 1 dereferenceable(1) %18, i64 noundef 2)
  %20 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %19)
  br label %21

21:                                               ; preds = %1, %8
  ret float 0x3F0A36E2E0000000
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIfERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN5Eigen15DenseCoeffsBaseINS_6MatrixIfLi3ELi1ELi0ELi3ELi1EEELi1EEixEl(ptr noundef nonnull align 1 dereferenceable(1), i64 noundef) local_unnamed_addr #2 align 2

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 = { 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 #2 = { 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" }

!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, !10, i64 8}
!6 = !{!"_ZTS9SimDomain", !7, i64 0, !10, i64 8, !10, i64 16}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !7, i64 24}
!12 = !{!"_ZTS15SnowParticleSet", !13, i64 0, !7, i64 24}
!13 = !{!"_ZTSSt6vectorIP12SnowParticleSaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIP12SnowParticleSaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIP12SnowParticleSaIS1_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIP12SnowParticleSaIS1_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!17 = !{!6, !10, i64 16}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass