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

; 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.line = type { %struct.PT, %struct.PT, %struct.PT, double }
%"class.std::vector.22" = type { %"struct.std::_Vector_base.23" }
%"struct.std::_Vector_base.23" = type { %"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair.27" = type <{ double, i32, [4 x i8] }>
%"class.__gnu_cxx::__normal_iterator.30" = type { ptr }

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

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

; 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 #2 align 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 i32 @_Z11orientation2PTS_S_(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK2PTmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK2PTdvEd(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16), double noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK2PTmlEd(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16), double noundef) #4 align 2

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 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) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4lineC2E2PTS0_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI2PTSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z25polygon_line_intersectionSt6vectorI2PTSaIS0_EES0_S0_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #4 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.line, align 8
  %9 = alloca %struct.PT, align 8
  %10 = alloca %struct.PT, align 8
  %11 = alloca double, align 8
  %12 = alloca %"class.std::vector.22", align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %struct.PT, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca %struct.PT, align 8
  %20 = alloca %struct.PT, align 8
  %21 = alloca i32, align 4
  %22 = alloca %struct.PT, align 8
  %23 = alloca %struct.PT, align 8
  %24 = alloca %struct.PT, align 8
  %25 = alloca %struct.line, align 8
  %26 = alloca %struct.PT, align 8
  %27 = alloca %struct.PT, align 8
  %28 = alloca %struct.PT, align 8
  %29 = alloca %struct.PT, align 8
  %30 = alloca %struct.PT, align 8
  %31 = alloca %struct.PT, align 8
  %32 = alloca %struct.PT, align 8
  %33 = alloca %struct.PT, align 8
  %34 = alloca double, align 8
  %35 = alloca %struct.PT, align 8
  %36 = alloca %struct.PT, align 8
  %37 = alloca i32, align 4
  %38 = alloca %"struct.std::pair.27", align 8
  %39 = alloca double, align 8
  %40 = alloca { double, i32 }, align 8
  %41 = alloca %"class.__gnu_cxx::__normal_iterator.30", align 8
  %42 = alloca %"class.__gnu_cxx::__normal_iterator.30", align 8
  %43 = alloca i32, align 4
  %44 = alloca i32, align 4
  %45 = alloca %struct.PT, align 8
  %46 = alloca %struct.PT, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %47 = call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #7
  %48 = trunc i64 %47 to i32
  store i32 %48, ptr %7, align 4, !tbaa !9
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 0) #7
  call void @_ZNSt6vectorI2PTSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %49)
  call void @llvm.lifetime.start.p0(i64 56, ptr %8) #7
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %1)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @_ZN4lineC2E2PTS0_(ptr noundef nonnull align 8 dereferenceable(56) %8, ptr noundef %9, ptr noundef %10)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store double 0.000000e+00, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #7
  call void @_ZNSt6vectorISt4pairIdiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %174, %3
  %51 = load i32, ptr %13, align 4, !tbaa !9
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %50
  store i32 2, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %186

55:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(16) %1)
          to label %56 unwind label %77

56:                                               ; preds = %55
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %57 unwind label %77

57:                                               ; preds = %56
  %58 = load i32, ptr %13, align 4, !tbaa !9
  %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) #7
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(16) %60)
          to label %61 unwind label %77

61:                                               ; preds = %57
  %62 = invoke noundef i32 @_Z11orientation2PTS_S_(ptr noundef %16, ptr noundef %19, ptr noundef %20)
          to label %63 unwind label %77

63:                                               ; preds = %61
  store i32 %62, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(16) %1)
          to label %64 unwind label %81

64:                                               ; preds = %63
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %65 unwind label %81

65:                                               ; preds = %64
  %66 = load i32, ptr %13, align 4, !tbaa !9
  %67 = add nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %68) #7
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(16) %69)
          to label %70 unwind label %81

