; LLVM IR from atlantis13579/Riemann :: Src/Geometry/Polygon3.ll (ZN7Riemann14TriangleArea3DERKN5Maths8TVector3IfEES4_S4_)

; 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.Maths::TVector3" = type { float, float, float }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_ZN7Riemann14TriangleArea3DERKN5Maths8TVector3IfEES4_S4_(ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  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
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %"class.Maths::TVector3", ptr %10, i32 0, i32 1
  %12 = load float, ptr %11, align 4, !tbaa !9
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %"class.Maths::TVector3", ptr %13, i32 0, i32 1
  %15 = load float, ptr %14, align 4, !tbaa !9
  %16 = fsub float %12, %15
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.Maths::TVector3", ptr %17, i32 0, i32 2
  %19 = load float, ptr %18, align 4, !tbaa !12
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.Maths::TVector3", ptr %20, i32 0, i32 2
  %22 = load float, ptr %21, align 4, !tbaa !12
  %23 = fsub float %19, %22
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.Maths::TVector3", ptr %24, i32 0, i32 1
  %26 = load float, ptr %25, align 4, !tbaa !9
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.Maths::TVector3", ptr %27, i32 0, i32 1
  %29 = load float, ptr %28, align 4, !tbaa !9
  %30 = fsub float %26, %29
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %"class.Maths::TVector3", ptr %31, i32 0, i32 2
  %33 = load float, ptr %32, align 4, !tbaa !12
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %"class.Maths::TVector3", ptr %34, i32 0, i32 2
  %36 = load float, ptr %35, align 4, !tbaa !12
  %37 = fsub float %33, %36
  %38 = fmul float %30, %37
  %39 = fneg float %38
  %40 = call float @llvm.fmuladd.f32(float %16, float %23, float %39)
  store float %40, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %"class.Maths::TVector3", ptr %41, i32 0, i32 2
  %43 = load float, ptr %42, align 4, !tbaa !12
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %"class.Maths::TVector3", ptr %44, i32 0, i32 2
  %46 = load float, ptr %45, align 4, !tbaa !12
  %47 = fsub float %43, %46
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %"class.Maths::TVector3", ptr %48, i32 0, i32 0
  %50 = load float, ptr %49, align 4, !tbaa !14
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %"class.Maths::TVector3", ptr %51, i32 0, i32 0
  %53 = load float, ptr %52, align 4, !tbaa !14
  %54 = fsub float %50, %53
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %"class.Maths::TVector3", ptr %55, i32 0, i32 2
  %57 = load float, ptr %56, align 4, !tbaa !12
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %"class.Maths::TVector3", ptr %58, i32 0, i32 2
  %60 = load float, ptr %59, align 4, !tbaa !12
  %61 = fsub float %57, %60
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %"class.Maths::TVector3", ptr %62, i32 0, i32 0
  %64 = load float, ptr %63, align 4, !tbaa !14
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %"class.Maths::TVector3", ptr %65, i32 0, i32 0
  %67 = load float, ptr %66, align 4, !tbaa !14
  %68 = fsub float %64, %67
  %69 = fmul float %61, %68
  %70 = fneg float %69
  %71 = call float @llvm.fmuladd.f32(float %47, float %54, float %70)
  store float %71, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %"class.Maths::TVector3", ptr %72, i32 0, i32 0
  %74 = load float, ptr %73, align 4, !tbaa !14
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = getelementptr inbounds %"class.Maths::TVector3", ptr %75, i32 0, i32 0
  %77 = load float, ptr %76, align 4, !tbaa !14
  %78 = fsub float %74, %77
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %"class.Maths::TVector3", ptr %79, i32 0, i32 1
  %81 = load float, ptr %80, align 4, !tbaa !9
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %"class.Maths::TVector3", ptr %82, i32 0, i32 1
  %84 = load float, ptr %83, align 4, !tbaa !9
  %85 = fsub float %81, %84
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %"class.Maths::TVector3", ptr %86, i32 0, i32 0
  %88 = load float, ptr %87, align 4, !tbaa !14
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %"class.Maths::TVector3", ptr %89, i32 0, i32 0
  %91 = load float, ptr %90, align 4, !tbaa !14
  %92 = fsub float %88, %91
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = getelementptr inbounds %"class.Maths::TVector3", ptr %93, i32 0, i32 1
  %95 = load float, ptr %94, align 4, !tbaa !9
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %"class.Maths::TVector3", ptr %96, i32 0, i32 1
  %98 = load float, ptr %97, align 4, !tbaa !9
  %99 = fsub float %95, %98
  %100 = fmul float %92, %99
  %101 = fneg float %100
  %102 = call float @llvm.fmuladd.f32(float %78, float %85, float %101)
  store float %102, ptr %9, align 4, !tbaa !13
  %103 = load float, ptr %7, align 4, !tbaa !13
  %104 = load float, ptr %7, align 4, !tbaa !13
  %105 = load float, ptr %8, align 4, !tbaa !13
  %106 = load float, ptr %8, align 4, !tbaa !13
  %107 = fmul float %105, %106
  %108 = call float @llvm.fmuladd.f32(float %103, float %104, float %107)
  %109 = load float, ptr %9, align 4, !tbaa !13
  %110 = load float, ptr %9, align 4, !tbaa !13
  %111 = call float @llvm.fmuladd.f32(float %109, float %110, float %108)
  %112 = call float @sqrtf(float noundef %111) #4
  %113 = fmul float 5.000000e-01, %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret float %113
}

