; LLVM IR from tangjz/acm-icpc :: hdu/6419.ll (Z15getIntersection6Sector7SegmentP5Point)

; 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.Segment = type { %struct.Point, %struct.Point }
%struct.Point = type { double, double }
%struct.Sector = type { %struct.Point, %struct.Point, %struct.Point }

@rad = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z12getFootPoint7Segment5PointRS0_(ptr noundef byval(%struct.Segment) align 8, double, double, ptr noundef nonnull align 8 dereferenceable(16)) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { double, double } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { double, double } @_ZNK5PointplERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { double, double } @_ZNK5PointmlERKd(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK7Segment8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sgnd(double noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5Point3lenEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6Sector8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z15getIntersection6Sector7SegmentP5Point(ptr noundef byval(%struct.Sector) align 8 %0, ptr noundef byval(%struct.Segment) align 8 %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.Point, align 8
  %7 = alloca %struct.Segment, align 8
  %8 = alloca %struct.Point, align 8
  %9 = alloca double, align 8
  %10 = alloca %struct.Point, align 8
  %11 = alloca %struct.Point, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  %15 = alloca %struct.Point, align 8
  %16 = alloca %struct.Point, align 8
  %17 = alloca double, align 8
  %18 = alloca i32, align 4
  %19 = alloca %struct.Point, align 8
  %20 = alloca %struct.Point, align 8
  store ptr %2, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %1, i64 32, i1 false), !tbaa.struct !9
  %21 = getelementptr inbounds %struct.Sector, ptr %0, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %21, i64 16, i1 false), !tbaa.struct !12
  %22 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 0
  %23 = load double, ptr %22, align 8
  %24 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 1
  %25 = load double, ptr %24, align 8
  %26 = call noundef zeroext i1 @_Z12getFootPoint7Segment5PointRS0_(ptr noundef byval(%struct.Segment) align 8 %7, double %23, double %25, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %27 = getelementptr inbounds %struct.Sector, ptr %0, i32 0, i32 0
  %28 = call { double, double } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %27)
  %29 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 0
  %30 = extractvalue { double, double } %28, 0
  store double %30, ptr %29, align 8
  %31 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 1
  %32 = extractvalue { double, double } %28, 1
  store double %32, ptr %31, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #6
  %33 = getelementptr inbounds %struct.Sector, ptr %0, i32 0, i32 0
  %34 = call { double, double } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %33)
  %35 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 0
  %36 = extractvalue { double, double } %34, 0
  store double %36, ptr %35, align 8
  %37 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 1
  %38 = extractvalue { double, double } %34, 1
  store double %38, ptr %37, align 8
  %39 = call noundef double @_ZNK5Point3dotERKS_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %11)
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  store double %39, ptr %9, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %40 = load double, ptr %9, align 8, !tbaa !10
  %41 = load i32, ptr @rad, align 4, !tbaa !13
  %42 = sext i32 %41 to i64
  %43 = load i32, ptr @rad, align 4, !tbaa !13
  %44 = sext i32 %43 to i64
  %45 = mul nsw i64 %42, %44
  %46 = sitofp i64 %45 to double
  %47 = fsub double %40, %46
  %48 = call noundef i32 @_Z3sgnd(double noundef %47)
  store i32 %48, ptr %12, align 4, !tbaa !13
  %49 = load i32, ptr %12, align 4, !tbaa !13
  %50 = icmp sgt i32 %49, 0
  br i1 %50, label %51, label %52

51:                                               ; preds = %3
  store i32 0, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %140

52:                                               ; preds = %3
  %53 = load i32, ptr %12, align 4, !tbaa !13
  %54 = icmp eq i32 %53, 0
  br i1 %54, label %55, label %68

55:                                               ; preds = %52
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.Point, ptr %56, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %57, ptr align 8 %6, i64 16, i1 false), !tbaa.struct !12
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.Point, ptr %58, i64 0
  %60 = call noundef zeroext i1 @_ZNK6Sector8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(16) %59)
  br i1 %60, label %61, label %65