70:                                               ; preds = %65
  %71 = invoke noundef i32 @_Z11orientation2PTS_S_(ptr noundef %22, ptr noundef %23, ptr noundef %24)
          to label %72 unwind label %81

72:                                               ; preds = %70
  store i32 %71, ptr %21, align 4, !tbaa !9
  %73 = load i32, ptr %15, align 4, !tbaa !9
  %74 = load i32, ptr %21, align 4, !tbaa !9
  %75 = icmp eq i32 %73, %74
  br i1 %75, label %76, label %85

76:                                               ; preds = %72
  store i32 4, ptr %14, align 4
  br label %171

77:                                               ; preds = %61, %57, %56, %55
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %17, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %18, align 4
  br label %185

81:                                               ; preds = %70, %65, %64, %63
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %17, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %18, align 4
  br label %184

85:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 56, ptr %25) #7
  %86 = load i32, ptr %13, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %87) #7
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 8 dereferenceable(16) %88)
          to label %89 unwind label %130

89:                                               ; preds = %85
  %90 = load i32, ptr %13, align 4, !tbaa !9
  %91 = add nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %92) #7
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef nonnull align 8 dereferenceable(16) %93)
          to label %94 unwind label %130

94:                                               ; preds = %89
  invoke void @_ZN4lineC2E2PTS0_(ptr noundef nonnull align 8 dereferenceable(56) %25, ptr noundef %26, ptr noundef %27)
          to label %95 unwind label %130

95:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 16, ptr %28) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %29) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %30) #7
  %96 = getelementptr inbounds %struct.line, ptr %25, i32 0, i32 2
  %97 = getelementptr inbounds %struct.line, ptr %8, i32 0, i32 3
  %98 = load double, ptr %97, align 8, !tbaa !13
  invoke void @_ZNK2PTmlEd(ptr dead_on_unwind writable sret(%struct.PT) align 8 %30, ptr noundef nonnull align 8 dereferenceable(16) %96, double noundef %98)
          to label %99 unwind label %134

99:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 16, ptr %31) #7
  %100 = getelementptr inbounds %struct.line, ptr %8, i32 0, i32 2
  %101 = getelementptr inbounds %struct.line, ptr %25, i32 0, i32 3
  %102 = load double, ptr %101, align 8, !tbaa !13
  invoke void @_ZNK2PTmlEd(ptr dead_on_unwind writable sret(%struct.PT) align 8 %31, ptr noundef nonnull align 8 dereferenceable(16) %100, double noundef %102)
          to label %103 unwind label %138

103:                                              ; preds = %99
  invoke void @_ZNK2PTmiERKS_(ptr dead_on_unwind writable sret(%struct.PT) align 8 %29, ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 8 dereferenceable(16) %31)
          to label %104 unwind label %138

104:                                              ; preds = %103
  %105 = getelementptr inbounds %struct.line, ptr %8, i32 0, i32 2
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull align 8 dereferenceable(16) %105)
          to label %106 unwind label %138

106:                                              ; preds = %104
  %107 = getelementptr inbounds %struct.line, ptr %25, i32 0, i32 2
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %33, ptr noundef nonnull align 8 dereferenceable(16) %107)
          to label %108 unwind label %138

108:                                              ; preds = %106
  %109 = invoke noundef double @_Z5cross2PTS_(ptr noundef %32, ptr noundef %33)
          to label %110 unwind label %138

110:                                              ; preds = %108
  invoke void @_ZNK2PTdvEd(ptr dead_on_unwind writable sret(%struct.PT) align 8 %28, ptr noundef nonnull align 8 dereferenceable(16) %29, double noundef %109)
          to label %111 unwind label %138

111:                                              ; preds = %110
  call void @llvm.lifetime.end.p0(i64 16, ptr %31) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %30) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %29) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #7
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 8 dereferenceable(16) %28)
          to label %112 unwind label %143

