; LLVM IR from ashishzero/karma :: src/modules/core/lin_maths.ll (Z11signed_area4Vec3S_S_)

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

%union.Vec3 = type { %struct.anon }
%struct.anon = type { float, float, float }

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

; 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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_Z11signed_area4Vec3S_S_(<2 x float> %0, float %1, <2 x float> %2, float %3, <2 x float> %4, float %5) #3 {
  %7 = alloca %union.Vec3, align 4
  %8 = alloca { <2 x float>, float }, align 4
  %9 = alloca %union.Vec3, align 4
  %10 = alloca { <2 x float>, float }, align 4
  %11 = alloca %union.Vec3, align 4
  %12 = alloca { <2 x float>, float }, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = getelementptr inbounds { <2 x float>, float }, ptr %8, i32 0, i32 0
  store <2 x float> %0, ptr %16, align 4
  %17 = getelementptr inbounds { <2 x float>, float }, ptr %8, i32 0, i32 1
  store float %1, ptr %17, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %8, i64 12, i1 false)
  %18 = getelementptr inbounds { <2 x float>, float }, ptr %10, i32 0, i32 0
  store <2 x float> %2, ptr %18, align 4
  %19 = getelementptr inbounds { <2 x float>, float }, ptr %10, i32 0, i32 1
  store float %3, ptr %19, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %10, i64 12, i1 false)
  %20 = getelementptr inbounds { <2 x float>, float }, ptr %12, i32 0, i32 0
  store <2 x float> %4, ptr %20, align 4
  %21 = getelementptr inbounds { <2 x float>, float }, ptr %12, i32 0, i32 1
  store float %5, ptr %21, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %12, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %22 = getelementptr inbounds %struct.anon, ptr %7, i32 0, i32 1
  %23 = load float, ptr %22, align 4, !tbaa !5
  %24 = getelementptr inbounds %struct.anon, ptr %7, i32 0, i32 2
  %25 = load float, ptr %24, align 4, !tbaa !5
  %26 = getelementptr inbounds %struct.anon, ptr %9, i32 0, i32 1
  %27 = load float, ptr %26, align 4, !tbaa !5
  %28 = getelementptr inbounds %struct.anon, ptr %9, i32 0, i32 2
  %29 = load float, ptr %28, align 4, !tbaa !5
  %30 = getelementptr inbounds %struct.anon, ptr %11, i32 0, i32 1
  %31 = load float, ptr %30, align 4, !tbaa !5
  %32 = getelementptr inbounds %struct.anon, ptr %11, i32 0, i32 2
  %33 = load float, ptr %32, align 4, !tbaa !5
  %34 = call noundef float @_Z18signed_area_doubleffffff(float noundef %23, float noundef %25, float noundef %27, float noundef %29, float noundef %31, float noundef %33)
  store float %34, ptr %13, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %35 = getelementptr inbounds %struct.anon, ptr %7, i32 0, i32 2
  %36 = load float, ptr %35, align 4, !tbaa !5
  %37 = getelementptr inbounds %struct.anon, ptr %7, i32 0, i32 0
  %38 = load float, ptr %37, align 4, !tbaa !5
  %39 = getelementptr inbounds %struct.anon, ptr %9, i32 0, i32 2
  %40 = load float, ptr %39, align 4, !tbaa !5
  %41 = getelementptr inbounds %struct.anon, ptr %9, i32 0, i32 0
  %42 = load float, ptr %41, align 4, !tbaa !5
  %43 = getelementptr inbounds %struct.anon, ptr %11, i32 0, i32 2
  %44 = load float, ptr %43, align 4, !tbaa !5
  %45 = getelementptr inbounds %struct.anon, ptr %11, i32 0, i32 0
  %46 = load float, ptr %45, align 4, !tbaa !5
  %47 = call noundef float @_Z18signed_area_doubleffffff(float noundef %36, float noundef %38, float noundef %40, float noundef %42, float noundef %44, float noundef %46)
  store float %47, ptr %14, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %48 = getelementptr inbounds %struct.anon, ptr %7, i32 0, i32 0
  %49 = load float, ptr %48, align 4, !tbaa !5
  %50 = getelementptr inbounds %struct.anon, ptr %7, i32 0, i32 1
  %51 = load float, ptr %50, align 4, !tbaa !5
  %52 = getelementptr inbounds %struct.anon, ptr %9, i32 0, i32 0
  %53 = load float, ptr %52, align 4, !tbaa !5
  %54 = getelementptr inbounds %struct.anon, ptr %9, i32 0, i32 1
  %55 = load float, ptr %54, align 4, !tbaa !5
  %56 = getelementptr inbounds %struct.anon, ptr %11, i32 0, i32 0
  %57 = load float, ptr %56, align 4, !tbaa !5
  %58 = getelementptr inbounds %struct.anon, ptr %11, i32 0, i32 1
  %59 = load float, ptr %58, align 4, !tbaa !5
  %60 = call noundef float @_Z18signed_area_doubleffffff(float noundef %49, float noundef %51, float noundef %53, float noundef %55, float noundef %57, float noundef %59)
  store float %60, ptr %15, align 4, !tbaa !8
  %61 = load float, ptr %13, align 4, !tbaa !8
  %62 = load float, ptr %13, align 4, !tbaa !8
  %63 = fmul float %62, %61
  store float %63, ptr %13, align 4, !tbaa !8
  %64 = load float, ptr %14, align 4, !tbaa !8
  %65 = load float, ptr %14, align 4, !tbaa !8
  %66 = fmul float %65, %64
  store float %66, ptr %14, align 4, !tbaa !8
  %67 = load float, ptr %15, align 4, !tbaa !8
  %68 = load float, ptr %15, align 4, !tbaa !8
  %69 = fmul float %68, %67
  store float %69, ptr %15, align 4, !tbaa !8
  %70 = load float, ptr %13, align 4, !tbaa !8
  %71 = load float, ptr %14, align 4, !tbaa !8
  %72 = fadd float %70, %71
  %73 = load float, ptr %15, align 4, !tbaa !8
  %74 = fadd float %72, %73
  %75 = call float @sqrtf(float noundef %74) #5
  %76 = fmul float 5.000000e-01, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  ret float %76
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_Z18signed_area_doubleffffff(float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) #4

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { inlinehint 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 #5 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"float", !6, 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 nounwind uwtable
define dso_local noundef float @_Z11signed_area4Vec3S_S_(<2 x float> %0, float %1, <2 x float> %2, float %3, <2 x float> %4, float %5) local_unnamed_addr #0 {
  %.sroa.026.4.vec.extract = extractelement <2 x float> %0, i64 1
  %.sroa.017.4.vec.extract = extractelement <2 x float> %2, i64 1
  %.sroa.09.4.vec.extract = extractelement <2 x float> %4, i64 1
  %7 = tail call noundef float @_Z18signed_area_doubleffffff(float noundef %.sroa.026.4.vec.extract, float noundef %1, float noundef %.sroa.017.4.vec.extract, float noundef %3, float noundef %.sroa.09.4.vec.extract, float noundef %5)
  %.sroa.026.0.vec.extract = extractelement <2 x float> %0, i64 0
  %.sroa.017.0.vec.extract = extractelement <2 x float> %2, i64 0
  %.sroa.09.0.vec.extract = extractelement <2 x float> %4, i64 0
  %8 = tail call noundef float @_Z18signed_area_doubleffffff(float noundef %1, float noundef %.sroa.026.0.vec.extract, float noundef %3, float noundef %.sroa.017.0.vec.extract, float noundef %5, float noundef %.sroa.09.0.vec.extract)
  %9 = tail call noundef float @_Z18signed_area_doubleffffff(float noundef %.sroa.026.0.vec.extract, float noundef %.sroa.026.4.vec.extract, float noundef %.sroa.017.0.vec.extract, float noundef %.sroa.017.4.vec.extract, float noundef %.sroa.09.0.vec.extract, float noundef %.sroa.09.4.vec.extract)
  %10 = fmul float %7, %7
  %11 = fmul float %8, %8
  %12 = fmul float %9, %9
  %13 = fadd float %10, %11
  %14 = fadd float %13, %12
  %sqrt = tail call float @llvm.sqrt.f32(float %14)
  %15 = fmul float %sqrt, 5.000000e-01
  ret float %15
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_Z18signed_area_doubleffffff(float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #1

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="64" "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 = { inlinehint 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 #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)"}


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