; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R2Shapes/R2Polygon.ll (ZNK9R2Polygon10ConvexHullEv)

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

%class.R2Box = type { %class.R2Solid, %class.R2Point, %class.R2Point }
%class.R2Solid = type { %class.R2Shape }
%class.R2Shape = type { ptr }
%class.R2Point = type { [2 x double] }
%class.R2Polygon = type <{ %class.R2Solid, ptr, i32, [4 x i8], %class.R2Box, i32, [4 x i8] }>
%class.R2Line = type { %class.R2Vector, %class.R2Vector, double }
%class.R2Vector = type { [2 x double] }

@R2null_box = external global %class.R2Box, align 8
@RN_EPSILON = external global double, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #1

declare void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) #3

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

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

declare void @_ZN5R2Box5UnionERK7R2Point(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

declare void @_ZN7R2PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK9R2Polygon10ConvexHullEv(ptr dead_on_unwind noalias writable sret(%class.R2Polygon) align 8 %0, ptr noundef nonnull align 8 dereferenceable(68) %1) unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %class.R2Point, align 8
  %14 = alloca i32, align 4
  %15 = alloca %class.R2Line, align 8
  %16 = alloca i32, align 4
  %17 = alloca double, align 8
  %18 = alloca %class.R2Line, align 8
  %19 = alloca double, align 8
  %20 = alloca %class.R2Line, align 8
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %21 = load ptr, ptr %4, align 8
  %22 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 2
  %23 = load i32, ptr %22, align 8, !tbaa !9
  %24 = icmp sle i32 %23, 3
  br i1 %24, label %25, label %26

25:                                               ; preds = %2
  call void @_ZN9R2PolygonC1ERKS_(ptr noundef nonnull align 8 dereferenceable(68) %0, ptr noundef nonnull align 8 dereferenceable(68) %21)
  br label %271

26:                                               ; preds = %2
  store i1 false, ptr %5, align 1
  call void @_ZN9R2PolygonC1Ev(ptr noundef nonnull align 8 dereferenceable(68) %0)
  %27 = getelementptr inbounds %class.R2Polygon, ptr %0, i32 0, i32 4
  %28 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %27, ptr noundef nonnull align 8 dereferenceable(40) @R2null_box)
          to label %29 unwind label %57

29:                                               ; preds = %26
  %30 = getelementptr inbounds %class.R2Polygon, ptr %0, i32 0, i32 5
  store i32 0, ptr %30, align 8, !tbaa !16
  %31 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 2
  %32 = load i32, ptr %31, align 8, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %33, i64 16)
  %35 = extractvalue { i64, i1 } %34, 1
  %36 = extractvalue { i64, i1 } %34, 0
  %37 = select i1 %35, i64 -1, i64 %36
  %38 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %37) #7
          to label %39 unwind label %57

39:                                               ; preds = %29
  %40 = icmp eq i64 %33, 0
  br i1 %40, label %48, label %41

41:                                               ; preds = %39
  %42 = getelementptr inbounds %class.R2Point, ptr %38, i64 %33
  br label %43

43:                                               ; preds = %45, %41
  %44 = phi ptr [ %38, %41 ], [ %46, %45 ]
  invoke void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %44)
          to label %45 unwind label %61

45:                                               ; preds = %43
  %46 = getelementptr inbounds %class.R2Point, ptr %44, i64 1
  %47 = icmp eq ptr %46, %42
  br i1 %47, label %48, label %43

48:                                               ; preds = %45, %39
  %49 = getelementptr inbounds %class.R2Polygon, ptr %0, i32 0, i32 1
  store ptr %38, ptr %49, align 8, !tbaa !17
  %50 = getelementptr inbounds %class.R2Polygon, ptr %0, i32 0, i32 2
  store i32 0, ptr %50, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 1, ptr %9, align 4, !tbaa !18
  br label %51

51:                                               ; preds = %90, %48
  %52 = load i32, ptr %9, align 4, !tbaa !18
  %53 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 2
  %54 = load i32, ptr %53, align 8, !tbaa !9
  %55 = icmp slt i32 %52, %54
  br i1 %55, label %65, label %56

56:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %93

57:                                               ; preds = %29, %26
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %6, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %7, align 4
  br label %270

61:                                               ; preds = %43
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %6, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %7, align 4
  call void @_ZdaPvm(ptr noundef %38, i64 noundef %37) #9
  br label %270