112:                                              ; preds = %111
  %113 = getelementptr inbounds %struct.line, ptr %8, i32 0, i32 2
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 8 dereferenceable(16) %113)
          to label %114 unwind label %143

114:                                              ; preds = %112
  %115 = invoke noundef double @_Z3dot2PTS_(ptr noundef %35, ptr noundef %36)
          to label %116 unwind label %143

116:                                              ; preds = %114
  store double %115, ptr %34, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #7
  %117 = load i32, ptr %15, align 4, !tbaa !9
  %118 = load i32, ptr %21, align 4, !tbaa !9
  %119 = icmp sgt i32 %117, %118
  br i1 %119, label %120, label %147

120:                                              ; preds = %116
  %121 = load i32, ptr %15, align 4, !tbaa !9
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %123, label %126

123:                                              ; preds = %120
  %124 = load i32, ptr %21, align 4, !tbaa !9
  %125 = icmp ne i32 %124, 0
  br label %126

126:                                              ; preds = %123, %120
  %127 = phi i1 [ false, %120 ], [ %125, %123 ]
  %128 = zext i1 %127 to i64
  %129 = select i1 %127, i32 2, i32 1
  store i32 %129, ptr %37, align 4, !tbaa !9
  br label %157

130:                                              ; preds = %94, %89, %85
  %131 = landingpad { ptr, i32 }
          cleanup
  %132 = extractvalue { ptr, i32 } %131, 0
  store ptr %132, ptr %17, align 8
  %133 = extractvalue { ptr, i32 } %131, 1
  store i32 %133, ptr %18, align 4
  br label %183

134:                                              ; preds = %95
  %135 = landingpad { ptr, i32 }
          cleanup
  %136 = extractvalue { ptr, i32 } %135, 0
  store ptr %136, ptr %17, align 8
  %137 = extractvalue { ptr, i32 } %135, 1
  store i32 %137, ptr %18, align 4
  br label %142

138:                                              ; preds = %110, %108, %106, %104, %103, %99
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %17, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %31) #7
  br label %142

142:                                              ; preds = %138, %134
  call void @llvm.lifetime.end.p0(i64 16, ptr %30) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %29) #7
  br label %182

143:                                              ; preds = %114, %112, %111
  %144 = landingpad { ptr, i32 }
          cleanup
  %145 = extractvalue { ptr, i32 } %144, 0
  store ptr %145, ptr %17, align 8
  %146 = extractvalue { ptr, i32 } %144, 1
  store i32 %146, ptr %18, align 4
  br label %181

147:                                              ; preds = %116
  %148 = load i32, ptr %15, align 4, !tbaa !9
  %149 = icmp ne i32 %148, 0
  br i1 %149, label %150, label %153

150:                                              ; preds = %147
  %151 = load i32, ptr %21, align 4, !tbaa !9
  %152 = icmp ne i32 %151, 0
  br label %153

153:                                              ; preds = %150, %147
  %154 = phi i1 [ false, %147 ], [ %152, %150 ]
  %155 = zext i1 %154 to i64
  %156 = select i1 %154, i32 -2, i32 -1
  store i32 %156, ptr %37, align 4, !tbaa !9
  br label %157

157:                                              ; preds = %153, %126
  call void @llvm.lifetime.start.p0(i64 16, ptr %38) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %39) #7
  %158 = load i32, ptr %37, align 4, !tbaa !9
  %159 = icmp sgt i32 %158, 0
  br i1 %159, label %160, label %163

160:                                              ; preds = %157
  %161 = load double, ptr %34, align 8, !tbaa !11
  %162 = fsub double %161, 1.000000e-09
  br label %166

163:                                              ; preds = %157
  %164 = load double, ptr %34, align 8, !tbaa !11
  %165 = fadd double %164, 1.000000e-09
  br label %166

