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

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

@_ZL2PI = external hidden global double, align 8

; Function Attrs: nounwind
declare double @acos(double noundef) #0

; Function Attrs: nounwind
declare double @sin(double noundef) #0

; 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 noundef double @_ZN2PT4normEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 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: mustprogress uwtable
declare dso_local void @_ZNK2PTmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z18circle_circle_area2PTdS_d(ptr noundef %0, double noundef %1, ptr noundef %2, double noundef %3) #4 {
  %5 = alloca double, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca %struct.PT, align 8
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store double %3, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  call void @_ZNK2PTmiERKS_(ptr dead_on_unwind writable sret(%struct.PT) align 8 %11, ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %15 = call noundef double @_ZN2PT4normEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  store double %15, ptr %10, align 8, !tbaa !9
  %16 = load double, ptr %7, align 8, !tbaa !9
  %17 = load double, ptr %9, align 8, !tbaa !9
  %18 = fadd double %16, %17
  %19 = load double, ptr %10, align 8, !tbaa !9
  %20 = fadd double %19, 1.000000e-09
  %21 = fcmp olt double %18, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %4
  store double 0.000000e+00, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %102

23:                                               ; preds = %4
  %24 = load double, ptr %7, align 8, !tbaa !9
  %25 = load double, ptr %10, align 8, !tbaa !9
  %26 = fadd double %24, %25
  %27 = load double, ptr %9, align 8, !tbaa !9
  %28 = fadd double %27, 1.000000e-09
  %29 = fcmp olt double %26, %28
  br i1 %29, label %30, label %36

30:                                               ; preds = %23
  %31 = load double, ptr @_ZL2PI, align 8, !tbaa !9
  %32 = load double, ptr %7, align 8, !tbaa !9
  %33 = fmul double %31, %32
  %34 = load double, ptr %7, align 8, !tbaa !9
  %35 = fmul double %33, %34
  store double %35, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %102

36:                                               ; preds = %23
  %37 = load double, ptr %9, align 8, !tbaa !9
  %38 = load double, ptr %10, align 8, !tbaa !9
  %39 = fadd double %37, %38
  %40 = load double, ptr %7, align 8, !tbaa !9
  %41 = fadd double %40, 1.000000e-09
  %42 = fcmp olt double %39, %41
  br i1 %42, label %43, label %49

43:                                               ; preds = %36
  %44 = load double, ptr @_ZL2PI, align 8, !tbaa !9
  %45 = load double, ptr %9, align 8, !tbaa !9
  %46 = fmul double %44, %45
  %47 = load double, ptr %9, align 8, !tbaa !9
  %48 = fmul double %46, %47
  store double %48, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %102

49:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %50 = load double, ptr %7, align 8, !tbaa !9
  %51 = load double, ptr %7, align 8, !tbaa !9
  %52 = load double, ptr %10, align 8, !tbaa !9
  %53 = load double, ptr %10, align 8, !tbaa !9
  %54 = fmul double %52, %53
  %55 = call double @llvm.fmuladd.f64(double %50, double %51, double %54)
  %56 = load double, ptr %9, align 8, !tbaa !9
  %57 = load double, ptr %9, align 8, !tbaa !9
  %58 = fneg double %56
  %59 = call double @llvm.fmuladd.f64(double %58, double %57, double %55)
  %60 = load double, ptr %7, align 8, !tbaa !9
  %61 = fmul double 2.000000e+00, %60
  %62 = load double, ptr %10, align 8, !tbaa !9
  %63 = fmul double %61, %62
  %64 = fdiv double %59, %63
  %65 = call double @acos(double noundef %64) #5
  store double %65, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %66 = load double, ptr %9, align 8, !tbaa !9
  %67 = load double, ptr %9, align 8, !tbaa !9
  %68 = load double, ptr %10, align 8, !tbaa !9
  %69 = load double, ptr %10, align 8, !tbaa !9
  %70 = fmul double %68, %69
  %71 = call double @llvm.fmuladd.f64(double %66, double %67, double %70)
  %72 = load double, ptr %7, align 8, !tbaa !9
  %73 = load double, ptr %7, align 8, !tbaa !9
  %74 = fneg double %72
  %75 = call double @llvm.fmuladd.f64(double %74, double %73, double %71)
  %76 = load double, ptr %9, align 8, !tbaa !9
  %77 = fmul double 2.000000e+00, %76
  %78 = load double, ptr %10, align 8, !tbaa !9
  %79 = fmul double %77, %78
  %80 = fdiv double %75, %79
  %81 = call double @acos(double noundef %80) #5
  store double %81, ptr %14, align 8, !tbaa !9
  %82 = load double, ptr %7, align 8, !tbaa !9
  %83 = load double, ptr %7, align 8, !tbaa !9
  %84 = fmul double %82, %83
  %85 = load double, ptr %13, align 8, !tbaa !9
  %86 = load double, ptr %13, align 8, !tbaa !9
  %87 = fmul double 2.000000e+00, %86
  %88 = call double @sin(double noundef %87) #5
  %89 = fdiv double %88, 2.000000e+00
  %90 = fsub double %85, %89
  %91 = load double, ptr %9, align 8, !tbaa !9
  %92 = load double, ptr %9, align 8, !tbaa !9
  %93 = fmul double %91, %92
  %94 = load double, ptr %14, align 8, !tbaa !9
  %95 = load double, ptr %14, align 8, !tbaa !9
  %96 = fmul double 2.000000e+00, %95
  %97 = call double @sin(double noundef %96) #5
  %98 = fdiv double %97, 2.000000e+00
  %99 = fsub double %94, %98
  %100 = fmul double %93, %99
  %101 = call double @llvm.fmuladd.f64(double %84, double %90, double %100)
  store double %101, ptr %5, align 8
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %102

102:                                              ; preds = %49, %43, %30, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %103 = load double, ptr %5, align 8
  ret double %103
}

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

