; LLVM IR from bohanwang/libpgo :: src/core/solidDeformationModel (invariantBasedMaterialStVK)

; 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.pgo::SolidDeformationModel::SimulationMeshENuMaterial" = type { %"class.pgo::SolidDeformationModel::SimulationMeshMaterial", double, double }
%"class.pgo::SolidDeformationModel::SimulationMeshMaterial" = type { ptr }
%"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK" = type { %"class.pgo::SolidDeformationModel::InvariantBasedMaterial", double, double, double }
%"class.pgo::SolidDeformationModel::InvariantBasedMaterial" = type { ptr }

@_ZTVN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKE = external dso_local unnamed_addr constant { [7 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKC2Eddd(ptr noundef nonnull align 8 dereferenceable(32) %0, double noundef %1, double noundef %2, double noundef %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca %"class.pgo::SolidDeformationModel::SimulationMeshENuMaterial", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store double %2, ptr %7, align 8, !tbaa !9
  store double %3, ptr %8, align 8, !tbaa !9
  %12 = load ptr, ptr %5, align 8
  call void @_ZN3pgo21SolidDeformationModel22InvariantBasedMaterialC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12)
  store ptr getelementptr inbounds inrange(-16, 40) ({ [7 x ptr] }, ptr @_ZTVN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKE, i32 0, i32 0, i32 2), ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #4
  %13 = load double, ptr %6, align 8, !tbaa !9
  %14 = load double, ptr %7, align 8, !tbaa !9
  invoke void @_ZN3pgo21SolidDeformationModel25SimulationMeshENuMaterialC2Edd(ptr noundef nonnull align 8 dereferenceable(24) %9, double noundef %13, double noundef %14)
          to label %15 unwind label %32

15:                                               ; preds = %4
  %16 = invoke noundef double @_ZNK3pgo21SolidDeformationModel25SimulationMeshENuMaterial13getLambdaLameEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
          to label %17 unwind label %36

17:                                               ; preds = %15
  %18 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %12, i32 0, i32 2
  store double %16, ptr %18, align 8, !tbaa !13
  %19 = invoke noundef double @_ZNK3pgo21SolidDeformationModel25SimulationMeshENuMaterial9getMuLameEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
          to label %20 unwind label %36

20:                                               ; preds = %17
  %21 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %12, i32 0, i32 1
  store double %19, ptr %21, align 8, !tbaa !16
  %22 = load double, ptr %8, align 8, !tbaa !9
  %23 = fcmp ogt double %22, 0.000000e+00
  br i1 %23, label %24, label %40

24:                                               ; preds = %20
  %25 = load double, ptr %8, align 8, !tbaa !9
  %26 = load double, ptr %6, align 8, !tbaa !9
  %27 = fmul double %25, %26
  %28 = load double, ptr %7, align 8, !tbaa !9
  %29 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %28, double 1.000000e+00)
  %30 = fdiv double %27, %29
  %31 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %12, i32 0, i32 3
  store double %30, ptr %31, align 8, !tbaa !17
  br label %42

32:                                               ; preds = %4
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %10, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %11, align 4
  br label %43

36:                                               ; preds = %17, %15
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %10, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %11, align 4
  call void @_ZN3pgo21SolidDeformationModel22SimulationMeshMaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #4
  br label %43

40:                                               ; preds = %20
  %41 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %12, i32 0, i32 3
  store double 0.000000e+00, ptr %41, align 8, !tbaa !17
  br label %42

42:                                               ; preds = %40, %24
  call void @_ZN3pgo21SolidDeformationModel22SimulationMeshMaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #4
  ret void

43:                                               ; preds = %36, %32
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #4
  call void @_ZN3pgo21SolidDeformationModel22InvariantBasedMaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %10, align 8
  %46 = load i32, ptr %11, align 4
  %47 = insertvalue { ptr, i32 } poison, ptr %45, 0
  %48 = insertvalue { ptr, i32 } %47, i32 %46, 1
  resume { ptr, i32 } %48
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3pgo21SolidDeformationModel22InvariantBasedMaterialC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3pgo21SolidDeformationModel25SimulationMeshENuMaterialC2Edd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3pgo21SolidDeformationModel22SimulationMeshMaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3pgo21SolidDeformationModel22InvariantBasedMaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 16}
!14 = !{!"_ZTSN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKE", !15, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!15 = !{!"_ZTSN3pgo21SolidDeformationModel22InvariantBasedMaterialE"}
!16 = !{!14, !10, i64 8}
!17 = !{!14, !10, i64 24}


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

%"class.pgo::SolidDeformationModel::SimulationMeshENuMaterial" = type { %"class.pgo::SolidDeformationModel::SimulationMeshMaterial", double, double }
%"class.pgo::SolidDeformationModel::SimulationMeshMaterial" = type { ptr }

@_ZTVN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKE = external dso_local unnamed_addr constant { [7 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKC2Eddd(ptr noundef nonnull align 8 dereferenceable(32) %0, double noundef %1, double noundef %2, double noundef %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.pgo::SolidDeformationModel::SimulationMeshENuMaterial", align 8
  tail call void @_ZN3pgo21SolidDeformationModel22InvariantBasedMaterialC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  store ptr getelementptr inbounds inrange(-16, 40) (i8, ptr @_ZTVN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKE, i64 16), ptr %0, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #4
  invoke void @_ZN3pgo21SolidDeformationModel25SimulationMeshENuMaterialC2Edd(ptr noundef nonnull align 8 dereferenceable(24) %5, double noundef %1, double noundef %2)
          to label %6 unwind label %16

6:                                                ; preds = %4
  %7 = call noundef double @_ZNK3pgo21SolidDeformationModel25SimulationMeshENuMaterial13getLambdaLameEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  store double %7, ptr %8, align 8, !tbaa !8
  %9 = call noundef double @_ZNK3pgo21SolidDeformationModel25SimulationMeshENuMaterial9getMuLameEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  store double %9, ptr %10, align 8, !tbaa !13
  %11 = fcmp ogt double %3, 0.000000e+00
  %12 = fmul double %1, %3
  %13 = call double @llvm.fmuladd.f64(double %2, double -2.000000e+00, double 1.000000e+00)
  %14 = fdiv double %12, %13
  %.sink = select i1 %11, double %14, double 0.000000e+00
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  store double %.sink, ptr %15, align 8
  call void @_ZN3pgo21SolidDeformationModel22SimulationMeshMaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #4
  ret void

16:                                               ; preds = %4
  %17 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #4
  call void @_ZN3pgo21SolidDeformationModel22InvariantBasedMaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #4
  resume { ptr, i32 } %17
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3pgo21SolidDeformationModel22InvariantBasedMaterialC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3pgo21SolidDeformationModel25SimulationMeshENuMaterialC2Edd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK3pgo21SolidDeformationModel25SimulationMeshENuMaterial9getMuLameEv(ptr noundef nonnull align 8 dereferenceable(24)) 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) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3pgo21SolidDeformationModel22SimulationMeshMaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3pgo21SolidDeformationModel22InvariantBasedMaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 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 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !11, i64 16}
!9 = !{!"_ZTSN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKE", !10, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!10 = !{!"_ZTSN3pgo21SolidDeformationModel22InvariantBasedMaterialE"}
!11 = !{!"double", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!9, !11, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass