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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN13Interpolation20trilinearInterpolateEPdddd(ptr noundef %0, double noundef %1, double noundef %2, double noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  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
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds double, ptr %9, i64 0
  %11 = load double, ptr %10, align 8, !tbaa !9
  %12 = load double, ptr %6, align 8, !tbaa !9
  %13 = fsub double 1.000000e+00, %12
  %14 = fmul double %11, %13
  %15 = load double, ptr %7, align 8, !tbaa !9
  %16 = fsub double 1.000000e+00, %15
  %17 = fmul double %14, %16
  %18 = load double, ptr %8, align 8, !tbaa !9
  %19 = fsub double 1.000000e+00, %18
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds double, ptr %20, i64 1
  %22 = load double, ptr %21, align 8, !tbaa !9
  %23 = load double, ptr %6, align 8, !tbaa !9
  %24 = fmul double %22, %23
  %25 = load double, ptr %7, align 8, !tbaa !9
  %26 = fsub double 1.000000e+00, %25
  %27 = fmul double %24, %26
  %28 = load double, ptr %8, align 8, !tbaa !9
  %29 = fsub double 1.000000e+00, %28
  %30 = fmul double %27, %29
  %31 = call double @llvm.fmuladd.f64(double %17, double %19, double %30)
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds double, ptr %32, i64 2
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = load double, ptr %6, align 8, !tbaa !9
  %36 = fsub double 1.000000e+00, %35
  %37 = fmul double %34, %36
  %38 = load double, ptr %7, align 8, !tbaa !9
  %39 = fmul double %37, %38
  %40 = load double, ptr %8, align 8, !tbaa !9
  %41 = fsub double 1.000000e+00, %40
  %42 = call double @llvm.fmuladd.f64(double %39, double %41, double %31)
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds double, ptr %43, i64 3
  %45 = load double, ptr %44, align 8, !tbaa !9
  %46 = load double, ptr %6, align 8, !tbaa !9
  %47 = fsub double 1.000000e+00, %46
  %48 = fmul double %45, %47
  %49 = load double, ptr %7, align 8, !tbaa !9
  %50 = fsub double 1.000000e+00, %49
  %51 = fmul double %48, %50
  %52 = load double, ptr %8, align 8, !tbaa !9
  %53 = call double @llvm.fmuladd.f64(double %51, double %52, double %42)
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds double, ptr %54, i64 4
  %56 = load double, ptr %55, align 8, !tbaa !9
  %57 = load double, ptr %6, align 8, !tbaa !9
  %58 = fmul double %56, %57
  %59 = load double, ptr %7, align 8, !tbaa !9
  %60 = fsub double 1.000000e+00, %59
  %61 = fmul double %58, %60
  %62 = load double, ptr %8, align 8, !tbaa !9
  %63 = call double @llvm.fmuladd.f64(double %61, double %62, double %53)
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds double, ptr %64, i64 5
  %66 = load double, ptr %65, align 8, !tbaa !9
  %67 = load double, ptr %6, align 8, !tbaa !9
  %68 = fsub double 1.000000e+00, %67
  %69 = fmul double %66, %68
  %70 = load double, ptr %7, align 8, !tbaa !9
  %71 = fmul double %69, %70
  %72 = load double, ptr %8, align 8, !tbaa !9
  %73 = call double @llvm.fmuladd.f64(double %71, double %72, double %63)
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds double, ptr %74, i64 6
  %76 = load double, ptr %75, align 8, !tbaa !9
  %77 = load double, ptr %6, align 8, !tbaa !9
  %78 = fmul double %76, %77
  %79 = load double, ptr %7, align 8, !tbaa !9
  %80 = fmul double %78, %79
  %81 = load double, ptr %8, align 8, !tbaa !9
  %82 = fsub double 1.000000e+00, %81
  %83 = call double @llvm.fmuladd.f64(double %80, double %82, double %73)
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds double, ptr %84, i64 7
  %86 = load double, ptr %85, align 8, !tbaa !9
  %87 = load double, ptr %6, align 8, !tbaa !9
  %88 = fmul double %86, %87
  %89 = load double, ptr %7, align 8, !tbaa !9
  %90 = fmul double %88, %89
  %91 = load double, ptr %8, align 8, !tbaa !9
  %92 = call double @llvm.fmuladd.f64(double %90, double %91, double %83)
  ret double %92
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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" }

!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}


; 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 norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef double @_ZN13Interpolation20trilinearInterpolateEPdddd(ptr nocapture noundef readonly %0, double noundef %1, double noundef %2, double noundef %3) local_unnamed_addr #1 {
  %5 = load double, ptr %0, align 8, !tbaa !5
  %6 = fsub double 1.000000e+00, %1
  %7 = fmul double %6, %5
  %8 = fsub double 1.000000e+00, %2
  %9 = fmul double %8, %7
  %10 = fsub double 1.000000e+00, %3
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load double, ptr %11, align 8, !tbaa !5
  %13 = fmul double %12, %1
  %14 = fmul double %8, %13
  %15 = fmul double %10, %14
  %16 = tail call double @llvm.fmuladd.f64(double %9, double %10, double %15)
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = fmul double %6, %18
  %20 = fmul double %19, %2
  %21 = tail call double @llvm.fmuladd.f64(double %20, double %10, double %16)
  %22 = getelementptr inbounds i8, ptr %0, i64 24
  %23 = load double, ptr %22, align 8, !tbaa !5
  %24 = fmul double %6, %23
  %25 = fmul double %8, %24
  %26 = tail call double @llvm.fmuladd.f64(double %25, double %3, double %21)
  %27 = getelementptr inbounds i8, ptr %0, i64 32
  %28 = load double, ptr %27, align 8, !tbaa !5
  %29 = fmul double %28, %1
  %30 = fmul double %8, %29
  %31 = tail call double @llvm.fmuladd.f64(double %30, double %3, double %26)
  %32 = getelementptr inbounds i8, ptr %0, i64 40
  %33 = load double, ptr %32, align 8, !tbaa !5
  %34 = fmul double %6, %33
  %35 = fmul double %34, %2
  %36 = tail call double @llvm.fmuladd.f64(double %35, double %3, double %31)
  %37 = getelementptr inbounds i8, ptr %0, i64 48
  %38 = load double, ptr %37, align 8, !tbaa !5
  %39 = fmul double %38, %1
  %40 = fmul double %39, %2
  %41 = tail call double @llvm.fmuladd.f64(double %40, double %10, double %36)
  %42 = getelementptr inbounds i8, ptr %0, i64 56
  %43 = load double, ptr %42, align 8, !tbaa !5
  %44 = fmul double %43, %1
  %45 = fmul double %44, %2
  %46 = tail call double @llvm.fmuladd.f64(double %45, double %3, double %41)
  ret double %46
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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