; LLVM IR from ShahjalalShohag/code-library :: Geometry/Geometry 2D.ll (Z21get_apollonius_circle2PTS_dd)

; 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.circle = type { %struct.PT, double }
%struct.PT = type { double, double }

@.str.5 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [8 x i8], align 1
@__PRETTY_FUNCTION__._Z21get_apollonius_circle2PTS_dd = external hidden unnamed_addr constant [53 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4signd(double noundef) #0

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 #0 align 2

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: nounwind
declare double @sqrt(double noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6circleC2E2PTd(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, double noundef) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z21get_apollonius_circle2PTS_dd(ptr dead_on_unwind noalias writable sret(%struct.circle) align 8 %0, ptr noundef %1, ptr noundef %2, double noundef %3, double noundef %4) #5 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca %struct.PT, align 8
  %16 = alloca double, align 8
  %17 = alloca %struct.PT, 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 double %3, ptr %9, align 8, !tbaa !9
  store double %4, ptr %10, align 8, !tbaa !9
  %18 = load double, ptr %10, align 8, !tbaa !9
  %19 = load double, ptr %10, align 8, !tbaa !9
  %20 = fmul double %19, %18
  store double %20, ptr %10, align 8, !tbaa !9
  %21 = load double, ptr %9, align 8, !tbaa !9
  %22 = load double, ptr %9, align 8, !tbaa !9
  %23 = fmul double %22, %21
  store double %23, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %24 = load double, ptr %10, align 8, !tbaa !9
  %25 = load double, ptr %9, align 8, !tbaa !9
  %26 = fsub double %24, %25
  store double %26, ptr %11, align 8, !tbaa !9
  %27 = load double, ptr %11, align 8, !tbaa !9
  %28 = call noundef i32 @_Z4signd(double noundef %27)
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %5
  br label %33

31:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.5, i32 noundef 400, ptr noundef @__PRETTY_FUNCTION__._Z21get_apollonius_circle2PTS_dd) #7
  unreachable

32:                                               ; No predecessors!
  br label %33

33:                                               ; preds = %32, %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %34 = load double, ptr %10, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.PT, ptr %1, i32 0, i32 0
  %36 = load double, ptr %35, align 8, !tbaa !11
  %37 = load double, ptr %9, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct.PT, ptr %2, i32 0, i32 0
  %39 = load double, ptr %38, align 8, !tbaa !11
  %40 = fmul double %37, %39
  %41 = fneg double %40
  %42 = call double @llvm.fmuladd.f64(double %34, double %36, double %41)
  store double %42, ptr %12, align 8, !tbaa !9
  %43 = load double, ptr %11, align 8, !tbaa !9
  %44 = load double, ptr %12, align 8, !tbaa !9
  %45 = fdiv double %44, %43
  store double %45, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %46 = load double, ptr %10, align 8, !tbaa !9
  %47 = getelementptr inbounds %struct.PT, ptr %1, i32 0, i32 1
  %48 = load double, ptr %47, align 8, !tbaa !13
  %49 = load double, ptr %9, align 8, !tbaa !9
  %50 = getelementptr inbounds %struct.PT, ptr %2, i32 0, i32 1
  %51 = load double, ptr %50, align 8, !tbaa !13
  %52 = fmul double %49, %51
  %53 = fneg double %52
  %54 = call double @llvm.fmuladd.f64(double %46, double %48, double %53)
  store double %54, ptr %13, align 8, !tbaa !9
  %55 = load double, ptr %11, align 8, !tbaa !9
  %56 = load double, ptr %13, align 8, !tbaa !9
  %57 = fdiv double %56, %55
  store double %57, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %58 = load double, ptr %10, align 8, !tbaa !9
  %59 = getelementptr inbounds %struct.PT, ptr %1, i32 0, i32 0
  %60 = load double, ptr %59, align 8, !tbaa !11
  %61 = fmul double %58, %60
  %62 = getelementptr inbounds %struct.PT, ptr %1, i32 0, i32 0
  %63 = load double, ptr %62, align 8, !tbaa !11
  %64 = load double, ptr %9, align 8, !tbaa !9
  %65 = getelementptr inbounds %struct.PT, ptr %2, i32 0, i32 0
  %66 = load double, ptr %65, align 8, !tbaa !11
  %67 = fmul double %64, %66
  %68 = getelementptr inbounds %struct.PT, ptr %2, i32 0, i32 0
  %69 = load double, ptr %68, align 8, !tbaa !11
  %70 = fmul double %67, %69
  %71 = fneg double %70
  %72 = call double @llvm.fmuladd.f64(double %61, double %63, double %71)
  %73 = load double, ptr %10, align 8, !tbaa !9
  %74 = getelementptr inbounds %struct.PT, ptr %1, i32 0, i32 1
  %75 = load double, ptr %74, align 8, !tbaa !13
  %76 = fmul double %73, %75
  %77 = getelementptr inbounds %struct.PT, ptr %1, i32 0, i32 1
  %78 = load double, ptr %77, align 8, !tbaa !13
  %79 = call double @llvm.fmuladd.f64(double %76, double %78, double %72)
  %80 = load double, ptr %9, align 8, !tbaa !9
  %81 = getelementptr inbounds %struct.PT, ptr %2, i32 0, i32 1
  %82 = load double, ptr %81, align 8, !tbaa !13
  %83 = fmul double %80, %82
  %84 = getelementptr inbounds %struct.PT, ptr %2, i32 0, i32 1
  %85 = load double, ptr %84, align 8, !tbaa !13
  %86 = fneg double %83
  %87 = call double @llvm.fmuladd.f64(double %86, double %85, double %79)
  store double %87, ptr %14, align 8, !tbaa !9
  %88 = load double, ptr %11, align 8, !tbaa !9
  %89 = load double, ptr %14, align 8, !tbaa !9
  %90 = fdiv double %89, %88
  store double %90, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #6
  %91 = load double, ptr %12, align 8, !tbaa !9
  %92 = load double, ptr %13, align 8, !tbaa !9
  call void @_ZN2PTC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %15, double noundef %91, double noundef %92)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %93 = load double, ptr %12, align 8, !tbaa !9
  %94 = load double, ptr %12, align 8, !tbaa !9
  %95 = load double, ptr %13, align 8, !tbaa !9
  %96 = load double, ptr %13, align 8, !tbaa !9
  %97 = fmul double %95, %96
  %98 = call double @llvm.fmuladd.f64(double %93, double %94, double %97)
  %99 = load double, ptr %14, align 8, !tbaa !9
  %100 = fsub double %98, %99
  store double %100, ptr %16, align 8, !tbaa !9
  %101 = load double, ptr %16, align 8, !tbaa !9
  %102 = call double @sqrt(double noundef %101) #6
  store double %102, ptr %16, align 8, !tbaa !9
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(16) %15)
  %103 = load double, ptr %16, align 8, !tbaa !9
  call void @_ZN6circleC2E2PTd(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %17, double noundef %103)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  ret void
}

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { noreturn 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 #4 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn 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, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS2PT", !10, i64 0, !10, i64 8}
!13 = !{!12, !10, 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"

%struct.circle = type { %struct.PT, double }
%struct.PT = type { double, double }

@.str.5 = external hidden unnamed_addr constant [87 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [8 x i8], align 1
@__PRETTY_FUNCTION__._Z21get_apollonius_circle2PTS_dd = external hidden unnamed_addr constant [53 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4signd(double noundef) local_unnamed_addr #0

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 #0 align 2

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6circleC2E2PTd(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, double noundef) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z21get_apollonius_circle2PTS_dd(ptr dead_on_unwind noalias writable sret(%struct.circle) align 8 %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, double noundef %3, double noundef %4) local_unnamed_addr #5 {
  %6 = alloca %struct.PT, align 8
  %7 = alloca %struct.PT, align 8
  %8 = fmul double %4, %4
  %9 = fmul double %3, %3
  %10 = fsub double %8, %9
  %11 = tail call noundef i32 @_Z4signd(double noundef %10)
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %12, label %13

12:                                               ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.5, i32 noundef 400, ptr noundef nonnull @__PRETTY_FUNCTION__._Z21get_apollonius_circle2PTS_dd) #6
  unreachable

13:                                               ; preds = %5
  %14 = load double, ptr %1, align 8, !tbaa !5
  %15 = load double, ptr %2, align 8, !tbaa !5
  %16 = fneg double %9
  %17 = fmul double %15, %16
  %18 = tail call double @llvm.fmuladd.f64(double %8, double %14, double %17)
  %19 = fdiv double %18, %10
  %20 = getelementptr inbounds i8, ptr %1, i64 8
  %21 = load double, ptr %20, align 8, !tbaa !10
  %22 = getelementptr inbounds i8, ptr %2, i64 8
  %23 = load double, ptr %22, align 8, !tbaa !10
  %24 = fmul double %23, %16
  %25 = tail call double @llvm.fmuladd.f64(double %8, double %21, double %24)
  %26 = fdiv double %25, %10
  %27 = fmul double %8, %14
  %28 = fmul double %15, %17
  %29 = tail call double @llvm.fmuladd.f64(double %27, double %14, double %28)
  %30 = fmul double %8, %21
  %31 = tail call double @llvm.fmuladd.f64(double %30, double %21, double %29)
  %32 = tail call double @llvm.fmuladd.f64(double %24, double %23, double %31)
  %33 = fdiv double %32, %10
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  call void @_ZN2PTC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %6, double noundef %19, double noundef %26)
  %34 = fmul double %26, %26
  %35 = call double @llvm.fmuladd.f64(double %19, double %19, double %34)
  %36 = fsub double %35, %33
  %37 = call double @sqrt(double noundef %36) #7
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @_ZN6circleC2E2PTd(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull %7, double noundef %37)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  ret void
}

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { noreturn 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 #4 = { mustprogress nofree nounwind willreturn memory(write) "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 = { 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 #6 = { noreturn nounwind }
attributes #7 = { 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, !7, i64 0}
!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 8}


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