; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK3pgo21SolidDeformationModel26InvariantBasedMaterialStVK17compute_d2psi_dI2EPKdPd(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #2 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
  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
  %9 = load ptr, ptr %4, align 8
  %10 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %9, i32 0, i32 2
  %11 = load double, ptr %10, align 8, !tbaa !9
  %12 = fmul double 2.500000e-01, %11
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds double, ptr %13, i64 0
  store double %12, ptr %14, align 8, !tbaa !13
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = getelementptr inbounds double, ptr %15, i64 1
  store double 0.000000e+00, ptr %16, align 8, !tbaa !13
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds double, ptr %17, i64 2
  store double 0.000000e+00, ptr %18, align 8, !tbaa !13
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds double, ptr %19, i64 3
  store double 0.000000e+00, ptr %20, align 8, !tbaa !13
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds double, ptr %21, i64 4
  store double 0.000000e+00, ptr %22, align 8, !tbaa !13
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds double, ptr %23, i64 5
  store double 0.000000e+00, ptr %24, align 8, !tbaa !13
  %25 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %9, i32 0, i32 3
  %26 = load double, ptr %25, align 8, !tbaa !14
  %27 = fcmp ogt double %26, 0.000000e+00
  br i1 %27, label %28, label %57

28:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds double, ptr %29, i64 2
  %31 = load double, ptr %30, align 8, !tbaa !13
  store double %31, ptr %7, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %32 = load double, ptr %7, align 8, !tbaa !13
  %33 = call double @sqrt(double noundef %32) #3
  store double %33, ptr %8, align 8, !tbaa !13
  %34 = load double, ptr %8, align 8, !tbaa !13
  %35 = fcmp olt double %34, 1.000000e+00
  br i1 %35, label %36, label %56

36:                                               ; preds = %28
  %37 = getelementptr inbounds %"class.pgo::SolidDeformationModel::InvariantBasedMaterialStVK", ptr %9, i32 0, i32 3
  %38 = load double, ptr %37, align 8, !tbaa !14
  %39 = load double, ptr %8, align 8, !tbaa !13
  %40 = fsub double 1.000000e+00, %39
  %41 = fmul double %38, %40
  %42 = load double, ptr %8, align 8, !tbaa !13
  %43 = fadd double 1.000000e+00, %42
  %44 = fmul double %41, %43
  %45 = load double, ptr %8, align 8, !tbaa !13
  %46 = fmul double 3.456000e+03, %45
  %47 = load double, ptr %8, align 8, !tbaa !13
  %48 = fmul double %46, %47
  %49 = load double, ptr %8, align 8, !tbaa !13
  %50 = fmul double %48, %49
  %51 = fdiv double %44, %50
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds double, ptr %52, i64 5
  %54 = load double, ptr %53, align 8, !tbaa !13
  %55 = fadd double %54, %51
  store double %55, ptr %53, align 8, !tbaa !13
  br label %56

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

57:                                               ; preds = %56, %3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { 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, !12, i64 16}
!10 = !{!"_ZTSN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKE", !11, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!11 = !{!"_ZTSN3pgo21SolidDeformationModel22InvariantBasedMaterialE"}
!12 = !{!"double", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!10, !12, 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 nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local void @_ZNK3pgo21SolidDeformationModel26InvariantBasedMaterialStVK17compute_d2psi_dI2EPKdPd(ptr nocapture noundef nonnull readonly align 8 dereferenceable(32) %0, ptr nocapture noundef readonly %1, ptr nocapture noundef %2) unnamed_addr #1 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = load double, ptr %4, align 8, !tbaa !5
  %6 = fmul double %5, 2.500000e-01
  store double %6, ptr %2, align 8, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  %8 = getelementptr inbounds i8, ptr %2, i64 40
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %7, i8 0, i64 40, i1 false)
  %10 = load double, ptr %9, align 8, !tbaa !12
  %11 = fcmp ogt double %10, 0.000000e+00
  br i1 %11, label %12, label %29

12:                                               ; preds = %3
  %13 = getelementptr inbounds i8, ptr %1, i64 16
  %14 = load double, ptr %13, align 8, !tbaa !11
  %15 = tail call double @sqrt(double noundef %14) #3
  %16 = fcmp olt double %15, 1.000000e+00
  br i1 %16, label %17, label %29

17:                                               ; preds = %12
  %18 = load double, ptr %9, align 8, !tbaa !12
  %19 = fsub double 1.000000e+00, %15
  %20 = fmul double %19, %18
  %21 = fadd double %15, 1.000000e+00
  %22 = fmul double %21, %20
  %23 = fmul double %15, 3.456000e+03
  %24 = fmul double %15, %23
  %25 = fmul double %15, %24
  %26 = fdiv double %22, %25
  %27 = load double, ptr %8, align 8, !tbaa !11
  %28 = fadd double %27, %26
  store double %28, ptr %8, align 8, !tbaa !11
  br label %29

29:                                               ; preds = %12, %17, %3
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !8, i64 16}
!6 = !{!"_ZTSN3pgo21SolidDeformationModel26InvariantBasedMaterialStVKE", !7, i64 0, !8, i64 8, !8, i64 16, !8, i64 24}
!7 = !{!"_ZTSN3pgo21SolidDeformationModel22InvariantBasedMaterialE"}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!8, !8, i64 0}
!12 = !{!6, !8, i64 24}


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