65:                                               ; preds = %51
  %66 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 1
  %67 = load ptr, ptr %66, align 8, !tbaa !17
  %68 = load i32, ptr %9, align 4, !tbaa !18
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds %class.R2Point, ptr %67, i64 %69
  %71 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %70, i32 noundef 0)
          to label %72 unwind label %85

72:                                               ; preds = %65
  %73 = load double, ptr %71, align 8, !tbaa !19
  %74 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 1
  %75 = load ptr, ptr %74, align 8, !tbaa !17
  %76 = load i32, ptr %8, align 4, !tbaa !18
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds %class.R2Point, ptr %75, i64 %77
  %79 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %78, i32 noundef 0)
          to label %80 unwind label %85

80:                                               ; preds = %72
  %81 = load double, ptr %79, align 8, !tbaa !19
  %82 = fcmp olt double %73, %81
  br i1 %82, label %83, label %89

83:                                               ; preds = %80
  %84 = load i32, ptr %9, align 4, !tbaa !18
  store i32 %84, ptr %8, align 4, !tbaa !18
  br label %89

85:                                               ; preds = %72, %65
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %6, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %267

89:                                               ; preds = %83, %80
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %9, align 4, !tbaa !18
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %9, align 4, !tbaa !18
  br label %51, !llvm.loop !21

93:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %94 = load i32, ptr %8, align 4, !tbaa !18
  store i32 %94, ptr %10, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !18
  br label %95

95:                                               ; preds = %258, %93
  %96 = load i32, ptr %11, align 4, !tbaa !18
  %97 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 2
  %98 = load i32, ptr %97, align 8, !tbaa !9
  %99 = icmp slt i32 %96, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %95
  store i32 5, ptr %12, align 4
  br label %263

101:                                              ; preds = %95
  %102 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 1
  %103 = load ptr, ptr %102, align 8, !tbaa !17
  %104 = load i32, ptr %10, align 4, !tbaa !18
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds %class.R2Point, ptr %103, i64 %105
  %107 = getelementptr inbounds %class.R2Polygon, ptr %0, i32 0, i32 1
  %108 = load ptr, ptr %107, align 8, !tbaa !17
  %109 = getelementptr inbounds %class.R2Polygon, ptr %0, i32 0, i32 2
  %110 = load i32, ptr %109, align 8, !tbaa !9
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %109, align 8, !tbaa !9
  %112 = sext i32 %110 to i64
  %113 = getelementptr inbounds %class.R2Point, ptr %108, i64 %112
  %114 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %113, ptr noundef nonnull align 8 dereferenceable(16) %106)
          to label %115 unwind label %147

115:                                              ; preds = %101
  %116 = getelementptr inbounds %class.R2Polygon, ptr %0, i32 0, i32 4
  %117 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 1
  %118 = load ptr, ptr %117, align 8, !tbaa !17
  %119 = load i32, ptr %10, align 4, !tbaa !18
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds %class.R2Point, ptr %118, i64 %120
  invoke void @_ZN5R2Box5UnionERK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %116, ptr noundef nonnull align 8 dereferenceable(16) %121)
          to label %122 unwind label %147

122:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #8
  %123 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 1
  %124 = load ptr, ptr %123, align 8, !tbaa !17
  %125 = load i32, ptr %10, align 4, !tbaa !18
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds %class.R2Point, ptr %124, i64 %126
  invoke void @_ZN7R2PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %127)
          to label %128 unwind label %151

128:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %129 = load i32, ptr %10, align 4, !tbaa !18
  store i32 %129, ptr %14, align 4, !tbaa !18
  %130 = load i32, ptr %14, align 4, !tbaa !18
  %131 = add nsw i32 %130, 1
  %132 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 2
  %133 = load i32, ptr %132, align 8, !tbaa !9
  %134 = srem i32 %131, %133
  store i32 %134, ptr %10, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 40, ptr %15) #8
  %135 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !17
  %137 = load i32, ptr %10, align 4, !tbaa !18
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds %class.R2Point, ptr %136, i64 %138
  invoke void @_ZN6R2LineC1ERK7R2PointS2_(ptr noundef nonnull align 8 dereferenceable(40) %15, ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %139)
          to label %140 unwind label %155

140:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !18
  br label %141

141:                                              ; preds = %245, %140
  %142 = load i32, ptr %16, align 4, !tbaa !18
  %143 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 2
  %144 = load i32, ptr %143, align 8, !tbaa !9
  %145 = icmp slt i32 %142, %144
  br i1 %145, label %159, label %146

