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

; 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 }
%"struct.std::pair.35" = type { i32, i32 }
%"class.std::initializer_list.4" = type { ptr, i64 }

; 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 @_ZSt3minIdERKT_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: inlinehint mustprogress uwtable
declare dso_local noundef double @_Z5dist22PTS_(ptr noundef, ptr noundef) #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZSt3minIdET_St16initializer_listIS0_E(ptr, i64) #3

; 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: mustprogress uwtable
declare dso_local i64 @_Z30tangents_from_point_to_polygonRSt6vectorI2PTSaIS0_EES0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z26dist_from_point_to_polygonRSt6vectorI2PTSaIS0_EES0_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1) #4 {
  %3 = alloca double, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca %struct.PT, align 8
  %11 = alloca %struct.PT, align 8
  %12 = alloca %struct.PT, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::pair.35", align 4
  %15 = alloca %struct.PT, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca double, align 8
  %20 = alloca %struct.PT, align 8
  %21 = alloca %struct.PT, align 8
  %22 = alloca double, align 8
  %23 = alloca %struct.PT, align 8
  %24 = alloca %struct.PT, align 8
  %25 = alloca %"class.std::initializer_list.4", align 8
  %26 = alloca [3 x double], align 8
  %27 = alloca double, align 8
  %28 = alloca %struct.PT, align 8
  %29 = alloca %struct.PT, align 8
  %30 = alloca %struct.PT, align 8
  %31 = alloca double, align 8
  %32 = alloca %struct.PT, align 8
  %33 = alloca %struct.PT, align 8
  %34 = 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 8, ptr %6) #6
  store double 1.000000e+100, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %35) #6
  %37 = trunc i64 %36 to i32
  store i32 %37, ptr %7, align 4, !tbaa !11
  %38 = load i32, ptr %7, align 4, !tbaa !11
  %39 = icmp sle i32 %38, 3
  br i1 %39, label %40, label %66

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

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

45:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %64

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = load i32, ptr %8, align 4, !tbaa !11
  %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) %10, ptr noundef nonnull align 8 dereferenceable(16) %50)
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = load i32, ptr %8, align 4, !tbaa !11
  %53 = add nsw i32 %52, 1
  %54 = load i32, ptr %7, align 4, !tbaa !11
  %55 = srem i32 %53, %54
  %56 = sext i32 %55 to i64
  %57 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %51, i64 noundef %56) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %57)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %58 = call noundef double @_Z22dist_from_point_to_seg2PTS_S_(ptr noundef %10, ptr noundef %11, ptr noundef %12)
  store double %58, ptr %9, align 8, !tbaa !9
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %60 = load double, ptr %59, align 8, !tbaa !9
  store double %60, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %61

61:                                               ; preds = %46
  %62 = load i32, ptr %8, align 4, !tbaa !11
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %8, align 4, !tbaa !11
  br label %41, !llvm.loop !13

64:                                               ; preds = %45
  %65 = load double, ptr %6, align 8, !tbaa !9
  store double %65, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %175

66:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %68 = call i64 @_Z30tangents_from_point_to_polygonRSt6vectorI2PTSaIS0_EES0_(ptr noundef nonnull align 8 dereferenceable(24) %67, ptr noundef %15)
  store i64 %68, ptr %14, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %69 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %14) #6
  store ptr %69, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %14) #6
  store ptr %70, ptr %17, align 8, !tbaa !5
  %71 = load ptr, ptr %17, align 8, !tbaa !5
  %72 = load i32, ptr %71, align 4, !tbaa !11
  %73 = load ptr, ptr %16, align 8, !tbaa !5
  %74 = load i32, ptr %73, align 4, !tbaa !11
  %75 = icmp sgt i32 %72, %74
  br i1 %75, label %76, label %81

76:                                               ; preds = %66
  %77 = load i32, ptr %7, align 4, !tbaa !11
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  %79 = load i32, ptr %78, align 4, !tbaa !11
  %80 = add nsw i32 %79, %77
  store i32 %80, ptr %78, align 4, !tbaa !11
  br label %81

81:                                               ; preds = %76, %66
  br label %82

82:                                               ; preds = %132, %81
  %83 = load ptr, ptr %17, align 8, !tbaa !5
  %84 = load i32, ptr %83, align 4, !tbaa !11
  %85 = load ptr, ptr %16, align 8, !tbaa !5
  %86 = load i32, ptr %85, align 4, !tbaa !11
  %87 = icmp slt i32 %84, %86
  br i1 %87, label %88, label %133

88:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %89 = load ptr, ptr %17, align 8, !tbaa !5
  %90 = load i32, ptr %89, align 4, !tbaa !11
  %91 = load ptr, ptr %16, align 8, !tbaa !5
  %92 = load i32, ptr %91, align 4, !tbaa !11
  %93 = add nsw i32 %90, %92
  %94 = ashr i32 %93, 1
  store i32 %94, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = load i32, ptr %18, align 4, !tbaa !11
  %97 = load i32, ptr %7, align 4, !tbaa !11
  %98 = srem i32 %96, %97
  %99 = sext i32 %98 to i64
  %100 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %95, i64 noundef %99) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(16) %100)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %101 = call noundef double @_Z5dist22PTS_(ptr noundef %20, ptr noundef %21)
  store double %101, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = load i32, ptr %18, align 4, !tbaa !11
  %104 = add nsw i32 %103, 1
  %105 = load i32, ptr %7, align 4, !tbaa !11
  %106 = srem i32 %104, %105
  %107 = sext i32 %106 to i64
  %108 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %102, i64 noundef %107) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(16) %108)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %109 = call noundef double @_Z5dist22PTS_(ptr noundef %23, ptr noundef %24)
  store double %109, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %26) #6
  %110 = load double, ptr %6, align 8, !tbaa !9
  store double %110, ptr %26, align 8, !tbaa !9
  %111 = getelementptr inbounds double, ptr %26, i64 1
  %112 = load double, ptr %19, align 8, !tbaa !9
  store double %112, ptr %111, align 8, !tbaa !9
  %113 = getelementptr inbounds double, ptr %26, i64 2
  %114 = load double, ptr %22, align 8, !tbaa !9
  store double %114, ptr %113, align 8, !tbaa !9
  %115 = getelementptr inbounds %"class.std::initializer_list.4", ptr %25, i32 0, i32 0
  store ptr %26, ptr %115, align 8, !tbaa !15
  %116 = getelementptr inbounds %"class.std::initializer_list.4", ptr %25, i32 0, i32 1
  store i64 3, ptr %116, align 8, !tbaa !18
  %117 = getelementptr inbounds { ptr, i64 }, ptr %25, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8
  %119 = getelementptr inbounds { ptr, i64 }, ptr %25, i32 0, i32 1
  %120 = load i64, ptr %119, align 8
  %121 = call noundef double @_ZSt3minIdET_St16initializer_listIS0_E(ptr %118, i64 %120)
  store double %121, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 24, ptr %26) #6
  %122 = load double, ptr %19, align 8, !tbaa !9
  %123 = load double, ptr %22, align 8, !tbaa !9
  %124 = fcmp olt double %122, %123
  br i1 %124, label %125, label %128

125:                                              ; preds = %88
  %126 = load i32, ptr %18, align 4, !tbaa !11
  %127 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 %126, ptr %127, align 4, !tbaa !11
  br label %132

128:                                              ; preds = %88
  %129 = load i32, ptr %18, align 4, !tbaa !11
  %130 = add nsw i32 %129, 1
  %131 = load ptr, ptr %17, align 8, !tbaa !5
  store i32 %130, ptr %131, align 4, !tbaa !11
  br label %132

132:                                              ; preds = %128, %125
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %82, !llvm.loop !19

133:                                              ; preds = %82
  %134 = load double, ptr %6, align 8, !tbaa !9
  %135 = call double @sqrt(double noundef %134) #6
  store double %135, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #6
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = load ptr, ptr %17, align 8, !tbaa !5
  %138 = load i32, ptr %137, align 4, !tbaa !11
  %139 = load i32, ptr %7, align 4, !tbaa !11
  %140 = srem i32 %138, %139
  %141 = sext i32 %140 to i64
  %142 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %136, i64 noundef %141) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 8 dereferenceable(16) %142)
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = load ptr, ptr %17, align 8, !tbaa !5
  %145 = load i32, ptr %144, align 4, !tbaa !11
  %146 = add nsw i32 %145, 1
  %147 = load i32, ptr %7, align 4, !tbaa !11
  %148 = srem i32 %146, %147
  %149 = sext i32 %148 to i64
  %150 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %143, i64 noundef %149) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 8 dereferenceable(16) %150)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %151 = call noundef double @_Z22dist_from_point_to_seg2PTS_S_(ptr noundef %28, ptr noundef %29, ptr noundef %30)
  store double %151, ptr %27, align 8, !tbaa !9
  %152 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %27)
  %153 = load double, ptr %152, align 8, !tbaa !9
  store double %153, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #6
  %154 = load ptr, ptr %4, align 8, !tbaa !5
  %155 = load ptr, ptr %17, align 8, !tbaa !5
  %156 = load i32, ptr %155, align 4, !tbaa !11
  %157 = load i32, ptr %7, align 4, !tbaa !11
  %158 = srem i32 %156, %157
  %159 = sext i32 %158 to i64
  %160 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %154, i64 noundef %159) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull align 8 dereferenceable(16) %160)
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = load ptr, ptr %17, align 8, !tbaa !5
  %163 = load i32, ptr %162, align 4, !tbaa !11
  %164 = sub nsw i32 %163, 1
  %165 = load i32, ptr %7, align 4, !tbaa !11
  %166 = add nsw i32 %164, %165
  %167 = load i32, ptr %7, align 4, !tbaa !11
  %168 = srem i32 %166, %167
  %169 = sext i32 %168 to i64
  %170 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %161, i64 noundef %169) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %33, ptr noundef nonnull align 8 dereferenceable(16) %170)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %34, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %171 = call noundef double @_Z22dist_from_point_to_seg2PTS_S_(ptr noundef %32, ptr noundef %33, ptr noundef %34)
  store double %171, ptr %31, align 8, !tbaa !9
  %172 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %31)
  %173 = load double, ptr %172, align 8, !tbaa !9
  store double %173, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #6
  %174 = load double, ptr %6, align 8, !tbaa !9
  store double %174, ptr %3, align 8
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %175

