; LLVM IR from idmillington/cyclone-physics :: src/core.ll (ZNK7cyclone7Matrix414getDeterminantEv)

; 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.cyclone::Matrix4" = type { [12 x double] }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZNK7cyclone7Matrix414getDeterminantEv(ptr noundef nonnull align 8 dereferenceable(96) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %5 = getelementptr inbounds [12 x double], ptr %4, i64 0, i64 8
  %6 = load double, ptr %5, align 8, !tbaa !9
  %7 = fneg double %6
  %8 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %9 = getelementptr inbounds [12 x double], ptr %8, i64 0, i64 5
  %10 = load double, ptr %9, align 8, !tbaa !9
  %11 = fmul double %7, %10
  %12 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %13 = getelementptr inbounds [12 x double], ptr %12, i64 0, i64 2
  %14 = load double, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %16 = getelementptr inbounds [12 x double], ptr %15, i64 0, i64 4
  %17 = load double, ptr %16, align 8, !tbaa !9
  %18 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %19 = getelementptr inbounds [12 x double], ptr %18, i64 0, i64 9
  %20 = load double, ptr %19, align 8, !tbaa !9
  %21 = fmul double %17, %20
  %22 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %23 = getelementptr inbounds [12 x double], ptr %22, i64 0, i64 2
  %24 = load double, ptr %23, align 8, !tbaa !9
  %25 = fmul double %21, %24
  %26 = call double @llvm.fmuladd.f64(double %11, double %14, double %25)
  %27 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %28 = getelementptr inbounds [12 x double], ptr %27, i64 0, i64 8
  %29 = load double, ptr %28, align 8, !tbaa !9
  %30 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %31 = getelementptr inbounds [12 x double], ptr %30, i64 0, i64 1
  %32 = load double, ptr %31, align 8, !tbaa !9
  %33 = fmul double %29, %32
  %34 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %35 = getelementptr inbounds [12 x double], ptr %34, i64 0, i64 6
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = call double @llvm.fmuladd.f64(double %33, double %36, double %26)
  %38 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %39 = getelementptr inbounds [12 x double], ptr %38, i64 0, i64 0
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %42 = getelementptr inbounds [12 x double], ptr %41, i64 0, i64 9
  %43 = load double, ptr %42, align 8, !tbaa !9
  %44 = fmul double %40, %43
  %45 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %46 = getelementptr inbounds [12 x double], ptr %45, i64 0, i64 6
  %47 = load double, ptr %46, align 8, !tbaa !9
  %48 = fneg double %44
  %49 = call double @llvm.fmuladd.f64(double %48, double %47, double %37)
  %50 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %51 = getelementptr inbounds [12 x double], ptr %50, i64 0, i64 4
  %52 = load double, ptr %51, align 8, !tbaa !9
  %53 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %54 = getelementptr inbounds [12 x double], ptr %53, i64 0, i64 1
  %55 = load double, ptr %54, align 8, !tbaa !9
  %56 = fmul double %52, %55
  %57 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %58 = getelementptr inbounds [12 x double], ptr %57, i64 0, i64 10
  %59 = load double, ptr %58, align 8, !tbaa !9
  %60 = fneg double %56
  %61 = call double @llvm.fmuladd.f64(double %60, double %59, double %49)
  %62 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %63 = getelementptr inbounds [12 x double], ptr %62, i64 0, i64 0
  %64 = load double, ptr %63, align 8, !tbaa !9
  %65 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %66 = getelementptr inbounds [12 x double], ptr %65, i64 0, i64 5
  %67 = load double, ptr %66, align 8, !tbaa !9
  %68 = fmul double %64, %67
  %69 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %3, i32 0, i32 0
  %70 = getelementptr inbounds [12 x double], ptr %69, i64 0, i64 10
  %71 = load double, ptr %70, align 8, !tbaa !9
  %72 = call double @llvm.fmuladd.f64(double %68, double %71, double %61)
  ret double %72
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 speculatable willreturn memory(none) }

!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 nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef double @_ZNK7cyclone7Matrix414getDeterminantEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(96) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 64
  %3 = load double, ptr %2, align 8, !tbaa !5
  %4 = fneg double %3
  %5 = getelementptr inbounds i8, ptr %0, i64 40
  %6 = load double, ptr %5, align 8, !tbaa !5
  %7 = fmul double %6, %4
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load double, ptr %8, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 72
  %13 = load double, ptr %12, align 8, !tbaa !5
  %14 = fmul double %11, %13
  %15 = fmul double %9, %14
  %16 = tail call double @llvm.fmuladd.f64(double %7, double %9, double %15)
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = fmul double %3, %18
  %20 = getelementptr inbounds i8, ptr %0, i64 48
  %21 = load double, ptr %20, align 8, !tbaa !5
  %22 = tail call double @llvm.fmuladd.f64(double %19, double %21, double %16)
  %23 = load double, ptr %0, align 8, !tbaa !5
  %24 = fneg double %23
  %25 = fmul double %13, %24
  %26 = tail call double @llvm.fmuladd.f64(double %25, double %21, double %22)
  %27 = getelementptr inbounds i8, ptr %0, i64 80
  %28 = load double, ptr %27, align 8, !tbaa !5
  %29 = fneg double %11
  %30 = fmul double %18, %29
  %31 = tail call double @llvm.fmuladd.f64(double %30, double %28, double %26)
  %32 = fmul double %6, %23
  %33 = tail call double @llvm.fmuladd.f64(double %32, double %28, double %31)
  ret double %33
}

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

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

!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