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

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK3pgo21SolidDeformationModel26InvariantBasedMaterialStVK15compute_dpsi_dIEPKdPd(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds double, ptr %11, i64 0
  %13 = load double, ptr %12, align 8, !tbaa !9
  store double %13, ptr %7, align 8, !tbaa !9
  %14 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %10, i32 0, i32 2
  %15 = load double, ptr %14, align 8, !tbaa !11
  %16 = fmul double 2.500000e-01, %15
  %17 = load double, ptr %7, align 8, !tbaa !9
  %18 = fsub double %17, 3.000000e+00
  %19 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %10, i32 0, i32 1
  %20 = load double, ptr %19, align 8, !tbaa !14
  %21 = fmul double 5.000000e-01, %20
  %22 = fneg double %21
  %23 = call double @llvm.fmuladd.f64(double %16, double %18, double %22)
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds double, ptr %24, i64 0
  store double %23, ptr %25, align 8, !tbaa !9
  %26 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %10, i32 0, i32 1
  %27 = load double, ptr %26, align 8, !tbaa !14
  %28 = fmul double 2.500000e-01, %27
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds double, ptr %29, i64 1
  store double %28, ptr %30, align 8, !tbaa !9
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds double, ptr %31, i64 2
  store double 0.000000e+00, ptr %32, align 8, !tbaa !9
  %33 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %10, i32 0, i32 3
  %34 = load double, ptr %33, align 8, !tbaa !15
  %35 = fcmp ogt double %34, 0.000000e+00
  br i1 %35, label %36, label %62

36:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds double, ptr %37, i64 2
  %39 = load double, ptr %38, align 8, !tbaa !9
  store double %39, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %40 = load double, ptr %8, align 8, !tbaa !9
  %41 = call double @sqrt(double noundef %40) #4
  store double %41, ptr %9, align 8, !tbaa !9
  %42 = load double, ptr %9, align 8, !tbaa !9
  %43 = fcmp olt double %42, 1.000000e+00
  br i1 %43, label %44, label %61

44:                                               ; preds = %36
  %45 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %10, i32 0, i32 3
  %46 = load double, ptr %45, align 8, !tbaa !15
  %47 = fneg double %46
  %48 = load double, ptr %9, align 8, !tbaa !9
  %49 = fsub double %48, 1.000000e+00
  %50 = fmul double %47, %49
  %51 = load double, ptr %9, align 8, !tbaa !9
  %52 = fsub double %51, 1.000000e+00
  %53 = fmul double %50, %52
  %54 = load double, ptr %9, align 8, !tbaa !9
  %55 = fmul double 1.728000e+03, %54
  %56 = fdiv double %53, %55
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds double, ptr %57, i64 2
  %59 = load double, ptr %58, align 8, !tbaa !9
  %60 = fadd double %59, %56
  store double %60, ptr %58, align 8, !tbaa !9
  br label %61

61:                                               ; preds = %44, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %62

62:                                               ; preds = %61, %3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { 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 #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, !10, i64 16}
!12 = !{!"_ZTSN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKE", !13, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!"_ZTSN3pgo21SolidDeformationModel22InvariantBasedMaterialE"}
!14 = !{!12, !10, i64 8}
!15 = !{!12, !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"

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local void @_ZNK3pgo21SolidDeformationModel26InvariantBasedMaterialStVK15compute_dpsi_dIEPKdPd(ptr nocapture noundef nonnull readonly align 8 dereferenceable(32) %0, ptr nocapture noundef readonly %1, ptr nocapture noundef %2) unnamed_addr #2 align 2 {
  %4 = load double, ptr %1, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load double, ptr %5, align 8, !tbaa !9
  %7 = fmul double %6, 2.500000e-01
  %8 = fadd double %4, -3.000000e+00
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load double, ptr %9, align 8, !tbaa !12
  %11 = fmul double %10, -5.000000e-01
  %12 = tail call double @llvm.fmuladd.f64(double %7, double %8, double %11)
  store double %12, ptr %2, align 8, !tbaa !5
  %13 = load double, ptr %9, align 8, !tbaa !12
  %14 = fmul double %13, 2.500000e-01
  %15 = getelementptr inbounds i8, ptr %2, i64 8
  store double %14, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %2, i64 16
  store double 0.000000e+00, ptr %16, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  %18 = load double, ptr %17, align 8, !tbaa !13
  %19 = fcmp ogt double %18, 0.000000e+00
  br i1 %19, label %20, label %35

20:                                               ; preds = %3
  %21 = getelementptr inbounds i8, ptr %1, i64 16
  %22 = load double, ptr %21, align 8, !tbaa !5
  %23 = tail call double @sqrt(double noundef %22) #3
  %24 = fcmp olt double %23, 1.000000e+00
  br i1 %24, label %25, label %35

25:                                               ; preds = %20
  %26 = load double, ptr %17, align 8, !tbaa !13
  %27 = fneg double %26
  %28 = fadd double %23, -1.000000e+00
  %29 = fmul double %28, %27
  %30 = fmul double %28, %29
  %31 = fmul double %23, 1.728000e+03
  %32 = fdiv double %30, %31
  %33 = load double, ptr %16, align 8, !tbaa !5
  %34 = fadd double %33, %32
  store double %34, ptr %16, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %20, %25, %3
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) 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, !6, i64 16}
!10 = !{!"_ZTSN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"_ZTSN3pgo21SolidDeformationModel22InvariantBasedMaterialE"}
!12 = !{!10, !6, i64 8}
!13 = !{!10, !6, i64 24}


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