175:                                              ; preds = %133, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %176 = load double, ptr %3, align 8
  ret double %176
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8)) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8)) #1

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 = { 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 #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 "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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSSt16initializer_listIdE", !6, i64 0, !17, i64 8}
!17 = !{!"long", !7, i64 0}
!18 = !{!16, !17, i64 8}
!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 }
%"struct.std::pair.35" = type { i32, i32 }

; 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 @_ZSt3minIdERKT_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: inlinehint mustprogress uwtable
declare dso_local noundef double @_Z5dist22PTS_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_Z22dist_from_point_to_seg2PTS_S_(ptr noundef, 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: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZSt3minIdET_St16initializer_listIS0_E(ptr, i64) local_unnamed_addr #3

; 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: mustprogress uwtable
declare dso_local i64 @_Z30tangents_from_point_to_polygonRSt6vectorI2PTSaIS0_EES0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z26dist_from_point_to_polygonRSt6vectorI2PTSaIS0_EES0_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef %1) local_unnamed_addr #4 {
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca %struct.PT, align 8
  %6 = alloca %struct.PT, align 8
  %7 = alloca %struct.PT, align 8
  %8 = alloca %"struct.std::pair.35", align 8
  %9 = alloca %struct.PT, align 8
  %10 = alloca %struct.PT, align 8
  %11 = alloca %struct.PT, align 8
  %12 = alloca %struct.PT, align 8
  %13 = alloca %struct.PT, align 8
  %14 = alloca [3 x double], align 8
  %15 = alloca double, align 8
  %16 = alloca %struct.PT, align 8
  %17 = alloca %struct.PT, align 8
  %18 = alloca %struct.PT, align 8
  %19 = alloca double, align 8
  %20 = alloca %struct.PT, align 8
  %21 = alloca %struct.PT, align 8
  %22 = alloca %struct.PT, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  store double 1.000000e+100, ptr %3, align 8, !tbaa !5
  %23 = tail call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %24 = trunc i64 %23 to i32
  %25 = icmp slt i32 %24, 4
  br i1 %25, label %.preheader, label %36

.preheader:                                       ; preds = %2
  %26 = icmp sgt i32 %24, 0
  br i1 %26, label %.lr.ph52.preheader, label %._crit_edge53

.lr.ph52.preheader:                               ; preds = %.preheader
  %27 = and i64 %23, 2147483647
  br label %.lr.ph52

.lr.ph52:                                         ; preds = %.lr.ph52.preheader, %.lr.ph52
  %indvars.iv = phi i64 [ 0, %.lr.ph52.preheader ], [ %indvars.iv.next, %.lr.ph52 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %28)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = icmp eq i64 %indvars.iv.next, %27
  %30 = and i64 %indvars.iv.next, 4294967295
  %31 = select i1 %29, i64 0, i64 %30
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %31) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %32)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %33 = call noundef double @_Z22dist_from_point_to_seg2PTS_S_(ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7)
  store double %33, ptr %4, align 8, !tbaa !5
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %35 = load double, ptr %34, align 8, !tbaa !5
  store double %35, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %exitcond.not = icmp eq i64 %indvars.iv.next, %27
  br i1 %exitcond.not, label %._crit_edge53, label %.lr.ph52, !llvm.loop !9

36:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %37 = call i64 @_Z30tangents_from_point_to_polygonRSt6vectorI2PTSaIS0_EES0_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull %9)
  store i64 %37, ptr %8, align 8
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %8) #6
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8) %8) #6
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = load i32, ptr %38, align 4, !tbaa !11
  %42 = icmp sgt i32 %40, %41
  br i1 %42, label %43, label %45

43:                                               ; preds = %36
  %44 = add nsw i32 %41, %24
  store i32 %44, ptr %38, align 4, !tbaa !11
  %.pre = load i32, ptr %39, align 4, !tbaa !11
  br label %45