%struct.PT = type { double, double }

@_ZL2PI = external hidden local_unnamed_addr global double, align 8

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

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

; 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 noundef double @_ZN2PT4normEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 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: mustprogress uwtable
declare dso_local void @_ZNK2PTmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z18circle_circle_area2PTdS_d(ptr noundef nonnull %0, double noundef %1, ptr noundef nonnull %2, double noundef %3) local_unnamed_addr #4 {
  %5 = alloca %struct.PT, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  call void @_ZNK2PTmiERKS_(ptr dead_on_unwind nonnull writable sret(%struct.PT) align 8 %5, ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %6 = call noundef double @_ZN2PT4normEv(ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  %7 = fadd double %1, %3
  %8 = fadd double %6, 1.000000e-09
  %9 = fcmp olt double %7, %8
  br i1 %9, label %54, label %10

10:                                               ; preds = %4
  %11 = fadd double %6, %1
  %12 = fadd double %3, 1.000000e-09
  %13 = fcmp olt double %11, %12
  br i1 %13, label %14, label %18

14:                                               ; preds = %10
  %15 = load double, ptr @_ZL2PI, align 8, !tbaa !5
  %16 = fmul double %15, %1
  %17 = fmul double %16, %1
  br label %54

18:                                               ; preds = %10
  %19 = fadd double %6, %3
  %20 = fadd double %1, 1.000000e-09
  %21 = fcmp olt double %19, %20
  br i1 %21, label %22, label %26

22:                                               ; preds = %18
  %23 = load double, ptr @_ZL2PI, align 8, !tbaa !5
  %24 = fmul double %23, %3
  %25 = fmul double %24, %3
  br label %54

26:                                               ; preds = %18
  %27 = fmul double %6, %6
  %28 = call double @llvm.fmuladd.f64(double %1, double %1, double %27)
  %29 = fneg double %3
  %30 = call double @llvm.fmuladd.f64(double %29, double %3, double %28)
  %31 = fmul double %1, 2.000000e+00
  %32 = fmul double %31, %6
  %33 = fdiv double %30, %32
  %34 = call double @acos(double noundef %33) #5
  %35 = call double @llvm.fmuladd.f64(double %3, double %3, double %27)
  %36 = fneg double %1
  %37 = call double @llvm.fmuladd.f64(double %36, double %1, double %35)
  %38 = fmul double %3, 2.000000e+00
  %39 = fmul double %38, %6
  %40 = fdiv double %37, %39
  %41 = call double @acos(double noundef %40) #5
  %42 = fmul double %1, %1
  %43 = fmul double %34, 2.000000e+00
  %44 = call double @sin(double noundef %43) #5
  %45 = fmul double %44, 5.000000e-01
  %46 = fsub double %34, %45
  %47 = fmul double %3, %3
  %48 = fmul double %41, 2.000000e+00
  %49 = call double @sin(double noundef %48) #5
  %50 = fmul double %49, 5.000000e-01
  %51 = fsub double %41, %50
  %52 = fmul double %47, %51
  %53 = call double @llvm.fmuladd.f64(double %42, double %46, double %52)
  br label %54

54:                                               ; preds = %4, %26, %22, %14
  %.0 = phi double [ %17, %14 ], [ %25, %22 ], [ %53, %26 ], [ 0.000000e+00, %4 ]
  ret double %.0
}

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


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