166:                                              ; preds = %163, %160
  %167 = phi double [ %162, %160 ], [ %165, %163 ]
  store double %167, ptr %39, align 8, !tbaa !11
  %168 = invoke { double, i32 } @_ZSt9make_pairIdRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %39, ptr noundef nonnull align 4 dereferenceable(4) %37)
          to label %169 unwind label %177

169:                                              ; preds = %166
  store { double, i32 } %168, ptr %40, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %38, ptr align 8 %40, i64 12, i1 false)
  invoke void @_ZNSt6vectorISt4pairIdiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(12) %38)
          to label %170 unwind label %177

170:                                              ; preds = %169
  call void @llvm.lifetime.end.p0(i64 8, ptr %39) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %38) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr %25) #7
  store i32 0, ptr %14, align 4
  br label %171

171:                                              ; preds = %170, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  %172 = load i32, ptr %14, align 4
  switch i32 %172, label %253 [
    i32 0, label %173
    i32 4, label %174
  ]

173:                                              ; preds = %171
  br label %174

174:                                              ; preds = %173, %171
  %175 = load i32, ptr %13, align 4, !tbaa !9
  %176 = add nsw i32 %175, 1
  store i32 %176, ptr %13, align 4, !tbaa !9
  br label %50, !llvm.loop !16

177:                                              ; preds = %169, %166
  %178 = landingpad { ptr, i32 }
          cleanup
  %179 = extractvalue { ptr, i32 } %178, 0
  store ptr %179, ptr %17, align 8
  %180 = extractvalue { ptr, i32 } %178, 1
  store i32 %180, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %39) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %38) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #7
  br label %181

181:                                              ; preds = %177, %143
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  br label %182

182:                                              ; preds = %181, %142
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #7
  br label %183

183:                                              ; preds = %182, %130
  call void @llvm.lifetime.end.p0(i64 56, ptr %25) #7
  br label %184

184:                                              ; preds = %183, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %185

185:                                              ; preds = %184, %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %247

186:                                              ; preds = %54
  %187 = call ptr @_ZNSt6vectorISt4pairIdiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %188 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.30", ptr %41, i32 0, i32 0
  store ptr %187, ptr %188, align 8
  %189 = call ptr @_ZNSt6vectorISt4pairIdiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %190 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.30", ptr %42, i32 0, i32 0
  store ptr %189, ptr %190, align 8
  %191 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.30", ptr %41, i32 0, i32 0
  %192 = load ptr, ptr %191, align 8
  %193 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.30", ptr %42, i32 0, i32 0
  %194 = load ptr, ptr %193, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIdiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %192, ptr %194)
          to label %195 unwind label %203

195:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 4, ptr %43) #7
  store i32 0, ptr %43, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %44) #7
  store i32 0, ptr %44, align 4, !tbaa !9
  br label %196

196:                                              ; preds = %233, %195
  %197 = load i32, ptr %43, align 4, !tbaa !9
  %198 = add nsw i32 %197, 1
  %199 = call noundef i64 @_ZNKSt6vectorISt4pairIdiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %200 = trunc i64 %199 to i32
  %201 = icmp slt i32 %198, %200
  br i1 %201, label %207, label %202

202:                                              ; preds = %196
  store i32 5, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %44) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %43) #7
  br label %236

203:                                              ; preds = %241, %239, %236, %186
  %204 = landingpad { ptr, i32 }
          cleanup
  %205 = extractvalue { ptr, i32 } %204, 0
  store ptr %205, ptr %17, align 8
  %206 = extractvalue { ptr, i32 } %204, 1
  store i32 %206, ptr %18, align 4
  br label %247

207:                                              ; preds = %196
  %208 = load i32, ptr %43, align 4, !tbaa !9
  %209 = sext i32 %208 to i64
  %210 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIdiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %209) #7
  %211 = getelementptr inbounds %"struct.std::pair.27", ptr %210, i32 0, i32 1
  %212 = load i32, ptr %211, align 8, !tbaa !18
  %213 = load i32, ptr %44, align 4, !tbaa !9
  %214 = add nsw i32 %213, %212
  store i32 %214, ptr %44, align 4, !tbaa !9
  %215 = load i32, ptr %44, align 4, !tbaa !9
  %216 = icmp ne i32 %215, 0
  br i1 %216, label %217, label %232

