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

; 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: 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z36maximum_dist_from_polygon_to_polygonRSt6vectorI2PTSaIS0_EES3_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #3 {
  %3 = alloca double, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca double, align 8
  %13 = alloca %struct.PT, align 8
  %14 = alloca %struct.PT, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.PT, align 8
  %19 = alloca %struct.PT, align 8
  %20 = alloca double, align 8
  %21 = alloca %struct.PT, align 8
  %22 = alloca %struct.PT, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #6
  %25 = trunc i64 %24 to i32
  store i32 %25, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #6
  %28 = trunc i64 %27 to i32
  store i32 %28, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store double 0.000000e+00, ptr %8, align 8, !tbaa !11
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = icmp slt i32 %29, 3
  br i1 %30, label %34, label %31

31:                                               ; preds = %2
  %32 = load i32, ptr %7, align 4, !tbaa !9
  %33 = icmp slt i32 %32, 3
  br i1 %33, label %34, label %68

34:                                               ; preds = %31, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %62, %34
  %36 = load i32, ptr %9, align 4, !tbaa !9
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %65

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %58, %40
  %42 = load i32, ptr %11, align 4, !tbaa !9
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %61

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = load i32, ptr %9, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %47, i64 noundef %49) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %50)
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = load i32, ptr %11, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %51, i64 noundef %53) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %54)
  %55 = call noundef double @_Z5dist22PTS_(ptr noundef %13, ptr noundef %14)
  store double %55, ptr %12, align 8, !tbaa !11
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %57 = load double, ptr %56, align 8, !tbaa !11
  store double %57, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %58

58:                                               ; preds = %46
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %11, align 4, !tbaa !9
  br label %41, !llvm.loop !13

61:                                               ; preds = %45
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %9, align 4, !tbaa !9
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %9, align 4, !tbaa !9
  br label %35, !llvm.loop !15

65:                                               ; preds = %39
  %66 = load double, ptr %8, align 8, !tbaa !11
  %67 = call double @sqrt(double noundef %66) #6
  store double %67, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %166

68:                                               ; preds = %31
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %69, i64 noundef 0) #6
  %71 = getelementptr inbounds %struct.PT, ptr %70, i32 0, i32 0
  %72 = load double, ptr %71, align 8, !tbaa !16
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %73, i64 noundef 0) #6
  %75 = getelementptr inbounds %struct.PT, ptr %74, i32 0, i32 0
  %76 = load double, ptr %75, align 8, !tbaa !16
  %77 = fcmp ogt double %72, %76
  br i1 %77, label %78, label %81

78:                                               ; preds = %68
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7) #6
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZSt4swapI2PTSaIS0_EEvRSt6vectorIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24) %79, ptr noundef nonnull align 8 dereferenceable(24) %80) #6
  br label %81

81:                                               ; preds = %78, %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %82 = load i32, ptr %6, align 4, !tbaa !9
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = add nsw i32 %82, %83
  %85 = add nsw i32 %84, 10
  store i32 %85, ptr %17, align 4, !tbaa !9
  br label %86

86:                                               ; preds = %108, %81
  %87 = load i32, ptr %16, align 4, !tbaa !9
  %88 = add nsw i32 %87, 1
  %89 = load i32, ptr %7, align 4, !tbaa !9
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %91, label %106

91:                                               ; preds = %86
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = load i32, ptr %16, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %92, i64 noundef %94) #6
  %96 = getelementptr inbounds %struct.PT, ptr %95, i32 0, i32 0
  %97 = load double, ptr %96, align 8, !tbaa !16
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = load i32, ptr %16, align 4, !tbaa !9
  %100 = add nsw i32 %99, 1
  %101 = sext i32 %100 to i64
  %102 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %98, i64 noundef %101) #6
  %103 = getelementptr inbounds %struct.PT, ptr %102, i32 0, i32 0
  %104 = load double, ptr %103, align 8, !tbaa !16
  %105 = fcmp olt double %97, %104
  br label %106

