; LLVM IR from ShahjalalShohag/code-library :: Geometry/Voronoi Diagram.ll (Z22line_line_intersection2PTS_S_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.PT = type { double, double }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2PTC2Edd(ptr noundef nonnull align 8 dereferenceable(16), double noundef, double noundef) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z22line_line_intersection2PTS_S_S_(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8 %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #3 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca %struct.PT, align 8
  %15 = alloca %struct.PT, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca %struct.PT, align 8
  %20 = alloca %struct.PT, align 8
  %21 = alloca double, align 8
  store ptr %0, ptr %6, align 8
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %22 = getelementptr inbounds %struct.PT, ptr %1, i32 0, i32 1
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds %struct.PT, ptr %2, i32 0, i32 1
  %25 = load double, ptr %24, align 8, !tbaa !9
  %26 = fsub double %23, %25
  store double %26, ptr %11, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %27 = getelementptr inbounds %struct.PT, ptr %2, i32 0, i32 0
  %28 = load double, ptr %27, align 8, !tbaa !13
  %29 = getelementptr inbounds %struct.PT, ptr %1, i32 0, i32 0
  %30 = load double, ptr %29, align 8, !tbaa !13
  %31 = fsub double %28, %30
  store double %31, ptr %12, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %1)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %32 = call noundef double @_Z5cross2PTS_(ptr noundef %14, ptr noundef %15)
  store double %32, ptr %13, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %33 = getelementptr inbounds %struct.PT, ptr %3, i32 0, i32 1
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.PT, ptr %4, i32 0, i32 1
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = fsub double %34, %36
  store double %37, ptr %16, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %38 = getelementptr inbounds %struct.PT, ptr %4, i32 0, i32 0
  %39 = load double, ptr %38, align 8, !tbaa !13
  %40 = getelementptr inbounds %struct.PT, ptr %3, i32 0, i32 0
  %41 = load double, ptr %40, align 8, !tbaa !13
  %42 = fsub double %39, %41
  store double %42, ptr %17, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(16) %3)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(16) %4)
  %43 = call noundef double @_Z5cross2PTS_(ptr noundef %19, ptr noundef %20)
  store double %43, ptr %18, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %44 = load double, ptr %11, align 8, !tbaa !12
  %45 = load double, ptr %17, align 8, !tbaa !12
  %46 = load double, ptr %16, align 8, !tbaa !12
  %47 = load double, ptr %12, align 8, !tbaa !12
  %48 = fmul double %46, %47
  %49 = fneg double %48
  %50 = call double @llvm.fmuladd.f64(double %44, double %45, double %49)
  store double %50, ptr %21, align 8, !tbaa !12
  %51 = load double, ptr %12, align 8, !tbaa !12
  %52 = load double, ptr %18, align 8, !tbaa !12
  %53 = load double, ptr %17, align 8, !tbaa !12
  %54 = load double, ptr %13, align 8, !tbaa !12
  %55 = fmul double %53, %54
  %56 = fneg double %55
  %57 = call double @llvm.fmuladd.f64(double %51, double %52, double %56)
  %58 = load double, ptr %21, align 8, !tbaa !12
  %59 = fdiv double %57, %58
  %60 = load double, ptr %13, align 8, !tbaa !12
  %61 = load double, ptr %16, align 8, !tbaa !12
  %62 = load double, ptr %11, align 8, !tbaa !12
  %63 = load double, ptr %18, align 8, !tbaa !12
  %64 = fmul double %62, %63
  %65 = fneg double %64
  %66 = call double @llvm.fmuladd.f64(double %60, double %61, double %65)
  %67 = load double, ptr %21, align 8, !tbaa !12
  %68 = fdiv double %66, %67
  call void @_ZN2PTC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %0, double noundef %59, double noundef %68)
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_Z5cross2PTS_(ptr noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"_ZTS2PT", !11, i64 0, !11, i64 8}
!11 = !{!"double", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!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"

%struct.PT = type { double, double }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2PTC2Edd(ptr noundef nonnull align 8 dereferenceable(16), double noundef, double noundef) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z22line_line_intersection2PTS_S_S_(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8 %0, ptr noundef nonnull %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = alloca %struct.PT, align 8
  %7 = alloca %struct.PT, align 8
  %8 = alloca %struct.PT, align 8
  %9 = alloca %struct.PT, align 8
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %2, i64 8
  %13 = load double, ptr %12, align 8, !tbaa !5
  %14 = fsub double %11, %13
  %15 = load double, ptr %2, align 8, !tbaa !10
  %16 = load double, ptr %1, align 8, !tbaa !10
  %17 = fsub double %15, %16
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %1)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %18 = call noundef double @_Z5cross2PTS_(ptr noundef nonnull %6, ptr noundef nonnull %7)
  %19 = getelementptr inbounds i8, ptr %3, i64 8
  %20 = load double, ptr %19, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %4, i64 8
  %22 = load double, ptr %21, align 8, !tbaa !5
  %23 = fsub double %20, %22
  %24 = load double, ptr %4, align 8, !tbaa !10
  %25 = load double, ptr %3, align 8, !tbaa !10
  %26 = fsub double %24, %25
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %3)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %4)
  %27 = call noundef double @_Z5cross2PTS_(ptr noundef nonnull %8, ptr noundef nonnull %9)
  %28 = fneg double %23
  %29 = fmul double %17, %28
  %30 = call double @llvm.fmuladd.f64(double %14, double %26, double %29)
  %31 = fneg double %26
  %32 = fmul double %18, %31
  %33 = call double @llvm.fmuladd.f64(double %17, double %27, double %32)
  %34 = fdiv double %33, %30
  %35 = fneg double %14
  %36 = fmul double %27, %35
  %37 = call double @llvm.fmuladd.f64(double %18, double %23, double %36)
  %38 = fdiv double %37, %30
  call void @_ZN2PTC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %0, double noundef %34, double noundef %38)
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_Z5cross2PTS_(ptr noundef, ptr noundef) local_unnamed_addr #2

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

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


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