45:                                               ; preds = %43, %36
  %46 = phi i32 [ %44, %43 ], [ %41, %36 ]
  %47 = phi i32 [ %.pre, %43 ], [ %40, %36 ]
  %48 = icmp slt i32 %47, %46
  br i1 %48, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %45
  %.pre57 = load double, ptr %3, align 8, !tbaa !5
  br label %._crit_edge

.lr.ph:                                           ; preds = %45
  %49 = getelementptr inbounds i8, ptr %14, i64 8
  %50 = getelementptr inbounds i8, ptr %14, i64 16
  br label %51

51:                                               ; preds = %.lr.ph, %70
  %52 = phi i32 [ %46, %.lr.ph ], [ %71, %70 ]
  %53 = phi i32 [ %47, %.lr.ph ], [ %72, %70 ]
  %54 = add nsw i32 %52, %53
  %55 = ashr i32 %54, 1
  %56 = srem i32 %55, %24
  %57 = sext i32 %56 to i64
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %57) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %58)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %59 = call noundef double @_Z5dist22PTS_(ptr noundef nonnull %10, ptr noundef nonnull %11)
  %60 = add nsw i32 %55, 1
  %61 = srem i32 %60, %24
  %62 = sext i32 %61 to i64
  %63 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %62) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %63)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %64 = call noundef double @_Z5dist22PTS_(ptr noundef nonnull %12, ptr noundef nonnull %13)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #6
  %65 = load double, ptr %3, align 8, !tbaa !5
  store double %65, ptr %14, align 8, !tbaa !5
  store double %59, ptr %49, align 8, !tbaa !5
  store double %64, ptr %50, align 8, !tbaa !5
  %66 = call noundef double @_ZSt3minIdET_St16initializer_listIS0_E(ptr nonnull %14, i64 3)
  store double %66, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #6
  %67 = fcmp olt double %59, %64
  br i1 %67, label %68, label %69

68:                                               ; preds = %51
  store i32 %55, ptr %38, align 4, !tbaa !11
  %.pre55 = load i32, ptr %39, align 4, !tbaa !11
  br label %70

69:                                               ; preds = %51
  store i32 %60, ptr %39, align 4, !tbaa !11
  %.pre56 = load i32, ptr %38, align 4, !tbaa !11
  br label %70

70:                                               ; preds = %69, %68
  %71 = phi i32 [ %.pre56, %69 ], [ %55, %68 ]
  %72 = phi i32 [ %60, %69 ], [ %.pre55, %68 ]
  %73 = icmp slt i32 %72, %71
  br i1 %73, label %51, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %70, %.._crit_edge_crit_edge
  %74 = phi double [ %.pre57, %.._crit_edge_crit_edge ], [ %66, %70 ]
  %75 = call double @sqrt(double noundef %74) #6
  store double %75, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #6
  %76 = load i32, ptr %39, align 4, !tbaa !11
  %77 = srem i32 %76, %24
  %78 = sext i32 %77 to i64
  %79 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %78) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(16) %79)
  %80 = load i32, ptr %39, align 4, !tbaa !11
  %81 = add nsw i32 %80, 1
  %82 = srem i32 %81, %24
  %83 = sext i32 %82 to i64
  %84 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %83) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(16) %84)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %85 = call noundef double @_Z22dist_from_point_to_seg2PTS_S_(ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %18)
  store double %85, ptr %15, align 8, !tbaa !5
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %87 = load double, ptr %86, align 8, !tbaa !5
  store double %87, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %19) #6
  %88 = load i32, ptr %39, align 4, !tbaa !11
  %89 = srem i32 %88, %24
  %90 = sext i32 %89 to i64
  %91 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %90) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(16) %91)
  %92 = load i32, ptr %39, align 4, !tbaa !11
  %93 = add nsw i32 %24, -1
  %94 = add i32 %93, %92
  %95 = srem i32 %94, %24
  %96 = sext i32 %95 to i64
  %97 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %96) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(16) %97)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %98 = call noundef double @_Z22dist_from_point_to_seg2PTS_S_(ptr noundef nonnull %20, ptr noundef nonnull %21, ptr noundef nonnull %22)
  store double %98, ptr %19, align 8, !tbaa !5
  %99 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %19)
  %100 = load double, ptr %99, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  br label %._crit_edge53

._crit_edge53:                                    ; preds = %.lr.ph52, %.preheader, %._crit_edge
  %.0 = phi double [ %100, %._crit_edge ], [ 1.000000e+100, %.preheader ], [ %35, %.lr.ph52 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  ret double %.0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm0EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EiiEONSt13tuple_elementIXT_ESt4pairIT0_T1_EE4typeEOS4_(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1

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 = { 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 #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 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10}


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