; LLVM IR from imeplusplus/icpc-notebook :: geometry/basics.ll (Z5cross5pointS_)

; 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.point = type { x86_fp80, x86_fp80 }

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef x86_fp80 @_Z5cross5pointS_(ptr noundef byval(%struct.point) align 16 %0, ptr noundef byval(%struct.point) align 16 %1) #1 {
  %3 = getelementptr inbounds %struct.point, ptr %0, i32 0, i32 0
  %4 = load x86_fp80, ptr %3, align 16, !tbaa !5
  %5 = getelementptr inbounds %struct.point, ptr %1, i32 0, i32 1
  %6 = load x86_fp80, ptr %5, align 16, !tbaa !10
  %7 = getelementptr inbounds %struct.point, ptr %0, i32 0, i32 1
  %8 = load x86_fp80, ptr %7, align 16, !tbaa !10
  %9 = getelementptr inbounds %struct.point, ptr %1, i32 0, i32 0
  %10 = load x86_fp80, ptr %9, align 16, !tbaa !5
  %11 = fmul x86_fp80 %8, %10
  %12 = fneg x86_fp80 %11
  %13 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %4, x86_fp80 %6, x86_fp80 %12)
  ret x86_fp80 %13
}

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, !7, i64 0}
!6 = !{!"_ZTS5point", !7, i64 0, !7, i64 16}
!7 = !{!"long double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 16}


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

%struct.point = type { x86_fp80, x86_fp80 }

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef x86_fp80 @_Z5cross5pointS_(ptr nocapture noundef readonly byval(%struct.point) align 16 %0, ptr nocapture noundef readonly byval(%struct.point) align 16 %1) local_unnamed_addr #1 {
  %3 = load x86_fp80, ptr %0, align 16, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 16
  %5 = load x86_fp80, ptr %4, align 16, !tbaa !10
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load x86_fp80, ptr %6, align 16, !tbaa !10
  %8 = load x86_fp80, ptr %1, align 16, !tbaa !5
  %9 = fneg x86_fp80 %7
  %10 = fmul x86_fp80 %8, %9
  %11 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %3, x86_fp80 %5, x86_fp80 %10)
  ret x86_fp80 %11
}

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, !7, i64 0}
!6 = !{!"_ZTS5point", !7, i64 0, !7, i64 16}
!7 = !{!"long double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 16}


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