106:                                              ; preds = %91, %86
  %107 = phi i1 [ false, %86 ], [ %105, %91 ]
  br i1 %107, label %108, label %111

108:                                              ; preds = %106
  %109 = load i32, ptr %16, align 4, !tbaa !9
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %16, align 4, !tbaa !9
  br label %86, !llvm.loop !18

111:                                              ; preds = %106
  br label %112

112:                                              ; preds = %151, %111
  %113 = load i32, ptr %17, align 4, !tbaa !9
  %114 = add nsw i32 %113, -1
  store i32 %114, ptr %17, align 4, !tbaa !9
  %115 = icmp ne i32 %113, 0
  br i1 %115, label %116, label %163

116:                                              ; preds = %112
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  %118 = load i32, ptr %15, align 4, !tbaa !9
  %119 = add nsw i32 %118, 1
  %120 = load i32, ptr %6, align 4, !tbaa !9
  %121 = srem i32 %119, %120
  %122 = sext i32 %121 to i64
  %123 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %117, i64 noundef %122) #6
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = load i32, ptr %15, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %124, i64 noundef %126) #6
  call void @_ZNK2PTmiERKS_(ptr dead_on_unwind writable sret(%struct.PT) align 8 %18, ptr noundef nonnull align 8 dereferenceable(16) %123, ptr noundef nonnull align 8 dereferenceable(16) %127)
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = load i32, ptr %16, align 4, !tbaa !9
  %130 = add nsw i32 %129, 1
  %131 = load i32, ptr %7, align 4, !tbaa !9
  %132 = srem i32 %130, %131
  %133 = sext i32 %132 to i64
  %134 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %128, i64 noundef %133) #6
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  %136 = load i32, ptr %16, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %135, i64 noundef %137) #6
  call void @_ZNK2PTmiERKS_(ptr dead_on_unwind writable sret(%struct.PT) align 8 %19, ptr noundef nonnull align 8 dereferenceable(16) %134, ptr noundef nonnull align 8 dereferenceable(16) %138)
  %139 = call noundef double @_Z5cross2PTS_(ptr noundef %18, ptr noundef %19)
  %140 = fcmp oge double %139, 0.000000e+00
  br i1 %140, label %141, label %146

141:                                              ; preds = %116
  %142 = load i32, ptr %16, align 4, !tbaa !9
  %143 = add nsw i32 %142, 1
  %144 = load i32, ptr %7, align 4, !tbaa !9
  %145 = srem i32 %143, %144
  store i32 %145, ptr %16, align 4, !tbaa !9
  br label %151

146:                                              ; preds = %116
  %147 = load i32, ptr %15, align 4, !tbaa !9
  %148 = add nsw i32 %147, 1
  %149 = load i32, ptr %6, align 4, !tbaa !9
  %150 = srem i32 %148, %149
  store i32 %150, ptr %15, align 4, !tbaa !9
  br label %151

151:                                              ; preds = %146, %141
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = load i32, ptr %15, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %152, i64 noundef %154) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(16) %155)
  %156 = load ptr, ptr %5, align 8, !tbaa !5
  %157 = load i32, ptr %16, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %156, i64 noundef %158) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(16) %159)
  %160 = call noundef double @_Z5dist22PTS_(ptr noundef %21, ptr noundef %22)
  store double %160, ptr %20, align 8, !tbaa !11
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %20)
  %162 = load double, ptr %161, align 8, !tbaa !11
  store double %162, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %112, !llvm.loop !19

163:                                              ; preds = %112
  %164 = load double, ptr %8, align 8, !tbaa !11
  %165 = call double @sqrt(double noundef %164) #6
  store double %165, ptr %3, align 8
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %166