61:                                               ; preds = %55
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.Point, ptr %62, i64 0
  %64 = call noundef zeroext i1 @_ZNK7Segment8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %63)
  br label %65

65:                                               ; preds = %61, %55
  %66 = phi i1 [ false, %55 ], [ %64, %61 ]
  %67 = zext i1 %66 to i32
  store i32 %67, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %140

68:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %69 = load i32, ptr @rad, align 4, !tbaa !13
  %70 = sext i32 %69 to i64
  %71 = load i32, ptr @rad, align 4, !tbaa !13
  %72 = sext i32 %71 to i64
  %73 = mul nsw i64 %70, %72
  %74 = sitofp i64 %73 to double
  %75 = load double, ptr %9, align 8, !tbaa !10
  %76 = fsub double %74, %75
  %77 = fpext double %76 to x86_fp80
  %78 = call x86_fp80 @sqrtl(x86_fp80 noundef %77) #6
  %79 = fptrunc x86_fp80 %78 to double
  store double %79, ptr %14, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #6
  %80 = getelementptr inbounds %struct.Segment, ptr %1, i32 0, i32 1
  %81 = getelementptr inbounds %struct.Segment, ptr %1, i32 0, i32 0
  %82 = call { double, double } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16) %80, ptr noundef nonnull align 8 dereferenceable(16) %81)
  %83 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 0
  %84 = extractvalue { double, double } %82, 0
  store double %84, ptr %83, align 8
  %85 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 1
  %86 = extractvalue { double, double } %82, 1
  store double %86, ptr %85, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %87 = load double, ptr %14, align 8, !tbaa !10
  %88 = call noundef double @_ZNK5Point3lenEv(ptr noundef nonnull align 8 dereferenceable(16) %15)
  %89 = fdiv double %87, %88
  store double %89, ptr %17, align 8, !tbaa !10
  %90 = call { double, double } @_ZNK5PointmlERKd(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(8) %17)
  %91 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 0
  %92 = extractvalue { double, double } %90, 0
  store double %92, ptr %91, align 8
  %93 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 1
  %94 = extractvalue { double, double } %90, 1
  store double %94, ptr %93, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %16, i64 16, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #6
  %95 = call { double, double } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %15)
  %96 = getelementptr inbounds { double, double }, ptr %19, i32 0, i32 0
  %97 = extractvalue { double, double } %95, 0
  store double %97, ptr %96, align 8
  %98 = getelementptr inbounds { double, double }, ptr %19, i32 0, i32 1
  %99 = extractvalue { double, double } %95, 1
  store double %99, ptr %98, align 8
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = load i32, ptr %18, align 4, !tbaa !13
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds %struct.Point, ptr %100, i64 %102
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %103, ptr align 8 %19, i64 16, i1 false), !tbaa.struct !12
  %104 = call noundef zeroext i1 @_ZNK6Sector8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(16) %103)
  br i1 %104, label %105, label %111

105:                                              ; preds = %68
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = load i32, ptr %18, align 4, !tbaa !13
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds %struct.Point, ptr %106, i64 %108
  %110 = call noundef zeroext i1 @_ZNK7Segment8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %109)
  br label %111

111:                                              ; preds = %105, %68
  %112 = phi i1 [ false, %68 ], [ %110, %105 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  br i1 %112, label %113, label %116

113:                                              ; preds = %111
  %114 = load i32, ptr %18, align 4, !tbaa !13
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %18, align 4, !tbaa !13
  br label %116

116:                                              ; preds = %113, %111
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #6
  %117 = call { double, double } @_ZNK5PointplERKS_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %15)
  %118 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 0
  %119 = extractvalue { double, double } %117, 0
  store double %119, ptr %118, align 8
  %120 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 1
  %121 = extractvalue { double, double } %117, 1
  store double %121, ptr %120, align 8
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  %123 = load i32, ptr %18, align 4, !tbaa !13
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds %struct.Point, ptr %122, i64 %124
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %125, ptr align 8 %20, i64 16, i1 false), !tbaa.struct !12
  %126 = call noundef zeroext i1 @_ZNK6Sector8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(16) %125)
  br i1 %126, label %127, label %133

