; LLVM IR from SourangshuGhosh/Fluid-Simulation-for-Computer-Graphics :: src/implicitpointprimitive.ll (ZN22ImplicitPointPrimitive30_initFieldFunctionCoefficientsEv)

; 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.ImplicitPointPrimitive = type { %"class.vmath::vec3", double, double, double, double }
%"class.vmath::vec3" = type { float, float, float }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN22ImplicitPointPrimitive30_initFieldFunctionCoefficientsEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  %5 = getelementptr inbounds %class.ImplicitPointPrimitive, ptr %4, i32 0, i32 1
  %6 = load double, ptr %5, align 8, !tbaa !9
  store double %6, ptr %3, align 8, !tbaa !14
  %7 = load double, ptr %3, align 8, !tbaa !14
  %8 = load double, ptr %3, align 8, !tbaa !14
  %9 = fmul double %7, %8
  %10 = load double, ptr %3, align 8, !tbaa !14
  %11 = fmul double %9, %10
  %12 = load double, ptr %3, align 8, !tbaa !14
  %13 = fmul double %11, %12
  %14 = load double, ptr %3, align 8, !tbaa !14
  %15 = fmul double %13, %14
  %16 = load double, ptr %3, align 8, !tbaa !14
  %17 = fmul double %15, %16
  %18 = fdiv double 1.000000e+00, %17
  %19 = fmul double 0x3FDC71C71C71C71C, %18
  %20 = getelementptr inbounds %class.ImplicitPointPrimitive, ptr %4, i32 0, i32 2
  store double %19, ptr %20, align 8, !tbaa !15
  %21 = load double, ptr %3, align 8, !tbaa !14
  %22 = load double, ptr %3, align 8, !tbaa !14
  %23 = fmul double %21, %22
  %24 = load double, ptr %3, align 8, !tbaa !14
  %25 = fmul double %23, %24
  %26 = load double, ptr %3, align 8, !tbaa !14
  %27 = fmul double %25, %26
  %28 = fdiv double 1.000000e+00, %27
  %29 = fmul double 0x3FFE38E38E38E38E, %28
  %30 = getelementptr inbounds %class.ImplicitPointPrimitive, ptr %4, i32 0, i32 3
  store double %29, ptr %30, align 8, !tbaa !16
  %31 = load double, ptr %3, align 8, !tbaa !14
  %32 = load double, ptr %3, align 8, !tbaa !14
  %33 = fmul double %31, %32
  %34 = fdiv double 1.000000e+00, %33
  %35 = fmul double 0x40038E38E38E38E4, %34
  %36 = getelementptr inbounds %class.ImplicitPointPrimitive, ptr %4, i32 0, i32 4
  store double %35, ptr %36, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  ret void
}

; 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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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, !13, i64 16}
!10 = !{!"_ZTS22ImplicitPointPrimitive", !11, i64 0, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40}
!11 = !{!"_ZTSN5vmath4vec3E", !12, i64 0, !12, i64 4, !12, i64 8}
!12 = !{!"float", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!10, !13, i64 24}
!16 = !{!10, !13, i64 32}
!17 = !{!10, !13, i64 40}


; 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 norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZN22ImplicitPointPrimitive30_initFieldFunctionCoefficientsEv(ptr nocapture noundef nonnull align 8 dereferenceable(48) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load double, ptr %2, align 8, !tbaa !5
  %4 = fmul double %3, %3
  %5 = fmul double %3, %4
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = fmul double %3, %5
  %8 = fmul double %3, %7
  %9 = fmul double %3, %8
  %10 = insertelement <2 x double> poison, double %9, i64 0
  %11 = insertelement <2 x double> %10, double %7, i64 1
  %12 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %11
  %13 = fmul <2 x double> %12, <double 0x3FDC71C71C71C71C, double 0x3FFE38E38E38E38E>
  store <2 x double> %13, ptr %6, align 8, !tbaa !12
  %14 = fdiv double 1.000000e+00, %4
  %15 = fmul double %14, 0x40038E38E38E38E4
  %16 = getelementptr inbounds i8, ptr %0, i64 40
  store double %15, ptr %16, align 8, !tbaa !13
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(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" }

!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, !11, i64 16}
!6 = !{!"_ZTS22ImplicitPointPrimitive", !7, i64 0, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!7 = !{!"_ZTSN5vmath4vec3E", !8, i64 0, !8, i64 4, !8, i64 8}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"double", !9, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!6, !11, i64 40}


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