217:                                              ; preds = %207
  %218 = load i32, ptr %43, align 4, !tbaa !9
  %219 = add nsw i32 %218, 1
  %220 = sext i32 %219 to i64
  %221 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIdiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %220) #7
  %222 = getelementptr inbounds %"struct.std::pair.27", ptr %221, i32 0, i32 0
  %223 = load double, ptr %222, align 8, !tbaa !20
  %224 = load i32, ptr %43, align 4, !tbaa !9
  %225 = sext i32 %224 to i64
  %226 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIdiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %225) #7
  %227 = getelementptr inbounds %"struct.std::pair.27", ptr %226, i32 0, i32 0
  %228 = load double, ptr %227, align 8, !tbaa !20
  %229 = fsub double %223, %228
  %230 = load double, ptr %11, align 8, !tbaa !11
  %231 = fadd double %230, %229
  store double %231, ptr %11, align 8, !tbaa !11
  br label %232

232:                                              ; preds = %217, %207
  br label %233

233:                                              ; preds = %232
  %234 = load i32, ptr %43, align 4, !tbaa !9
  %235 = add nsw i32 %234, 1
  store i32 %235, ptr %43, align 4, !tbaa !9
  br label %196, !llvm.loop !21

236:                                              ; preds = %202
  %237 = load double, ptr %11, align 8, !tbaa !11
  %238 = getelementptr inbounds %struct.line, ptr %8, i32 0, i32 2
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %45, ptr noundef nonnull align 8 dereferenceable(16) %238)
          to label %239 unwind label %203

239:                                              ; preds = %236
  %240 = getelementptr inbounds %struct.line, ptr %8, i32 0, i32 2
  invoke void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %46, ptr noundef nonnull align 8 dereferenceable(16) %240)
          to label %241 unwind label %203

241:                                              ; preds = %239
  %242 = invoke noundef double @_Z3dot2PTS_(ptr noundef %45, ptr noundef %46)
          to label %243 unwind label %203

243:                                              ; preds = %241
  %244 = call double @sqrt(double noundef %242) #7
  %245 = fdiv double %237, %244
  store double %245, ptr %11, align 8, !tbaa !11
  call void @_ZNSt6vectorI2PTSaIS0_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #7
  %246 = load double, ptr %11, align 8, !tbaa !11
  store i32 1, ptr %14, align 4
  call void @_ZNSt6vectorISt4pairIdiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  ret double %246

247:                                              ; preds = %203, %185
  call void @_ZNSt6vectorISt4pairIdiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %248

248:                                              ; preds = %247
  %249 = load ptr, ptr %17, align 8
  %250 = load i32, ptr %18, align 4
  %251 = insertvalue { ptr, i32 } poison, ptr %249, 0
  %252 = insertvalue { ptr, i32 } %251, i32 %250, 1
  resume { ptr, i32 } %252

253:                                              ; preds = %171
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIdiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(12)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { double, i32 } @_ZSt9make_pairIdRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIdiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr, ptr) #3

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

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

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

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

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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 = !{!14, !12, i64 48}
!14 = !{!"_ZTS4line", !15, i64 0, !15, i64 16, !15, i64 32, !12, i64 48}
!15 = !{!"_ZTS2PT", !12, i64 0, !12, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !10, i64 8}
!19 = !{!"_ZTSSt4pairIdiE", !12, i64 0, !10, i64 8}
!20 = !{!19, !12, i64 0}
!21 = distinct !{!21, !17}