127:                                              ; preds = %116
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = load i32, ptr %18, align 4, !tbaa !13
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds %struct.Point, ptr %128, i64 %130
  %132 = call noundef zeroext i1 @_ZNK7Segment8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %131)
  br label %133

133:                                              ; preds = %127, %116
  %134 = phi i1 [ false, %116 ], [ %132, %127 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #6
  br i1 %134, label %135, label %138

135:                                              ; preds = %133
  %136 = load i32, ptr %18, align 4, !tbaa !13
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %18, align 4, !tbaa !13
  br label %138

138:                                              ; preds = %135, %133
  %139 = load i32, ptr %18, align 4, !tbaa !13
  store i32 %139, ptr %4, align 4
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %140

140:                                              ; preds = %138, %65, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #6
  %141 = load i32, ptr %4, align 4
  ret i32 %141
}

; Function Attrs: nounwind
declare x86_fp80 @sqrtl(x86_fp80 noundef) #5

attributes #0 = { 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 #1 = { nocallback nofree nosync 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 nounwind willreturn memory(argmem: readwrite) }
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 "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 }

!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 = !{i64 0, i64 8, !10, i64 8, i64 8, !10, i64 16, i64 8, !10, i64 24, i64 8, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"double", !7, i64 0}
!12 = !{i64 0, i64 8, !10, i64 8, i64 8, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !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.Segment = type { %struct.Point, %struct.Point }
%struct.Point = type { double, double }
%struct.Sector = type { %struct.Point, %struct.Point, %struct.Point }

@rad = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z12getFootPoint7Segment5PointRS0_(ptr noundef byval(%struct.Segment) align 8, double, double, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { double, double } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress 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) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { double, double } @_ZNK5PointplERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { double, double } @_ZNK5PointmlERKd(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5Point3dotERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK7Segment8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sgnd(double noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5Point3lenEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6Sector8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 3) i32 @_Z15getIntersection6Sector7SegmentP5Point(ptr noundef byval(%struct.Sector) align 8 %0, ptr noundef byval(%struct.Segment) align 8 %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca %struct.Point, align 8
  %5 = alloca %struct.Point, align 8
  %6 = alloca %struct.Point, align 8
  %7 = alloca %struct.Point, align 8
  %8 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  %.sroa.016.0.copyload = load double, ptr %0, align 8, !tbaa !5
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 8
  %.sroa.2.0.copyload = load double, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !5
  %9 = call noundef zeroext i1 @_Z12getFootPoint7Segment5PointRS0_(ptr noundef nonnull byval(%struct.Segment) align 8 %1, double %.sroa.016.0.copyload, double %.sroa.2.0.copyload, ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  %10 = call { double, double } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %0)
  %11 = extractvalue { double, double } %10, 0
  store double %11, ptr %5, align 8
  %12 = getelementptr inbounds i8, ptr %5, i64 8
  %13 = extractvalue { double, double } %10, 1
  store double %13, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  %14 = call { double, double } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %0)
  %15 = extractvalue { double, double } %14, 0
  store double %15, ptr %6, align 8
  %16 = getelementptr inbounds i8, ptr %6, i64 8
  %17 = extractvalue { double, double } %14, 1
  store double %17, ptr %16, align 8
  %18 = call noundef double @_ZNK5Point3dotERKS_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  %19 = load i32, ptr @rad, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = mul nsw i64 %20, %20
  %22 = uitofp nneg i64 %21 to double
  %23 = fsub double %18, %22
  %24 = call noundef i32 @_Z3sgnd(double noundef %23)
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %67, label %26

26:                                               ; preds = %3
  %27 = icmp eq i32 %24, 0
  br i1 %27, label %28, label %33

28:                                               ; preds = %26
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %4, i64 16, i1 false), !tbaa.struct !11
  %29 = call noundef zeroext i1 @_ZNK6Sector8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(16) %2)
  br i1 %29, label %30, label %67