146:                                              ; preds = %141
  store i32 8, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %249

147:                                              ; preds = %115, %101
  %148 = landingpad { ptr, i32 }
          cleanup
  %149 = extractvalue { ptr, i32 } %148, 0
  store ptr %149, ptr %6, align 8
  %150 = extractvalue { ptr, i32 } %148, 1
  store i32 %150, ptr %7, align 4
  br label %264

151:                                              ; preds = %122
  %152 = landingpad { ptr, i32 }
          cleanup
  %153 = extractvalue { ptr, i32 } %152, 0
  store ptr %153, ptr %6, align 8
  %154 = extractvalue { ptr, i32 } %152, 1
  store i32 %154, ptr %7, align 4
  br label %262

155:                                              ; preds = %128
  %156 = landingpad { ptr, i32 }
          cleanup
  %157 = extractvalue { ptr, i32 } %156, 0
  store ptr %157, ptr %6, align 8
  %158 = extractvalue { ptr, i32 } %156, 1
  store i32 %158, ptr %7, align 4
  br label %261

159:                                              ; preds = %141
  %160 = load i32, ptr %16, align 4, !tbaa !18
  %161 = load i32, ptr %14, align 4, !tbaa !18
  %162 = icmp eq i32 %160, %161
  br i1 %162, label %163, label %164

163:                                              ; preds = %159
  br label %245

164:                                              ; preds = %159
  %165 = load i32, ptr %16, align 4, !tbaa !18
  %166 = load i32, ptr %8, align 4, !tbaa !18
  %167 = icmp eq i32 %165, %166
  br i1 %167, label %168, label %200

168:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %169 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 1
  %170 = load ptr, ptr %169, align 8, !tbaa !17
  %171 = load i32, ptr %16, align 4, !tbaa !18
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds %class.R2Point, ptr %170, i64 %172
  %174 = invoke noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %15, ptr noundef nonnull align 8 dereferenceable(16) %173)
          to label %175 unwind label %190

175:                                              ; preds = %168
  %176 = load double, ptr @RN_EPSILON, align 8, !tbaa !19
  %177 = call double @llvm.fmuladd.f64(double 1.000000e+03, double %176, double %174)
  store double %177, ptr %17, align 8, !tbaa !19
  %178 = load double, ptr %17, align 8, !tbaa !19
  %179 = fcmp ogt double %178, 0.000000e+00
  br i1 %179, label %180, label %198

180:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 40, ptr %18) #8
  %181 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 1
  %182 = load ptr, ptr %181, align 8, !tbaa !17
  %183 = load i32, ptr %16, align 4, !tbaa !18
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds %class.R2Point, ptr %182, i64 %184
  invoke void @_ZN6R2LineC1ERK7R2PointS2_(ptr noundef nonnull align 8 dereferenceable(40) %18, ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %185)
          to label %186 unwind label %194

186:                                              ; preds = %180
  %187 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZN6R2LineaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %15, ptr noundef nonnull align 8 dereferenceable(40) %18)
          to label %188 unwind label %194

188:                                              ; preds = %186
  call void @llvm.lifetime.end.p0(i64 40, ptr %18) #8
  %189 = load i32, ptr %16, align 4, !tbaa !18
  store i32 %189, ptr %10, align 4, !tbaa !18
  br label %198

190:                                              ; preds = %168
  %191 = landingpad { ptr, i32 }
          cleanup
  %192 = extractvalue { ptr, i32 } %191, 0
  store ptr %192, ptr %6, align 8
  %193 = extractvalue { ptr, i32 } %191, 1
  store i32 %193, ptr %7, align 4
  br label %199

194:                                              ; preds = %186, %180
  %195 = landingpad { ptr, i32 }
          cleanup
  %196 = extractvalue { ptr, i32 } %195, 0
  store ptr %196, ptr %6, align 8
  %197 = extractvalue { ptr, i32 } %195, 1
  store i32 %197, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 40, ptr %18) #8
  br label %199

198:                                              ; preds = %188, %175
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %244

199:                                              ; preds = %194, %190
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %248

200:                                              ; preds = %164
  %201 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 1
  %202 = load ptr, ptr %201, align 8, !tbaa !17
  %203 = load i32, ptr %16, align 4, !tbaa !18
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds %class.R2Point, ptr %202, i64 %204
  %206 = invoke noundef i32 @_Z10R2ContainsRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %205)
          to label %207 unwind label %210