; 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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nounwind
declare float @sqrtf(float noundef) #3

; 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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, !11, i64 4}
!10 = !{!"_ZTSN5Maths8TVector3IfEE", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"float", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !11, 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 float @_ZN7Riemann14TriangleArea3DERKN5Maths8TVector3IfEES4_S4_(ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %1, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %1, i64 4
  %5 = load float, ptr %4, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load float, ptr %6, align 4, !tbaa !5
  %8 = fsub float %5, %7
  %9 = getelementptr inbounds i8, ptr %2, i64 8
  %10 = load float, ptr %9, align 4, !tbaa !10
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load float, ptr %11, align 4, !tbaa !10
  %13 = fsub float %10, %12
  %14 = getelementptr inbounds i8, ptr %2, i64 4
  %15 = load float, ptr %14, align 4, !tbaa !5
  %16 = fsub float %15, %7
  %17 = getelementptr inbounds i8, ptr %1, i64 8
  %18 = load float, ptr %17, align 4, !tbaa !10
  %19 = fsub float %18, %12
  %20 = fneg float %16
  %21 = fmul float %19, %20
  %22 = tail call float @llvm.fmuladd.f32(float %8, float %13, float %21)
  %23 = load float, ptr %2, align 4, !tbaa !11
  %24 = load float, ptr %0, align 4, !tbaa !11
  %25 = fsub float %23, %24
  %26 = load float, ptr %1, align 4, !tbaa !11
  %27 = fsub float %26, %24
  %28 = fneg float %13
  %29 = fmul float %27, %28
  %30 = tail call float @llvm.fmuladd.f32(float %19, float %25, float %29)
  %31 = fneg float %25
  %32 = fmul float %8, %31
  %33 = tail call float @llvm.fmuladd.f32(float %27, float %16, float %32)
  %34 = fmul float %30, %30
  %35 = tail call float @llvm.fmuladd.f32(float %22, float %22, float %34)
  %36 = tail call float @llvm.fmuladd.f32(float %33, float %33, float %35)
  %sqrt = tail call float @llvm.sqrt.f32(float %36)
  %37 = fmul float %sqrt, 5.000000e-01
  ret float %37
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.sqrt.f32(float) #2

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) }
attributes #2 = { 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, !7, i64 4}
!6 = !{!"_ZTSN5Maths8TVector3IfEE", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 0}


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