30:                                               ; preds = %28
  %31 = call noundef zeroext i1 @_ZNK7Segment8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %32 = zext i1 %31 to i32
  br label %67

33:                                               ; preds = %26
  %34 = load i32, ptr @rad, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = mul nsw i64 %35, %35
  %37 = uitofp nneg i64 %36 to double
  %38 = fsub double %37, %18
  %39 = fpext double %38 to x86_fp80
  %40 = call x86_fp80 @sqrtl(x86_fp80 noundef %39) #6
  %41 = fptrunc x86_fp80 %40 to double
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  %42 = getelementptr inbounds i8, ptr %1, i64 16
  %43 = call { double, double } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %44 = extractvalue { double, double } %43, 0
  store double %44, ptr %7, align 8
  %45 = getelementptr inbounds i8, ptr %7, i64 8
  %46 = extractvalue { double, double } %43, 1
  store double %46, ptr %45, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %47 = call noundef double @_ZNK5Point3lenEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
  %48 = fdiv double %41, %47
  store double %48, ptr %8, align 8, !tbaa !5
  %49 = call { double, double } @_ZNK5PointmlERKd(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %50 = extractvalue { double, double } %49, 0
  %51 = extractvalue { double, double } %49, 1
  store double %50, ptr %7, align 8, !tbaa !5
  store double %51, ptr %45, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  %52 = call { double, double } @_ZNK5PointmiERKS_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %53 = extractvalue { double, double } %52, 0
  %54 = extractvalue { double, double } %52, 1
  store double %53, ptr %2, align 8, !tbaa !5
  %.sroa.54.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  store double %54, ptr %.sroa.54.0..sroa_idx, align 8, !tbaa !5
  %55 = call noundef zeroext i1 @_ZNK6Sector8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(16) %2)
  br i1 %55, label %56, label %.critedge

56:                                               ; preds = %33
  %57 = call noundef zeroext i1 @_ZNK7Segment8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %spec.select = zext i1 %57 to i32
  br label %.critedge

.critedge:                                        ; preds = %56, %33
  %.025 = phi i32 [ %spec.select, %56 ], [ 0, %33 ]
  %58 = call { double, double } @_ZNK5PointplERKS_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %59 = extractvalue { double, double } %58, 0
  %60 = extractvalue { double, double } %58, 1
  %61 = zext nneg i32 %.025 to i64
  %62 = getelementptr inbounds %struct.Point, ptr %2, i64 %61
  store double %59, ptr %62, align 8, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %62, i64 8
  store double %60, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !5
  %63 = call noundef zeroext i1 @_ZNK6Sector8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(16) %62)
  br i1 %63, label %64, label %.critedge2

64:                                               ; preds = %.critedge
  %65 = call noundef zeroext i1 @_ZNK7Segment8containsERK5Point(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(16) %62)
  %66 = zext i1 %65 to i32
  %spec.select27 = add nuw nsw i32 %.025, %66
  br label %.critedge2

.critedge2:                                       ; preds = %64, %.critedge
  %.1 = phi i32 [ %spec.select27, %64 ], [ %.025, %.critedge ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  br label %67

67:                                               ; preds = %28, %30, %3, %.critedge2
  %.0 = phi i32 [ %.1, %.critedge2 ], [ 0, %3 ], [ 0, %28 ], [ %32, %30 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  ret i32 %.0
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare x86_fp80 @sqrtl(x86_fp80 noundef) local_unnamed_addr #5

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #6 = { 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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 8, !5, i64 8, i64 8, !5}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,ReassociatePass,SROAPass,SimplifyCFGPass