; LLVM IR from lzyrapx/Competitive-Programming :: 51Nod/1298（计算几何）（线段与圆的交点）.ll (Z12intersection5pointS_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.point = type { double, double }

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

; 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) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local { double, double } @_Z12intersection5pointS_S_S_(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) #2 {
  %9 = alloca %struct.point, align 8
  %10 = alloca %struct.point, align 8
  %11 = alloca %struct.point, align 8
  %12 = alloca %struct.point, align 8
  %13 = alloca %struct.point, align 8
  %14 = alloca double, align 8
  %15 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 0
  store double %0, ptr %15, align 8
  %16 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 1
  store double %1, ptr %16, align 8
  %17 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 0
  store double %2, ptr %17, align 8
  %18 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 1
  store double %3, ptr %18, align 8
  %19 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 0
  store double %4, ptr %19, align 8
  %20 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 1
  store double %5, ptr %20, align 8
  %21 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 0
  store double %6, ptr %21, align 8
  %22 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 1
  store double %7, ptr %22, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %10, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %23 = getelementptr inbounds %struct.point, ptr %10, i32 0, i32 0
  %24 = load double, ptr %23, align 8, !tbaa !10
  %25 = getelementptr inbounds %struct.point, ptr %12, i32 0, i32 0
  %26 = load double, ptr %25, align 8, !tbaa !10
  %27 = fsub double %24, %26
  %28 = getelementptr inbounds %struct.point, ptr %12, i32 0, i32 1
  %29 = load double, ptr %28, align 8, !tbaa !12
  %30 = getelementptr inbounds %struct.point, ptr %13, i32 0, i32 1
  %31 = load double, ptr %30, align 8, !tbaa !12
  %32 = fsub double %29, %31
  %33 = getelementptr inbounds %struct.point, ptr %10, i32 0, i32 1
  %34 = load double, ptr %33, align 8, !tbaa !12
  %35 = getelementptr inbounds %struct.point, ptr %12, i32 0, i32 1
  %36 = load double, ptr %35, align 8, !tbaa !12
  %37 = fsub double %34, %36
  %38 = getelementptr inbounds %struct.point, ptr %12, i32 0, i32 0
  %39 = load double, ptr %38, align 8, !tbaa !10
  %40 = getelementptr inbounds %struct.point, ptr %13, i32 0, i32 0
  %41 = load double, ptr %40, align 8, !tbaa !10
  %42 = fsub double %39, %41
  %43 = fmul double %37, %42
  %44 = fneg double %43
  %45 = call double @llvm.fmuladd.f64(double %27, double %32, double %44)
  %46 = getelementptr inbounds %struct.point, ptr %10, i32 0, i32 0
  %47 = load double, ptr %46, align 8, !tbaa !10
  %48 = getelementptr inbounds %struct.point, ptr %11, i32 0, i32 0
  %49 = load double, ptr %48, align 8, !tbaa !10
  %50 = fsub double %47, %49
  %51 = getelementptr inbounds %struct.point, ptr %12, i32 0, i32 1
  %52 = load double, ptr %51, align 8, !tbaa !12
  %53 = getelementptr inbounds %struct.point, ptr %13, i32 0, i32 1
  %54 = load double, ptr %53, align 8, !tbaa !12
  %55 = fsub double %52, %54
  %56 = getelementptr inbounds %struct.point, ptr %10, i32 0, i32 1
  %57 = load double, ptr %56, align 8, !tbaa !12
  %58 = getelementptr inbounds %struct.point, ptr %11, i32 0, i32 1
  %59 = load double, ptr %58, align 8, !tbaa !12
  %60 = fsub double %57, %59
  %61 = getelementptr inbounds %struct.point, ptr %12, i32 0, i32 0
  %62 = load double, ptr %61, align 8, !tbaa !10
  %63 = getelementptr inbounds %struct.point, ptr %13, i32 0, i32 0
  %64 = load double, ptr %63, align 8, !tbaa !10
  %65 = fsub double %62, %64
  %66 = fmul double %60, %65
  %67 = fneg double %66
  %68 = call double @llvm.fmuladd.f64(double %50, double %55, double %67)
  %69 = fdiv double %45, %68
  store double %69, ptr %14, align 8, !tbaa !6
  %70 = getelementptr inbounds %struct.point, ptr %11, i32 0, i32 0
  %71 = load double, ptr %70, align 8, !tbaa !10
  %72 = getelementptr inbounds %struct.point, ptr %10, i32 0, i32 0
  %73 = load double, ptr %72, align 8, !tbaa !10
  %74 = fsub double %71, %73
  %75 = load double, ptr %14, align 8, !tbaa !6
  %76 = getelementptr inbounds %struct.point, ptr %9, i32 0, i32 0
  %77 = load double, ptr %76, align 8, !tbaa !10
  %78 = call double @llvm.fmuladd.f64(double %74, double %75, double %77)
  store double %78, ptr %76, align 8, !tbaa !10
  %79 = getelementptr inbounds %struct.point, ptr %11, i32 0, i32 1
  %80 = load double, ptr %79, align 8, !tbaa !12
  %81 = getelementptr inbounds %struct.point, ptr %10, i32 0, i32 1
  %82 = load double, ptr %81, align 8, !tbaa !12
  %83 = fsub double %80, %82
  %84 = load double, ptr %14, align 8, !tbaa !6
  %85 = getelementptr inbounds %struct.point, ptr %9, i32 0, i32 1
  %86 = load double, ptr %85, align 8, !tbaa !12
  %87 = call double @llvm.fmuladd.f64(double %83, double %84, double %86)
  store double %87, ptr %85, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  %88 = load { double, double }, ptr %9, align 8
  ret { double, double } %88
}

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

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

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


; 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 { double, double } @_Z12intersection5pointS_S_S_(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7) local_unnamed_addr #0 {
  %9 = insertelement <2 x double> poison, double %0, i64 0
  %10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
  %11 = insertelement <2 x double> poison, double %4, i64 0
  %12 = insertelement <2 x double> %11, double %2, i64 1
  %13 = fsub <2 x double> %10, %12
  %14 = fsub double %5, %7
  %15 = insertelement <2 x double> poison, double %1, i64 0
  %16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
  %17 = insertelement <2 x double> poison, double %5, i64 0
  %18 = insertelement <2 x double> %17, double %3, i64 1
  %19 = fsub <2 x double> %16, %18
  %20 = fsub double %4, %6
  %21 = fneg <2 x double> %19
  %22 = insertelement <2 x double> poison, double %20, i64 0
  %23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
  %24 = fmul <2 x double> %23, %21
  %25 = insertelement <2 x double> poison, double %14, i64 0
  %26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> zeroinitializer
  %27 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %26, <2 x double> %24)
  %28 = extractelement <2 x double> %27, i64 0
  %29 = extractelement <2 x double> %27, i64 1
  %30 = fdiv double %28, %29
  %31 = insertelement <2 x double> poison, double %2, i64 0
  %32 = insertelement <2 x double> %31, double %3, i64 1
  %33 = insertelement <2 x double> %9, double %1, i64 1
  %34 = fsub <2 x double> %32, %33
  %35 = insertelement <2 x double> poison, double %30, i64 0
  %36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
  %37 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %34, <2 x double> %36, <2 x double> %33)
  %38 = extractelement <2 x double> %37, i64 0
  %.fca.0.insert = insertvalue { double, double } poison, double %38, 0
  %39 = extractelement <2 x double> %37, i64 1
  %.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %39, 1
  ret { double, double } %.fca.1.insert
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) 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 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,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass