; LLVM IR from NishkarshRaj/Computer-Graphics :: Logistics/Clipping Algorithms/Sutherland Hodgeman/Sutherland_Net.ll (Z6inside7point2DS_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"

%struct.point2D = type { float, float }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z6inside7point2DS_S_(<2 x float> %0, <2 x float> %1, <2 x float> %2) #0 {
  %4 = alloca %struct.point2D, align 4
  %5 = alloca %struct.point2D, align 4
  %6 = alloca %struct.point2D, align 4
  store <2 x float> %0, ptr %4, align 4
  store <2 x float> %1, ptr %5, align 4
  store <2 x float> %2, ptr %6, align 4
  %7 = getelementptr inbounds %struct.point2D, ptr %6, i32 0, i32 1
  %8 = load float, ptr %7, align 4, !tbaa !5
  %9 = getelementptr inbounds %struct.point2D, ptr %5, i32 0, i32 1
  %10 = load float, ptr %9, align 4, !tbaa !5
  %11 = fsub float %8, %10
  %12 = getelementptr inbounds %struct.point2D, ptr %4, i32 0, i32 0
  %13 = load float, ptr %12, align 4, !tbaa !10
  %14 = getelementptr inbounds %struct.point2D, ptr %5, i32 0, i32 0
  %15 = load float, ptr %14, align 4, !tbaa !10
  %16 = getelementptr inbounds %struct.point2D, ptr %6, i32 0, i32 0
  %17 = load float, ptr %16, align 4, !tbaa !10
  %18 = fsub float %15, %17
  %19 = getelementptr inbounds %struct.point2D, ptr %4, i32 0, i32 1
  %20 = load float, ptr %19, align 4, !tbaa !5
  %21 = fmul float %18, %20
  %22 = call float @llvm.fmuladd.f32(float %11, float %13, float %21)
  %23 = getelementptr inbounds %struct.point2D, ptr %6, i32 0, i32 0
  %24 = load float, ptr %23, align 4, !tbaa !10
  %25 = getelementptr inbounds %struct.point2D, ptr %5, i32 0, i32 1
  %26 = load float, ptr %25, align 4, !tbaa !5
  %27 = getelementptr inbounds %struct.point2D, ptr %5, i32 0, i32 0
  %28 = load float, ptr %27, align 4, !tbaa !10
  %29 = getelementptr inbounds %struct.point2D, ptr %6, i32 0, i32 1
  %30 = load float, ptr %29, align 4, !tbaa !5
  %31 = fmul float %28, %30
  %32 = fneg float %31
  %33 = call float @llvm.fmuladd.f32(float %24, float %26, float %32)
  %34 = fadd float %22, %33
  %35 = fcmp olt float %34, 0.000000e+00
  ret i1 %35
}

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

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 = { 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 = !{!"_ZTS7point2D", !7, i64 0, !7, i64 4}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !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(none) uwtable
define dso_local noundef zeroext i1 @_Z6inside7point2DS_S_(<2 x float> %0, <2 x float> %1, <2 x float> %2) local_unnamed_addr #0 {
  %.sroa.0.4.vec.extract = extractelement <2 x float> %2, i64 1
  %.sroa.05.4.vec.extract = extractelement <2 x float> %1, i64 1
  %4 = fsub float %.sroa.0.4.vec.extract, %.sroa.05.4.vec.extract
  %.sroa.010.0.vec.extract = extractelement <2 x float> %0, i64 0
  %.sroa.05.0.vec.extract = extractelement <2 x float> %1, i64 0
  %.sroa.0.0.vec.extract = extractelement <2 x float> %2, i64 0
  %5 = fsub <2 x float> %1, %2
  %shift = shufflevector <2 x float> %0, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %6 = fmul <2 x float> %shift, %5
  %7 = extractelement <2 x float> %6, i64 0
  %8 = tail call float @llvm.fmuladd.f32(float %4, float %.sroa.010.0.vec.extract, float %7)
  %9 = fneg float %.sroa.05.0.vec.extract
  %10 = fmul float %.sroa.0.4.vec.extract, %9
  %11 = tail call float @llvm.fmuladd.f32(float %.sroa.0.0.vec.extract, float %.sroa.05.4.vec.extract, float %10)
  %12 = fadd float %11, %8
  %13 = fcmp olt float %12, 0.000000e+00
  ret i1 %13
}

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

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


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