; 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.line = type { %struct.PT, %struct.PT, %struct.PT, double }
%"class.std::vector.22" = type { %"struct.std::_Vector_base.23" }
%"struct.std::_Vector_base.23" = type { %"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<double, int>, std::allocator<std::pair<double, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair.27" = type <{ double, i32, [4 x i8] }>

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

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

; 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 #2 align 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 i32 @_Z11orientation2PTS_S_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK2PTmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK2PTdvEd(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16), double noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK2PTmlEd(ptr dead_on_unwind noalias writable sret(%struct.PT) align 8, ptr noundef nonnull align 8 dereferenceable(16), double noundef) local_unnamed_addr #4 align 2

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 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 #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4lineC2E2PTS0_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI2PTSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z25polygon_line_intersectionSt6vectorI2PTSaIS0_EES0_S0_(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #4 personality ptr @__gxx_personality_v0 {
  %4 = alloca %struct.line, align 8
  %5 = alloca %struct.PT, align 8
  %6 = alloca %struct.PT, align 8
  %7 = alloca %"class.std::vector.22", align 8
  %8 = alloca %struct.PT, 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 %struct.line, align 8
  %15 = alloca %struct.PT, align 8
  %16 = alloca %struct.PT, align 8
  %17 = alloca %struct.PT, align 8
  %18 = alloca %struct.PT, align 8
  %19 = alloca %struct.PT, align 8
  %20 = alloca %struct.PT, align 8
  %21 = alloca %struct.PT, align 8
  %22 = alloca %struct.PT, align 8
  %23 = alloca %struct.PT, align 8
  %24 = alloca %struct.PT, align 8
  %25 = alloca i32, align 4
  %26 = alloca %"struct.std::pair.27", align 8
  %27 = alloca double, align 8
  %28 = alloca %struct.PT, align 8
  %29 = alloca %struct.PT, align 8
  %30 = tail call noundef i64 @_ZNKSt6vectorI2PTSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %31 = trunc i64 %30 to i32
  %32 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 0) #6
  tail call void @_ZNSt6vectorI2PTSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %32)
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %4) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %1)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @_ZN4lineC2E2PTS0_(ptr noundef nonnull align 8 dereferenceable(56) %4, ptr noundef nonnull %5, ptr noundef nonnull %6)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  call void @_ZNSt6vectorISt4pairIdiESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %33 = icmp sgt i32 %31, 0
  br i1 %33, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3
  %34 = getelementptr inbounds i8, ptr %14, i64 32
  %35 = getelementptr inbounds i8, ptr %4, i64 48
  %36 = getelementptr inbounds i8, ptr %4, i64 32
  %37 = getelementptr inbounds i8, ptr %14, i64 48
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %26, i64 8
  %wide.trip.count = and i64 %30, 2147483647
  br label %43

._crit_edge:                                      ; preds = %84, %3
  %38 = call ptr @_ZNSt6vectorISt4pairIdiESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %39 = call ptr @_ZNSt6vectorISt4pairIdiESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIdiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %38, ptr %39)
          to label %.preheader unwind label %93

.preheader:                                       ; preds = %._crit_edge
  %40 = call noundef i64 @_ZNKSt6vectorISt4pairIdiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %41 = trunc i64 %40 to i32
  %42 = icmp sgt i32 %41, 1
  br i1 %42, label %.lr.ph55, label %._crit_edge56

43:                                               ; preds = %.lr.ph, %84
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %84 ]
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %1)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %44 = 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) %10, ptr noundef nonnull align 8 dereferenceable(16) %44)
  %45 = invoke noundef i32 @_Z11orientation2PTS_S_(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10)
          to label %46 unwind label %51

46:                                               ; preds = %43
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %1)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv.next) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %47)
  %48 = invoke noundef i32 @_Z11orientation2PTS_S_(ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef nonnull %13)
          to label %49 unwind label %53

49:                                               ; preds = %46
  %50 = icmp eq i32 %45, %48
  br i1 %50, label %84, label %55

51:                                               ; preds = %43
  %52 = landingpad { ptr, i32 }
          cleanup
  br label %110

53:                                               ; preds = %46
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %110

55:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %14) #6
  %56 = 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) %15, ptr noundef nonnull align 8 dereferenceable(16) %56)
  %57 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorI2PTSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv.next) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(16) %57)
  invoke void @_ZN4lineC2E2PTS0_(ptr noundef nonnull align 8 dereferenceable(56) %14, ptr noundef nonnull %15, ptr noundef nonnull %16)
          to label %58 unwind label %75

58:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %17) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %18) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %19) #6
  %59 = load double, ptr %35, align 8, !tbaa !5
  invoke void @_ZNK2PTmlEd(ptr dead_on_unwind nonnull writable sret(%struct.PT) align 8 %19, ptr noundef nonnull align 8 dereferenceable(16) %34, double noundef %59)
          to label %60 unwind label %77

60:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %20) #6
  %61 = load double, ptr %37, align 8, !tbaa !5
  invoke void @_ZNK2PTmlEd(ptr dead_on_unwind nonnull writable sret(%struct.PT) align 8 %20, ptr noundef nonnull align 8 dereferenceable(16) %36, double noundef %61)
          to label %62 unwind label %79

62:                                               ; preds = %60
  invoke void @_ZNK2PTmiERKS_(ptr dead_on_unwind nonnull writable sret(%struct.PT) align 8 %18, ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(16) %20)
          to label %63 unwind label %79

63:                                               ; preds = %62
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(16) %36)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(16) %34)
  %64 = call noundef double @_Z5cross2PTS_(ptr noundef nonnull %21, ptr noundef nonnull %22)
  invoke void @_ZNK2PTdvEd(ptr dead_on_unwind nonnull writable sret(%struct.PT) align 8 %17, ptr noundef nonnull align 8 dereferenceable(16) %18, double noundef %64)
          to label %65 unwind label %79

65:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %20) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %19) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %18) #6
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(16) %17)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(16) %36)
  %66 = call noundef double @_Z3dot2PTS_(ptr noundef nonnull %23, ptr noundef nonnull %24)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %25) #6
  %67 = icmp sgt i32 %45, %48
  %68 = icmp ne i32 %45, 0
  %69 = icmp ne i32 %48, 0
  %70 = and i1 %68, %69
  %71 = select i1 %70, i32 -2, i32 -1
  %72 = select i1 %70, i32 2, i32 1
  %storemerge = select i1 %67, i32 %72, i32 %71
  store i32 %storemerge, ptr %25, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %26) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %27) #6
  %.v = select i1 %67, double -1.000000e-09, double 1.000000e-09
  %73 = fadd double %66, %.v
  store double %73, ptr %27, align 8, !tbaa !13
  %74 = invoke { double, i32 } @_ZSt9make_pairIdRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull align 4 dereferenceable(4) %25)
          to label %82 unwind label %85

75:                                               ; preds = %55
  %76 = landingpad { ptr, i32 }
          cleanup
  br label %88

77:                                               ; preds = %58
  %78 = landingpad { ptr, i32 }
          cleanup
  br label %81

79:                                               ; preds = %63, %62, %60
  %80 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %20) #6
  br label %81

81:                                               ; preds = %79, %77
  %.pn = phi { ptr, i32 } [ %80, %79 ], [ %78, %77 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %19) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %18) #6
  br label %87

82:                                               ; preds = %65
  %.fca.0.extract = extractvalue { double, i32 } %74, 0
  %.fca.1.extract = extractvalue { double, i32 } %74, 1
  store double %.fca.0.extract, ptr %26, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  invoke void @_ZNSt6vectorISt4pairIdiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(12) %26)
          to label %83 unwind label %85

83:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %27) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %25) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %14) #6
  br label %84

84:                                               ; preds = %49, %83
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %43, !llvm.loop !14

85:                                               ; preds = %82, %65
  %86 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %27) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %25) #6
  br label %87