207:                                              ; preds = %200
  %208 = icmp ne i32 %206, 0
  br i1 %208, label %209, label %214

209:                                              ; preds = %207
  br label %245

210:                                              ; preds = %200
  %211 = landingpad { ptr, i32 }
          cleanup
  %212 = extractvalue { ptr, i32 } %211, 0
  store ptr %212, ptr %6, align 8
  %213 = extractvalue { ptr, i32 } %211, 1
  store i32 %213, ptr %7, align 4
  br label %248

214:                                              ; preds = %207
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %215 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 1
  %216 = load ptr, ptr %215, align 8, !tbaa !17
  %217 = load i32, ptr %16, align 4, !tbaa !18
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds %class.R2Point, ptr %216, i64 %218
  %220 = invoke noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %15, ptr noundef nonnull align 8 dereferenceable(16) %219)
          to label %221 unwind label %234

221:                                              ; preds = %214
  store double %220, ptr %19, align 8, !tbaa !19
  %222 = load double, ptr %19, align 8, !tbaa !19
  %223 = fcmp ogt double %222, 0.000000e+00
  br i1 %223, label %224, label %242

224:                                              ; preds = %221
  call void @llvm.lifetime.start.p0(i64 40, ptr %20) #8
  %225 = getelementptr inbounds %class.R2Polygon, ptr %21, i32 0, i32 1
  %226 = load ptr, ptr %225, align 8, !tbaa !17
  %227 = load i32, ptr %16, align 4, !tbaa !18
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds %class.R2Point, ptr %226, i64 %228
  invoke void @_ZN6R2LineC1ERK7R2PointS2_(ptr noundef nonnull align 8 dereferenceable(40) %20, ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %229)
          to label %230 unwind label %238

230:                                              ; preds = %224
  %231 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZN6R2LineaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %15, ptr noundef nonnull align 8 dereferenceable(40) %20)
          to label %232 unwind label %238

232:                                              ; preds = %230
  call void @llvm.lifetime.end.p0(i64 40, ptr %20) #8
  %233 = load i32, ptr %16, align 4, !tbaa !18
  store i32 %233, ptr %10, align 4, !tbaa !18
  br label %242

234:                                              ; preds = %214
  %235 = landingpad { ptr, i32 }
          cleanup
  %236 = extractvalue { ptr, i32 } %235, 0
  store ptr %236, ptr %6, align 8
  %237 = extractvalue { ptr, i32 } %235, 1
  store i32 %237, ptr %7, align 4
  br label %243

238:                                              ; preds = %230, %224
  %239 = landingpad { ptr, i32 }
          cleanup
  %240 = extractvalue { ptr, i32 } %239, 0
  store ptr %240, ptr %6, align 8
  %241 = extractvalue { ptr, i32 } %239, 1
  store i32 %241, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 40, ptr %20) #8
  br label %243

242:                                              ; preds = %232, %221
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %244

243:                                              ; preds = %238, %234
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %248

244:                                              ; preds = %242, %198
  br label %245

245:                                              ; preds = %244, %209, %163
  %246 = load i32, ptr %16, align 4, !tbaa !18
  %247 = add nsw i32 %246, 1
  store i32 %247, ptr %16, align 4, !tbaa !18
  br label %141, !llvm.loop !23

248:                                              ; preds = %243, %210, %199
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %261

249:                                              ; preds = %146
  %250 = load i32, ptr %10, align 4, !tbaa !18
  %251 = load i32, ptr %8, align 4, !tbaa !18
  %252 = icmp eq i32 %250, %251
  br i1 %252, label %253, label %254

253:                                              ; preds = %249
  store i32 5, ptr %12, align 4
  br label %255

254:                                              ; preds = %249
  store i32 0, ptr %12, align 4
  br label %255