166:                                              ; preds = %163, %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %167 = load double, ptr %3, align 8
  ret double %167
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapI2PTSaIS0_EEvRSt6vectorIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2

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 = { 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 #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 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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !12, i64 0}
!17 = !{!"_ZTS2PT", !12, i64 0, !12, i64 8}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

; 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 #3 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z36maximum_dist_from_polygon_to_polygonRSt6vectorI2PTSaIS0_EES3_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) local_unnamed_addr #3 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca %struct.PT, align 8
  %8 = alloca %struct.PT, align 8
  %9 = alloca %struct.PT, align 8
  %10 = alloca %struct.PT, align 8
  %11 = alloca double, align 8
  %12 = alloca %struct.PT, align 8
  %13 = alloca %struct.PT, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %14 = tail call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %15 = trunc i64 %14 to i32
  store i32 %15, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %16 = tail call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %17 = trunc i64 %16 to i32
  store i32 %17, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  store double 0.000000e+00, ptr %5, align 8, !tbaa !9
  %18 = icmp slt i32 %15, 3
  %19 = icmp slt i32 %17, 3
  %or.cond = or i1 %19, %18
  br i1 %or.cond, label %.preheader43, label %32

.preheader43:                                     ; preds = %2
  %20 = icmp sgt i32 %15, 0
  %21 = icmp sgt i32 %17, 0
  %or.cond67 = and i1 %20, %21
  br i1 %or.cond67, label %.preheader.preheader, label %._crit_edge51

.preheader.preheader:                             ; preds = %.preheader43
  %22 = and i64 %16, 2147483647
  %23 = and i64 %14, 2147483647
  br label %.lr.ph48

.lr.ph48:                                         ; preds = %._crit_edge49, %.preheader.preheader
  %indvars.iv57 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next58, %._crit_edge49 ]
  br label %25

._crit_edge49:                                    ; preds = %25
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %24 = icmp ult i64 %indvars.iv.next58, %23
  br i1 %24, label %.lr.ph48, label %._crit_edge51, !llvm.loop !11

25:                                               ; preds = %.lr.ph48, %25
  %indvars.iv54 = phi i64 [ 0, %.lr.ph48 ], [ %indvars.iv.next55, %25 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv57) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %26)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv54) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %27)
  %28 = call noundef double @_Z5dist22PTS_(ptr noundef nonnull %7, ptr noundef nonnull %8)
  store double %28, ptr %6, align 8, !tbaa !9
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %30 = load double, ptr %29, align 8, !tbaa !9
  store double %30, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %31 = icmp ult i64 %indvars.iv.next55, %22
  br i1 %31, label %25, label %._crit_edge49, !llvm.loop !14

32:                                               ; preds = %2
  %33 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 0) #6
  %34 = load double, ptr %33, align 8, !tbaa !15
  %35 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #6
  %36 = load double, ptr %35, align 8, !tbaa !15
  %37 = fcmp ogt double %34, %36
  br i1 %37, label %38, label %39

38:                                               ; preds = %32
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4) #6
  call void @_ZSt4swapI2PTSaIS0_EEvRSt6vectorIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %.pre = load i32, ptr %3, align 4, !tbaa !5
  %.pre60 = load i32, ptr %4, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %38, %32
  %40 = phi i32 [ %.pre60, %38 ], [ %17, %32 ]
  %41 = phi i32 [ %.pre, %38 ], [ %15, %32 ]
  %42 = add i32 %41, 10
  %43 = add i32 %42, %40
  br label %44

44:                                               ; preds = %48, %39
  %indvars.iv = phi i64 [ %indvars.iv.next, %48 ], [ 0, %39 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next, %46
  br i1 %47, label %48, label %.critedge

48:                                               ; preds = %44
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv) #6
  %50 = load double, ptr %49, align 8, !tbaa !15
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv.next) #6
  %52 = load double, ptr %51, align 8, !tbaa !15
  %53 = fcmp olt double %50, %52
  br i1 %53, label %44, label %.critedge, !llvm.loop !17

.critedge:                                        ; preds = %44, %48
  %.not44 = icmp eq i32 %43, 0
  br i1 %.not44, label %.critedge.._crit_edge_crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.critedge
  %54 = trunc nuw nsw i64 %indvars.iv to i32
  br label %.lr.ph