87:                                               ; preds = %85, %81
  %.pn45 = phi { ptr, i32 } [ %86, %85 ], [ %.pn, %81 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #6
  br label %88

88:                                               ; preds = %87, %75
  %.pn45.pn = phi { ptr, i32 } [ %.pn45, %87 ], [ %76, %75 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %14) #6
  br label %110

._crit_edge56:                                    ; preds = %106, %.preheader
  %.031.lcssa = phi double [ 0.000000e+00, %.preheader ], [ %.1, %106 ]
  %89 = getelementptr inbounds i8, ptr %4, i64 32
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 8 dereferenceable(16) %89)
  call void @_ZN2PTC2ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 8 dereferenceable(16) %89)
  %90 = call noundef double @_Z3dot2PTS_(ptr noundef nonnull %28, ptr noundef nonnull %29)
  %91 = call double @sqrt(double noundef %90) #6
  %92 = fdiv double %.031.lcssa, %91
  call void @_ZNSt6vectorI2PTSaIS0_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  call void @_ZNSt6vectorISt4pairIdiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %4) #6
  ret double %92

93:                                               ; preds = %._crit_edge
  %94 = landingpad { ptr, i32 }
          cleanup
  br label %110

.lr.ph55:                                         ; preds = %.preheader, %106
  %indvars.iv60 = phi i64 [ %indvars.iv.next61, %106 ], [ 0, %.preheader ]
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %106 ], [ 1, %.preheader ]
  %.054 = phi i32 [ %98, %106 ], [ 0, %.preheader ]
  %.03152 = phi double [ %.1, %106 ], [ 0.000000e+00, %.preheader ]
  %95 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIdiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %indvars.iv60) #6
  %96 = getelementptr inbounds i8, ptr %95, i64 8
  %97 = load i32, ptr %96, align 8, !tbaa !16
  %98 = add nsw i32 %97, %.054
  %.not = icmp eq i32 %98, 0
  br i1 %.not, label %106, label %99

99:                                               ; preds = %.lr.ph55
  %100 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIdiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %indvars.iv58) #6
  %101 = load double, ptr %100, align 8, !tbaa !18
  %102 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIdiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %indvars.iv60) #6
  %103 = load double, ptr %102, align 8, !tbaa !18
  %104 = fsub double %101, %103
  %105 = fadd double %.03152, %104
  br label %106

106:                                              ; preds = %.lr.ph55, %99
  %.1 = phi double [ %105, %99 ], [ %.03152, %.lr.ph55 ]
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %107 = call noundef i64 @_ZNKSt6vectorISt4pairIdiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  %sext = shl i64 %107, 32
  %108 = ashr exact i64 %sext, 32
  %109 = icmp slt i64 %indvars.iv.next59, %108
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  br i1 %109, label %.lr.ph55, label %._crit_edge56, !llvm.loop !19

110:                                              ; preds = %51, %88, %53, %93
  %.pn45.pn.pn.pn.pn = phi { ptr, i32 } [ %94, %93 ], [ %52, %51 ], [ %.pn45.pn, %88 ], [ %54, %53 ]
  call void @_ZNSt6vectorISt4pairIdiESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %4) #6
  resume { ptr, i32 } %.pn45.pn.pn.pn.pn
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIdiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { double, i32 } @_ZSt9make_pairIdRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt4pairIdiESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr, ptr) local_unnamed_addr #3

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

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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, !8, i64 48}
!6 = !{!"_ZTS4line", !7, i64 0, !7, i64 16, !7, i64 32, !8, i64 48}
!7 = !{!"_ZTS2PT", !8, i64 0, !8, i64 8}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!8, !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !12, i64 8}
!17 = !{!"_ZTSSt4pairIdiE", !8, i64 0, !12, i64 8}
!18 = !{!17, !8, i64 0}
!19 = distinct !{!19, !15}


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