255:                                              ; preds = %254, %253
  call void @llvm.lifetime.end.p0(i64 40, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #8
  %256 = load i32, ptr %12, align 4
  switch i32 %256, label %263 [
    i32 0, label %257
  ]

257:                                              ; preds = %255
  br label %258

258:                                              ; preds = %257
  %259 = load i32, ptr %11, align 4, !tbaa !18
  %260 = add nsw i32 %259, 1
  store i32 %260, ptr %11, align 4, !tbaa !18
  br label %95, !llvm.loop !24

261:                                              ; preds = %248, %155
  call void @llvm.lifetime.end.p0(i64 40, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %262

262:                                              ; preds = %261, %151
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #8
  br label %264

263:                                              ; preds = %255, %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %265

264:                                              ; preds = %262, %147
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %267

265:                                              ; preds = %263
  store i1 true, ptr %5, align 1
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  %266 = load i1, ptr %5, align 1
  br i1 %266, label %269, label %268

267:                                              ; preds = %264, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %270

268:                                              ; preds = %265
  call void @_ZN9R2PolygonD1Ev(ptr noundef nonnull align 8 dereferenceable(68) %0) #8
  br label %269

269:                                              ; preds = %268, %265
  br label %271

270:                                              ; preds = %267, %61, %57
  call void @_ZN9R2PolygonD1Ev(ptr noundef nonnull align 8 dereferenceable(68) %0) #8
  br label %272

271:                                              ; preds = %269, %25
  ret void

272:                                              ; preds = %270
  %273 = load ptr, ptr %6, align 8
  %274 = load i32, ptr %7, align 4
  %275 = insertvalue { ptr, i32 } poison, ptr %273, 0
  %276 = insertvalue { ptr, i32 } %275, i32 %274, 1
  resume { ptr, i32 } %276
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #6 align 2

declare void @_ZN6R2LineC1ERK7R2PointS2_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

declare noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN6R2LineaSERKS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) #6 align 2

declare noundef i32 @_Z10R2ContainsRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

declare void @_ZN9R2PolygonC1Ev(ptr)

declare void @_ZN9R2PolygonC1ERKS_(ptr, ptr)

declare void @_ZN9R2PolygonD1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nobuiltin allocsize(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 = { "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 = { nobuiltin 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 #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { builtin allocsize(0) }
attributes #8 = { nounwind }
attributes #9 = { builtin 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, !13, i64 16}
!10 = !{!"_ZTS9R2Polygon", !11, i64 0, !6, i64 8, !13, i64 16, !14, i64 24, !13, i64 64}
!11 = !{!"_ZTS7R2Solid", !12, i64 0}
!12 = !{!"_ZTS7R2Shape"}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS5R2Box", !11, i64 0, !15, i64 8, !15, i64 24}
!15 = !{!"_ZTS7R2Point", !7, i64 0}
!16 = !{!10, !13, i64 64}
!17 = !{!10, !6, i64 8}
!18 = !{!13, !13, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"double", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !22}


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

%class.R2Box = type { %class.R2Solid, %class.R2Point, %class.R2Point }
%class.R2Solid = type { %class.R2Shape }
%class.R2Shape = type { ptr }
%class.R2Point = type { [2 x double] }
%class.R2Polygon = type <{ %class.R2Solid, ptr, i32, [4 x i8], %class.R2Box, i32, [4 x i8] }>
%class.R2Line = type { %class.R2Vector, %class.R2Vector, double }
%class.R2Vector = type { [2 x double] }

@R2null_box = external global %class.R2Box, align 8
@RN_EPSILON = external local_unnamed_addr global double, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #0

declare void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

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

declare void @_ZN5R2Box5UnionERK7R2Point(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

declare void @_ZN7R2PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK9R2Polygon10ConvexHullEv(ptr dead_on_unwind noalias writable sret(%class.R2Polygon) align 8 %0, ptr noundef nonnull align 8 dereferenceable(68) %1) unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.R2Point, align 8
  %4 = alloca %class.R2Line, align 8
  %5 = alloca %class.R2Line, align 8
  %6 = alloca %class.R2Line, align 8
  %7 = getelementptr inbounds i8, ptr %1, i64 16
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp slt i32 %8, 4
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  tail call void @_ZN9R2PolygonC1ERKS_(ptr noundef nonnull align 8 dereferenceable(68) %0, ptr noundef nonnull align 8 dereferenceable(68) %1)
  br label %.loopexit

11:                                               ; preds = %2
  tail call void @_ZN9R2PolygonC1Ev(ptr noundef nonnull align 8 dereferenceable(68) %0)
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %12, ptr noundef nonnull align 8 dereferenceable(40) @R2null_box)
          to label %14 unwind label %41

14:                                               ; preds = %11
  %15 = getelementptr inbounds i8, ptr %0, i64 64
  store i32 0, ptr %15, align 8, !tbaa !15
  %16 = load i32, ptr %7, align 8, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i32 %16, 0
  %19 = shl nsw i64 %17, 4
  %20 = select i1 %18, i64 -1, i64 %19
  %21 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %20) #7
          to label %22 unwind label %41

22:                                               ; preds = %14
  %23 = icmp eq i32 %16, 0
  br i1 %23, label %.preheader67.thread, label %26

.preheader67.thread:                              ; preds = %22
  %24 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %21, ptr %24, align 8, !tbaa !16
  %25 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 0, ptr %25, align 8, !tbaa !5
  br label %.loopexit

26:                                               ; preds = %22
  %27 = getelementptr inbounds %class.R2Point, ptr %21, i64 %17
  br label %28

28:                                               ; preds = %30, %26
  %29 = phi ptr [ %21, %26 ], [ %31, %30 ]
  invoke void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %29)
          to label %30 unwind label %43

30:                                               ; preds = %28
  %31 = getelementptr inbounds i8, ptr %29, i64 16
  %32 = icmp eq ptr %31, %27
  br i1 %32, label %.loopexit68, label %28

.loopexit68:                                      ; preds = %30
  %.pre = load i32, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %21, ptr %33, align 8, !tbaa !16
  %34 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 0, ptr %34, align 8, !tbaa !5
  %35 = icmp sgt i32 %.pre, 1
  br i1 %35, label %.lr.ph, label %.preheader67

.lr.ph:                                           ; preds = %.loopexit68
  %36 = getelementptr inbounds i8, ptr %1, i64 8
  br label %45

.preheader67:                                     ; preds = %55, %.loopexit68
  %37 = phi i32 [ %.pre, %.loopexit68 ], [ %59, %55 ]
  %.052.lcssa = phi i32 [ 0, %.loopexit68 ], [ %.153, %55 ]
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph83, label %.loopexit

.lr.ph83:                                         ; preds = %.preheader67
  %39 = getelementptr inbounds i8, ptr %1, i64 8
  %40 = zext i32 %.052.lcssa to i64
  br label %64

41:                                               ; preds = %14, %11
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %149

43:                                               ; preds = %28
  %44 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdaPvm(ptr noundef nonnull %21, i64 noundef %20) #8
  br label %149

45:                                               ; preds = %.lr.ph, %55
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %55 ]
  %.05275 = phi i32 [ 0, %.lr.ph ], [ %.153, %55 ]
  %46 = load ptr, ptr %36, align 8, !tbaa !16
  %47 = getelementptr inbounds %class.R2Point, ptr %46, i64 %indvars.iv
  %48 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %47, i32 noundef 0)
          to label %49 unwind label %62

49:                                               ; preds = %45
  %50 = load double, ptr %48, align 8, !tbaa !17
  %51 = load ptr, ptr %36, align 8, !tbaa !16
  %52 = sext i32 %.05275 to i64
  %53 = getelementptr inbounds %class.R2Point, ptr %51, i64 %52
  %54 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %53, i32 noundef 0)
          to label %55 unwind label %62

55:                                               ; preds = %49
  %56 = load double, ptr %54, align 8, !tbaa !17
  %57 = fcmp olt double %50, %56
  %58 = trunc nuw nsw i64 %indvars.iv to i32
  %.153 = select i1 %57, i32 %58, i32 %.05275
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %59 = load i32, ptr %7, align 8, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = icmp slt i64 %indvars.iv.next, %60
  br i1 %61, label %45, label %.preheader67, !llvm.loop !19

62:                                               ; preds = %49, %45
  %63 = landingpad { ptr, i32 }
          cleanup
  br label %149

64:                                               ; preds = %._crit_edge, %.lr.ph83
  %.04582 = phi i32 [ 0, %.lr.ph83 ], [ %91, %._crit_edge ]
  %.04681 = phi i32 [ %.052.lcssa, %.lr.ph83 ], [ %.147.lcssa, %._crit_edge ]
  %65 = load ptr, ptr %39, align 8, !tbaa !16
  %66 = sext i32 %.04681 to i64
  %67 = getelementptr inbounds %class.R2Point, ptr %65, i64 %66
  %68 = load ptr, ptr %33, align 8, !tbaa !16
  %69 = load i32, ptr %34, align 8, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %34, align 8, !tbaa !5
  %71 = sext i32 %69 to i64
  %72 = getelementptr inbounds %class.R2Point, ptr %68, i64 %71
  %73 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %72, ptr noundef nonnull align 8 dereferenceable(16) %67)
          to label %74 unwind label %93

74:                                               ; preds = %64
  %75 = load ptr, ptr %39, align 8, !tbaa !16
  %76 = getelementptr inbounds %class.R2Point, ptr %75, i64 %66
  invoke void @_ZN5R2Box5UnionERK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %12, ptr noundef nonnull align 8 dereferenceable(16) %76)
          to label %77 unwind label %93

77:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #9
  %78 = load ptr, ptr %39, align 8, !tbaa !16
  %79 = getelementptr inbounds %class.R2Point, ptr %78, i64 %66
  invoke void @_ZN7R2PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %79)
          to label %80 unwind label %95

80:                                               ; preds = %77
  %81 = add nsw i32 %.04681, 1
  %82 = load i32, ptr %7, align 8, !tbaa !5
  %83 = srem i32 %81, %82
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #9
  %84 = load ptr, ptr %39, align 8, !tbaa !16
  %85 = sext i32 %83 to i64
  %86 = getelementptr inbounds %class.R2Point, ptr %84, i64 %85
  invoke void @_ZN6R2LineC1ERK7R2PointS2_(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %86)
          to label %.preheader unwind label %97

.preheader:                                       ; preds = %80
  %87 = load i32, ptr %7, align 8, !tbaa !5
  %88 = icmp sgt i32 %87, 0
  br i1 %88, label %.lr.ph79.preheader, label %._crit_edge

.lr.ph79.preheader:                               ; preds = %.preheader
  %89 = zext i32 %.04681 to i64
  br label %.lr.ph79

._crit_edge:                                      ; preds = %143, %.preheader
  %90 = phi i32 [ %87, %.preheader ], [ %144, %143 ]
  %.147.lcssa = phi i32 [ %83, %.preheader ], [ %.450, %143 ]
  %.not = icmp ne i32 %.147.lcssa, %.052.lcssa
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #9
  %91 = add nuw nsw i32 %.04582, 1
  %92 = icmp slt i32 %91, %90
  %or.cond = select i1 %.not, i1 %92, i1 false
  br i1 %or.cond, label %64, label %.loopexit, !llvm.loop !21

93:                                               ; preds = %74, %64
  %94 = landingpad { ptr, i32 }
          cleanup
  br label %149

95:                                               ; preds = %77
  %96 = landingpad { ptr, i32 }
          cleanup
  br label %148

97:                                               ; preds = %80
  %98 = landingpad { ptr, i32 }
          cleanup
  br label %147

.lr.ph79:                                         ; preds = %.lr.ph79.preheader, %143
  %indvars.iv86 = phi i64 [ 0, %.lr.ph79.preheader ], [ %indvars.iv.next87, %143 ]
  %.14777 = phi i32 [ %83, %.lr.ph79.preheader ], [ %.450, %143 ]
  %99 = icmp eq i64 %indvars.iv86, %89
  br i1 %99, label %143, label %100

100:                                              ; preds = %.lr.ph79
  %101 = icmp eq i64 %indvars.iv86, %40
  %102 = trunc nuw nsw i64 %indvars.iv86 to i32
  %103 = load ptr, ptr %39, align 8, !tbaa !16
  br i1 %101, label %104, label %121

104:                                              ; preds = %100
  %105 = getelementptr inbounds %class.R2Point, ptr %103, i64 %40
  %106 = invoke noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(16) %105)
          to label %107 unwind label %117

107:                                              ; preds = %104
  %108 = load double, ptr @RN_EPSILON, align 8, !tbaa !17
  %109 = call double @llvm.fmuladd.f64(double %108, double 1.000000e+03, double %106)
  %110 = fcmp ogt double %109, 0.000000e+00
  br i1 %110, label %111, label %143

111:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #9
  %112 = load ptr, ptr %39, align 8, !tbaa !16
  %113 = getelementptr inbounds %class.R2Point, ptr %112, i64 %40
  invoke void @_ZN6R2LineC1ERK7R2PointS2_(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %113)
          to label %114 unwind label %119

114:                                              ; preds = %111
  %115 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZN6R2LineaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(40) %5)
          to label %116 unwind label %119

116:                                              ; preds = %114
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #9
  br label %143

117:                                              ; preds = %104
  %118 = landingpad { ptr, i32 }
          cleanup
  br label %147

119:                                              ; preds = %114, %111
  %120 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #9
  br label %147

121:                                              ; preds = %100
  %122 = getelementptr inbounds %class.R2Point, ptr %103, i64 %indvars.iv86
  %123 = invoke noundef i32 @_Z10R2ContainsRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %122)
          to label %124 unwind label %125

124:                                              ; preds = %121
  %.not56 = icmp eq i32 %123, 0
  br i1 %.not56, label %127, label %143

125:                                              ; preds = %121
  %126 = landingpad { ptr, i32 }
          cleanup
  br label %147

127:                                              ; preds = %124
  %128 = load ptr, ptr %39, align 8, !tbaa !16
  %129 = getelementptr inbounds %class.R2Point, ptr %128, i64 %indvars.iv86
  %130 = invoke noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(16) %129)
          to label %131 unwind label %139

131:                                              ; preds = %127
  %132 = fcmp ogt double %130, 0.000000e+00
  br i1 %132, label %133, label %143

133:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %6) #9
  %134 = load ptr, ptr %39, align 8, !tbaa !16
  %135 = getelementptr inbounds %class.R2Point, ptr %134, i64 %indvars.iv86
  invoke void @_ZN6R2LineC1ERK7R2PointS2_(ptr noundef nonnull align 8 dereferenceable(40) %6, ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %135)
          to label %136 unwind label %141

136:                                              ; preds = %133
  %137 = invoke noundef nonnull align 8 dereferenceable(40) ptr @_ZN6R2LineaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(40) %6)
          to label %138 unwind label %141

138:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #9
  br label %143

139:                                              ; preds = %127
  %140 = landingpad { ptr, i32 }
          cleanup
  br label %147

141:                                              ; preds = %136, %133
  %142 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #9
  br label %147

143:                                              ; preds = %131, %138, %107, %116, %124, %.lr.ph79
  %.450 = phi i32 [ %.14777, %.lr.ph79 ], [ %.14777, %124 ], [ %102, %116 ], [ %.14777, %107 ], [ %102, %138 ], [ %.14777, %131 ]
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %144 = load i32, ptr %7, align 8, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = icmp slt i64 %indvars.iv.next87, %145
  br i1 %146, label %.lr.ph79, label %._crit_edge, !llvm.loop !22

147:                                              ; preds = %125, %119, %117, %141, %139, %97
  %.pn58.pn.pn = phi { ptr, i32 } [ %98, %97 ], [ %126, %125 ], [ %120, %119 ], [ %118, %117 ], [ %142, %141 ], [ %140, %139 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #9
  br label %148

148:                                              ; preds = %147, %95
  %.pn58.pn.pn.pn = phi { ptr, i32 } [ %.pn58.pn.pn, %147 ], [ %96, %95 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #9
  br label %149

149:                                              ; preds = %62, %148, %93, %43, %41
  %.pn64.pn = phi { ptr, i32 } [ %44, %43 ], [ %42, %41 ], [ %63, %62 ], [ %.pn58.pn.pn.pn, %148 ], [ %94, %93 ]
  call void @_ZN9R2PolygonD1Ev(ptr noundef nonnull align 8 dereferenceable(68) %0) #9
  resume { ptr, i32 } %.pn64.pn

.loopexit:                                        ; preds = %._crit_edge, %.preheader67.thread, %.preheader67, %10
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #6 align 2

declare void @_ZN6R2LineC1ERK7R2PointS2_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

declare noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN6R2LineaSERKS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #6 align 2

declare noundef i32 @_Z10R2ContainsRK7R2PointS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

declare void @_ZN9R2PolygonC1Ev(ptr) local_unnamed_addr

declare void @_ZN9R2PolygonC1ERKS_(ptr, ptr) local_unnamed_addr

declare void @_ZN9R2PolygonD1Ev(ptr) local_unnamed_addr

attributes #0 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { nobuiltin 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { 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 #7 = { builtin allocsize(0) }
attributes #8 = { builtin nounwind }
attributes #9 = { 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, !12, i64 16}
!6 = !{!"_ZTS9R2Polygon", !7, i64 0, !9, i64 8, !12, i64 16, !13, i64 24, !12, i64 64}
!7 = !{!"_ZTS7R2Solid", !8, i64 0}
!8 = !{!"_ZTS7R2Shape"}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!"_ZTS5R2Box", !7, i64 0, !14, i64 8, !14, i64 24}
!14 = !{!"_ZTS7R2Point", !10, i64 0}
!15 = !{!6, !12, i64 64}
!16 = !{!6, !9, i64 8}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !10, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = distinct !{!22, !20}


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