.critedge.._crit_edge_crit_edge:                  ; preds = %.critedge
  %.pre61 = load double, ptr %5, align 8, !tbaa !9
  br label %._crit_edge51

.lr.ph:                                           ; preds = %.lr.ph.preheader, %78
  %.in = phi i32 [ %55, %78 ], [ %43, %.lr.ph.preheader ]
  %.146 = phi i32 [ %.2, %78 ], [ %54, %.lr.ph.preheader ]
  %.03745 = phi i32 [ %.138, %78 ], [ 0, %.lr.ph.preheader ]
  %55 = add nsw i32 %.in, -1
  %56 = add nsw i32 %.03745, 1
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = srem i32 %56, %57
  %59 = sext i32 %58 to i64
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %59) #6
  %61 = sext i32 %.03745 to i64
  %62 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %61) #6
  call void @_ZNK2PTmiERKS_(ptr dead_on_unwind nonnull writable sret(%struct.PT) align 8 %9, ptr noundef nonnull align 8 dereferenceable(16) %60, ptr noundef nonnull align 8 dereferenceable(16) %62)
  %63 = add nsw i32 %.146, 1
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = srem i32 %63, %64
  %66 = sext i32 %65 to i64
  %67 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %66) #6
  %68 = sext i32 %.146 to i64
  %69 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %68) #6
  call void @_ZNK2PTmiERKS_(ptr dead_on_unwind nonnull writable sret(%struct.PT) align 8 %10, ptr noundef nonnull align 8 dereferenceable(16) %67, ptr noundef nonnull align 8 dereferenceable(16) %69)
  %70 = call noundef double @_Z5cross2PTS_(ptr noundef nonnull %9, ptr noundef nonnull %10)
  %71 = fcmp ult double %70, 0.000000e+00
  br i1 %71, label %75, label %72

72:                                               ; preds = %.lr.ph
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = srem i32 %63, %73
  %.pre63 = sext i32 %74 to i64
  br label %78

75:                                               ; preds = %.lr.ph
  %76 = load i32, ptr %3, align 4, !tbaa !5
  %77 = srem i32 %56, %76
  %.pre62 = sext i32 %77 to i64
  br label %78

78:                                               ; preds = %75, %72
  %.pre-phi64 = phi i64 [ %68, %75 ], [ %.pre63, %72 ]
  %.pre-phi = phi i64 [ %.pre62, %75 ], [ %61, %72 ]
  %.138 = phi i32 [ %77, %75 ], [ %.03745, %72 ]
  %.2 = phi i32 [ %.146, %75 ], [ %74, %72 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #6
  %79 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.pre-phi) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %79)
  %80 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.pre-phi64) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %80)
  %81 = call noundef double @_Z5dist22PTS_(ptr noundef nonnull %12, ptr noundef nonnull %13)
  store double %81, ptr %11, align 8, !tbaa !9
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %83 = load double, ptr %82, align 8, !tbaa !9
  store double %83, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  %.not = icmp eq i32 %55, 0
  br i1 %.not, label %._crit_edge51, label %.lr.ph, !llvm.loop !18

._crit_edge51:                                    ; preds = %78, %._crit_edge49, %.critedge.._crit_edge_crit_edge, %.preheader43
  %.sink = phi double [ 0.000000e+00, %.preheader43 ], [ %.pre61, %.critedge.._crit_edge_crit_edge ], [ %30, %._crit_edge49 ], [ %83, %78 ]
  %84 = call double @sqrt(double noundef %.sink) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  ret double %84
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapI2PTSaIS0_EEvRSt6vectorIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

attributes #0 = { mustprogress 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 = { 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 #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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = distinct !{!14, !12}
!15 = !{!16, !10, i64 0}
!16 = !{!"_ZTS2PT", !10, i64 0, !10, i64 8}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass